title: PUT-PIXEL in every language

text:
# Question
Title: PUT-PIXEL in every language
During work on some project I needed to draw pixels on screen. I found some put-pixel function in JS, but code was quite big and clumsy - so I wonder, how small put-pixel function can be...

# Challenge

Create the smallest put-pixel function.

We count size of whole program: **initialization code (if needed), function and code necessary to draw the test case witch 11 pixels**. If your language does not support functions, you can use what you have. Language must be capable of graphical output or drawing charts (saving files is not allowed).

The function (or program) should accept as input the following 6 independent integers pixel parameters (and other if needed):

* `x` from 0 to at least 255 - horizontal position
* `y` from 0 to at least 255 - vertical position
* `R` from 0 to 255 - red color component
* `G` from 0 to 255 - green color component
* `B` from 0 to 255 - blue color component
* `A` from 0 to 255 - alpha (if 0 then the pixel color is fully transparent, and we see old background pixel; if 255 then the pixel is completely opaque; for values 0\<A\<255 we calculate color in linear way, using the old and new pixel colors).

more parameters than above 6 is allowed and parameters can have any order. Number parameters can be strings and have base different than 10 or be coded in some way (if chosen language requires that).

# Test case

On output you should draw following test-case with 11 pixels (I will use `putPixel(x,y,R,G,B,A)` as example to show case)

```
putPixel(126, 127, 255,   0,   0, 255) // Red
putPixel(127, 127,   0, 255,   0, 255) // Green
putPixel(128, 127,   0,   0, 255, 255) // Blue
putPixel(129, 127, 255,   0,   0, 255) // Red
putPixel(129, 127,   0, 255,   0, 127) // Dark Yellow (previous red + transparent green)

putPixel(126, 128,   0,   0,   0, 255) // Black
putPixel(127, 128, 255, 255, 255, 255) // White
putPixel(128, 128, 255,   0,   0, 255) // Red
putPixel(128, 128,   0,   0, 255, 127) // Dark pink (previous red + transparent blue)
putPixel(129, 128,   0, 255,   0, 255) // Blue
putPixel(129, 128,   0,   0, 255, 127) // Dark sea-blue (previous blue + transparent green)

```

We should see 8 pixel (but we paint 11pixel, but 3 of them are transparent paints on already colored pixels).

**Leaderboard:**

```
/* Configuration */

var QUESTION_ID = 250776; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 88163; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();

    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
```

```
body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
```

```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
```

# Answer
> 6 votes
# TikZ, ~~333, 322,~~ 307 bytes

* Wrapper (`\documentclass...`, `\begin...`/`\end{document}`, and `\tikz{}`): 66 bytes
* Definition of Macro `~`: ~~113, 112~~ 97 bytes
* Test Cases: 14 + 10 x 13 bytes = 144 bytes (~~154 bytes~~)

## Compact Code

```
\documentclass[tikz]{standalone}\def~{document}\begin~\tikz{\def~#1#2#3#4#5#6#7;{\color[HTML]{#7}\fill[opacity=(0x#5#6)/255](0x#1#2,-0x#3#4)rectangle++(,);~}~7E7FFFff0000;7F7FFF00ff00;807FFF0000ff;817FFFff0000;817F7F00ff00;7E80FF000000;7F80FFffffff;8080FFff0000;80807F0000ff;8180FF00ff00;81807F0000ff;}\end~

```

Try It Online

## Output

The code produces a PDF file (vector graphic image); the picture above is a PNG image produced by conversion via pdf2png.com.

## Readable Version of the Code

```
01: \documentclass[tikz]{standalone}\def~{document}\begin~\tikz{
02: \def~#1#2#3#4#5#6#7;{
03:     \color[HTML]{#7}
04:     \fill[opacity=(0x#5#6)/255]
05:     (0x#1#2,-0x#3#4)rectangle++(,);
06: ~}
07: ~7E7FFFff0000;
08: 7F7FFF00ff00;
09: 807FFF0000ff;
10: 817FFFff0000;
11: 817F7F00ff00;
12: 7E80FF000000;
13: 7F80FFffffff;
14: 8080FFff0000;
15: 80807F0000ff;
16: 8180FF00ff00;
17: 81807F0000ff;
18: }\end~

```

## Explanation

**Lines 1 and 18**

Defining `~` as `document` outside of the document-scope allows for saving three bytes when writing `\begin~` and `\end~`. Note: `~` is the only "active char" in LaTeX.

**Lines 2 and 6**

Defining `~` within the document-scope does not interfere with the definition outside of the document scope. We define `~` to be a macro with seven parameters,

* parameters 1 and 2 being the two hex digits for the x-coordinate,
* parameters 3 and 4 being the two hex digits for the y-coordinate,
* parameters 5 and 6 being the two hex digits for the opacity, and
* parameter 7 being the color which will be provided as HTML color.

`;` denotes the end of the HTML color string. We could omit this if we used a technique that helps to use more than nine arguments. However, we don't use this approach here because using more than nine arguments would add more than the 11 bytes (coming from the eleven `;` in the eleven test cases) that we could possibly save. Note that if we had to deal with several hundred test cases, we would rather opt for omitting the `;` and, thus, for allowing for more than nine arguments.

The definition of the macro ends with `}` in line 7. Before ending the definition, we call the macro itself again. This allows us to refrain from repeating the `~` character multiple times when inputting the test case. Note that this produces a "recoverable error" when the last pixel is printed. However, a graphical output is generated nevertheless.

**Line 3**

We define the color that we will use to draw the pixel. The RGB values provided in the test cases have been converted to the HTML model in the obvious manner. Since we are required to use integers, we note explicitly that we do observe this requirement by making use of *hex integers!*

**Line 4**

We use the `\fill`-command to draw the pixel, and we set the opacity.

**Line 5**

We provide the coordinates as hex integers. Note that the y-coordinate is prefixed with a `-` because TikZ has its origin in the bottom left corner of the screen whereas the task provides a test case output that clearly shows its origin to be in the top left corner of the screen. The height and the width of each pixel will be 1 cm. `(,)` is equivalent to `(1,1)`. The standard unit for coordinates is centimeter.

We also close the scope of the definition of `~` as shorthand for `numexpr`.

**Lines 7, 8, ..., 17**

Test cases / output.

## Improvements

Please help me to get better. If you know TikZ and if you can save some more bytes, please make sure to comment on this solution. Thank you!

# Answer
> 4 votes
# C (tcc) + sh + imagemagick, 454 bytes

* C code: 434 bytes (removing newlines)
* filename: 1 byte
* shell command: 18 bytes

--

```
#define p(x,y,R,G,B,A){int*j=i+(x+y*w)*3,C[3]={R,G,B};for(k=0;k<3;++k)j[k]=(C[k]*A+j[k]*(w-A))/w;}
w=255;c;
main(k){
int*i=calloc(w*w,12);
p(126,127,255,0,0,255)
p(127,127,0,255,0,255)
p(128,127,0,0,255,255)
p(129,127,255,0,0,255)
p(129,127,0,255,0,127)
p(126,128,0,0,0,255)
p(127,128,255,255,255,255)
p(128,128,255,0,0,255)
p(128,128,0,0,255,127)
p(129,128,0,255,0,255)
p(129,128,0,0,255,127)
puts("P6 255 255 255");
for(;c<w*w*3;)
putchar(i[c++]);
}

```

Assuming the code is saved in a file named `a`, run `tcc -run a|display`.

# Answer
> 4 votes
# C#, .NET 6.0, Windows Forms, 452 443 435 bytes

`Application.EnableVisualStyles();Form F=new();List<int[]>L=new();void P(params int[]a)=>L.Add(a);F.Paint+=(s,e)=>L.ForEach(p=>e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(p[5],p[2],p[3],p[4])),p[0],p[1],1,1));int a=127,b=128,c=129,z=255;P(126,a,z,0,0,z);P(a,a,0,z,0,z);P(b,a,0,0,z,z);P(c,a,z,0,0,z);P(c,a,0,z,0,a);P(126,b,0,0,0,z);P(a,b,z,z,z,z);P(b,b,z,0,0,z);P(b,b,0,0,z,a);P(c,b,0,z,0,z);P(c,b,0,0,z,a);Application.Run(F);`

To run this, put the above in a file, e.g. `x.cs` and create a project file, e.g. `x.csproj` as follows:

```
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0-windows</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <UseWindowsForms>true</UseWindowsForms>
    </PropertyGroup>
</Project>

```

Then run it with `dotnet run`.

Explanation:

```
// Initialise graphics
Application.EnableVisualStyles();
var F=new Form();

// Definition of the function P adds its parameters to a list of pixels
var L=new List<int[]>();
void P(params int[]a)=>L.Add(a);

// Paint method fills a rectangle for each pixel in the list
F.Paint+=(s,e)=>L.ForEach(p=>e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(p[5],p[2],p[3],p[4])),p[0],p[1],1,1));

// Test case (golfed)
int a=127,b=128,c=129,z=255;
P(126,a,z,0,0,z);
P(a,a,0,z,0,z);
P(b,a,0,0,z,z);
P(c,a,z,0,0,z);
P(c,a,0,z,0,a);
P(126,b,0,0,0,z);
P(a,b,z,z,z,z);
P(b,b,z,0,0,z);
P(b,b,0,0,z,a);
P(c,b,0,z,0,z);
P(c,b,0,0,z,a);

// Finally run the application
Application.Run(F);

```

### Improvements

* Use `new()` syntax to save the bytes of `var`
* Use the `Graphics` property of the `PaintEventArgs` instead of calling `CreateGraphics()` on the `Form`.

# Answer
> 2 votes
# JavaScript + Canvas, ~~405~~ 329 bytes

```
d=document
d.body.append(c=d.createElement('canvas'))
c=c.getContext('2d')
p=(x,y,a,...r)=>{c.fillStyle=`rgba(${r},${a/k})`;c.fillRect(x,y,1,1)}
p(126,g=127,k=255,k,0,0)
p(g,g,k,0,k,0)
p(h=128,g,k,0,0,k)
p(j=129,g,k,k,0,0)
p(j,g,g,0,k,0)
p(126,h,k,0,0,0)
p(g,h,k,k,k,k)
p(h,h,k,k,0,0)
p(h,h,g,0,0,k)
p(j,h,k,0,k,0)
p(j,h,g,0,0,k)
```

The fill-style is set by coercing an array to a string in order to get the commas, and also to save on declaring a couple of parameters.

