Title: Remove every N-th N

Body:
The task

In this challenge, your input is a non-empty list of positive integers, given in the native format of your language.
Your output is that same list, in the same format, with some elements removed.
You shall remove every occurrence of 1, every second occurrence of 2, every third occurrence 3, and so on.
In general, for every positive integer N, you shall remove every Nth occurrence of N from the list, starting with the Nth occurrence.

Example

Consider the input list

```<code>[3,2,6,1,1,6,2,3,2,6,6,6,6,1,6,6,3,3,7,2]
</code>```

First, we remove every occurrence of 1:

```<code>[3,2,6,    6,2,3,2,6,6,6,6,  6,6,3,3,7,2]
</code>```

Then every second occurrence of 2:

```<code>[3,2,6,    6,  3,2,6,6,6,6,  6,6,3,3,7  ]
</code>```

Then every third occurrence of 3:

```<code>[3,2,6,    6,  3,2,6,6,6,6,  6,6,  3,7  ]
</code>```

The numbers 4 and 5 don't occur in the input, so they can be skipped.
Next, we remove every sixth occurrence of 6:

```<code>[3,2,6,    6,  3,2,6,6,6,    6,6,  3,7  ]
</code>```

There's only one occurrence of 7, so that can be skipped as well.
Thus the correct output is

```<code>[3,2,6,6,3,2,6,6,6,6,6,3,7]
</code>```

Rules and scoring

You can write either a full program or a function.
The lowest byte count wins, and standard loopholes are disallowed.

Test cases

```<code>[1] -> []
[2] -> [2]
[1,1,1] -> []
[2,2,2] -> [2,2]
[1,1,2,2,2,3,3,3,3] -> [2,2,3,3,3]
[1,2,3,1,2,3,1,2,3,1,2,3] -> [2,3,3,2,3]
[3,2,6,1,1,6,2,3,2,6,6,6,6,1,6,6,3,3,7,2] -> [3,2,6,6,3,2,6,6,6,6,6,3,7]
[5,4,5,4,3,5,4,5,4,5,4,3,5,4,5,3,3,3,4,5,4,5,4,5,4,3,3,3,5,4] -> [5,4,5,4,3,5,4,5,4,3,5,4,5,3,3,4,5,5,4,4,3,3,5,4]
[6,4,5,8,2,9,3,1,8,5,3,5,5,6,3,5,1,2,3,9,3,5,8,7,5,9,1,3,4,8,2,3,4,7,8,5,8,5,3,1] -> [6,4,5,8,2,9,3,8,5,3,5,5,6,3,9,3,5,8,7,5,9,4,8,2,3,4,7,8,5,8,5,3]
[4,4,9,12,9,4,4,4,12,9,12,9,12,4,12,4,4,9,4,9,12,4,12,4,4,12,4,4,9,12,9,12,9,4,9,12,4,9,12,9,12,9,4,9,12,12,4,4,12,4] -> [4,4,9,12,9,4,4,12,9,12,9,12,4,12,4,9,4,9,12,4,12,4,12,4,4,9,12,9,12,4,9,12,9,9,12,9,4,9,12,12,4,4,12]
[2,2,11,11,11,11,6,2,2,6,6,2,2,2,2,6,11,6,11,11,2,11,2,6,6,11,2,11,6,2,6,6,6,6,6,11,2,11,11,6,6,6,11,6,2,6,2,6,6,2,11,2,2,11,11,11,11,2,6,2] -> [2,11,11,11,11,6,2,6,6,2,2,6,11,6,11,11,2,11,6,11,2,11,6,6,6,6,6,2,11,11,6,6,6,11,6,2,6,6,11,2,11,11,11,11,2,6]
[20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102] -> [20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,21,22,100,101,102,20,22,100,101,102,20,21,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,21,22,100,101,102,20,21,22,100,101,102,20,22,100,101,102,20,21,22,100,101,102,20,21,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,21,22,101,102,20,21,22,100,102,20,21,22,100,101,20,21,22,100,101,102,20,21,22,100,101,102,20,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,22,100,101,102,20,21,100,101,102]
</code>```

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If you want to include multiple numbers in your header, make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the leaderboard snippet:

```<code>[3,2,6,    6,2,3,2,6,6,6,6,  6,6,3,3,7,2]
</code>```0

var QUESTION_ID=70091,OVERRIDE_USER=32014;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
Racket 179 bytes

(λ(l)(define m(apply max l))(let g((n 1)(c 0))(set! l(for/list((i l))(if(= i n)(begin
(set! c(+ 1 c))(if(= 0(modulo c n))0 i))i)))(if(< n m)(g(+ 1 n)0)(filter(λ(x)(> x 0))l))))

Ungolfed:

(define f
  (λ(l)
    (define m (apply max l))
    (let loop ((n 1) (c 0))
      (set! l (for/list ((i l))
                (if (= i n)
                    (begin
                      (set! c (+ 1 c))
                      (if (= 0 (modulo c n))
                          0 i ))                  ; replace by 0
                    i )))
      (if (< n m)
          (loop (+ 1 n) 0)
          (filter (λ(x)(> x 0)) l)                ; remove all 0s
          ))))

Testing:

(f '[1])
(f '[2])
(f '[1 1 1])
(f '[2 2 2])
(f '[1 1 2 2 2 3 3 3 3])
(f '[1 2 3 1 2 3 1 2 3 1 2 3])
(f '[3 2 6 1 1 6 2 3 2 6 6 6 6 1 6 6 3 3 7 2])

Output:

'()
'(2)
'()
'(2 2)
'(2 2 3 3 3)
'(2 3 3 2 3)
'(3 2 6 6 3 2 6 6 6 6 6 3 7)


答:
Haskell, 135 bytes

```<code>(%)=mod
x!y=x-x%y
f a=[[j|j<-[1..9],and[a!!k/=j|k<-[i!3-i!9%27+p%3+p!3*3|p<-[0..8]]++[i!9..i!9+8]++[i%9,i%9+9..80]],a!!i<1]|i<-[0..80]]
</code>```

Defines a function f from lists of 81 Ints to lists of lists of Ints;

IO is like orlp's answer, except it uses [0,1,2,3,4,5,6,7,8,9] instead of ".123456789".

dianne saved a couple of bytes.

ContentLicense: CC BY-SA 3.0

Title: Retrieve all possible marks that can be placed in a Sudoku puzzle

Body:
Given a Sudoku puzzle, find all possible marks that can be filled into each empty cell.

Test case

Input:

```<code>[
    [
        // Top left:
        [
            0, 0, 0,
            3, 4, 0,
            0, 0, 2
        ],
        // Top middle:
        [
            7, 4, 0,
            0, 0, 0,
            0, 0, 3
        ],
        // Top right:
        [
            8, 0, 0,
            1, 7, 0,
            0, 0, 0
        ]
    ],
    [
        // Middle left:
        [
            9, 0, 4,
            7, 0, 0,
            1, 0, 3
        ],
        // Center:
        [
            0, 5, 0,
            0, 0, 0,
            0, 7, 0
        ],
        // Middle right:
        [
            0, 0, 0,
            6, 4, 0,
            0, 0, 0
        ]
    ],
    [
        // Bottom left:
        [
            0, 0, 7,
            6, 3, 0,
            0, 0, 0
        ],
        // Bottom middle:
        [
            0, 0, 5,
            0, 0, 0,
            9, 1, 0
        ],
        // Bottom right:
        [
            0, 0, 0,
            5, 2, 0,
            7, 0, 0
        ]
    ]
]
</code>```

Output:

```<code>[
    [
        // Top left:
        [
            [5], [1, 5, 6, 9], [1, 5, 6, 9],
            [], [], [5, 6, 8, 9],
            [5, 8], [1, 5, 6, 7, 8, 9], []
        ],
        // Top middle:
        [
            [], [], [1, 2, 6, 9],
            [2, 5, 6, 8], [2, 6, 8, 9], [2, 6, 8, 9],
            [1, 5, 6, 8], [6, 8, 9], []
        ],
        // Top right:
        [
            [], [3, 5, 6, 9], [2, 3, 5, 6, 9],
            [], [], [2, 5, 6, 9],
            [4, 9], [5, 6, 9], [4, 5, 6, 9]
        ]
    ],
    [
        // Middle left:
        [
            [], [2, 6, 8], [],
            [], [2, 5, 8], [5, 8],
            [], [2, 5, 6, 8], []
        ],
        // Center:
        [
            [1, 2, 3, 6, 8], [], [1, 2, 6, 8],
            [1, 2, 3, 8], [2, 3, 8, 9], [1, 2, 8, 9],
            [2, 4, 6, 8], [], [2, 4, 6, 8, 9]
        ],
        // Middle right:
        [
            [2, 3], [1, 3, 8], [1, 2, 3, 7, 8],
            [], [], [1, 2, 3, 5, 8, 9],
            [2, 9], [5, 8, 9], [2, 5, 8, 9]
        ]
    ],
    [
        // Bottom left:
        [
            [2, 4, 8], [1, 2, 8, 9], [],
            [], [], [1, 8, 9],
            [2, 4, 5, 8], [2, 5, 8], [5, 8]
        ],
        // Bottom middle:
        [
            [2, 3, 4, 6, 8], [2, 3, 6, 8], [],
            [4, 8], [8], [4, 7, 8],
            [], [], [2, 4, 6, 8]
        ],
        // Bottom right:
        [
            [3, 4, 9], [1, 3, 6, 8, 9], [1, 3, 4, 6, 8, 9],
            [], [], [1, 4, 8, 9],
            [], [3, 6, 8], [3, 4, 6, 8]
        ]
    ]
]
</code>```

Output visualisation; the small numbers:

Rules

This is a code-golf. The shortest answer in bytes (or equivalent) wins.

Input can be in array or string format.

Input must be in the order presented above (top-left, top-middle, top-right, etc...)

Output can be in array or string format, as long as the output can logically represent the expected result.

Output must be in the same order as the input (top-left, top-middle, top-right, etc...)

Output does not need to be prettified.

Code must be applicable to any valid incomplete Sudoku grid.

Standard golfing rules apply.

Additional Notes:

You get additional fake internet points if your program or function uses the result to solve the Sudoku puzzle to the point where cell values can no longer be logically solved. For example, the very first cell in the test case can only ever possibly contain the number 5, so it should be considered when filling in the other values. This is just for fun and additional challenge, otherwise the shortest answer wins regardless of whether or not this criterion is met.

Body:
Haskell, 135 bytes

(%)=mod
x!y=x-x%y
f a=[[j|j<-[1..9],and[a!!k/=j|k<-[i!3-i!9%27+p%3+p!3*3|p<-[0..8]]++[i!9..i!9+8]++[i%9,i%9+9..80]],a!!i<1]|i<-[0..80]]

Defines a function f from lists of 81 Ints to lists of lists of Ints;

IO is like orlp's answer, except it uses [0,1,2,3,4,5,6,7,8,9] instead of ".123456789".

dianne saved a couple of bytes.


问:
Golf Your Language's Identicon
Identicons are small images of geometric patterns that represent the hash value of a string. Stack Exchange uses the identicons from Gravatar as each user's default avatar image.

In this challenge, we will use the Gravatar identicons as well to generate some text to golf.

Challenge

This stack snippet (a minified version of this JSFiddle) lets you type in a string and gives back a 100×100 pixel black and white version of that string's identicon, along with a text version where 1 is for black and 0 is for white:

 <input id='str' type='text' size='32' value='Python'> <button type='button' onclick='go()'>Go</button>

<input id='type1' name='type' type='radio' value='identicon' checked> Identicon <input id='type2' name='type' type='radio' value='monsterid'> Monster <input id='type3' name='type' type='radio' value='wavatar'> Wavatar <input id='type4' name='type' type='radio' value='retro'> Retro

original
<canvas id='original' style='border:1px solid gray;'> Your browser does not support the canvas tag. </canvas>

binary
<canvas id='binary' style='border:1px solid gray;'> </canvas>

text
 <textarea id='text' style='background-color:#eee' readonly></textarea>

your text
 <textarea id='userText'></textarea>
<button type='button' onclick='markDiffs()'>Mark Differences With X</button>

(this snippet has only been tested in Chrome and Firefox)
```
</div>
</div>
</p>
<p>(It also lets you load the Monster, Wavatar, and Retro Gravatar styles, but those are just for fun and aren't meant to be used for this challenge. Unicornicons are unfortunately missing due to XSS constraints. :/ )</p>
<p>Your task is to write a program that outputs the 100×100 character text block of <code>0</code>'s and <code>1</code>'s that is generated when you put your programming language's name into the snippet input box.</p>
<p>For example, if your submission is written in Python, you would type <code>Python</code> into the stack snippet and see that</p>
<p><img src="https://i.stack.imgur.com/HNQMh.png" alt="Python identicon" /></p>
<p>is the identicon for Python, and</p>
<p><img src="https://i.stack.imgur.com/saFGU.png" alt="binary Python identicon" /></p>
<p>is the black and white (binary) version, and</p>
```0000000000000000000000011111111111111111111111111100000000000000000000000010000000000000000000000000
[encoded data, 9900 characters]
```

is the corresponding textual output that your Python program must produce.

However, since identicons can have a lot of awkward angles and their rasterization as a black and white image can leave jaggies, your output is allowed to have up to 300 0's or 1's that are the opposites of what they are supposed to be. (That's 3% of the 10000 total 0's and 1's.)

Near the bottom of the snippet, you can paste in the output of your program and check how many 0's or 1's are different than what they should be. Any number of differences at or below 300 is valid.

Scoring

The submission with the fewest bytes wins. (Handy byte counter.)

Tiebreaker goes to the submission with the fewest incorrect 0's and 1's.

If there's still a tie, the earlier submission wins.

Details

Output goes to stdout or a similar alternative if your language does not have stdout.

The output may optionally have a trailing newline.

Please include the color identicon image in your post along with the exact string that generates it. There's no need to waste space and post your entire textual output.

Your program should run without an internet connection. You need to generate the text in your code, not query it from the Gravatar site.

Use common sense when "naming" your language. Use the language name you would normally use on this site. Don't be annoying and contrive a name that makes the identicon easy to golf. e.g. Python 2 is fine for Python but python 2.7.2 is stretching it and python 2.7.2 by Guido van Rossum would be ridiculous.

I realize some languages are inherently easier than others because their identicon shapes are simpler. That's just the way it's gonna be, don't get too disgruntled or competitive about that. ;)

答:
///, 1319 bytes, 0 errors

```<code>/=/gD//_/QPG//-/NAN//)/N0M//(/M0F//*/LCL//&/GTQ//%/GRG//$/GIG//#/DPK//@/BcQ//!/BH//z/BAQ//y/CI//x/AP//w/ALOK//v/ALIL//u/NRM//t/CR//s/SRS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DHMHGJQkX
1HSHLyQkW
lH1nGtlH
WUGtW
XUNjX
YUNjY
ZUMmZ
VUMmV
aUFCa
pUFCp
rUSxr
qUSxq
iUdfi
sUdfs
d0dUFKAId0d
</code>```

Try it online!

This took me around 2 hours to make, because I was manually replacing stuff. The biggest thing I made in ///.

Probably I can golf a few more bytes.

Also, see Erik the Golfer's answer in /// (4 bytes shorter than mine).

Title: Golf Your Language's Identicon

Body:
///, 1319 bytes, 0 errors

/=/gD//_/QPG//-/NAN//)/N0M//(/M0F//*/LCL//&/GTQ//%/GRG//$/GIG//#/DPK//@/BcQ//!/BH//z/BAQ//y/CI//x/AP//w/ALOK//v/ALIL//u/NRM//t/CR//s/SRS//r/NPN//q/MIM//p/GcG//o/DAAD//n/CP//m/C0//l/1AFK//k/CT//j/CE//i/FAF//h/CH//g/CO//f/AO//e/FMHFM//d/FD//c/AH//b/FF//a/QH1HQ//Z/LHBHL//Y/KHGHK//X/DHMHD//W/1HSH1//V/BHKHB//U/JA//T/EE//S/F1//R/E0//Q/B1//P/IE//O/I0//N/G1//M/GD//L/DD//K/D1//J/CA//I/AE//H/A0//G/BD//F/BB//E/00//D/11//C/AAA//B/11111//A/00000/bBAIFKUbB
sfdUs
ifdUi
qxSUq
rxSUr
pCFUp
aCFUa
VmMUV
ZmMUZ
YjNUY
XjNUX
WtGUW
lnGUlH
WkQgKHSH1
XkQhQHMHD
YJBkMHGHK
ZJBjdH!L
VhLCFV
ahLfFNH1HQ
pyKcFScG
ryKPbLPN
q=IbGIM
i=Abi
sn1RbFKRS
d0dn10bFQ0d
AIFL=g1U
fd0DkK0DkKU
fd0*E*JH
xSE@R@JH
xSE$T$JI
CFRuAuJI
CFReJO
mMT)I)JO
mMT%O%JP
jNAzPzJP
jNvAvCC
tGH#c#CC
tGt1n1Cm
kQHocoJOD
kQwAwJHL
JBA!BP!BgQ
JBT&O&hN
hLTNENINENtF
hLRemd
yKR(A(fFL
yKE-T-cFQ
=E_R_OFN
=0BfBEBf!b
n10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ITUhHSlFrWAoxSFNITHlRa1cKbEgxbkd0bEgKV1VHdFcKWFVOalgKWVVOalkKWlVNbVoKVlVNbVYKYVVGQ2EKcFVGQ3AKclVTeHIKcVVTeHEKaVVkZmkKc1VkZnMKZDBkVUZLQUlkMGQ&input=" rel="nofollow noreferrer">Try it online!

This took me around 2 hours to make, because I was manually replacing stuff. The biggest thing I made in ///.

Probably I can golf a few more bytes.

Also, see Erik the Golfer's answer in /// (4 bytes shorter than mine).


问:
Add two numbers
Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list.

Output: Their sum. Use the same format for output integers as input integers. For example, the input 5 16 would lead to the output 21.

Restrictions: No standard loopholes please. This is code-golf, answer in lowest amount of bytes wins.

Notes: This should be fairly trivial, however I'm interested to see how it can be implemented. The answer can be a complete program or a function, but please identify which one it is.

Test cases:

```<code>1 2 -> 3
14 15 -> 29
7 9 -> 16
-1 8 -> 7
8 -9 -> -1
-8 -9 -> -17
</code>```

Or as CSV:

```<code>a,b,c
1,2,3
14,15,29
7,9,16
-1,8,7
8,-9,-1
-8,-9,-17
</code>```

Leaderboard

var QUESTION_ID=84260,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Codelike, 6 bytes

code:

```<code>ouuabe
</code>```

breakdown:

```<code>o      changes the direction that the code proceeds in, turning counterclockwise until it hits a command
 uu    takes 2 integers from user input
   a   adds the two integers together and pushes the result to the stack
    b  prints the integer value at the top of the stack
     e ends the program
</code>```

You can download the compiler here!

(Full disclosure, I did create this language and I did add the b command after reading this challenge but it was something I was already considering adding and it doesn't complete the challenge on its own so I feel that it doesn't violate the rules.)

Title: Add two numbers

Body:
Codelike, 6 bytes

code:

ouuabe

breakdown:

o      changes the direction that the code proceeds in, turning counterclockwise until it hits a command
 uu    takes 2 integers from user input
   a   adds the two integers together and pushes the result to the stack
    b  prints the integer value at the top of the stack
     e ends the program

You can download the compiler here!

(Full disclosure, I did create this language and I did add the b command after reading this challenge but it was something I was already considering adding and it doesn't complete the challenge on its own so I feel that it doesn't violate the rules.)


问:
i love yOu i lOve you i love yOu!
XKCD #99, with the title "Binary Heart" shows a simple image of ones and zeros, with some digits colored red.

The red heart is visible to the naked eye, but the message hidden in the binary sequence is not. If you remove all the spaces and newlines and interpret the binary sequence as 8 bit ASCII-code, you'll end up with the message:

```<code>iloveyOuilOveyouiloveyOuilOveyOuiloveyouilOveyouilOveyOuilOv
</code>```

Cute right?

Pssst... The string isn't a pure string repetition.

Your challenge is to create this binary image with 21 digits across, and 23 digits down. There should be exactly one space between each digit in each row, and one newline for each new row. Note that the last bits are only the beginning of the letter e, since 21*23 isn't divisible by 8. You need those bits correct too.

The function or program should not take any input. Leading and trailing spaces and newlines are accepted.

The result of your code should look like this:

```<code>0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1
1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0
1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0
1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0
1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1
0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1
0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1
0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0
1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1
0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0
1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1
0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0
1 1 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1
0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1
1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0
0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0
1 0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1
1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0
0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0
1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1
0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1
</code>```

This is code golf, so the shortest answer (in bytes) wins.

Leaderboard

var QUESTION_ID=94699,OVERRIDE_USER=31516;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
C++11, Non-competing, <s>726</s> <s>687</s> 636 bytes (*NIX or W10 threshold 2 required)

```<code>#include <iostream>
#include <string>
#ifdef  _WIN32
#include <Windows.h>
#endif
using namespace std;int main() {
#ifdef  _WIN32
HANDLE h=GetStdHandle(-11);DWORD m;GetConsoleMode(h,&m);SetConsoleMode(h,m|0x04);
#endif
cout<<"\033[47m\033[30m";string d("4fup8y8hihjyl9g1ifh9wpc4f52l5a8giosim2isj80xff814db9wmf958x4zlbl58x4zlbl6zxgjt9whbcz4mu91r0j5c4kfq48uxw53w1zvpdshv6ylrnl3t38qyiteyw0lphs3kx59vf4ezay145thrt7lkb80w83nz10ih27f77p0820wzr9");for(int s=0;s!=184;s+=8){unsigned long long n=stoull(d.substr(s,8),NULL,36),i=3;for(int p=40;p!=-2;p-=2){int r=(n&(i<<p))>>p;printf(r>1?"\033[31m %d\033[30m":" %d",r>1?r-2:r);}puts("");}return 0;}
</code>```

I know this can be golfed way better. I want to see a short c++ answer damnit!

I also probably made a few mistakes when I was encoding the heart section.

Output (colors fixed):

ContentLicense: CC BY-SA 4.0

Title: i love yOu i lOve you i love yOu!

Body:
C++11, Non-competing, <s>726</s> <s>687</s> 636 bytes (*NIX or W10 threshold 2 required)

#include <iostream>
#include <string>
#ifdef  _WIN32
#include <Windows.h>
#endif
using namespace std;int main() {
#ifdef  _WIN32
HANDLE h=GetStdHandle(-11);DWORD m;GetConsoleMode(h,&m);SetConsoleMode(h,m|0x04);
#endif
cout<<"\033[47m\033[30m";string d("4fup8y8hihjyl9g1ifh9wpc4f52l5a8giosim2isj80xff814db9wmf958x4zlbl58x4zlbl6zxgjt9whbcz4mu91r0j5c4kfq48uxw53w1zvpdshv6ylrnl3t38qyiteyw0lphs3kx59vf4ezay145thrt7lkb80w83nz10ih27f77p0820wzr9");for(int s=0;s!=184;s+=8){unsigned long long n=stoull(d.substr(s,8),NULL,36),i=3;for(int p=40;p!=-2;p-=2){int r=(n&(i<<p))>>p;printf(r>1?"\033[31m %d\033[30m":" %d",r>1?r-2:r);}puts("");}return 0;}

I know this can be golfed way better. I want to see a short c++ answer damnit!

I also probably made a few mistakes when I was encoding the heart section.

Output (colors fixed):


问:
Tips for golfing in Pyth
Pyth is a Python-inspired procedural programming language, created by PPCG user isaacg.

What general tips do you have for golfing in Pyth? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Pyth.

One tip per answer, please.

答:
Use Packed Pyth

Packed Pyth is a new "programming language" which is exactly the same as Pyth, except that it uses 7 bits per character instead of 8 bits per character.

To use it, clone the pyth repository. The file packed-pyth.py is the interpreter.

Say your code is "Hello, world!.

First, put it in a file: echo -n '"Hello, world!' > code.pyth

Next, pack the Pyth code into Packed Pyth file: python3 packed-pyth.py -p code.pyth code.ppyth

Finally, run the Packed Pyth code: python3 packed-pyth.py code.ppyth

When running code, you can provide the -d flag to see what the Pyth code that's actually being run is, and you can provide input as a second command line argument after the file containing the code.

Upside:

Code is shorter by 1/8th.

Downside:

ASCII only.

No interactive input.

Full debug options are not availible.

Worse error reporting.

Title: Tips for golfing in Pyth


问:
Now I know my ABCs, won't you come and golf with me?
Write a program or function that outputs this exact text, case-insensitive:

```<code>A, B, C, D, E, F, G,
H, I, J, K, L, M, N, O, P,
Q, R, S,
T, U, V,
W, X, Y, Z.
</code>```

(Based on the alphabet song that many American kids learn to help memorize the alphabet, though edited for more compressibility.)

The output must look exactly the same as the above (again, case-insensitive), but may contain trailing spaces on each line and/or trailing newlines. Notice the period at the end.

This is code-golf, so the shortest code in bytes wins.

答:
JavaScript (ES6), <s>66</s> <s>64</s> 60 bytes

```<code>_=>`ABCDEFG
HIJKLMNOP
QRS
TUV
WXY`.replace(/./g,"$&, ")+"Z."
</code>```

Regex matches the characters but not the carriage returns, so, using regex replace, I can add the ", " to each character.

Edit: Removed 2 characters thanks to ETHProductions

Edit: Changed from CRLF to LF, thanks @Olivier Grégoire

Body:
JavaScript (ES6), <s>66</s> <s>64</s> 60 bytes

_=>`ABCDEFG
HIJKLMNOP
QRS
TUV
WXY`.replace(/./g,"$&, ")+"Z."

Regex matches the characters but not the carriage returns, so, using regex replace, I can add the ", " to each character.

Edit: Removed 2 characters thanks to ETHProductions

Edit: Changed from CRLF to LF, thanks @Olivier Grégoire


问:
2048-like array shift
Assume we want to shift an array like it is done in the 2048 game: if we have two equal consecutive elements in array, merge them into twice the value element.
Shift must return a new array, where every pair of consecutive equal elements is replaced with their sum, and pairs should not intersect.
Shifting is performed only once, so we don't need to merge resulting values again.
Notice that if we have 3 consecutive equal elements, we have to sum rightmost ones, so for example, [2, 2, 2] should become [2, 4], not [4, 2].

The task is to write shortest function which takes an array and returns a shifted array.

You may assume that all integers will be strictly positive.

Examples:

```<code>[] -> []
[2, 2, 4, 4] -> [4, 8]
[2, 2, 2, 4, 4, 8] -> [2, 4, 8, 8]
[2, 2, 2, 2] -> [4, 4]
[4, 4, 2, 8, 8, 2] -> [8, 2, 16, 2]
[1024, 1024, 512, 512, 256, 256] -> [2048, 1024, 512]
[3, 3, 3, 1, 1, 7, 5, 5, 5, 5] -> [3, 6, 2, 7, 10, 10]
</code>```

I am also very interested in solution using reduce :)

答:
Mathematica, 53 bytes

```<code>Join@@(Reverse[Plus@@@#~Partition~UpTo@2]&/@Split@#)&
</code>```

Explanation

```<code>Split@#
</code>```

Split the input into sublists consisting of runs of identical elements. i.e. {2, 2, 2, 4, 8, 8} becomes {{2, 2, 2}, {4}, {8, 8}}.

```<code>#~Partition~UpTo@2
</code>```

Partition each of the sublist into partitions length at most 2. i.e. {{2, 2, 2}, {4}, {8, 8}} becomes {{{2, 2}, {2}}, {{4}}, {{8, 8}}}.

```<code>Plus@@@
</code>```

Total each partition. i.e. {{{2, 2}, {2}}, {{4}}, {{8, 8}}} becomes {{4, 2}, {4}, {16}}.

```<code>Reverse
</code>```

Reverse the results because Mathematica's Partition command goes from left to right, but we want the partitions to be in other direction. i.e. {{4, 2}, {4}, {16}} becomes {{2, 4}, {4}, {16}}.

```<code>Join@@
</code>```

Flatten the result. i.e. {{2, 4}, {4}, {16}} becomes {2, 4, 4, 16}.

Title: 2048-like array shift

Body:
Mathematica, 53 bytes

Join@@(Reverse[Plus@@@#~Partition~UpTo@2]&/@Split@#)&

Explanation

Split@#

Split the input into sublists consisting of runs of identical elements. i.e. {2, 2, 2, 4, 8, 8} becomes {{2, 2, 2}, {4}, {8, 8}}.

#~Partition~UpTo@2

Partition each of the sublist into partitions length at most 2. i.e. {{2, 2, 2}, {4}, {8, 8}} becomes {{{2, 2}, {2}}, {{4}}, {{8, 8}}}.

Plus@@@

Total each partition. i.e. {{{2, 2}, {2}}, {{4}}, {{8, 8}}} becomes {{4, 2}, {4}, {16}}.

Reverse

Reverse the results because Mathematica's Partition command goes from left to right, but we want the partitions to be in other direction. i.e. {{4, 2}, {4}, {16}} becomes {{2, 4}, {4}, {16}}.

Join@@

Flatten the result. i.e. {{2, 4}, {4}, {16}} becomes {2, 4, 4, 16}.


问:
Generate binary matrices which are distinct up to reflections
Here are all the 2x2 binary matrices

```<code>#0  #1  #2  #3  #4  #5  #6  #7  #8  #9  #10 #11 #12 #13 #14 #15
--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
00  00  00  00  01  01  01  01  10  10  10  10  11  11  11  11
00  01  10  11  00  01  10  11  00  01  10  11  00  01  10  11
</code>```

Two binary square matrices are equivalent under the relation ~ if one can be mapped onto the other by any number of reflections in the horizontal or vertical axes.

#1 ~ #2 under reflection in the vertical axis so we only need to keep one of these (it doesn't matter which). Likewise #3 ~ #12, #6 ~ #9 and so on.

THE GOAL is to produce a program which takes a single input N and prints as many N x N binary matrices as exist such that all matrices in the output are distinct under the above relation.

In hand-wavey pseudocode, an admissible solution would be

```<code>define M[i] = N by N matrix with bit pattern equal to i

for i = 0 to (2^(N^2)) - 1
    valid = true
    for j = i+1 to (2^(N^2)) - 1
        if (equivalent(M[i], M[j]))
            valid = false
            break
    if (valid)
        print (M[i])
</code>```

For the input N=2 one valid output would be

```<code>00  00  00  01  10  01  11
00  01  11  01  01  11  11
</code>```

But by selecting different matrices from the same equivalence class another valid output would be

```<code>00  10  11  11  11  10  01
00  00  00  10  11  10  10
</code>```

The order of matrices doesn't matter, the particular choice from equivalent matrices doesn't matter, and whitespace doesn't matter, output the matrices however you like as long as it's human-readable.

The output must be exhaustive.

Shortest code wins.

EDIT: this is my first golf post and I've changed my mind on the winning criteria.

Shortest code in a language not specifically designed for conciseness/golfing wins.

I hope it's not bad etiquette to change this criterion post-hoc, but I think doing it in a "normal" language is a much more interesting proposition.

答:
Mathematica, 94 bytes

```<code>DeleteDuplicatesBy[{0,1}~Tuples~{#,#},Sort@Join[Join@@Outer[Reverse,{#},{1,2,{1,2}},1],{#}]&]&
</code>```

Body:
Mathematica, 94 bytes

DeleteDuplicatesBy[{0,1}~Tuples~{#,#},Sort@Join[Join@@Outer[Reverse,{#},{1,2,{1,2}},1],{#}]&]&


答:
Java 8, <s>130</s> 114 bytes

Edit:

-16 bytes off. Thanks to @Kevin Cruijssen.

Snipet:

```<code>s->{int j=0,i=s.length,l[]=new int[i];for(;--i>-1;[j++]=s[i]==s[i-1]?s[i--]*2:s[i]);return Collection.reverse(l);}
</code>```

Code:

```<code>public static int[] shift(int[]a){
  List<int> out = new ArrayList<>();
  for(int i = s.length-1; i>-1;i--){
    if(s[i]==s[i-1]){
      out.add(s[i]*2);
      i--;
    }else{
      out.add(s[i]);
    }
  }
  return Arrays.reverse(out.toArray());
}
</code>```

Title: 2048-like array shift

Body:
Assume we want to shift an array like it is done in the 2048 game: if we have two equal consecutive elements in array, merge them into twice the value element.
Shift must return a new array, where every pair of consecutive equal elements is replaced with their sum, and pairs should not intersect.
Shifting is performed only once, so we don't need to merge resulting values again.
Notice that if we have 3 consecutive equal elements, we have to sum rightmost ones, so for example, [2, 2, 2] should become [2, 4], not [4, 2].

The task is to write shortest function which takes an array and returns a shifted array.

You may assume that all integers will be strictly positive.

Examples:

```<code>[] -> []
[2, 2, 4, 4] -> [4, 8]
[2, 2, 2, 4, 4, 8] -> [2, 4, 8, 8]
[2, 2, 2, 2] -> [4, 4]
[4, 4, 2, 8, 8, 2] -> [8, 2, 16, 2]
[1024, 1024, 512, 512, 256, 256] -> [2048, 1024, 512]
[3, 3, 3, 1, 1, 7, 5, 5, 5, 5] -> [3, 6, 2, 7, 10, 10]
</code>```

I am also very interested in solution using reduce :)

Body:
Java 8, <s>130</s> 114 bytes

Edit:

-16 bytes off. Thanks to @Kevin Cruijssen.

Snipet:

s->{int j=0,i=s.length,l[]=new int[i];for(;--i>-1;[j++]=s[i]==s[i-1]?s[i--]*2:s[i]);return Collection.reverse(l);}

Code:

public static int[] shift(int[]a){
  List<int> out = new ArrayList<>();
  for(int i = s.length-1; i>-1;i--){
    if(s[i]==s[i-1]){
      out.add(s[i]*2);
      i--;
    }else{
      out.add(s[i]);
    }
  }
  return Arrays.reverse(out.toArray());
}


答:
Mathematica, 123 bytes (275 with color)

I'm not sure if using Grid instead of outputting a string is OK (if not then this is a non-competing entry).

B/W

```<code>Grid@Partition[ReplacePart[PadLeft[{},483,IntegerDigits[36^^nz4sp78k5qyb,2,64]],
Thread[51+32{0,1,4,5,6,9,11,12,13}->0]],21]
</code>```

Color

```<code>Grid[Partition[ReplacePart[PadLeft[{},483,IntegerDigits[36^^nz4sp78k5qyb,2,64]],
Thread[51+32{0,1,4,5,6,9,11,12,13}->0]],21],ItemStyle->{{},{},Thread[Join@@MapIndexed[
Thread@{Range@@#,2+First@#2}&,Thread[Partition[IntegerDigits[36^^k32b741shmsoiwed4vnakt],
17]+{0,10}]]->Red]}]
</code>```

Title: i love yOu i lOve you i love yOu!

Body:
XKCD #99, with the title "Binary Heart" shows a simple image of ones and zeros, with some digits colored red.

The red heart is visible to the naked eye, but the message hidden in the binary sequence is not. If you remove all the spaces and newlines and interpret the binary sequence as 8 bit ASCII-code, you'll end up with the message:

```<code>iloveyOuilOveyouiloveyOuilOveyOuiloveyouilOveyouilOveyOuilOv
</code>```

Cute right?

Pssst... The string isn't a pure string repetition.

Your challenge is to create this binary image with 21 digits across, and 23 digits down. There should be exactly one space between each digit in each row, and one newline for each new row. Note that the last bits are only the beginning of the letter e, since 21*23 isn't divisible by 8. You need those bits correct too.

The function or program should not take any input. Leading and trailing spaces and newlines are accepted.

The result of your code should look like this:

```<code>0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1
1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0
1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0
1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0
1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1
0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1
0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1
0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0
1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1
0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0
1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1
0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0
1 1 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1
0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1
1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0
0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0
1 0 1 0 1 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1
1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0
0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0
1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1
0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1
</code>```

This is code golf, so the shortest answer (in bytes) wins.

Leaderboard

var QUESTION_ID=94699,OVERRIDE_USER=31516;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
Mathematica, 123 bytes (275 with color)

I'm not sure if using Grid instead of outputting a string is OK (if not then this is a non-competing entry).

B/W

Grid@Partition[ReplacePart[PadLeft[{},483,IntegerDigits[36^^nz4sp78k5qyb,2,64]],
Thread[51+32{0,1,4,5,6,9,11,12,13}->0]],21]

Color

Grid[Partition[ReplacePart[PadLeft[{},483,IntegerDigits[36^^nz4sp78k5qyb,2,64]],
Thread[51+32{0,1,4,5,6,9,11,12,13}->0]],21],ItemStyle->{{},{},Thread[Join@@MapIndexed[
Thread@{Range@@#,2+First@#2}&,Thread[Partition[IntegerDigits[36^^k32b741shmsoiwed4vnakt],
17]+{0,10}]]->Red]}]


问:
Natural Pi #0 - Rock

Goal

Create a program/function that takes an input N, check if N random pairs of integers are relatively prime, and returns sqrt(6 * N / #coprime).

TL;DR

These challenges are simulations of algorithms that only require nature and your brain (and maybe some re-usable resources) to approximate Pi. If you really need Pi during the zombie apocalypse, these methods don't waste ammo! There are eight more challenges to come. Checkout the sandbox post to make recommendations.

Simulation

What are we simulating? Well, the probability that two random integers are relatively prime (ie coprime or gcd==1) is 6/Pi/Pi, so a natural way to calculate Pi would be to scoop up two buckets (or handfuls) of rocks; count them; see if their gcd is 1; repeat. After doing this a <s>couple</s> lot of times, sqrt(6.0 * total / num_coprimes) will tend towards Pi. If calculating the square-root in post-apocalyptic world makes you nervous, don't worry! There is Newton's Method for that.

How are we simulating this?

Take input N

Do the following N times:

Uniformly generate random positive integers, i and j

With 1 <= i , j <= 10^6

If gcd(i , j) == 1: result = 1

Else: result = 0

Take the sum of the N results, S

Return sqrt(6 * N / S)

Specification

Input

Flexible, take input in any of the standard ways (eg function parameter,STDIN) and in any standard format (eg String, Binary)

Output

Flexible, give output in any of the standard ways (eg return, print)

White space, trailing and leading white space is acceptable

Accuracy, please provide at least 4 decimal places of accuracy (ie 3.1416)

Scoring

Shortest code wins!

Test Cases

Your output may not line up with these, because of random chance. But on average, you should get about this much accuracy for the given value of N.

```<code>Input     ->  Output
-----         ------
100       ->  3.????
10000     ->  3.1???
1000000   ->  3.14??
</code>```

答:
Frink, <s> 84</s>  89

```<code>r[]:=random[10^6]+1
g=n=eval[input[1]]
for a=1to n
g=g-1%gcd[r[],r[]]
println[(6*n/g)^.5]
</code>```

I got lucky: g=n=... saves a byte over g=0 n=...; and 1%gcd() gives (0,1) vs (1,0) so I can subtract.
And unlucky: n is preassigned and a used because loop variables and their bounds are local and undefined outside the loop.

Verbose

```<code>r[] := random[10^6] + 1     // function. Frink parses Unicode superscript!
g = n = eval[input[""]]     // input number, [1] works too
for a = 1 to n              // repeat n times
   g = g - 1%gcd[r[], r[]]  // subtract 1 if gcd(i, j) > 1
println[(6*n/g)^.5]         // ^.5 is shorter than sqrt[x], but no super ".", no ½
</code>```

Title: Natural Pi #0 - Rock

Body:
Frink, <s> 84</s>  89

r[]:=random[10^6]+1
g=n=eval[input[1]]
for a=1to n
g=g-1%gcd[r[],r[]]
println[(6*n/g)^.5]

I got lucky: g=n=... saves a byte over g=0 n=...; and 1%gcd() gives (0,1) vs (1,0) so I can subtract.
And unlucky: n is preassigned and a used because loop variables and their bounds are local and undefined outside the loop.

Verbose

r[] := random[10^6] + 1     // function. Frink parses Unicode superscript!
g = n = eval[input[""]]     // input number, [1] works too
for a = 1 to n              // repeat n times
   g = g - 1%gcd[r[], r[]]  // subtract 1 if gcd(i, j) > 1
println[(6*n/g)^.5]         // ^.5 is shorter than sqrt[x], but no super ".", no ½


Title: Golf Your Language's Identicon

Body:
Identicons are small images of geometric patterns that represent the hash value of a string. Stack Exchange uses the identicons from Gravatar as each user's default avatar image.

In this challenge, we will use the Gravatar identicons as well to generate some text to golf.

Challenge

This stack snippet (a minified version of this JSFiddle) lets you type in a string and gives back a 100×100 pixel black and white version of that string's identicon, along with a text version where 1 is for black and 0 is for white:

 <input id='str' type='text' size='32' value='Python'> <button type='button' onclick='go()'>Go</button>

<input id='type1' name='type' type='radio' value='identicon' checked> Identicon <input id='type2' name='type' type='radio' value='monsterid'> Monster <input id='type3' name='type' type='radio' value='wavatar'> Wavatar <input id='type4' name='type' type='radio' value='retro'> Retro

original
<canvas id='original' style='border:1px solid gray;'> Your browser does not support the canvas tag. </canvas>

binary
<canvas id='binary' style='border:1px solid gray;'> </canvas>

text
 <textarea id='text' style='background-color:#eee' readonly></textarea>

your text
 <textarea id='userText'></textarea>
<button type='button' onclick='markDiffs()'>Mark Differences With X</button>

(this snippet has only been tested in Chrome and Firefox)
```
</div>
</div>
</p>
<p>(It also lets you load the Monster, Wavatar, and Retro Gravatar styles, but those are just for fun and aren't meant to be used for this challenge. Unicornicons are unfortunately missing due to XSS constraints. :/ )</p>
<p>Your task is to write a program that outputs the 100×100 character text block of <code>0</code>'s and <code>1</code>'s that is generated when you put your programming language's name into the snippet input box.</p>
<p>For example, if your submission is written in Python, you would type <code>Python</code> into the stack snippet and see that</p>
<p><img src="https://i.stack.imgur.com/HNQMh.png" alt="Python identicon" /></p>
<p>is the identicon for Python, and</p>
<p><img src="https://i.stack.imgur.com/saFGU.png" alt="binary Python identicon" /></p>
<p>is the black and white (binary) version, and</p>
```0000000000000000000000011111111111111111111111111100000000000000000000000010000000000000000000000000
[encoded data, 9900 characters]
```

is the corresponding textual output that your Python program must produce.

However, since identicons can have a lot of awkward angles and their rasterization as a black and white image can leave jaggies, your output is allowed to have up to 300 0's or 1's that are the opposites of what they are supposed to be. (That's 3% of the 10000 total 0's and 1's.)

Near the bottom of the snippet, you can paste in the output of your program and check how many 0's or 1's are different than what they should be. Any number of differences at or below 300 is valid.

Scoring

The submission with the fewest bytes wins. (Handy byte counter.)

Tiebreaker goes to the submission with the fewest incorrect 0's and 1's.

If there's still a tie, the earlier submission wins.

Details

Output goes to stdout or a similar alternative if your language does not have stdout.

The output may optionally have a trailing newline.

Please include the color identicon image in your post along with the exact string that generates it. There's no need to waste space and post your entire textual output.

Your program should run without an internet connection. You need to generate the text in your code, not query it from the Gravatar site.

Use common sense when "naming" your language. Use the language name you would normally use on this site. Don't be annoying and contrive a name that makes the identicon easy to golf. e.g. Python 2 is fine for Python but python 2.7.2 is stretching it and python 2.7.2 by Guido van Rossum would be ridiculous.

I realize some languages are inherently easier than others because their identicon shapes are simpler. That's just the way it's gonna be, don't get too disgruntled or competitive about that. ;)

Body:
///, 1315 bytes, 0 errors

/-/\/\///O/00000-I/11111-o/OOO-i/11-@/000-!/II-8/O0-|/Ii-*/O@-+/0|-_/i1-=/oO-#/ii-$/I1-%/|i-^/!1-&/*0-2/+1-3/=O-4/I8_8I-5/!!-6/#8I8#-7/$818$-9/18^81-A/_8|8_-B/i8%8i-C/o@-D/O8-d/o8-E/o0-F/|1-g/+i-H/O*-h/o*-j/!%8!%-k/!i-l/!O!-m/#80#-n/0_-p/1O!_-q/^@^-r/iOOi-s/0$-t/
=-u/%8g-v/o&-w/|D|-x/
F*2-y/#*_O-z/#o#0-Z/0IHI-Y/E0/5i_D0!_35I
qHk3q
lHk3l
uO&^3uxO&^3F*2
wo!3w
7o!37
4og34
6og36
AE23A
BE23B
9C|39
ph+3p8
9Csh_8^81
BCsd$8%8i
A=ICg8|8_
6=IYk8I8#
4d#o!4
7d#H!F818$
wdnD!^D|xdn&5#*2
uhi805|8g
lhiO5l
qv1@5!_@^
k0kv105!$0k
D0!#hih13
Hk0iCn0iCn3
Hk0z0#o#=8
O&^00ID$@ID$=8
O&^0+8+@+8+=80
o!@F@%OF@%=80
o!@j=*
og@2g82g=*
og@+@|*|@|=&
E2OIO$&IO$=&
E2OmOOmoo
C|8i&_Di&_oo
C|C1v1oE
Cs8rDr=*i
CsOyO#*_=8#tIOI8I&I8Ih$tI@+@s*|@sdF
d#@2028202C!
d#@jEk
dn@%0!O%0!H!#
dn02OF@2OFD!$
hi0s*+@$*+*!F
hiZ0Z85
v1nY#nY#@5i
v_d#di05#
5$hihiv
5_@iCn0iC0#v
!^Oz0zih
!%*ID$@ID$0ih
!|OO|8+@+8+0nd0
!IHF@%OF@%0nd0
!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vd3gzXkgyKjIKdTNeSGc4ZwpsM2tIbApxM2tIcQprMGszIV9EMGswaw" rel="nofollow noreferrer">Try it online!

This is the identicon for ///. It's possibly the biggest thing I've ever done in ///!


答:
Perl, 41 bytes

Includes +1 for -p

Give input sequence on STDIN:

```<code>shift2048.pl <<< "2 2 2 4 4 8 2"
</code>```

shift2048.pl:

```<code>#!/usr/bin/perl -p
s/.*\K\b(\d+) \1\b/2*$1.A/e&&redo;y/A//d
</code>```

Title: 2048-like array shift

Body:
Perl, 41 bytes

Includes +1 for -p

Give input sequence on STDIN:

shift2048.pl <<< "2 2 2 4 4 8 2"

shift2048.pl:

#!/usr/bin/perl -p
s/.*\K\b(\d+) \1\b/2*$1.A/e&&redo;y/A//d


答:
Python, 61 bytes

def f(l):b=l[-2:-1]==l[-1:];return l and f(l[:~b])+[l[-1]<<b]
```

The Boolean b checks whether the last two elements should collapse by checking that they are equal in a way that's safe for lists of length 1 or 0. The last element if then appended with a multiplier of 1 for equal or 2 for unequal. It's appended to the recursive result on the list with that many elements chopped off the end. Thanks to Dennis for 1 byte!

Title: 2048-like array shift

Body:
Python, 61 bytes

def f(l):b=l[-2:-1]==l[-1:];return l and f(l[:~b])+[l[-1]<<b]

The Boolean b checks whether the last two elements should collapse by checking that they are equal in a way that's safe for lists of length 1 or 0. The last element if then appended with a multiplier of 1 for equal or 2 for unequal. It's appended to the recursive result on the list with that many elements chopped off the end. Thanks to Dennis for 1 byte!


答:
Java, <s>11</s> <s>10</s> 9 bytes

```<code>a->b->a+b
</code>```

Ungolfed test code

```<code>public static void main(String[] args) {
    Function<Integer, Function<Integer, Integer>> func = (a -> b -> a + b);

    System.out.println(func.apply(5).apply(10));
}
</code>```

Title: Add two numbers

Body:
Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list.

Output: Their sum. Use the same format for output integers as input integers. For example, the input 5 16 would lead to the output 21.

Restrictions: No standard loopholes please. This is code-golf, answer in lowest amount of bytes wins.

Notes: This should be fairly trivial, however I'm interested to see how it can be implemented. The answer can be a complete program or a function, but please identify which one it is.

Test cases:

```<code>1 2 -> 3
14 15 -> 29
7 9 -> 16
-1 8 -> 7
8 -9 -> -1
-8 -9 -> -17
</code>```

Or as CSV:

```<code>a,b,c
1,2,3
14,15,29
7,9,16
-1,8,7
8,-9,-1
-8,-9,-17
</code>```

Leaderboard

var QUESTION_ID=84260,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
Java, <s>11</s> <s>10</s> 9 bytes

a->b->a+b

Ungolfed test code

public static void main(String[] args) {
    Function<Integer, Function<Integer, Integer>> func = (a -> b -> a + b);

    System.out.println(func.apply(5).apply(10));
}


答:
Perl, 37 bytes

Includes +4 for -0n

Run with the input as separate lines on STDIN:

```<code>perl -M5.010 shift2048.pl
2
2
2
4
4
8
2
^D
</code>```

shift2048.pl:

```<code>#!/usr/bin/perl -0n
s/\b(\d+
)(\1|)$//&&do$0|say$1+$2
</code>```

Title: 2048-like array shift

Body:
Perl, 37 bytes

Includes +4 for -0n

Run with the input as separate lines on STDIN:

perl -M5.010 shift2048.pl
2
2
2
4
4
8
2
^D

shift2048.pl:

#!/usr/bin/perl -0n
s/\b(\d+
)(\1|)$//&&do$0|say$1+$2


答:
Perl 5.10, <s>61</s> 50 bytes (<s>49</s> + 1 for flag)

Thanks to Ton Hospel for saving 11 bytes!

Regex-free solution, with -a flag:

```<code>@a=($F[-1]-$b?$b:2*pop@F,@a)while$b=pop@F;say"@a"
</code>```

Try here!

Title: 2048-like array shift

Body:
Perl 5.10, <s>61</s> 50 bytes (<s>49</s> + 1 for flag)

Thanks to Ton Hospel for saving 11 bytes!

Regex-free solution, with -a flag:

@a=($F[-1]-$b?$b:2*pop@F,@a)while$b=pop@F;say"@a"

Try here!


问:
Tips for Golfing in Brain-Flak
Brain-flak is a stack-based turing-tarpit language, written collaboratively between me, DJMcMayhem, and 1000000000.

Some users  are very experienced in the mysterious ways of Brain-Flak. So I thought it a good idea to set up this question as a way for us, and hopefully others too, to share our knowledge with the community and lower the bar of entry to this language "designed to be painful to use". And perhaps even teach those of us with more experience some new tricks.

So what tips do you have for golfing in brain-flak? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to brain-flak (e.g. "remove comments" is not an answer).

Please post one tip per answer.

答:
Optimise your integers

Integers are tedious to represent in Brain-Flak. Fortunately we have a question that will help Golf a Brain-Flak Integer for you. (Note that the question is designed to push the integer to the stack, so push-pop redundancy probably applies to more realistic programs.)

Title: Tips for Golfing in Brain-Flak


答:
Haskell, 56 bytes

```<code>g(a:b:r)|a==b=a+b:g r|l<-b:r=a:g l
g x=x
r=reverse
r.g.r
</code>```

Title: 2048-like array shift

Body:
Haskell, 56 bytes

g(a:b:r)|a==b=a+b:g r|l<-b:r=a:g l
g x=x
r=reverse
r.g.r


答:
PHP, <s>86 100 99</s> 94 bytes

```<code>for($r=[];$v=+($p=array_pop)($a=&$argv);)array_unshift($r,end($a)-$v?$v:2*$p($a));print_r($r);
</code>```

requires PHP 7.0; takes values from command line arguments.

Run with -nr or try it online.

Title: 2048-like array shift

Body:
PHP, <s>86 100 99</s> 94 bytes

for($r=[];$v=+($p=array_pop)($a=&$argv);)array_unshift($r,end($a)-$v?$v:2*$p($a));print_r($r);

requires PHP 7.0; takes values from command line arguments.

Run with -nr or try it online.


问:
Implement a Truth-Machine
A truth-machine (credits goes to this guy for coming up with it) is a very simple program designed to demonstrate the I/O and control flow of a language. Here's what a truth-machine does:

Gets a number (either 0 or 1) from STDIN.

If that number is 0, print out 0 and terminate.

If that number is 1, print out 1 forever.

Challenge

Write a truth-machine as described above in your language of choice. The truth-machine must be a full program that follows these rules:

take input from STDIN or an acceptable alternative

If your language cannot take input from STDIN, it may take input from a hardcoded variable or suitable equivalent in the program

must output to STDOUT or an acceptable alternative

If your language is incapable of outputting the characters 0 or 1, byte or unary I/O is acceptable.

when the input is 1, it must continually print 1s and only stop if the program is killed or runs out of memory

the output must only be either a 0 followed by either one or no newline or space, or infinite 1s with each 1 followed by either one or no newline or space. No other output can be generated, except constant output of your language's interpreter that cannot be suppressed (such as a greeting, ANSI color codes or indentation). Your usage of newlines or spaces must be consistent: for example, if you choose to output 1 with a newline after it all 1s must have a newline after them.

if and only if your language cannot possibly terminate on an input of 0 it is acceptable for the code to enter an infinite loop in which nothing is outputted.

Since this is a catalog, languages created after this challenge are allowed to compete. Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. Other than that, all the standard rules of code-golf must be obeyed. Submissions in most languages will be scored in bytes in an appropriate preexisting encoding (usually UTF-8).

Catalog

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
ABCR, 7 bytes

```<code>iAo7ox
</code>```

ABCR is a stack-based programming language that allows a few simple operations on any of its three stacks and a single register.

Explanation:

```<code>i        Numerical input.  Places result in register.
 A       Queue register value to queue a.
  o      Output peek(a) as a number.
   7     while(register){
    o      output peek(a) again
     x   }
</code>```

Title: Implement a Truth-Machine

Body:
ABCR, 7 bytes

iAo7ox

ABCR is a stack-based programming language that allows a few simple operations on any of its three stacks and a single register.

Explanation:

i        Numerical input.  Places result in register.
 A       Queue register value to queue a.
  o      Output peek(a) as a number.
   7     while(register){
    o      output peek(a) again
     x   }


答:
Julia 205 bytes

```<code>t(x)=Val{x}
s(x)=t(x)()
f^::t(1)=f
^{y}(f,::t(y))=x->f(((f^s(y-1))(x)))
g()=[]
g{a}(::t(a))=[a]
g{a}(::t(a),B...)=[a;g(B...)]
g{a}(::t(a),::t(a),B...)=[2a;g(B...)]
K(A)=g(s.(A)...)
H(A)=(K^s(length(A)))(A)
</code>```

Function to be called is H

eg H([1,2,2,4,8,2,])

This is in no way the shortest way do this in julia.
But it is so cool, that I wanted to share it anyway.

t(a) is a value-type, representing the value (a).

s(a) is an instance of that value type

g is a function that dispatches on the difference values (using the value types) and numbers of its parameters. And that is cool

K just wraps g so that

Extra cool part:

```<code>f^::t(1)=f
^{y}(f,::t(y))=x->f(((f^s(y-1))(x)))
</code>```

This defines the ^ operator to apply to functions.
So that K^s(2)(X) is same as K(K(X))
so H is just calling K on K a bunch of times -- enough times to certainly collapse any nested case

This can be done much much shorter, but this way is just so fun.

Title: 2048-like array shift

Body:
Julia 205 bytes

t(x)=Val{x}
s(x)=t(x)()
f^::t(1)=f
^{y}(f,::t(y))=x->f(((f^s(y-1))(x)))
g()=[]
g{a}(::t(a))=[a]
g{a}(::t(a),B...)=[a;g(B...)]
g{a}(::t(a),::t(a),B...)=[2a;g(B...)]
K(A)=g(s.(A)...)
H(A)=(K^s(length(A)))(A)

Function to be called is H

eg H([1,2,2,4,8,2,])

This is in no way the shortest way do this in julia.
But it is so cool, that I wanted to share it anyway.

t(a) is a value-type, representing the value (a).

s(a) is an instance of that value type

g is a function that dispatches on the difference values (using the value types) and numbers of its parameters. And that is cool

K just wraps g so that

Extra cool part:

f^::t(1)=f
^{y}(f,::t(y))=x->f(((f^s(y-1))(x)))

This defines the ^ operator to apply to functions.
So that K^s(2)(X) is same as K(K(X))
so H is just calling K on K a bunch of times -- enough times to certainly collapse any nested case

This can be done much much shorter, but this way is just so fun.


问:
Simple cat program
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and concatenate) several files read from disc.

Task

You should write a full program which reads the contents of the standard input stream and writes them verbatim to the standard output stream. If and only if your language does not support standard input and/or output streams (as understood in most languages), you may instead take these terms to mean their closest equivalent in your language (e.g. JavaScript's prompt and alert). These are the only admissible forms of I/O, as any other interface would largely change the nature of the task and make answers much less comparable.

The output should contain exactly the input and nothing else. The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation. This also applies to trailing newlines. If the input does not contain a trailing newline, the output shouldn't include one either! (The only exception being if your language absolutely always prints a trailing newline after execution.)

Output to the standard error stream is ignored, so long as the standard output stream contains the expected output. In particular, this means your program can terminate with an error upon hitting the end of the stream (EOF), provided that doesn't pollute the standard output stream. If you do this, I encourage you to add an error-free version to your answer as well (for reference).

As this is intended as a challenge within each language and not between languages, there are a few language specific rules:

If it is at all possible in your language to distinguish null bytes in the standard input stream from the EOF, your program must support null bytes like any other bytes (that is, they have to be written to the standard output stream as well).

If it is at all possible in your language to support an arbitrary infinite input stream (i.e. if you can start printing bytes to the output before you hit EOF in the input), your program has to work correctly in this case. As an example yes | tr -d \\n | ./my_cat should print an infinite stream of ys. It is up to you how often you print and flush the standard output stream, but it must be guaranteed to happen after a finite amount of time, regardless of the stream (this means, in particular, that you cannot wait for a specific character like a linefeed before printing).

Please add a note to your answer about the exact behaviour regarding null-bytes, infinite streams, and extraneous output.

Additional rules

This is not about finding the language with the shortest solution for this (there are some where the empty program does the trick) - this is about finding the shortest solution in every language. Therefore, no answer will be marked as accepted.

Submissions in most languages will be scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8.

Some languages, like Folders, are a bit tricky to score. If in doubt, please ask on Meta.

Feel free to use a language (or language version) even if it's newer than this challenge. Languages specifically written to submit a 0-byte answer to this challenge are fair game but not particularly interesting.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Also note that languages do have to fulfil our usual criteria for programming languages.

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Headsecks or Unary), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

Unless they have been overruled earlier, all standard code-golf rules apply, including the http://meta.codegolf.stackexchange.com/q/1061.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the author actually had to put effort into golfing the code.

Catalogue

The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
ABCR, 4 bytes

```<code>5cQx
</code>```

Explanation:

```<code>5      while(peek(B)){  //Queue B peeks default to 1, so this infinite-loops
 c        dequeue(c)  // Queue C dequeues default to an input character if C is empty
  Q       print(c)   /* Prints peek at the queue, and peeks on an empty queue C
                        default to the register value, which was set by `c` */
   x    }
</code>```

Title: Simple cat program

Body:
ABCR, 4 bytes

5cQx

Explanation:

5      while(peek(B)){  //Queue B peeks default to 1, so this infinite-loops
 c        dequeue(c)  // Queue C dequeues default to an input character if C is empty
  Q       print(c)   /* Prints peek at the queue, and peeks on an empty queue C
                        default to the register value, which was set by `c` */
   x    }


问:
Divisibility test

Task

Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.

You may write a program or a function and use any of the our standard methods of receiving input and providing output.

The output should be a truthy or a falsy value; truthy if n is divisible by d, and falsy otherwise.

Your code only has to handle integers it can represent natively, as long as it works for all signed 8-bit integers. However, your algorithm has to work for arbitrarily large integers.

You may use any programming language, but note that these loopholes are forbidden by default.

This is code-golf, so the shortest valid answer – measured in bytes – wins.

Test cases

```<code> n,  d    output

 1,  1    truthy
 2,  1    truthy
 6,  3    truthy
17, 17    truthy
22,  2    truthy
 1,  2    falsy
 2,  3    falsy
 2,  4    falsy
 3,  9    falsy
15, 16    falsy
</code>```

Leaderboard

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

```<code>## Perl, 43 + 3 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
R, 20 bytes

Small improvement on this answer.

```<code>a=scan();!a[1]%%a[2]
</code>```

If the result of the modulo operation is 0, this is interpreted as a false, which is then inverted by the !. Any other number would be a truthy, which again is inverted by the ! into a false.

Title: Divisibility test

Body:
R, 20 bytes

Small improvement on this answer.

a=scan();!a[1]%%a[2]

If the result of the modulo operation is 0, this is interpreted as a false, which is then inverted by the !. Any other number would be a truthy, which again is inverted by the ! into a false.


问:
Shortest infinite loop producing no output
Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

Each submission must be a full program.

You must create the shortest infinite loop.

Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.

The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.

The program must not write anything to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge.
-Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D

Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.

This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainf**k-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.

Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be  improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

```<code># Language name, X bytes
</code>```

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

```<code>#[Language name](http://link.to/the/language), X bytes
</code>```

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//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"//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='
'+c.body.replace(OVERRIDE_REG,'')+'
'});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(''+lang+'').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)}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
ABCR, 2 bytes

```<code>5x
</code>```

Explanation:  5 loops while the front member of queue B resolves to a truthy value.  The default value for queue B is 1, so the loop continues until it finds its matching x; since there are no operations in the loop, it continues ad infinitum with no output.

Body:
ABCR, 2 bytes

5x

Explanation:  5 loops while the front member of queue B resolves to a truthy value.  The default value for queue B is 1, so the loop continues until it finds its matching x; since there are no operations in the loop, it continues ad infinitum with no output.


问:
pssssssssssssst
Introduction

This is one is pretty straightforward. We will be drawing a snake in ascii. This was inspired by that old snake game where you have to collect the fruit and you continuously grow.

Definition

Given a positive integer N that represents the snake's length, draw a snake so that it has a body of n plus a head and a tail.

Parts:

head:     <, >, ^, v

tail:     @

vertical: |

horizonal: -

All corners should be satisfied with a \ or / respectively. Unless the head ends on a corner in which case the head <, >, ^, v takes priority in the direction the snake is curled. i.e. for the length 1 example, it is turned counter clockwise and so the head is turned that way. For a clockwise solution it would be to the right >.

The snake must start in the middle with its tail but it may go outwards in any direction you choose either clockwise or counter-clockwise. It must also wrap tightly around itself as it expands outwards in a circular fashion.

Example

```<code>/--\
|/\|
||@|
|\-/
\--->
</code>```

Where the @ is the tail and starting position. As seen above the tail starts in the middle, goes up to the left in a counter-clockwise rotation outward.

Here the length is 19 plus a tail and a head.

As another example, here is length 1:

```<code><\
 @

</code>```

Winning

This is code-golf so the answer that is submitted with the smallest number of bytes wins, with time to be used as a tie breaker.

Have fun!

Title: pssssssssssssst

Body:
JavaScript (ES7), 200 bytes

(n,s=(n*4+1)**.5|0,i=+`1201`[s%4],d=i=>`-`.repeat(i))=>[...Array(s-2>>2)].reduce(s=>`/-${d(i)}\\
${s.replace(/^|$/gm,`|`)}
|\\${d(i,i+=2)}/`,[`/\\
|@`,`/-\\
|@/`,`@`,`/@`][s%4])+`
\\${d(n-(s*s>>2))}>`

ES6 version for ease of testing:

f=(n,s=Math.sqrt((n*4+1))|0,i=+`1201`[s%4],d=i=>`-`.repeat(i))=>[...Array(s-2>>2)].reduce(s=>`/-${d(i)}\\
${s.replace(/^|$/gm,`|`)}
|\\${d(i,i+=2)}/`,[`/\\
|@`,`/-\\
|@/`,`@`,`/@`][s%4])+`
\\${d(n-(s*s>>2))}>`;

<input type=number min=1 oninput=o.textContent=f(this.value)><pre id=o>