The alpha parameter is taken before the r,g,b rest parameter, and it has to be divided by 255; it saves two bytes to reuse the variable `k` for this, which is assigned on the next line but that occurs before the function is called for the first time. This raises the question of whether the function itself is allowed to depend on the test code...

Thanks to @Kaiido for informing me about `append` (vs. `appendChild`).

Without the test code, it would be 146 bytes (including +2 for replacing `k` with `255`).

# Answer
> 2 votes
# Java 8, ~~441~~ 433 bytes

```
import java.awt.*;class M{static Graphics g;public static void main(String[]s){new Frame(){public void paint(Graphics G){g=G;int a=127,b=128,z=255;p(126,a,z,0,0,z);p(a,a,0,z,0,z);p(b,a,0,0,z,z);p(129,a,z,0,0,z);p(129,a,0,z,0,a);p(126,b,0,0,0,z);p(a,b,z,z,z,z);p(b,b,z,0,0,z);p(b,b,0,0,z,a);p(129,b,0,z,0,z);p(129,b,0,0,z,a);}{show();}};}static void p(int...a){g.setColor(new Color(a[2],a[3],a[4],a[5]));g.fillRect(a[0],a[1],10,10);}}

```

Java is one of the reasons why we allow both programs and functions for codegolf challenges, since the additional fluff is so dang verbose.. :/

* Initialization code: 146 bytes
* Actual draw pixel method: 88 bytes
* 11 test cases: 199 bytes

**Explanation:**

*Initialization code:*

```
import java.awt.*;        // Required import for Frame, Graphics, and Color
class M{                  // Class
  static Graphics g;      //  With (static) class-variable Graphics object to save bytes
  public static void main(String[]s){
                          //  Mandatory main method
    new Frame(){          //   Create a new Frame to draw on
      public void paint(Graphics G){
                          //    Overwrite its paint method
        g=G;              //     Set the class-variable Graphics object
                          /*     Test cases */
      }                   //    Close the paint-method
      {                   //    Open an initializer-block of the Frame:
        show();           //     Show the Frame
      }                   //    Close the initializer-block
    };                    //   Close the Frame
  }                       //  Close the main-method
  static                  //  Static block for the draw pixel method
                          /*  Draw pixel method */
}                         // Close the class

```

*Draw pixel method:*

```
void p(int...a){          // Draw pixel method with variable length integer parameters
  g.setColor(new Color(   //  Set a new color
    a[2],a[3],a[4],a[5]));//  using the 3rd to 6th parameters as red,green,blue,alpha
  g.fillRect(             //  And create a rectangle
    a[0],a[1],            //  at x,y-position using the 1st & 2nd parameters
    1,1);                 //  of 1 by 1 pixel
}                         // Close the draw pixel method

```

*Test cases:*

```
int a=127,b=128,z=255;    // Create three variables to save bytes
p(126,a,z,0,0,z);p(a,a,0,z,0,z);p(b,a,0,0,z,z);p(129,a,z,0,0,z);p(129,a,0,z,0,a);p(126,b,0,0,0,z);p(a,b,z,z,z,z);p(b,b,z,0,0,z);p(b,b,0,0,z,a);p(129,b,0,z,0,z);p(129,b,0,0,z,a);
                          // Draw the 11 pixels

```

**Screenshot (using enlarged 10x10 pixels instead of 1x1):**

# Answer
> 2 votes
# C + Win32 GDI, 508 bytes

```
#include<Windows.h>
A=127,B=128,C=129,Z=255;h,d,o,c,m;p(x,y,R,G,B,a){o=GetPixel(d=GetDC(h),x,y),c=RGB(R,G,B);SetPixel(d,x,y,((((256-a)*(o&0xFF00FF))>>8|(a*(c&0xFF00FF))>>8)&0xFF00FF)+((((256-a)*(o&65280))>>8|(a*(c&65280))>>8)&65280));}main(){for(h=CreateWindow("STATIC","",1<<28,0,0,Z,Z,0,0,0,0);GetMessage(&m,h,0,0);)DispatchMessage(&m),p(126,A,Z,0,0,Z),p(A,A,0,Z,0,Z),p(B,A,0,0,Z,Z),p(C,A,Z,0,0,Z),p(C,A,0,Z,0,A),p(126,B,0,0,0,Z),p(A,B,Z,Z,Z,Z),p(B,B,Z,0,0,Z),p(B,B,0,0,Z,A),p(C,B,0,Z,0,Z),p(C,B,0,0,Z,A);}

```

Slightly ungolfed:

```
#include <Windows.h>

int h, d, o, c, m;

p(x, y, R, G, B, a)
{
    d = GetDC(h);
    o = GetPixel(d, x, y);
    c = RGB(R, G, B);
    SetPixel(d, x, y, ((((0x100 - a) * (o & 0xFF00FF)) >> 8 | (a * (c & 0xFF00FF)) >> 8) & 0xFF00FF) + ((((0x100 - a) * (o & 65280)) >> 8 | (a * (c & 65280)) >> 8) & 65280));
}

main()
{
    h = CreateWindow("STATIC", "", 1 << 28, 0, 0, 199, 199, 0, 0, 0, 0);
    while (GetMessage(&m, h, 0, 0))
    {
        DispatchMessage(&m);
        int A = 127, B = 128, C = 129, Z = 255;
        p(126, A, Z, 0, 0, Z);
        p(A, A, 0, Z, 0, Z);
        p(B, A, 0, 0, Z, Z);
        p(C, A, Z, 0, 0, Z);
        p(C, A, 0, Z, 0, A);
        p(126, B, 0, 0, 0, Z);
        p(A, B, Z, Z, Z, Z);
        p(B, B, Z, 0, 0, Z);
        p(B, B, 0, 0, Z, A);
        p(C, B, 0, Z, 0, Z);
        p(C, B, 0, 0, Z, A);
    }
}

```

# Answer
> 1 votes
# JSFuck, ~~30220 29681 29542~~ 29353 bytes

This is JSFuck (subset of JS which use only `[]()!+` characters) port of this solution

```
[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]](([]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+!![]+!![]+(+!![])+![]+(+[])+!![]+(+!![])+!![]+(+!![])+(+!![])+(+!![])+![]+!![]+(+!![])+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+!![]+![]+(+!![])+!![]+(+!![])+(+[])+(+[])+![]+!![]+![]+(+!![])+!![]+(+!![])+!![]+(+!![])+!![]+(+[])+![]+(+!![])+![]+![]+(+!![])+(+!![])+!![]+(+!![])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+(+[])+(+[])+(+[])+!![]+!![]+(+[])+(+!![])+![]+(+[])+!![]+(+!![])+![]+(+[])+(+!![])+(+!![])+![]+!![]+![]+(+!![])+!![]+(+!![])+![]+(+!![])+![]+(+[])+(+!![])+(+!![])+!![]+(+[])+!![]+(+[])+![]+(+[])+(+[])+(+!![])+![]+![]+(+!![])+(+!![])+![]+(+!![])+(+[])+(+[])+!![]+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+![]+(+[])+(+[])+(+[])+(+[])+![]+![]+(+!![])+![]+(+[])+!![]+(+[])+!![]+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+(+[])+![]+!![]+![]+(+!![])+![]+(+!![])+!![]+(+!![])+![]+(+!![])+(+!![])+(+!![])+!![]+(+!![])+(+[])+(+!![])+(+[])+(+[])+!![]+(+!![])+![]+!![]+!![]+(+!![])+![]+!![]+![]+(+!![])+!![]+(+!![])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+!![])+!![]+![]+(+[])+(+!![])+!![]+(+!![])+(+[])+(+!![])+![]+(+[])+(+[])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+[])+(+[])+(+[])+(+[])+![]+![]+(+!![])+!![]+(+[])+(+[])+(+[])+!![]+!![]+(+!![])+(+[])+![]+![]+(+[])+(+!![])+!![]+![]+(+[])+(+[])+![]+!![]+(+[])+(+!![])+!![]+![]+(+!![])+(+[])+![]+!![]+(+[])+(+!![])+![]+(+[])+(+!![])+(+[])+![]+!![]+(+[])+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+!![])+!![]+(+[])+![]+(+[])+![]+![]+(+!![])+(+[])+!![]+!![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+!![]+![]+!![]+(+!![])+![]+(+[])+!![]+(+[])+![]+!![]+![]+(+!![])+![]+(+!![])+![]+(+!![])+![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+(+!![])+![]+!![]+(+[])+(+!![])+(+!![])+(+[])+!![]+(+!![])+!![]+(+!![])+(+[])+(+!![])+!![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+!![]+(+!![])+(+!![])+![]+(+[])+(+[])+(+!![])+!![]+(+[])+![]+(+!![])+![]+(+!![])+!![]+(+!![])+![]+(+[])+![]+(+!![])+![]+(+[])+(+!![])+(+[])+![]+![]+(+[])+(+[])+![]+(+!![])+(+[])+(+!![])+!![]+![]+!![]+(+!![])+!![]+(+[])+![]+(+!![])+!![]+!![]+(+!![])+(+[])+![]+!![]+(+[])+(+[])+![]+(+!![])+(+[])+(+!![])+!![]+![]+!![]+(+!![])+![]+(+[])+(+!![])+(+[])+![]+!![]+!![]+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+!![]+!![]+(+!![])+(+[])+![]+![]+(+!![])+(+!![])+![]+(+[])+(+[])+(+[])+!![]+![]+!![]+(+!![])+![]+(+[])+!![]+(+[])+![]+!![]+![]+(+!![])+![]+(+!![])+![]+(+!![])+![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+(+!![])+![]+!![]+(+[])+(+!![])+(+!![])+(+[])+![]+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+(+[])+!![]+(+!![])+!![]+(+!![])+(+[])+(+[])+![]+![]+(+[])+(+!![])+!![]+![]+(+[])+(+[])+![]+!![]+(+[])+(+!![])+!![]+![]+(+!![])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+![]+![]+(+!![])+(+!![])+!![]+!![]+(+!![])+(+[])+(+[])+![]+![]+(+[])+![]+![]+(+[])+(+[])+!![]+(+[])+(+[])+(+!![])+!![]+![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+!![]+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+![]+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+!![])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+!![]+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+[])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+[])+(+!![])+(+!![])+![]+(+!![])+(+[])+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+(+[])+![]+(+!![])+![]+(+[])+![]+(+[])+!![]+(+[])+![]+(+[])+!![]+(+[])+!![]+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+![]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+(+[])+(+[])+!![]+![]+(+[])+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+[])+!![]+(+[])+!![]+(+!![])+(+[])+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+!![]+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+![]+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+!![])+![]+(+[])+!![]+(+[])+(+[])+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+!![]+![]+(+[])+![]+![]+!![]+(+[])+![]+(+!![])+!![]+(+[])+![]+(+!![])+!![]+(+[])+![]+![]+(+!![])+(+[])+![]+!![]+![]+(+!![])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+!![])+(+!![])+!![]+(+[])+(+[])+(+!![])+![]+!![]+(+[])+(+!![])+![]+(+[])+(+!![])+(+!![])+![]+(+[])+!![]+(+!![])+![]+(+!![])+(+!![])+(+[])+![]+![]+(+[])+(+[])+![]+!![]+!![]+(+[])+![]+!![]+![]+(+!![])+!![]+![]+!![]+(+[])+!![]+(+!![])+![]+(+!![])+!![]+!![]+(+!![])+(+[])+![]+!![]+!![]+(+!![])+![]+(+!![])+!![]+(+[])+![]+!![]+(+[])+(+!![])+!![]+![]+(+[])+(+[])+!![]+!![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+!![]+(+[])+(+[])+(+[])+![]+![]+(+[])+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+!![])+!![]+![]+(+[])+(+!![])+(+!![])+!![]+(+!![])+(+[])+![]+!![]+![]+(+!![])+![]+!![]+(+!![])+(+!![])+![]+(+[])+(+!![])+(+!![])+!![]+(+[])+(+[])+(+[])+![]+![]+(+[])+(+!![])+!![]+(+!![])+(+!![])+(+[])+!![]+!![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+!![]+(+[])+(+[])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+![]+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+!![]+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+![]+(+[])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+![]+(+!![])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+(+!![])+!![]+(+!![])+(+!![])+(+!![])+![]+!![]+(+!![])+!![]+(+!![])+(+!![])+(+!![])+(+!![])+!![]+(+!![])+(+[])+![]+![]+(+!![])+(+[])+![]+![]+(+!![])+(+[])+![]+![]+(+!![]))[[]+([]+![])[!![]+!![]+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]]([]+!![])[[]+([][[]+([]+!![])[!![]+!![]+!![]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]](!![]+!![]+!![])[[]+([]+![])[!![]+!![]+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]]([]+![])[[]+([][[]+([]+!![])[!![]+!![]+!![]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]](!![]+!![])[[]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+![])[+!![]]+([]+!![])[+![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(+([]+(+!![])+(!![]+!![]+!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![])+(+[])))]([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(![]+[+[]])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()[[]+(+!![])+(+[])]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(![]+[+[]])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()[[]+(+!![])+(+[])]+(![]+[+[]]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]])[+([]+(!![]+!![])+(+[]))])())[[]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+![])[+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))]([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(+[![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(+!![])+(+!![]))]+([]+![])[+[]]+([]+[])[[]+([]+![])[+[]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+![])[!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]()[+([]+(+!![])+(+!![]))]+([]+[])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()[!![]+!![]]+([+[]]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+![])[!![]+!![]]+([]+![])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+![])[!![]+!![]]+([]+![])[!![]+!![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]])[+([]+(+!![])+(+[]))]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]+(![]+[+[]]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]])[+([]+(!![]+!![])+(+[]))]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+([]+![])[+[]]+([]+!![])[+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(+[![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(+!![])+(+!![]))]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+!![])[!![]+!![]+!![]])()(([]+[])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]())[!![]+!![]]+(+([]+(+!![])+(!![]+!![]+!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![])+(+[])))+([]+![])[+!![]]+([]+!![])[+!![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(+[![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(+!![])+(+!![]))]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+!![])[!![]+!![]+!![]])()(([]+[])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]())[!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([][[]]+[])[!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]]+[])[+([]+(+!![])+(!![]+!![]+!![]))]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+![])[+!![]]+([]+!![])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])))[+[]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]]+[])[+([]+(+!![])+(!![]+!![]+!![]))]+([]+![])[+[]]+([][[]+([]+![])[!![]+!![]+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+![])[!![]+!![]]](![]+[])+[])[+!![]]+(!![]+!![]+!![]+!![])+([+[]]+![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(!![]+!![])+(+[]))]+([+[]]+![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(!![]+!![])+(+[]))])())[[]+([][[]+([]+!![])[!![]+!![]+!![]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]]([]))()
```

# Answer
> 1 votes
# simply, 321 bytes

This is a very verbose language that I've been writing for a while now.

It uses the canvas module, to do all the drawing.
This is based on the HTML `<canvas>` and the JavaScript `canvas.getContent('2d')`.

```
$C=call!CANVAS->init(256,256)def&p($x$y$R$G$B$A)call$C->fillRect($x$y,1,1&str_concat("rgba("$R','$G','$B','&div($A,255)')'))&p($a=126$b=127$F=255,0,0$F)&p($b$b,0$F,0$F)&p($c=128$b,0,0$F$F)&p($d=129$b$F,0,0$F)&p($d$b,0$F,0$b)&p($a$c,0,0,0$F)&p($b$c$F$F$F$F)&p($c$c$F,0,0$F)&p($c$c,0,0$F$b)&p($d$c,0$F,0$F)&p($d$c,0,0$F$b);

```

This generates a 256x256 canvas, due to the X and Y being in the 0-255 range.

**Result (raw and zoomed):**

---

## Explanation:

**Generates the canvas, 29 bytes**

```
$C=call!CANVAS->init(256,256)

```

All it does is really that: create the canvas.
It's assigned to a local variable, because of the next point.

**Draws the pixels, 95 bytes**

```
def&p($x$y$R$G$B$A)call$C->fillRect($x$y,1,1&str_concat("rgba("$R','$G','$B','&div($A,255)')'))

```

Defines the function that will do all the drawing.
There's no scope opening, so, it takes the next statement as the whole function code.
This is similar to C-like `if(cond) do_something();`, but applied to functions.

This gives access to the local variables to that single statement, which won't happen for a function with a new scope.

**Pixel data, 197 bytes**

```
&p($a=126$b=127$F=255,0,0$F)&p($b$b,0$F,0$F)&p($c=128$b,0,0$F$F)&p($d=129$b$F,0,0$F)&p($d$b,0$F,0$b)&p($a$c,0,0,0$F)&p($b$c$F$F$F$F)&p($c$c$F,0,0$F)&p($c$c,0,0$F$b)&p($d$c,0$F,0$F)&p($d$c,0,0$F$b);

```

All the data to draw.

There's a mix between commas (`,`) and variables glued to values.
This is intentional, as the language doesn't care (much) if there's a comma or not, as long as they are 2 distinct tokens.

---

## Ungolfed code:

```
// Creates the 256x256 canvas, and displays it
// This uses a global variable (starts with %), so it is available in &putPixel
Set %canvas to the result of calling !CANVAS->init(256, 256).

// This is the function that does the drawing
Define the function &putPixel with the arguments $x, $y, $R, $G, $B, $A.
Begin.
    // $alpha has to be between 0 and 1, so, needs to be divided by 255.
    Set $alpha to the result of calling &div($A, 255).

    // Sets $style to the rgba(...) value for the pixel
    Set $style to the result of calling &str_concat("rgba(", $R, ',', $G, ',', $B, ',', $alpha, ')').

    // This is the function that does the drawing
    Call the function %canvas->fillRect($x, $y, 1, 1, $style).
End.

// From here on, everything is just the pixel data

//  Red
Call the function &putPixel(126, 127, 255,   0,   0, 255).
//  Green
Call the function &putPixel(127, 127,   0, 255,   0, 255).
//  Blue
Call the function &putPixel(128, 127,   0,   0, 255, 255).
//  Red
Call the function &putPixel(129, 127, 255,   0,   0, 255).
//  Dark Yellow (previous red + transparent green)
Call the function &putPixel(129, 127,   0, 255,   0, 127).

// ⬛ Black
Call the function &putPixel(126, 128,   0,   0,   0, 255).
// ⬜ White
Call the function &putPixel(127, 128, 255, 255, 255, 255).
//  Red
Call the function &putPixel(128, 128, 255,   0,   0, 255).
//  Dark pink (previous red + transparent blue)
Call the function &putPixel(128, 128,   0,   0, 255, 127).
//  Blue
Call the function &putPixel(129, 128,   0, 255,   0, 255).
//  Dark sea-blue (previous blue + transparent green)
Call the function &putPixel(129, 128,   0,   0, 255, 127).

```

# Answer
> 0 votes
# JavaScript, ~~299 ... 257~~ 252 bytes

Yeah... finally, the 256-bytes barrier was broken. This is improvement of kaya3 answer (329 bytes)

```
document.write`<canvas id=Y>`,c=Y.getContext`2d`
p=(x,y,a,...r)=>{c.fillStyle=`rgba(${r},${a/255})`;c.fillRect(x,y,1,1)}
(0x13112fb565921390e1525ad52e2debb235fdb48dc495b7b695e1605n+'')
.replace(/.{6}/g,x=>p(...[...x].map(u=>[0,126,127,128,129,255][u])))
```

Initialization & function: 120 bytes

Test-case code: 131 bytes (after remove one new-line character before last line)

Draw pixel explanation: we change BigInt hex num into long decimal string with 66 digits. We split long string into eleven 6-digit chunks and treat each digit as index. Then map each index to color value using array `[0,126,127,128,129,255]` and call put-pixel function `p` with parameters from such mapped chunk

---
Tags: code-golf, graphical-output
---


title: Carpet an Airport

text:
# Question
Title: Carpet an Airport
In 2015 the Portland International Airport began the replacement of their iconic carpet. I want you to write a program to draw their old carpet in as few bytes as possible.

The carpet:

### Specifications

* Here is a link to a scalable pdf image of one tile. Your output should match the relative dimensions and placement of that image.
* All colors in your final image should be within 15 of every RGB value in the specified image. These are listed below for your convenience.

```
            Red   Green Blue
Teal:       0,    168,  142
Magenta:    168,  108,  185
Orange:     247,  58,   58
Light Blue: 90,   166,  216
Dark Blue:  0,    77,   117

```
* Your output must be at least 150x150 pixels and should be square. If you choose to output in a scalable format like a vector image you should match the image exactly.
* You may output the image in any preexisting image format.
* This is so you should aim to minimize the number of bytes in your code.

# Answer
> 10 votes
# Tikz, ~~725~~ ~~693~~ ~~681~~ 671 bytes

> Some significant improvements can be made to this answer. If you would like to make major golfs then you should post your own answer with your modified version. For minor improvements that I just missed, and don't require large explanation, feel free to comment them. I would like to reward major improvements, and I will definitely upvote any answer that beats this.

---

```
\documentclass{standalone}\usepackage{xcolor,tikz}\begin{document}\tikz[line width=20,every node/.style={minimum size=20}]{\definecolor{t}{RGB}{0,168,142}\definecolor{m}{RGB}{168,99,185}\definecolor{o}{RGB}{247,58,58}\definecolor{b}{RGB}{90,166,216}\definecolor{d}{RGB}{40,77,117}\fill[t](-7.5,-7.5)rectangle(7.5,7.5);\draw(-1,0)node[fill=o]{};\foreach\x in{1,...,7}{\draw(-\x,-1)node[fill=m]{};\draw(0,\x)node[fill=b]{};}\foreach\x in{1,...,3}{\draw(\x,\x)node[fill=d]{};\draw(3+\x,-3-\x)node[fill=d]{};\draw(-3-\x,3+\x)node[fill=d]{};\draw(4+\x,1)node[fill=o]{};}\draw[d](.65,0)--(7.35,0);\draw[d,dash pattern=on20off8.5on162.5off8.5](0,-7.35)--(0,3.35);}\end{document}

```

Try it Online!

## Explanation

A good deal of the code is a wrapper:

```
\documentclass{standalone}\usepackage{xcolor,tikz}\begin{document}\tikz{...}\end{document}

```

This is a slight variation on the standard Tikz wrapper in that it also has the line `\usepackage{xcolor}` so that we can create the colors properly.

The first thing that is done is `line width=20,every node/.style={minimum size=20}]` which sets the lines and nodes to be the proper size.

Once that is done we define the colors we will be using for the various parts of the image:

```
\definecolor{t}{RGB}{0,168,142}\definecolor{m}{RGB}{168,99,185}\definecolor{o}{RGB}{247,58,58}\definecolor{b}{RGB}{90,166,216}\definecolor{d}{RGB}{40,77,117}

```

Now that everything is set up we paint the background to our canvas teal:

```
\fill[t](-7.5,-7.5)rectangle(7.5,7.5);

```

*(I wont include an image of this because it is just a teal square, but I will be including images of each other step)*

The first node we add is the orange node just left of the center of the canvas.

```
\draw(-1,0)node[fill=o]{};

```

Now we will draw the light blue and magenta nodes. There are 7 blue nodes and 4 blue nodes, but we can draw extra nodes that will be covered up by lines later on so we will draw 7 of each.

```
\foreach\x in{1,...,7}{
    \draw(-\x,-1)node[fill=m]{};
    \draw(0,\x)node[fill=b]{};
}

```

Now we will draw all the groups of 3 dots using a single `\foreach` loop

```
\foreach\x in{1,...,3}{\draw(\x,\x)node[fill=d]{};\draw(3+\x,-3-\x)node[fill=d]{};\draw(-3-\x,3+\x)node[fill=d]{};\draw(4+\x,1)node[fill=o]{};}

```

Now we draw the right line. This line will be a simple line with offsets of `.35` in each direction to match the size of a node.

```
\draw[d](.65,0)--(7.35,0);

```

Now we must draw in the dark blue lines and squares on the x-axis. We will draw them with one line using a custom dash pattern.

This pattern is `[dash pattern=on20off8.5on162.5off8.5]` This creates a square with a long solid tail. Our line will start from the bottom and will not quite cover 2 cycles of the pattern.

```
\draw[d,dash pattern=on20off8.5on162.5off8.5](0,-7.35)--(0,3.35);

```

And now we are done.

# Answer
> 9 votes
## Pure HTML, 873 bytes

```
<table width=152 height=152 bgcolor=#0a8><tr><td colspan=7><td bgcolor=#5AD><tr><td><td bgcolor=#057><td colspan=5><td bgcolor=#5AD><tr><td><td><td bgcolor=#057><td colspan=4><td bgcolor=#5AD><tr><td><td><td><td bgcolor=#057><td><td><td><td bgcolor=#5AD><tr><td colspan=7><td bgcolor=#057><td><td><td bgcolor=#057><tr><td colspan=7><td bgcolor=#057><td><td bgcolor=#057><tr><td colspan=7><td bgcolor=#057><td bgcolor=#057><td><td><td><td bgcolor=#F33><td bgcolor=#F33><td bgcolor=#F33><tr><td colspan=6><td bgcolor=#F33><td bgcolor=#057><td colspan=7 bgcolor=#057><tr><td bgcolor=#A6B><td bgcolor=#A6B><td bgcolor=#A6B><td bgcolor=#A6B><td bgcolor=#A6B><td bgcolor=#A6B><td bgcolor=#A6B><td rowspan=6 bgcolor=#057><tr><td><tr><td><tr><td colspan=11><td bgcolor=#057><tr><td colspan=12><td bgcolor=#057><tr><td colspan=13><td bgcolor=#057><tr><td colspan=7><td bgcolor=#057>
```

## HTML + CSS, 625 bytes

```
#l{background:#5AD}th{background:#057}#o{background:#F33}#m>td{background:#A6B
```

```
<table width=152 height=152 bgcolor=#0A8><tr><td colspan=7><td id=l><tr><td><th><td colspan=5><td id=l><tr><td><td><th><td colspan=4><td id=l><tr><td><td><td><th><td><td><td><td id=l><tr><td colspan=7><th><td><td><th><tr><td colspan=7><th><td><th><tr><td colspan=7><th><th><td><td><td><td bgcolor=#F33><td bgcolor=#F33><td bgcolor=#F33><tr><td colspan=6><td bgcolor=#F33><th><th colspan=7><tr id=m><td><td><td><td><td><td><td><th rowspan=6><tr><td><tr><td><tr><td colspan=11><th><tr><td colspan=12><th><tr><td colspan=13><th><tr><td colspan=7><th>
```

# Answer
> 7 votes
# literal PNG file, ~~283~~, ~~234~~ 227 bytes

**EDIT**: Using online image compression service https://compress-or-die.com/, this went down another 7 bytes.

```
albn@alexhij:~/tmp$ ls -l carpet3.png
-rw-r--r-- 1 albn albn 227 15. Feb 12:01 carpet3.png
albn@alexhij:~/tmp$ base64 carpet3.png
iVBORw0KGgoAAAANSUhEUgAAAJgAAACYBAMAAADq7D0SAAAAD1BMVEUAqI4ATXWobLn3Ojpapthl
S7nNAAAAj0lEQVR4Ae3ThRHCQBQGYVqgBVq4Fui/Jt4ILks8/80uLvkyOTlkd67EILHojtWEyxQT
Sw6uFS5TTCw/uFa+TDGx/PjS3z+KiS2GcRtgzIqJdboDPomteniCxMTyatXtMiExMcB22amCJ7wG
MbHpBWBiYmJiYmJwAjGx/ncAn0VMrP8dwL+KieXHFyImltoF6oWZiblRTNQAAAAASUVORK5CYII=

```

The 227 bytes are the actual size of the binary file carpet.png. When encoded in base64, as displayed in the quoted block above, it is a few bytes longer (308 bytes). Encapsulating that in an html snippet that renders the image rightaway will add another few bytes:

# HTML, ~~414~~, ~~343~~, 336 bytes

```
<img src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAACYBAMAAADq7D0SAAAAD1BMVEUAqI4ATXWobLn3OjpapthlS7nNAAAAj0lEQVR4Ae3ThRHCQBQGYVqgBVq4Fui/Jt4ILks8/80uLvkyOTlkd67EILHojtWEyxQTSw6uFS5TTCw/uFa+TDGx/PjS3z+KiS2GcRtgzIqJdboDPomteniCxMTyatXtMiExMcB22amCJ7wGMbHpBWBiYmJiYmJwAjGx/ncAn0VMrP8dwL+KieXHFyImltoF6oWZiblRTNQAAAAASUVORK5CYII
```

**Edit**: I removed the quotes and closing \> as Shaggy suggested. Also compressed the image down another ~~17~~, 24 bytes

# Answer
> 6 votes
# Mathematica, 285 bytes

```
e={1,1};r=RGBColor["#"<>#]&;c=Cuboid;s=c[3#-e,3#+e]&;a=Array;b=a[s[{1,-1}#]&,3,#]&;Graphics@{r@"0a8",c[-23e,23e],r@"a6b",a[s@{-#,-1}&,7],r@"f33",a[s@{#,1}&,3,5],s@{-1,0},r@"5ad",a[s@{0,#}&,4,4],r@"057",a[s[e#]&,4,0],b@4,b[-6],s@{0,-7},{-1,2}~c~{1,10},{-1,-2}~c~{1,-19},{2,-1}~c~{22,1}}

```

Easier to read:

```
 1  c = Cuboid; e = {1, 1};
 2  s = c[3 # - e, 3 # + e] &;
 3  a = Array; b = a[s[{1, -1} #] &, 3, #] &;
 4  r = RGBColor["#" <> #] &;
 5  Graphics@{
 6   r@"0a8", c[-23 e, 23 e],
 7   r@"a6b", a[s@{-#, -1} &, 7],
 8   r@"f33", a[s@{#, 1} &, 3, 5], s@{-1, 0},
 9   r@"5ad", a[s@{0, #} &, 4, 4],
10   r@"057",
11    a[s[e #] &, 4, 0], b@4, b[-6], s@{0, -7},
12    {-1, 2}~c~{1, 10}, {-1, -2}~c~{1, -19}, {2, -1}~c~{22, 1}
13  }

```

Lines 1–3 define short names for functions, the most important of which is `s` which draws a square centered at the coordinates it receives (really 3 times its coordinates, for appropriate scaling). Line 4 defines a color function using Mathematica's "shortcut" RGB system: `RGBColor["#xyz"]`, where `xyz` are hexadecimal digits, stands for `RGBColor[{17x, 17y, 17z}]` (so that each coordinate has 16 equally spaced options running from 0 to 255). The first commands on lines 6–10 switch the current color, using the shortcut colors that are closest to the designated five colors (no value is off by more than 8 when we round to the nearest multiple of 17).

Line 6 draws the large teal square. Line 7 draws the line of magenta squares, Line 8 draws the line of orange squares and the single orange square. Line 9 draws the line of light blue squares. Line 11 draws the three diagonal lines of dark blue squares, as well as the single dark blue square at the bottom. Finally, line 12 draws the three long dark blue rectangles. The output is below:

(Golf tip: the command `Cuboid`, which is intended for 3d graphics objects, works just fine in 2d and is shorter than `Rectangle`.)

# Answer
> 5 votes
# TikZ, ~~671\>439\>432\>377\>334~~\>311 (282) bytes

> My original answer started from the code that Ad Hoc Garf Hunter provided above, cf. Tikz, 671 bytes.
> I took this code and my knowledge about general LaTeX to make some improvements to the length of it, saving a bit more than 1 out of every 3 bytes.
> However, two years later, I returned to this problem and gave it another try by starting from scratch.

---

Here's my all new, personal solution. Note that the solution uses non-printable single-byte characters. In the depiction of this solution, they are replaced by circled characters. The circled characters can be mapped by `0x(circled character)` with the help of an ASCII table.

```
\documentclass[tikz]{standalone}\begin{document}\tikz{\let~\def~Ⓒ{;\color[HTML]}~④{)rectangle++(.7}~Ⓕ{\fill(}~~#1#2{Ⓕ0x#1,0x#2④,.7);}Ⓒ{00a88e}Ⓕ.85,.85④+14.3,15)Ⓒ{004d75}~2E~3D~4C~BB~AA~99~88~C4~D3~E2~81Ⓕ8,2④,5.7)(8,9④,2.7)(9,8④+6,.7)Ⓒ{5aa6d8}~8F~8E~8D~8CⒸ{f73a3a}~D9~E9~F9~78Ⓒ{a86cb9}~17~27~37~47~57~67~77}\stop

```

Try it Online!

## Output

## Explanation

Here's a more readable version of my personal new solution.

```
01: \documentclass[tikz]{standalone}\begin{document}\tikz{
02: \let~\def~Ⓒ{;\color[HTML]}~④{)rectangle++(.7}~Ⓕ{\fill(}
03: ~~#1#2{Ⓕ0x#1,0x#2④,.7);}
04: Ⓒ{00a88e}Ⓕ.85,.85④+14.3,15)
05: Ⓒ{004d75}~2E~3D~4C~BB~AA~99~88~C4~D3~E2~81
06: Ⓕ8,2④,5.7)(8,9④,2.7)(9,8④+6,.7)
07: Ⓒ{5aa6d8}~8F~8E~8D~8C
08: Ⓒ{f73a3a}~D9~E9~F9~78
09: Ⓒ{a86cb9}~17~27~37~47~57~67~77
10: }\stop

```

Let's start with the wrapper in lines 1 and 10. This is basically the standard TikZ-wrapper.

In line 2, we assign a shorthand (`~`) to the command `\def` within the TikZ-scope. Note that the only available printable single-character command `~` (catcode=13) is now defined as a command within the `\tikz{}` scope. This helps us to define even more shorthands in a very compact way. We then assign a shorthand to `\color` that allows us to change the color that we use for `\fill`-commands later on. As we have five colors in total, we will use the command  five times. Note that  for `\color` is a mnemonic declaration. We assign a shorthand to a string that will be used quite a lot to draw rectangles.  for rectangle (with four sides) is a mnemonic assignment as well. It contains the closing bracket for the first and the opening bracket for the second coordinate as well as the most common value for the x-value of the second coordinate. In the end of the line, we define a shorthand for the `\fill` command. The assignment is again mnemonic: . Note that all of the three assignments to "circled characters" are really assignments to non-printable single-byte control characters (0xY, Y standing for the corresponding circled character, being interpreted as ASCII hex value). These characters are all active (catcode=13) characters. All those assignments are displayed as mid-dots in the "Try It Online"-version at Overleaf. This renders an actually sort of "unreadable" (but completely working!) code view that can be ameliorated if you just copy the code to another editor, e.g. here.

In line 3, we continue to redefine `~` and, from now on, use this command to draw little squares. We benefit from the fact that the whole tile can be divided in 15 by 15 squares which is less than 16 by 16. Therefore, we can use hexadecimal one-digit numbers to refer to a unique square with only two characters.

In lines 4 and 6, we draw a huge square in teal and some rectangles, more exactly: all those not being square, in dark blue. We don't need to pick the color dark blue, since this happens in line 5, see below.

Lines 5, 7, 8, and 9 draw all the squares in four different colors. As we pick dark blue as our color for the squares in line 5, we can keep it for the rectangles, see above. Thus, we only have to use the -command five times.

## We can make it even shorter!

If you visited the "Try It Online"-link, you might have found a "hacky" version with 29 bytes less. This version produces the same output. However, it throws errors and has a white border. Therefore, the "hacky" version is non-competing. It differs from the version described above by two things: (A) We don't use `\begin{document}`. This produces errors, but we obtain an output nevertheless. We can save 16 bytes. (B) In the "hacky" definition of the final version of `~`, `~` calls itself. This helps us to save a lot of `~` characters in lines 6, 7, 8, and 9 (10+3+3+6 = 22, to be exact). However, we will have to introduce the `~` character in line 3 and one pair of curly braces for each of the lines 6, 7, 8, and 9 to make this work, leaving us with a difference of 13 bytes.

## Comments regarding Ad Hoc Garf Hunter's solution

I did not like the fact that I didn't fully understand the dash pattern that the other solution is using. Also, I tried to avoid nodes and lines by concentrating on rectangles. Furthermore, I believe in the metric system. Thus, I refrained from using other units than mm or cm. ;-) I believe that my second approach is much cleaner now.

## Improvements

Please feel free to comment and help me save more bytes.

# Literal PNG file, 223 bytes

I've created this PNG file from my TikZ output.

# Answer
> 2 votes
# Python, 420

```
from PIL import Image,ImageDraw
B=0,77,117
I=Image.new('RGB',(300,300),(0,168,142))
r=ImageDraw.Draw(I).rectangle
for x,y,c in['7172737a98cde670123456bcd70112233456666778888888bcde23232323331111300000003333'[x::26]for x in range(26)]:exec'r([W,W,14+W,14+W],[(168,108,185),(247,58,58),(90,166,216),B][%s]);'.replace('W','2+20*0x%s')%(x,y,x,y,c)
r([162,142,296,156],B)
r([142,82,156,136],B)
r([142,162,156,276],B)
I.show()

```

# Answer
> 2 votes
# T-SQL, 680 bytes

```
CREATE TABLE g(c INT,s geometry)
INSERT g SELECT c,geometry::Point(x,y,0).STBuffer(.4)
FROM(VALUES(1,7,8),(1,13,9),(1,14,9),(1,15,9),(2,2,14),(2,3,13),(2,4,12)
 ,(2,8,8),(2,9,9),(2,10,10),(2,11,11),(2,8,1),(2,12,4),(2,13,3),(2,14,2)
 ,(3,1,7),(3,2,7),(3,3,7),(3,4,7),(3,5,7),(3,6,7),(3,7,7)
 ,(35,8,12),(35,8,13),(35,8,14),(35,8,15))a(c,x,y)
INSERT g SELECT c,geometry::STLineFromText('LINESTRING('+v+')',0).STBuffer(.4)
FROM(VALUES(0,'.8 .8,15.2 15.2'),(2,'8 2,8 7'),(2,'8 9,8 11'),(2,'9 8,15 8'))a(c,v);
WITH t AS(SELECT 4n UNION ALL SELECT n+1FROM t WHERE n<34)
INSERT g SELECT n,geometry::Point(1,1,0).STBuffer(.01)FROM t;
SELECT c,geometry::UnionAggregate(s.STEnvelope())FROM g GROUP BY c

```

So, this doesn't *entirely* satisfy the color requirement, but as I explain below, that's not fully under my control. Let's call this the *faded carpet* version.

Formatted/commented code and output:

Notes:

* The points (and lines) in the table are expanded into a circle with `STBuffer`, then squared off with `STEnvelope`.
* The SQL spatial results pane has a fixed color palette, so I am limited in what colors I can display (no bright red, etc)
* To get the colors I want, I have to select them *in the correct order*. Column *c* in my table defines the grouping order; the large teal square is group 0, the 4 blue squares are group 35.
* To get *multiple* objects of the same color, I have to *combine them into a single object*, that's the purpose of the `UnionAggregate()` function at the end.
* To "skip ahead" through the color palette to get to the light blue, I have to insert 31 dummy objects that are big enough to get assigned a color, but small enough not to show.

To see more strange uses of SQL spatial features, see draw the biohazard symbol and draw the Easter Bunny.

# Answer
> 1 votes
# HTML/SVG, ~~550~~ ~~542~~ 521 bytes

```
<svg><path fill=#0a8 d="M0 0h152v152H0z"/><path fill=#5ad d="M72 2h8v8h-8zm0 10h8v8h-8zm0 10h8v8h-8zm0 10h8v8h-8z"/><path fill=#057 d="M12 12h8v8h-8zm10 10h8v8h-8zm10 10h8v8h-8zm40 10h8v28h-8zm0 30h8v8h-8zm10-10h8v8h-8zm10-10h8v8h-8zm10-10h8v8h-8zM82 72h68v8H82zM72 82h8v58h-8zm0 60h8v8h-8zm40-30h8v8h-8zm10 10h8v8h-8zm10 10h8v8h-8z"/><path fill=#f33 d="M62 72h8v8h-8zm60-10h8v8h-8zm10 0h8v8h-8zm10 0h8v8h-8z"/><path fill=#a6b d="M2 82h8v8H2zm10 0h8v8h-8zm10 0h8v8h-8zm10 0h8v8h-8zm10 0h8v8h-8zm10 0h8v8h-8zm10 0h8v8h-8z"
```

# Answer
> 1 votes
# HTML/SVG + JavaScript (ES6), ~~500~~ 499 bytes

An extra `>` is required in order for this to function as a Snippet, see this Fiddle for actual code.

```
[[t="5ad",2],[t,o=12],[t,p=22],[t,q=32],[,o,o],[,p,p],[,q,q],[,42,,28],[],[,v=62,s=82],[,52,92],[,42,102],[,,s,,68],[,s,,58],[,142],[,112,112],[,122,122],[,132,132],[t="f33",,v],[t,v,122],[t,v,132],[t,v,142],[t="a6b",s,2],[t,s,o],[t,s,p],[t,s,q],[t,s,42],[t,s,52],[t,s,v],["0a8",0,0,152,152]].map(x=>a(x[0],x[1],x[2],x[3],x[4]),a=(f="057",y=72,x=72,h=8,w=8)=>(c.after(r=c.cloneNode()),r.id++,r[s="setAttribute"]("fill","#"+f),r[s]("x",x),r[s]("y",y),r[s]("width",w),r[s]("height",h)))
```

```
<svg><rect id=c>
```

---

## Explanation

An array of arrays is mapped to function `a`, creating clones of the `rect` in the HTML, inserting them after the initial `rect` and setting their `fill`, `x`, `y`, `width` & `height` attributes. Each array contains values for those attributes, in that order, with any missing values being set by the default parameters of `a`. The seemingly unnecessary `r.id++` allows the use of `cloneNode()` while ensuring there is only ever 1 `rect` with an `id` of c; this saves the need to use the ridiculously expensive `document.createElementNS("http://www.w3.org/2000/svg","rect")`.

# Answer
> 1 votes
# PHP+SVG, 425 Bytes

```
<svg><rect x=0 y=0 fill=#00a88e width=150 height=150 /><?foreach(["004d75"=>[[1,1],[2,2],[3,3],[7,14],[7,7],[8,6],[9,5],[10,4],[11,11],[12,12],[13,13],[7,4,0,2],[8,7,6,0],[7,8,0,5]],"5aa6d8"=>[[7,0],[7,1],[7,2],[7,3]],a86cb9=>[[0,8],[1,8],[2,8],[3,8],[4,8],[5,8],[6,8]],f73a3a=>[[6,7],[12,6],[13,6],[14,6]]]as$c=>$p)foreach($p as$v)echo"<rect x={$v[0]}1 y={$v[1]}1 width=".(8+10*$v[2])." height=".(8+10*$v[3])." fill=#$c />";

```

expanded

```
<svg><rect x=0 y=0 fill=#00a88e width=150 height=150 />
<?foreach([
"004d75"=>[[1,1],[2,2],[3,3],[7,14],[7,7],[8,6],[9,5],[10,4],[11,11],[12,12],[13,13],[7,4,0,2],[8,7,6,0],[7,8,0,5]]
,"5aa6d8"=>[[7,0],[7,1],[7,2],[7,3]]
,a86cb9=>[[0,8],[1,8],[2,8],[3,8],[4,8],[5,8],[6,8]]
,f73a3a=>[[6,7],[12,6],[13,6],[14,6]] # Array containing color and position ,width, height of each rect without the background
]as$c=>$p)
  foreach($p as$v)
    echo"<rect x={$v[0]}1 y={$v[1]}1 width=".(8+10*$v[2])." height=".(8+10*$v[3])." fill=#$c />"; # Output the rects

```

The result of the code in a HTML snippet

```
<svg><rect x=0 y=0 fill=#00a88e width=150 height=150 /><rect x=11 y=11 width=8 height=8 fill=#004d75 /><rect x=21 y=21 width=8 height=8 fill=#004d75 /><rect x=31 y=31 width=8 height=8 fill=#004d75 /><rect x=71 y=141 width=8 height=8 fill=#004d75 /><rect x=71 y=71 width=8 height=8 fill=#004d75 /><rect x=81 y=61 width=8 height=8 fill=#004d75 /><rect x=91 y=51 width=8 height=8 fill=#004d75 /><rect x=101 y=41 width=8 height=8 fill=#004d75 /><rect x=111 y=111 width=8 height=8 fill=#004d75 /><rect x=121 y=121 width=8 height=8 fill=#004d75 /><rect x=131 y=131 width=8 height=8 fill=#004d75 /><rect x=71 y=41 width=8 height=28 fill=#004d75 /><rect x=81 y=71 width=68 height=8 fill=#004d75 /><rect x=71 y=81 width=8 height=58 fill=#004d75 /><rect x=71 y=01 width=8 height=8 fill=#5aa6d8 /><rect x=71 y=11 width=8 height=8 fill=#5aa6d8 /><rect x=71 y=21 width=8 height=8 fill=#5aa6d8 /><rect x=71 y=31 width=8 height=8 fill=#5aa6d8 /><rect x=01 y=81 width=8 height=8 fill=#a86cb9 /><rect x=11 y=81 width=8 height=8 fill=#a86cb9 /><rect x=21 y=81 width=8 height=8 fill=#a86cb9 /><rect x=31 y=81 width=8 height=8 fill=#a86cb9 /><rect x=41 y=81 width=8 height=8 fill=#a86cb9 /><rect x=51 y=81 width=8 height=8 fill=#a86cb9 /><rect x=61 y=81 width=8 height=8 fill=#a86cb9 /><rect x=61 y=71 width=8 height=8 fill=#f73a3a /><rect x=121 y=61 width=8 height=8 fill=#f73a3a /><rect x=131 y=61 width=8 height=8 fill=#f73a3a /><rect x=141 y=61 width=8 height=8 fill=#f73a3a />
```

PHP+SVG, 375 Bytes

This Byte count can be reach with compressing the SVG

```
<?=bzdecompress(base64_decode("QlpoNDFBWSZTWY2177gAASSZgEgA/+c/5B3gMAE5TQVtQeig0AAACU0VNMAAAEYIlEnpMKNlGahso2plh0zoaSEpIkukINaC3RWRF74IvArdRF1FcBXrSTFWXTorp2xvpb3k7FbaV62syISgiBEweHhxtWUmgWCsqqaKSEARyAOAEZJJOwYBQqTAWotSrmEXJbBRTYNhCg4RPaKOUUbAX+Fr4VfIrzzIQQkkJCWfMEEOOISTuDkOzgQzDQDNQKu/4K7AZh8L41DddV8iv2LQOBXv+iugriHAr6sK/IrUV1FeRXMV3FdhW8V9KugrmK8CvOQin+LuSKcKEhG2vfcA"));

```

# Answer
> 1 votes
# HTML, 366 bytes

Sunday got a Base64 answer up while I was still working on this; if s/he chooses to use it then I'll delete this answer.

```
<img src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAACYBAMAAADq7D0SAAAAD1BMVEUAqI4ATXWobLlaptj3OjrqGXAuAAAAp0lEQVRo3u3YQQqFMAxFUbeQLbiFbsH9r8k3y8CmTiKm7b2Dwv/CgUAD4jF3TYGBRdgKmRqPCQa28gaMZ20KDGz5DQhnbQoMTG2wAcPR/ScY2HeYVw4zBQYWYDUvbRLWFS/lBxhYhM3bpXzMcWBgEVa5U70cpsDAnkf1FxcwMDAwMLBczP8DAwuwmpc2HzMFBhY8qHlp8zFTYGCdyn8GKrhOYBtjv3QDvf+Zic+8bOsAAAAASUVORK5CYII
```

If the Base64 string on it's own is a valid answer then that's just 335 bytes:

```
iVBORw0KGgoAAAANSUhEUgAAAJgAAACYBAMAAADq7D0SAAAAD1BMVEUAqI4ATXWobLlaptj3OjrqGXAuAAAAp0lEQVRo3u3YQQqFMAxFUbeQLbiFbsH9r8k3y8CmTiKm7b2Dwv/CgUAD4jF3TYGBRdgKmRqPCQa28gaMZ20KDGz5DQhnbQoMTG2wAcPR/ScY2HeYVw4zBQYWYDUvbRLWFS/lBxhYhM3bpXzMcWBgEVa5U70cpsDAnkf1FxcwMDAwMLBczP8DAwuwmpc2HzMFBhY8qHlp8zFTYGCdyn8GKrhOYBtjv3QDvf+Zic+8bOsAAAAASUVORK5CYII

```

# Answer
> 0 votes
## **HTML + Javascript(jQuery)** : 474(js)+ 22(HTML) =\> 496bytes

```
a=$("table"),a.append("<tr>".repeat(15)),$("tr").append("<td width='15' height='15'>".repeat(15)),o={g:"#0a8",b:"#057",c:"#5AD",r:"#F33",p:"#A6B"},z="14g,b,",s="7g,c,8g,b,5g,c,9g,b,4g,c,10g,b,3g,c,"+z+"2g,b,11g,b,g,b,12g,2b,3g,3r,6g,r,8b,7p,b,"+z+z+z+"3g,b,10g,b,4g,b,9g,b,5g,b,8g,b",m="",t=s.split(",");for(var i=0;i<t.length;i++)m+=t[i].length>1?t[i].charAt(1).repeat(t[i].match(/(\d+)/g)):t[i].charAt(0);for(i=0;i<225;i++)$("td:eq("+i+")").attr("bgcolor",o[m.charAt(i)]);
```

```
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<table bgcolor='#0A8'>
```

# Answer
> 0 votes
# HTML + Javascript, 378 bytes

```
document.write`<canvas id=Y>`
c=Y.getContext`2d`
N=(w,o)=>[...w].map(d=>Number('0x'+d)*10+o)
S=f=>c.fillStyle='#'+f
T=(z,p,s)=>c.fillRect(...N(p,1),...N(s,8))
S('0a8');c.fillRect(0,0,150,150)
U=(f,s)=>{S(f);s.replace(/../g,w=>T(0,w,'00'))}
U('a6b','08182838485868')
U('f33','67c6d6e6')
U('5ad','70717273')
U('057','112233bbccdd778695a47e')
'740278058760'.replace(/(..)(..)/g,T)
```

### Explanation

```
document.write`<canvas id=Y>`                   // draw a canvas element

c=Y.getContext`2d`                              // Canvas2DContext

N=(w,o)=>[...w].map(d=>Number('0x'+d)*10+o)     // take a string, interpret each letter
                                                // as a hex number and add an offset

S=f=>c.fillStyle='#'+f                          // set global fill color

T=(z,p,s)=>c.fillRect(...N(p,1),...N(s,8))      // fill a rect
                                                // each x and y is (hex digit)*10 + 1,
                                                // each w and h is (hex digit)*10 + 8

S('0a8');c.fillRect(0,0,150,150)                // draw background

U=(f,s)=>{S(f);s.replace(/../g,w=>T(0,w,'00'))} // draw 8x8 squares

U('a6b','08182838485868')                       // magenta squares,  each represented
                                                // as two digits in the string

U('f33','67c6d6e6')                             // orange squares

U('5ad','70717273')                             // light blue squares

U('057','112233bbccdd778695a47e')               // dark blue squares

'740278058760'.replace(/(..)(..)/g,T)           // dark blue rects, each represented
                                                // as four digits in the string

```

---
Tags: code-golf, kolmogorov-complexity, graphical-output
---


title: Output the nth Even Perfect Number

text:
# Question
Title: Output the nth Even Perfect Number
## Challenge

Given an integer, n, as input where `0 <= n <= 2^10`, output the nth even perfect number.

## Perfect Numbers

A perfect number is a number, x where the sum of its factors (excluding itself) equals x. For example, 6:

```
6: 1, 2, 3, 6

```

And, of course, `1 + 2 + 3 = 6`, so 6 is perfect.

If a perfect number, `x`, is even, `x mod 2 = 0`.

## Examples

The following are the first 10 even perfect numbers:

```
6
28
496
8128
33550336
8589869056
137438691328
2305843008139952128
2658455991569831744654692615953842176
191561942608236107294793378084303638130997321548169216

```

Note that you may index this however you wish: 6 may be the 1st or the 0th even perfect number.

## Winning

Shortest code in bytes wins.

# Answer
# Jelly, 7 bytes

```
6Æṣ=$#Ṫ

```

Try it online!

### How it works

```
6Æṣ=$#Ṫ  Main link. Argument: n

6        Set the return value to 6.
     #   Execute the link to the left with argument k = 6, 7, 8, ... until n
         values of k result in a truthy value. Yield the array of matches.
    $        Combine the two links to the left into a monadic chain.
 Æṣ              Compute the sum of k's proper divisors.
   =             Compare the result with k.
      Ṫ  Tail; extract the last match.

```
> 7 votes

# Answer
# Mathematica, 13 bytes

Not surprisingly, there is a built-in.

```
PerfectNumber

```

Example:

```
In[1]:= PerfectNumber[18]

Out[1]= 33570832131986724437010877211080384841138028499879725454996241573482158\

>    45044404288204877880943769038844953577426084988557369475990617384115743842\

>    47301308070476236559422361748505091085378276585906423254824947614731965790\

>    74656099918600764404702181660294469121778737965822199901663478093006075022\

>    35922320184998563614417718592540207818507301504509772708485946474363553778\

>    15002849158802448863064617859829560720600134749556178514816801859885571366\

>    09224841817877083608951191123174885226416130683197710667392351007374503755\

>    40335253147622794359007165170269759424103195552989897121800121464177467313\

>    49444715625609571796578815564191221029354502997518133405151709561679510954\

>    53649485576150660101689160658011770193274226308280507786835049549112576654\

>    51011967045674593989019420525517538448448990932896764698816315598247156499\

>    81962616327512831278795091980742531934095804545624886643834653798850027355\

>    06153988851506645137759275553988219425439764732399824712438125054117523837\

>    43825674443705501944105100648997234160911797840456379499200487305751845574\

>    87014449512383771396204942879824895298272331406370148374088561561995154576\

>    69607964052126908149265601786094447595560440059050091763547114092255371397\

>    42580786755435211254219478481549478427620117084594927467463298521042107553\

>    17849183589266903954636497214522654057134843880439116344854323586388066453\

>    13826206591131266232422007835577345584225720310518698143376736219283021119\

>    28761789614688558486006504887631570108879621959364082631162227332803560330\

>    94756423908044994601567978553610182466961012539222545672409083153854682409\

>    31846166962495983407607141601251889544407008815874744654769507268678051757\

>    74695689121248545626112138666740771113961907153092335582317866270537439303\

>    50490226038824797423347994071302801487692985977437781930503487497407869280\

>    96033906295910199238181338557856978191860647256209708168229116156300978059\

>    19702685572687764976707268496046345276316038409383829227754491185785965832\

>    8888332628525056

```
> 6 votes

# Answer
# MATL, 15 bytes

```
`@Z\s@E=vtsG<}n

```

Very slow. It keeps trying increasing numbers one by one until the *n*-th perfect number is found.

Try it online!

### Explanation

```
`        % Do...while
  @      %   Push iteration index, k (starting at 1)
  Z\     %   Array of divisors
  s      %   Sum
  @E     %   Push k. Multiply by 2
  =      %   Equal? If so, k is a perfect number
  v      %   Concatenate vertically. This gradually builds an array which at the k-th
         %   iteration contains k zero/one values, where ones indicate perfect numbers
  ts     %   Duplicate. Sum of array
  G<     %   Push input. Less than? This is the loop condition: if true, proceed with
         %   next iteration
}        % Finally (execute right before exiting loop)
  n      %   Number of elements of the array
         % End (implicit). Display (implicit)

```
> 4 votes

# Answer
# Pyth, 13 bytes

```
e.fqsf!%ZTStZ

```

Try it online!

Please do not try any higher number. It just tests the even numbers one by one.
> 3 votes

# Answer
# 05AB1E, 8 bytes

```
µNNÑ¨OQ½

```

Try it online!

**Explanation**

```
µ          # loop over increasing N until counter equals input
 N         # push N
  NÑ       # push factors of N
    ¨      # remove last factor (itself)
     O     # sum factors
      Q    # compare the sum to N for equality
       ½   # if true, increase counter

```
> 2 votes

# Answer
# Python 2,  ~~198 153 83 78 77 75~~ 74 bytes

```
i=input()
j=0
while i:j+=1;i-=sum(x*(j%x<1)for x in range(1,j))==j
print j

```

Try it online!

Now it just reads like psuedocode.

* Saved ~~45~~ Countless Bytes because @Leaky Nun taught me about the sum function and list comprehension.
* Saved 2 bytes thanks to @shooqie's suggestion to remove the uncessary brackets.

We just iterate through every even number until we have found n perfect numbers.
> 2 votes

# Answer
# PHP, 111 Bytes

0-Indexing

Works with the concept that a perfect number is a number where `n=x*y` `x=2^i` and `y=2^(i+1)-1` and y must be prime

```
for(;!$r[$argn];$u?:$r[]=$z)for($z=2**++$n*($y=2**($n+1)-1),$u=0,$j=1;$j++<sqrt($y);)$y%$j?:$u++;echo$r[$argn];

```

Try it online!
> 2 votes

# Answer
# Python 3, 69 bytes

```
f=lambda n,k=1:n and-~f(n-(sum(j>>k%j*j for j in range(1,k))==k),k+1)

```

Try it online!
> 1 votes

# Answer
**Scala, 103 bytes**

```
n=>Stream.from(1).filter(_%2==0).filter(x=>Stream.from(1).take(x-1).filter(x%_==0).sum==x).drop(n).head

```
> 1 votes

# Answer
# Haskell, 61 Bytes

```
(!!)(filter(\x->x==sum[n|n<-[1..x-1],x`mod`n==0]||x==1)[1..])

```
> 1 votes

# Answer
# Haskell, 52 bytes

```
([n|n<-[1..],n==sum[d|d<-[1..div n 2],mod n d<1]]!!)

```

Try it online!

Starts at n = 0. Not particularly fast
> 1 votes

# Answer
# JavaScript (ES6), 68 bytes

```
n=>eval(`for(x=5;n;s||n--)for(f=s=++x;f--;)(x/f-(x/f|0))||(s-=f);x`)

```

```
F=n=>eval('for(x=5;n;s||n--)for(f=s=++x;f--;)(x/f-(x/f|0))||(s-=f);x')

console.log(
  F(1),
  F(2),
  F(3),
  //F(4),
  //F(5),
)
```
> 0 votes

# Answer
# Perl 6, 42 bytes

```
{(grep {$_==[+] grep $_%%*,^$_},^∞)[$_]}

```

The input index is 1-based.
> 0 votes

# Answer
## Clojure, 79 bytes

```
#(nth(for[i(range):when(=(apply +(for[j(range 1 i):when(=(mod i j)0)]j))i)]i)%)

```

Following the spec, heavy usage of for's `:when` condition.
> 0 votes

# Answer
# PowerShell, 152 bytes

```
$ErrorActionPreference='SilentlyContinue'
function p{param($x)(1..($x-1)|?{!($x%$_)})|%{$s+=$_};$s}
1..$args[0]|%{if(((p -x $_)-eq$_)-and(!($_%2))){$_}}

```

Try it online!
> 0 votes

---
Tags: code-golf, math, number
---


title: Divisor reduction

text:
# Question
Title: Divisor reduction
A divisor of a number *n* is any number that evenly divides *n*, including 1 and *n* itself. The number of divisors *d(n)* is how many divisors a number has. Here's *d(n)* for the first couple n:

```
n    divisors    d(n)
1    1           1
2    1, 2        2
3    1, 3        2
4    1, 2, 4     3
5    1, 5        2
6    1, 2, 3, 6  4

```

We can repeatedly subtract the number of divisors from a number. For example:

```
16                  = 16
16 - d(16) = 16 - 5 = 11
11 - d(11) = 11 - 2 = 9
 9 - d( 9) =  9 - 3 = 6
 6 - d( 6) =  6 - 4 = 2
 2 - d( 2) =  2 - 2 = 0

```

In this case it took 5 steps to get to 0.

---

Write a program or function that given a nonnegative number *n* returns the number of steps it takes to reduce it to 0 by repeated subtraction of the number of divisors.

Examples:

```
0, 0
1, 1
6, 2
16, 5
100, 19
100000, 7534

```

# Answer
> 1 votes
# Jelly, ~~10~~ 9 bytes

1 byte thanks to Dennis ♦.

Port of my answer in Pyth.

```
ÆDLạµÐĿL’

```

Try it online!

Test suite.

## Explanation

```
_ÆDL$$ÐĿL’
      ÐĿ    Repeat the following until result no longer unique:
 ÆD             Yield the array of the divisors
   L            Yield the length of the array
_               Subtract that from the number
        L   Number of iterations
         ’  Minus one.

```

# Answer
> 6 votes
# Python, 49 bytes

```
f=lambda n:n and-~f(sum(n%~x<0for x in range(n)))

```

orlp helped save a byte! And Sp3000 saved two more. Thanks!

# Answer
> 6 votes
# C, 52 bytes

```
g,o;l(f){for(g=o=f;o;f%o--||--g);return f?1+l(g):0;}

```

# Answer
> 4 votes
# Pyth, 10 bytes

```
tl.ulf%NTS

```

Test suite.

## Explanation

```
tl.ulf%NTS
tl.ulf%NTSNQ  implicit variables at the end
           Q  obtain the input number
  .u      N   repeat the following until result no longer unique:
         S        generate range from 1 to N
     f            filter for:
      %NT             T in that range, which N%T is truthy (not zero)
    l             length of that list
                  that means, we found the number of "non-divisors" of N
tl            number of iterations, minus 1.

```

# Answer
> 3 votes
## Julia, 31 bytes

```
f(n)=n<1?0:f(sum(n%(1:n).>0))+1

```

Straightforward recursive implementation.

# Answer
> 2 votes
## JavaScript (ES6), ~~64~~ 51 bytes

```
f=n=>n&&[...Array(m=n)].map((_,i)=>m-=n%++i<1)|f(m)+1

```

Don't ask me why I was unnecessarily using tail recursion.

# Answer
> 2 votes
# MATL, 14 bytes

```
`t~?x@q.]t:\zT

```

**Try it online!**

### Explanation

```
`            T  % Infinite loop
 t~?    ]       % Duplicate number. Is it non-zero?
    x@q.        % If so: delete number, push iteration index minus 1, break loop
         t:\    % Duplicate, range, modulo (remainder). Divisors give a 0 remainder
            z   % Number of non-zero elements; that is, of non-divisors

```

# Answer
> 2 votes
# Java, ~~147~~ 93

```
a->{int k,i,n=new Integer(a),l=0;for(;n!=0;n-=k)for(l+=k=i=1;i<n;)if(n%i++==0)++k;return l;}

```

# Answer
> 2 votes
## Hoon, ~~93~~ 76 bytes

```
|=
r/@
?~
r
0
+($(r (sub r (lent (skim (gulf 1^r) |=(@ =(0 (mod r +<))))))))

```

Ungolfed:

```
|=  r/@
?~  r
  0
=+  (skim (gulf 1^r) |=(@ =(0 (mod r +<))))
+($(r (sub r (lent -))))

```

Returns a function that takes an atom, `r`. Create an intermediate value that contains all the devisors of `r` (Make list \[1..n\], keep only the elements where (mod r i) == 0). If `r` is zero return zero, else return the incremented value of recursing with r equal r-(length divisors).

The code as-is takes a stupid amount of time to evaluate for n=100.000, entirely because finding the devisors for big numbers makes a giant list and maps over it. Memoizing the divisors gets the correct output for n=10.000, but I didn't bother waiting around for 100.000

# Answer
> 1 votes
## 05AB1E, ~~12~~ 10 bytes

**Code:**

```
[Ð>#Ñg-¼]¾

```

**Explanation:**

```
[           # start infinite loop
 Ð          # triplicate current number
  >#        # increase by 1 and break if true
    Ñg      # get number of divisors
      -     # subtract number of divisors from number
       ¼    # increase counter
        ]   # end loop
         ¾  # print counter

```

Try it online

Edit: 2 bytes saved and a bug with input 0 fixed thanks to @Adnan

# Answer
> 1 votes
## R, 50 bytes

Pretty simple implementation. Try it online

```
z=scan();i=0;while(z>0){z=z-sum(z%%1:z<1);i=i+1};i

```

# Answer
> 1 votes
## PowerShell v2+, ~~74~~ 67 bytes

```
param($n)for($o=0;$n-gt0){$a=0;1..$n|%{$a+=!($n%$_)};$n-=$a;$o++}$o

```

Seems pretty lengthy in comparison to some of the other answers...

Takes input `$n`, enters a `for` loop with the condition that `$n` is greater than `0`. Each loop iteration we set helper `$a`, then loop through every number from `1` up to `$n`. Each inner loop we check against every number to see if it's a divisor, and if so we increment our helper `$a` (using Boolean negation and implicit cast-to-int). Then, we subtract how many divisors we've found `$n-=$a` and increment our counter `$o++`. Finally, we output `$o`.

Takes a *long* time to execute, since it's a significant for-loop construct. For example, running `n = 10,000` on my machine (1yr old Core i5) takes almost 3 minutes.

# Answer
> 1 votes
# Mathcad, \[tbd\] bytes

---

Mathcad byte equivalence scheme is yet to be determined. Using a rough keystroke equivalence, the program uses about 39 "bytes". Note that the while and for programming operators only take one keyboard operation each to input (ctl-\] and ctl-shft-#, respectively) - indeed, they can only be entered this way from the keyboard.

What you see is exactly what gets put down on a Mathcad worksheet. Mathcad evaluates the equations/programs and puts the output on the same sheet (eg, after the '=' evaluation operator or on the plot).

# Answer
> 1 votes
## Haskell, ~~43~~ ~~40~~ 39 bytes

```
g 0=0;g n=1+g(sum$min 1.mod n<$>[1..n])

```

Simple recursive approach. Usage example: `g 16` -\> `5`.

Edit: @Lynn saved ~~3~~ 4 bytes. Thanks!

# Answer
> 1 votes
# MATL, 13 bytes

```
tX`t:\ztt]Nq&

```

Try it online

Explanation:

```
t               % Duplicate input
 X`      ]      % while loop, consumes 1 input
   t:\z         % calculates n-d(n), by counting number non-divisors
       tt       % dupe twice, for while loop condition, next iteration and to keep in stack
          Nq&   % get stack size, decrement, display that value

```

# Answer
> 1 votes
## Mathematica, 35 bytes

```
If[#<1,0,#0[#-0~DivisorSigma~#]+1]&

```

Making use of good old `DivisorSigma`. @MartinBüttner notes the following alternatives:

```
If[#<1,0,#0[#-DivisorSum[#,1&]]+1]&
f@0=0;f@n_:=f[n-DivisorSum[n,1&]]+1

```

# Answer
> 1 votes
# Racket - 126 bytes Down to 98 bytes  91 bytes

An extremely naive solution - could probably be cut down a lot with a decent algorithm and some lisp tricks that I don't know

```
(define(g x[c 0][d 0][i 2])(cond[(= x 0)c][(= i x)(g d(+ 1 c))][(=(modulo x i)0)(g x c d(+ 1 i))][else(g x c(+ 1 d)(+ 1 i))]))

```

Edit: explanation by request. As I said, this is an extremely naive recursive solution and can be much much shorter.

```
(define (g x [c 0] [d 0] [i 2]) ;g is the name of the function - arguments are x (input), c (counter for steps), d (non-divisor counter), i (iterator)
  (cond
    [(= x 0) c] ;once x gets to 0 c is outputted
    [(= i x) (g d (+ 1 c))] ;if iterator reaches x then we recurse with d as input and add 1 to c
    [(= (modulo x i) 0) (g x c d (+ 1 i))] ;checks if iterator is non divisor, then adds it to d and increments iterator
    [else(g x c (+ 1 d) (+ 1 i))])) ;otherwise just increments iterator

```

Edit 2: 98 byte version with a less dumb algorithm (still pretty dumb though and can be shorter)

```
(define(g x)(if(< x 1)0(+ 1(g(length(filter(λ(y)(>(modulo x y)0))(cdr(build-list x values))))))))

```

Explanation:

```
(define (g x) ;function name g, input x
  (if (< x 1)
      0 ;returns 0 if x < 1 (base case)
      (+ 1 ;simple recursion - adds 1 to output for each time we're looping
         (g (length ;the input we're passing is the length of...
              (filter (λ (y) (> (modulo x y) 0)) ;the list where all numbers which are 0 modulo x are 0 are filtered out from...
                             (cdr (build-list x values)))))))) ;the list of all integers up to x, not including 0

```

Edit 3: Saved 7 bytes by replacing `(cdr(build-list x values))` with `(build-list x add1)`

```
(define(g x)(if(< x 1)0(+ 1(g(length(filter(λ(y)(>(modulo x y)0))(build-list x add1)))))))

```

# Answer
> 1 votes
# APL, 22 bytes

```
{2>⍵:⍵⋄1+∇⍵-0+.=⍵|⍨⍳⍵}

```

# Answer
> 0 votes
# \>\<\>, 52+2 = 54 bytes

The input number needs to be present on the stack at program start, so there's +2 bytes for the `-v` flag. Try it online!

```
:0)?v~ln;>~$-]
03[}\::
@@:$<    v?=0:-1}+{~$?@@01%@:

```

4 annoying bytes wasted on alignment issues. Bah.

This one works by building the sequence from `n` to `0` on the stack. Once 0 has been reached, pop it and ouput the length of the remaining stack.

By the way , it runs in `O(n^2)` time, so I wouldn't try `n = 100000`...

# Answer
> 0 votes
## \>\<\>, 36 + 3 = 39 bytes

```
:?v~ln; >~&
:}\0&
+&>1-:?!^:{:}$%0)&

```

The implementation's relatively straightforward, with each iteration being `sum(n%k>0 for k in range(1,n-1))`. +3 bytes for the `-v` flag, per meta.

Try it online!

# Answer
> 0 votes
# Perl 5, 40 bytes

```
sub f{@_?(1,f((1)x grep@_%$_,1..@_)):()}

```

Input and output are as lists of the requisite number of copies of `1`.

# Answer
> 0 votes
# Ruby, 42 bytes

```
f=->n{n<1?0:1+f[n-(1..n).count{|i|n%i<1}]}

```

There's a stack overflow error on the largest test case `100000`, so here's an iterative version within **49 bytes**. Takes a while, though, considering the `O(N^2)` complexity.

```
->n{c=0;c+=1 while 0<n-=(1..n).count{|i|n%i<1};c}

```

# Answer
> 0 votes
# C#, 63 bytes

```
int F(int n)=>n<1?0:F(Enumerable.Range(1,n).Count(i=>n%i>0))+1;

```

# Answer
> 0 votes
## Actually, 17 bytes

```
";╗R`╜%`░l;"£╬klD

```

Try it online! (note: last test case times out on TIO)

Explanation:

```
";╗R`╜%`░l;"£╬klD
"          "£╬     while top of stack is truthy, call the function:
 ;╗                  push a copy of n to reg0
   R                 range(1,n+1) ([1,n])
    `  `░l             push the number of values where the following is truthy:
     ╜%                  k mod n
                       (this computes the number of non-divisors of n)
          ;            make a copy
              klD  push entire stack as list, count number of items, subtract 1
                   (the result is the number of times the function was called)

```

# Answer
> 0 votes
# Husk, 9 bytes

```
←LU¡Ṡ-oLḊ

```

Try it online!

# Answer
> 0 votes
# Japt, 8 bytes

```
©ÒßU-â l

```

Try it

Or 9 bytes without recursion:

```
©@µâ l}f1

```

Try it

# Answer
> 0 votes
# Vyxal `l`, 5 bytes

```
≬KL-İ

```

Try it Online!

Flagless:

# Vyxal, 6 bytes

```
≬KL-İL

```

Try it Online!

---
Tags: code-golf, math, integer
---