问:
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

```

答:
PHP+HTML+CSS, 173 Bytes Colored 367 Bytes

CLI only PHP 173 Bytes

```<code>$o=2841;for($i=0;$i<16;)$t.=il.Oo[$o>>$i++&1].vey.Oo[$o>>$i++&1].u;foreach(str_split($t)as$c)$x.="0".decbin(ord($c));for($i=0;$i<504;$i++){$i%21?:print"\n";echo$x[$i]." ";}}
</code>```

conform to the bounty spec content type text/html

```<code><?=gzinflate(base64_decode("jVNbDoIwELwKJ9Ctn9hwF9HGmFQwiB+GeHcRd7ezvDQEAmWmMzuT+nv7jKG4dddDc75UOW124foqu0OM+aO6h3Z/rGPd5E04vfz2C/a3gjLXXzTcxG/pSem7xzr4hxhn2BZLZvfpDjRg/3FBjBWuL78fflsWAOVl0uWk8rmG3yDCMNnMLMsshHpq0jLVQLKj6RrIbHBCYoq6WclPHHJ+PNdqjEZlpLNgbaTy2xoTHAQ3kBasKZyg3/XUDAVV5urVcDE5mQXsGWugIJqikibVmcZTJIrL0Bq3NKdgjxhak2q5ukmpWuXS+QJPEBVi52vE025VJy7Yw18u3g==");
</code>```

b{all:unset;color:red} instead of b{all:unset;color:#911;background:red} in the first version

PHP+HTML+CSS, 392 Bytes

heart red +black which looks more pretty

Maybe call the color number in the CSS Part

```<code><?=gzinflate(base64_decode("jVTLDoIwELyb+A8m3nXrzdrwL7xijAgG8GAI/67WdpktD00DoWWmMztLMU37LPLo3t3i+nwpNe0O+a1Purgo9KNs8vaUVkVV6+1RqVMSp9dzXT3KTNd51pv9l7xemXtEG/UeZC9yT8OdhrlFK3iLKCX4IZqEwngPcuh/vBCjPd8k34nZJxGA3TLxMip9hgWAkAP67cTyUBOhJluVXDYxWIKsBWgyRE9jEntayNL75CxdfYuRBkqB1ozBkdJvg46iRIiWNmOQCSQ6vpygIEmlqYZz1LAN1AQmhUFQUfBBhjVzbWE1SFIbNOi6NqUSHkI06JvtmjlqMzR37gSCMxEboicbG/wVpPbICzv5y8sL"));
</code>```

add this before it looks nicer

```<code><style>*{word-spacing:1em;}</style>
</code>```

Output first version it is the ugliest HTML Code in my live

red-black heart

```<code><style>*{word-spacing:1em;}</style><style>p{margin:0.2em}b{all:unset;color:#911;background:red}</style>
<p>0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1
<p>1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
<p>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0
<p>1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0
<p>1 1 1 1 0 <b>1 1 1</b> 0 1 1 0 0 <b>1 1 0</b> 0 1 0 1 0
<p>1 1 1 <b>1 0 0 1 0 1 1</b> 0 <b>1 1 1 1 0 1 1</b> 1 0 1
<p>0 1 0 <b>1 1 0 1 0 0 1</b> 0 <b>1 1 0 1 1 0 0</b> 0 1 1
<p>0 1 1 <b>1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1</b> 0 1
<p>0 1 <b>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1</b> 1 0
<p>1 0 <b>1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0</b> 0 1
<p>0 0 1 <b>1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0</b> 1 0
<p>1 0 1 <b>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0</b> 1 1 1
<p>0 1 0 1 <b>0 1 1 0 1 0 0 1 0 1 1 0</b> 1 1 0 0 0
<p>1 1 0 1 1 <b>1 1 0 1 1 1 0 1 1 0 0</b> 1 1 0 0 1
<p>0 1 0 1 1 1 <b>1 0 0 1 0 1 1 0 1</b> 1 1 1 0 1 1
<p>1 0 1 0 1 0 1 <b>1 0 1 0 0 1 0</b> 1 1 0 1 1 0 0
<p>0 1 0 0 1 1 1 1 <b>0 1 1 1 0</b> 1 1 0 0 1 1 0 0
<p>1 0 1 0 1 1 1 1 0 <b>0 1 0</b> 1 1 0 1 1 1 1 0 1
<p>1 1 0 1 0 1 0 1 1 0 <b>1</b> 0 0 1 0 1 1 0 1 1 0
<p>0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
<p>0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0
<p>1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1
<p>0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1
</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```
</div>
</div>
</p>

<p>375 Bytes for create the HTML Page with PHP directly</p>

```<?$o=2841;for(;$i<16;)$t.=il.Oo[$o>>$i++&1].vey.Oo[$o>>$i++&1].u;foreach(str_split($t)as$c)$x.="0".decbin(ord($c));$a=[1,9,20,28,41,49,62,82,103,125,146,168,190,212,234,256,278,300];$z=[3,11,26,34,47,55,77,98,119,140,160,179,200,220,240,260,280,300];for($i=0;$i<483;$i++)echo $i%21?"":"
",in_array($i-88,$a)?"":"",$x[$i],in_array($i-88,$z)?"":""," ";
```

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

Body:
PHP+HTML+CSS, 173 Bytes Colored 367 Bytes

CLI only PHP 173 Bytes

$o=2841;for($i=0;$i<16;)$t.=il.Oo[$o>>$i++&1].vey.Oo[$o>>$i++&1].u;foreach(str_split($t)as$c)$x.="0".decbin(ord($c));for($i=0;$i<504;$i++){$i%21?:print"\n";echo$x[$i]." ";}}

conform to the bounty spec content type text/html

<?=gzinflate(base64_decode("jVNbDoIwELwKJ9Ctn9hwF9HGmFQwiB+GeHcRd7ezvDQEAmWmMzuT+nv7jKG4dddDc75UOW124foqu0OM+aO6h3Z/rGPd5E04vfz2C/a3gjLXXzTcxG/pSem7xzr4hxhn2BZLZvfpDjRg/3FBjBWuL78fflsWAOVl0uWk8rmG3yDCMNnMLMsshHpq0jLVQLKj6RrIbHBCYoq6WclPHHJ+PNdqjEZlpLNgbaTy2xoTHAQ3kBasKZyg3/XUDAVV5urVcDE5mQXsGWugIJqikibVmcZTJIrL0Bq3NKdgjxhak2q5ukmpWuXS+QJPEBVi52vE025VJy7Yw18u3g==");

b{all:unset;color:red} instead of b{all:unset;color:#911;background:red} in the first version

PHP+HTML+CSS, 392 Bytes

heart red +black which looks more pretty

Maybe call the color number in the CSS Part

<?=gzinflate(base64_decode("jVTLDoIwELyb+A8m3nXrzdrwL7xijAgG8GAI/67WdpktD00DoWWmMztLMU37LPLo3t3i+nwpNe0O+a1Purgo9KNs8vaUVkVV6+1RqVMSp9dzXT3KTNd51pv9l7xemXtEG/UeZC9yT8OdhrlFK3iLKCX4IZqEwngPcuh/vBCjPd8k34nZJxGA3TLxMip9hgWAkAP67cTyUBOhJluVXDYxWIKsBWgyRE9jEntayNL75CxdfYuRBkqB1ozBkdJvg46iRIiWNmOQCSQ6vpygIEmlqYZz1LAN1AQmhUFQUfBBhjVzbWE1SFIbNOi6NqUSHkI06JvtmjlqMzR37gSCMxEboicbG/wVpPbICzv5y8sL"));

add this before it looks nicer

<style>*{word-spacing:1em;}</style>

Output first version it is the ugliest HTML Code in my live

red-black heart

<style>*{word-spacing:1em;}</style><style>p{margin:0.2em}b{all:unset;color:#911;background:red}</style>
<p>0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1
<p>1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
<p>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0
<p>1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0
<p>1 1 1 1 0 <b>1 1 1</b> 0 1 1 0 0 <b>1 1 0</b> 0 1 0 1 0
<p>1 1 1 <b>1 0 0 1 0 1 1</b> 0 <b>1 1 1 1 0 1 1</b> 1 0 1
<p>0 1 0 <b>1 1 0 1 0 0 1</b> 0 <b>1 1 0 1 1 0 0</b> 0 1 1
<p>0 1 1 <b>1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1</b> 0 1
<p>0 1 <b>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1</b> 1 0
<p>1 0 <b>1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0</b> 0 1
<p>0 0 1 <b>1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0</b> 1 0
<p>1 0 1 <b>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0</b> 1 1 1
<p>0 1 0 1 <b>0 1 1 0 1 0 0 1 0 1 1 0</b> 1 1 0 0 0
<p>1 1 0 1 1 <b>1 1 0 1 1 1 0 1 1 0 0</b> 1 1 0 0 1
<p>0 1 0 1 1 1 <b>1 0 0 1 0 1 1 0 1</b> 1 1 1 0 1 1
<p>1 0 1 0 1 0 1 <b>1 0 1 0 0 1 0</b> 1 1 0 1 1 0 0
<p>0 1 0 0 1 1 1 1 <b>0 1 1 1 0</b> 1 1 0 0 1 1 0 0
<p>1 0 1 0 1 1 1 1 0 <b>0 1 0</b> 1 1 0 1 1 1 1 0 1
<p>1 1 0 1 0 1 0 1 1 0 <b>1</b> 0 0 1 0 1 1 0 1 1 0
<p>0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
<p>0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0
<p>1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1
<p>0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1

    <style>p{margin:0.2em}b{all:unset;color:red}</style>
    <p>0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1
    <p>1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1
    <p>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0
    <p>1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 0 0
    <p>1 1 1 1 0 <b>1 1 1</b> 0 1 1 0 0 <b>1 1 0</b> 0 1 0 1 0
    <p>1 1 1 <b>1 0 0 1 0 1 1</b> 0 <b>1 1 1 1 0 1 1</b> 1 0 1
    <p>0 1 0 <b>1 1 0 1 0 0 1</b> 0 <b>1 1 0 1 1 0 0</b> 0 1 1
    <p>0 1 1 <b>1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1</b> 0 1
    <p>0 1 <b>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0 1 1</b> 1 0
    <p>1 0 <b>1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0</b> 0 1
    <p>0 0 1 <b>1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0</b> 1 0
    <p>1 0 1 <b>1 1 1 0 0 1 0 1 0 0 1 1 1 1 0</b> 1 1 1
    <p>0 1 0 1 <b>0 1 1 0 1 0 0 1 0 1 1 0</b> 1 1 0 0 0
    <p>1 1 0 1 1 <b>1 1 0 1 1 1 0 1 1 0 0</b> 1 1 0 0 1
    <p>0 1 0 1 1 1 <b>1 0 0 1 0 1 1 0 1</b> 1 1 1 0 1 1
    <p>1 0 1 0 1 0 1 <b>1 0 1 0 0 1 0</b> 1 1 0 1 1 0 0
    <p>0 1 0 0 1 1 1 1 <b>0 1 1 1 0</b> 1 1 0 0 1 1 0 0
    <p>1 0 1 0 1 1 1 1 0 <b>0 1 0</b> 1 1 0 1 1 1 1 0 1
    <p>1 1 0 1 0 1 0 1 1 0 <b>1</b> 0 0 1 0 1 1 0 1 1 0
    <p>0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0
    <p>0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 0
    <p>1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1
    <p>0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1

375 Bytes for create the HTML Page with PHP directly

<?$o=2841;for(;$i<16;)$t.=il.Oo[$o>>$i++&1].vey.Oo[$o>>$i++&1].u;foreach(str_split($t)as$c)$x.="0".decbin(ord($c));$a=[1,9,20,28,41,49,62,82,103,125,146,168,190,212,234,256,278,300];$z=[3,11,26,34,47,55,77,98,119,140,160,179,200,220,240,260,280,300];for($i=0;$i<483;$i++)echo $i%21?"":"<p>",in_array($i-88,$a)?"<b style=color:red>":"",$x[$i],in_array($i-88,$z)?"</b>":""," ";


问:
Find the intersection point of a plane and ray
Given a ray with a point and a vector and a plane with a point and a normal vector to the plane. You have to find the intersection point of the plane and the ray..

So your job if you choose to accept is to write a shortest function that will do the job.

```<code>RULES:
The submission must be a complete program
And that's all

INPUT FORMAT:
x y z rx ry rz //gives the ray point and the ray vectors
x y z px py pz //gives the point on the plane and the vector normal to plane

OUTPUT FORMAT:
(x,y,z) //intersection point

Test Case:
2 3 4 0.577 0.577 0.577
7 1 3 1 0 0
(7,8,9)
</code>```

The shortest codes in bytes win.

References: https://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm  thanks orlp for the reference

答:
R, 88 bytes

```<code>x=scan()
v=scan()
r=scan()
n=scan()
C=cat
C("(");C(x+v*sum((r-x)*n)/sum(v*n),sep=", ");C(")")
</code>```

Adapted from the Mathematica answer. Takes the following values from stdin, x (ray point), v (ray direction), r (plane point), n (plane normal). Outputs (7, 8, 9) for the test case.

ContentLicense: CC BY-SA 3.0

Body:
R, 88 bytes

x=scan()
v=scan()
r=scan()
n=scan()
C=cat
C("(");C(x+v*sum((r-x)*n)/sum(v*n),sep=", ");C(")")

Adapted from the Mathematica answer. Takes the following values from stdin, x (ray point), v (ray direction), r (plane point), n (plane normal). Outputs (7, 8, 9) for the test case.


问:
Remove leading and trailing zeroes
Given a non-empty list/array containing only non-negative integers like this:

```<code>[0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]
</code>```

Output the list with trailing and leading zeroes removed.

The output for this would be:

```<code>[8, 1, 4, 3, 5, 6, 4, 1, 2]
</code>```

Some other test cases:

```<code>[0, 4, 1, 2, 0, 1, 2, 4, 0] > [4, 1, 2, 0, 1, 2, 4]
[0, 0, 0, 0, 0, 0] > nothing
[3, 4, 5, 0, 0] > [3, 4, 5]
[6] > [6]
</code>```

Shortest code wins

答:
C#, 134 bytes

```<code>using System.Linq;n=>string.Join(" ",n).Trim('0',' ').Split(new[]{' '},StringSplitOptions.RemoveEmptyEntries).Select(s=>int.Parse(s));
</code>```

If I can return a comma separated string of the return values:

C#, 36 bytes

```<code>n=>string.Join(",",n).Trim('0',',');
</code>```

Title: Remove leading and trailing zeroes

Body:
C#, 134 bytes

using System.Linq;n=>string.Join(" ",n).Trim('0',' ').Split(new[]{' '},StringSplitOptions.RemoveEmptyEntries).Select(s=>int.Parse(s));

If I can return a comma separated string of the return values:

C#, 36 bytes

n=>string.Join(",",n).Trim('0',',');


问:
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.

答:
JavaScript (ES6), 195 bytes

```<code>n=>[...Array(p=1<<n*n)].map(_=>(p++).toString(2).slice(1)).filter((s,i,a)=>![1,0,1].some(c=>a.indexOf((c?b.reverse():b=b.map(s=>[...s].reverse().join``)).join``)<i,b=s.match(eval(`/.{${n}}/g`))))
</code>```

Returns strings representing all matrix entries concatenated e.g. 111101111 represents a 3×3 matrix of 1s with a 0 in the middle. Explanation:

```<code>n=>[...Array(p=1<<n*n)].map(            Enumerate all binary matrices
 _=>(p++).toString(2).slice(1)          Convert to padded binary
).filter((s,i,a)=>![1,0,1].some(        Check reflections of each matrix
 c=>a.indexOf((c?b.reverse():           Reverse the order of lines
  b=b.map(s=>[...s].reverse().join``    Or reverse each line
  )).join``)<i,                         Has this been seen before?
 b=s.match(eval(`/.{${n}}/g`))))        Reshape string into a square
</code>```

Body:
JavaScript (ES6), 195 bytes

n=>[...Array(p=1<<n*n)].map(_=>(p++).toString(2).slice(1)).filter((s,i,a)=>![1,0,1].some(c=>a.indexOf((c?b.reverse():b=b.map(s=>[...s].reverse().join``)).join``)<i,b=s.match(eval(`/.{${n}}/g`))))

Returns strings representing all matrix entries concatenated e.g. 111101111 represents a 3×3 matrix of 1s with a 0 in the middle. Explanation:

n=>[...Array(p=1<<n*n)].map(            Enumerate all binary matrices
 _=>(p++).toString(2).slice(1)          Convert to padded binary
).filter((s,i,a)=>![1,0,1].some(        Check reflections of each matrix
 c=>a.indexOf((c?b.reverse():           Reverse the order of lines
  b=b.map(s=>[...s].reverse().join``    Or reverse each line
  )).join``)<i,                         Has this been seen before?
 b=s.match(eval(`/.{${n}}/g`))))        Reshape string into a square


答:
R, 39 bytes

```<code>function(x)x[min(i<-which(x>0)):max(i)]
</code>```

Four bytes shorter than David Arenburg's R answer. This implementation finds the first and last index in the array which is greater than zero, and returns everything in the array between those two indices.

Title: Remove leading and trailing zeroes

Body:
Given a non-empty list/array containing only non-negative integers like this:

```<code>[0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]
</code>```

Output the list with trailing and leading zeroes removed.

The output for this would be:

```<code>[8, 1, 4, 3, 5, 6, 4, 1, 2]
</code>```

Some other test cases:

```<code>[0, 4, 1, 2, 0, 1, 2, 4, 0] > [4, 1, 2, 0, 1, 2, 4]
[0, 0, 0, 0, 0, 0] > nothing
[3, 4, 5, 0, 0] > [3, 4, 5]
[6] > [6]
</code>```

Shortest code wins

Body:
R, 39 bytes

function(x)x[min(i<-which(x>0)):max(i)]

Four bytes shorter than David Arenburg's R answer. This implementation finds the first and last index in the array which is greater than zero, and returns everything in the array between those two indices.


答:
PHP, 61 bytes

```<code><?=preg_replace("^[^_]*_(0_)*(.*)(_0)*$","$2",join(_,$argv));
</code>```

regexp using the underscore as delimiter.

Title: Remove leading and trailing zeroes

Body:
PHP, 61 bytes

<?=preg_replace("^[^_]*_(0_)*(.*)(_0)*$","$2",join(_,$argv));

regexp using the underscore as delimiter.


答:
J, <s>66</s> <s>56</s> 53 bytes

```<code>[:~.,~{.@/:~@(2:_&(][:,(;|.;|."1)&>)<)@$"#.2#:@i.@^*:
</code>```

Brute-force search.

Usage

```<code>   f =: [:~.,~{.@/:~@(2:_&(][:,(;|.;|."1)&>)<)@$"#.2#:@i.@^*:
   f 2
┌───┬───┬───┬───┬───┬───┬───┐
│0 0│0 0│0 0│0 1│0 1│0 1│1 1│
│0 0│0 1│1 1│0 1│1 0│1 1│1 1│
└───┴───┴───┴───┴───┴───┴───┘
   # f 3
168
   # f 4
16576
</code>```

Explanation

```<code>[:~.,~{.@/:~@(2:_&(][:,(;|.;|."1)&>)<)@$"#.2#:@i.@^*:  Input: integer n
                                                   *:  Square n
                                           2      ^    Compute m = 2 ^ (n ^ 2)
                                               i.@     Make a range [0, m)
                                            #:@        Convert each to binary digits
    ,~                                                    Pair, make [n, n]
                                       $"#.            Reshape each binary list
                                                          to a matrix with size [n, n]
             (                       )@                Operate on each
                                    <                    Box it, call x
              2:                                         The constant 2
                _&(                )                     Repeat that many times on x
                       (        )&>                        For each box
                            |."1                             Reverse by column
                         |.                                  Reverse by row
                           ;                                 Join them
                        ;                                    Join with initial
                    [:,                                    Flatten
                   ]                                       Return that as the new x
         /:~@                                          Sort each
      {.@                                              Take the head of each
[:~.                                                   Unique and return
</code>```

Title: Generate binary matrices which are distinct up to reflections

Body:
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.

Body:
J, <s>66</s> <s>56</s> 53 bytes

[:~.,~{.@/:~@(2:_&(][:,(;|.;|."1)&>)<)@$"#.2#:@i.@^*:

Brute-force search.

Usage

   f =: [:~.,~{.@/:~@(2:_&(][:,(;|.;|."1)&>)<)@$"#.2#:@i.@^*:
   f 2
┌───┬───┬───┬───┬───┬───┬───┐
│0 0│0 0│0 0│0 1│0 1│0 1│1 1│
│0 0│0 1│1 1│0 1│1 0│1 1│1 1│
└───┴───┴───┴───┴───┴───┴───┘
   # f 3
168
   # f 4
16576

Explanation

[:~.,~{.@/:~@(2:_&(][:,(;|.;|."1)&>)<)@$"#.2#:@i.@^*:  Input: integer n
                                                   *:  Square n
                                           2      ^    Compute m = 2 ^ (n ^ 2)
                                               i.@     Make a range [0, m)
                                            #:@        Convert each to binary digits
    ,~                                                    Pair, make [n, n]
                                       $"#.            Reshape each binary list
                                                          to a matrix with size [n, n]
             (                       )@                Operate on each
                                    <                    Box it, call x
              2:                                         The constant 2
                _&(                )                     Repeat that many times on x
                       (        )&>                        For each box
                            |."1                             Reverse by column
                         |.                                  Reverse by row
                           ;                                 Join them
                        ;                                    Join with initial
                    [:,                                    Flatten
                   ]                                       Return that as the new x
         /:~@                                          Sort each
      {.@                                              Take the head of each
[:~.                                                   Unique and return


答:
PHP, 41 Bytes

```<code><?="[".trim(join(",",$_GET[a]),",0")."]";
</code>```

If the input as array could be write as ?a=0&b=0 and so on it can be reduce to 38 Bytes

```<code><?="[".trim(join(",",$_GET),",0")."]";
</code>```

The longer way working with Regex 65 Bytes

```<code><?="[".preg_replace("#^(0,)*|(,0)*$#","",join(",",$_GET[a]))."]";
</code>```

Title: Remove leading and trailing zeroes

Body:
PHP, 41 Bytes

<?="[".trim(join(",",$_GET[a]),",0")."]";

If the input as array could be write as ?a=0&b=0 and so on it can be reduce to 38 Bytes

<?="[".trim(join(",",$_GET),",0")."]";

The longer way working with Regex 65 Bytes

<?="[".preg_replace("#^(0,)*|(,0)*$#","",join(",",$_GET[a]))."]";


问:
Let's draw some Atari ST bombs!

Introduction

The Atari ST was a rather popular personal computer from the mid 80's to early 90's era, powered by a Motorola 68000 microprocessor. On this machine, the default behavior of the operating system for uncaught CPU exceptions was to display a row of bombs on the screen, as shown in the following picture:

Source: https://commons.wikimedia.org/wiki/File:Row_of_bombs.png

NB: Depending on the OS version, the bomb graphics may vary slightly. But let's take this one as reference.

The number of bombs depends on the exception vector, the most common ones being:

($008) Bus Error : 2 bombs

($00c) Address Error : 3 bombs

($010) Illegal Instruction : 4 bombs

Goal

Your goal is to write a program or function that prints or outputs an ASCII art of such Atari ST bombs.

Input

An integer representing the number of bombs to display. Your code must support the most common values: 2, 3 and 4. Supporting less and/or more bombs is fine, but it is neither required nor subject to a bonus.

Output

The original bomb consists of a 16x16 pixel tile, represented here in both ASCII and binary:

```<code>....##..........    0000110000000000
.#.#..#.........    0101001000000000
.......#........    0000000100000000
#..#....#.......    1001000010000000
..#...#####.....    0010001111100000
......#####.....    0000001111100000
....#########...    0000111111111000
...###########..    0001111111111100
...###########..    0001111111111100
..#############.    0011111111111110
..########.####.    0011111111011110
...#######.###..    0001111111011100
...######.####..    0001111110111100
....#########...    0000111111111000
.....#######....    0000011111110000
.......###......    0000000111000000
</code>```

In this challenge, each ASCII bomb must be stretched to twice its original width for a better rendering. Therefore, it will consist of 16 rows of 32 characters, using ## for 'ON' pixels and two spaces for 'OFF' pixels. All bomb tiles must be put side by side. Leading spaces are forbidden. Trailing spaces are also forbidden, except the ones that are actually part of the bomb tile (i.e. the 31st and 32nd columns) which must be present. You may include no more than one leading line-break and no more than one trailing line-break.

Example

Below is the reference output for two bombs, where mandatory line-breaks are marked as \n and tolerated extra line-breaks are marked as (\n):

```<code>(\n)
        ####                            ####                    \n
  ##  ##    ##                    ##  ##    ##                  \n
              ##                              ##                \n
##    ##        ##              ##    ##        ##              \n
    ##      ##########              ##      ##########          \n
            ##########                      ##########          \n
        ##################              ##################      \n
      ######################          ######################    \n
      ######################          ######################    \n
    ##########################      ##########################  \n
    ################  ########      ################  ########  \n
      ##############  ######          ##############  ######    \n
      ############  ########          ############  ########    \n
        ##################              ##################      \n
          ##############                  ##############        \n
              ######                          ######            (\n)
</code>```

(Of course, other line-break formats such as \r or \r\n may be used just as well.)

Rules

This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

答:
PHP, <s>144</s> <s>140</s> <s>139</s> <s>138</s> 136 bytes

Note: uses Windows-1252 encoding

```<code>for(;$j%=32*$argn or$r=intval(substr("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow",$i++*3,3),36)*print~õ;)echo~ßÜ[$r>>$j++/2%16&1];
</code>```

Run like this:

```<code>echo 2 | php -nR 'for(;$j%=32*$argn or$r=intval(substr("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow",$i++*3,3),36)*print~õ;)echo~ßÜ[$r>>$j++/2%16&1];'
</code>```

Or using IBM-850 encoding (135 bytes and prettier result):

```<code>echo 2 | php -nR 'for(;$j%=32*$argn or$r=intval(substr(~¤╬£¤══¤╠ö¤╚ø╬òÃ╬ò╦╔Ø╦£Æê£ÆêÅ×╦ÉùÉØèÿ£ÃÉ╔Ø╦╠╦ê¤Éê,$i++*3,3),36)*print~§;)echo~▀M[$r>>$j++/2%16&1];'

        ▓▓▓▓                            ▓▓▓▓
  ▓▓  ▓▓    ▓▓                    ▓▓  ▓▓    ▓▓
              ▓▓                              ▓▓
▓▓    ▓▓        ▓▓              ▓▓    ▓▓        ▓▓
    ▓▓      ▓▓▓▓▓▓▓▓▓▓              ▓▓      ▓▓▓▓▓▓▓▓▓▓
            ▓▓▓▓▓▓▓▓▓▓                      ▓▓▓▓▓▓▓▓▓▓
        ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓
        ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓                  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
              ▓▓▓▓▓▓                          ▓▓▓▓▓▓
</code>```

Explanation

This doesn't do any binary stuff and doesn't require an external file.

Every 16 bit number is reversed, then encoded as a base-36 number, padded with a leading 0 if necessary, so every 16 bits result in 3 bytes. Concatenating those results in 01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow. The code reverses the process so the bombs are printed correctly N times.

Tweaks

Saved 4 bytes by using only a single for-loop

Saved a byte by printing a single char for each iteration and using string index instead of ternary

Saved a byte by getting resetting $j to zero on line boundaries with %=. This gets rid of parentheses

Saved 2 bytes by using $argn

Title: Let's draw some Atari ST bombs!

Body:
PHP, <s>144</s> <s>140</s> <s>139</s> <s>138</s> 136 bytes

Note: uses Windows-1252 encoding

for(;$j%=32*$argn or$r=intval(substr("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow",$i++*3,3),36)*print~õ;)echo~ßÜ[$r>>$j++/2%16&1];

Run like this:

echo 2 | php -nR 'for(;$j%=32*$argn or$r=intval(substr("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow",$i++*3,3),36)*print~õ;)echo~ßÜ[$r>>$j++/2%16&1];'

Or using IBM-850 encoding (135 bytes and prettier result):

echo 2 | php -nR 'for(;$j%=32*$argn or$r=intval(substr(~¤╬£¤══¤╠ö¤╚ø╬òÃ╬ò╦╔Ø╦£Æê£ÆêÅ×╦ÉùÉØèÿ£ÃÉ╔Ø╦╠╦ê¤Éê,$i++*3,3),36)*print~§;)echo~▀M[$r>>$j++/2%16&1];'

        ▓▓▓▓                            ▓▓▓▓
  ▓▓  ▓▓    ▓▓                    ▓▓  ▓▓    ▓▓
              ▓▓                              ▓▓
▓▓    ▓▓        ▓▓              ▓▓    ▓▓        ▓▓
    ▓▓      ▓▓▓▓▓▓▓▓▓▓              ▓▓      ▓▓▓▓▓▓▓▓▓▓
            ▓▓▓▓▓▓▓▓▓▓                      ▓▓▓▓▓▓▓▓▓▓
        ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓
        ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓                  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
              ▓▓▓▓▓▓                          ▓▓▓▓▓▓

Explanation

This doesn't do any binary stuff and doesn't require an external file.

Every 16 bit number is reversed, then encoded as a base-36 number, padded with a leading 0 if necessary, so every 16 bits result in 3 bytes. Concatenating those results in 01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow. The code reverses the process so the bombs are printed correctly N times.

Tweaks

Saved 4 bytes by using only a single for-loop

Saved a byte by printing a single char for each iteration and using string index instead of ternary

Saved a byte by getting resetting $j to zero on line boundaries with %=. This gets rid of parentheses

Saved 2 bytes by using $argn


问:
How many times will a bell tower ring?

Introduction

A bell tower will ring its bells every hour, n times, with n being the the current hour on a 12 hour clock.

For example, a bell will ring 5 times at 5pm, and 10 times at 10am.

Task

Given two times in a suitable format, output the number of times the bell will ring, inclusive of the start and end times

Examples

```<code>"10am-12pm"
10+11+12= 33

[01:00, 05:00]
1+2+3+4+5 = 15

[11, 15]
11+12+1+2+3 = 29

[10:00pm, 10:00am]
10+11+12+1+2+3+4+5+6+7+8+9+10 = 88
</code>```

If the start is the same as the end then the you simply just ouput the number of chimes for that hour:

```<code>[5pm, 5pm]
5 = 5
</code>```

As you can see, you may choose an input method but the output must be an integer on its own (or an acceptable alternative) trailing/ leading newlines and spaces are allowed.

Note:

inputs may span from the afternoon of one day to the morning of the next.

the difference between the two times will never be more than 24 hours.

input is flexible so long as you clearly state what format your input is.

your input must have a clear distinction between AM and PM.

答:
Cubix, <s>45</s> 44 bytes

Saved 1 byte, thanks to @ETHproductions

My first foray into Cubix...

```<code>)$424tU4OI0Iuq;;-!^;^%&21u+rr;ss!;sqU>&%r$@;
</code>```

Or, cubified:

```<code>      ) $ 4
      2 4 t
      U 4 O
I 0 I u q ; ; - ! ^ ; ^
% & 2 1 u + r r ; s s !
; s q U > & % r $ @ ; .
      . . .
      . . .
      . . .
</code>```

You can try it out at the online interpreter. Input is in 24 hour format, with the end time first. For example, from 5pm to 1am the input should be 1 17.

Previous version, 45 bytes:

```<code>)$442t\/OI0Iuq;;-!^;^%&21u+rr;ss!;sqU>&%r$@.;
</code>```

Title: How many times will a bell tower ring?

Body:
Cubix, <s>45</s> 44 bytes

Saved 1 byte, thanks to @ETHproductions

My first foray into Cubix...

)$424tU4OI0Iuq;;-!^;^%&21u+rr;ss!;sqU>&%r$@;

Or, cubified:

      ) $ 4
      2 4 t
      U 4 O
I 0 I u q ; ; - ! ^ ; ^
% & 2 1 u + r r ; s s !
; s q U > & % r $ @ ; .
      . . .
      . . .
      . . .

You can try it out at the online interpreter. Input is in 24 hour format, with the end time first. For example, from 5pm to 1am the input should be 1 17.

Previous version, 45 bytes:

)$442t\/OI0Iuq;;-!^;^%&21u+rr;ss!;sqU>&%r$@.;


问:
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

```

答:
Vitsy, 1 Byte

This is a function that leaves 0 on the stack if true and a non-zero integer on the stack if false.

```<code>M
</code>```

(This is the modulo function.)

Try it Online!

(N has been added for output).

Title: Divisibility test

Body:
Vitsy, 1 Byte

This is a function that leaves 0 on the stack if true and a non-zero integer on the stack if false.

M

(This is the modulo function.)

Try it Online!

(N has been added for output).


问:
The shifting dot
Your program has to print out a number of spaces, followed by a dot and a newline.
The number of spaces is the x position of your dot defined with 0 < x < 30

Every new line is a turn. Your program runs for 30 turns. Your program starts with a random x position and every turn shifts this position randomly by 1 to the left or right, while staying inside the defined area. Every turn your dot has to change its position by 1.

Your score is the number of characters. You get 10 bonus points, if every printed line consists of exactly 30 characters (and newline). You get 50 bonus points, if, while random, your program tends to stay in the middle of the defined area.

Edit:
The 50 bonus points are intended to pull your dot to the middle. For example, this apply's if your dot is at x=20 and has a chance of 66% to go left and 33% to go right. This has to be independent from starting point and should only happen by altering the percentage value of left/right dynamically.

No input of any kind allowed, output has to be on the executing console!

For better understanding, here is a readable example in java, that would give you a score of 723:

public class DotJumper{
    public static void main(String[] args){
        int i = (int)(Math.random()*30);
        int max = 29;
        int step = 1;
        int count = 30;
        while(count>0){
            if(i<=1){
                i+=step;
            }else if(i>=max){
                i-=step;
            }else{
                if(Math.random() > 0.5){
                    i+=step;
                }else{
                    i-=step;
                }
            }
            print(i);
            count--;
        }
    }
    public static void print(int i){
        while(i>0){
            System.out.print(' ');
            i--;
        }
        System.out.println('.');
    }
}
```

答:
Scala, 95 - 10 = 85 bytes

```<code>def r=math.random
Seq.iterate(r*30,30){n=>println(("#"*30)updated(n.toInt,'.'))
(r*2-1+n)round}
</code>```

I'm still thinking about the 50 byte bonus.

Explanation:

```<code>def r=math.random //define a shortcut for math.random, which returns a number 0 <= n < 1
Seq.iterate(      //build a sequence,
  r*30,             //starting with a random number bewteen 0 and 29
  30                //and containing 30 elements.
){n=>             //Calculate each element by applying this function to the previous element
  println(        //print...
    (" "*30)             //30 spaces
    updated(n.toInt,'.') //with the n-th char replaced with a dot
  )               //and a newline.
                  //The next element is
  (r*2-1+n)       //an random number between -1 and 1 plus n
  round           //rounded to the nearest integer.
}
</code>```

Title: The shifting dot

Body:
Scala, 95 - 10 = 85 bytes

def r=math.random
Seq.iterate(r*30,30){n=>println(("#"*30)updated(n.toInt,'.'))
(r*2-1+n)round}

I'm still thinking about the 50 byte bonus.

Explanation:

def r=math.random //define a shortcut for math.random, which returns a number 0 <= n < 1
Seq.iterate(      //build a sequence,
  r*30,             //starting with a random number bewteen 0 and 29
  30                //and containing 30 elements.
){n=>             //Calculate each element by applying this function to the previous element
  println(        //print...
    (" "*30)             //30 spaces
    updated(n.toInt,'.') //with the n-th char replaced with a dot
  )               //and a newline.
                  //The next element is
  (r*2-1+n)       //an random number between -1 and 1 plus n
  round           //rounded to the nearest integer.
}


问:
Hamming numbers
Hamming numbers are numbers which evenly divide a power of 60. Equivalently, their prime factors are all \$ \le 5 \$.

Given a positive integer, print that many Hamming numbers, in order.

Rules:

Input will be a positive integer \$n \le 1,000,000 \$

Output should be the first \$n\$ terms of https://oeis.org/A051037

Execution time must be \$<1\$ minute

This is code-golf; shortest code wins

答:
Haskell, <s>101</s> <s>97</s> 92+|n| characters

```<code>h=1:m 2h&m 3h&m 5h
m=map.(*)
c@(a:b)&o@(m:n)|a<m=a:b&o|a>m=m:c&n|0<1=a:b&n
main=print$take 1000000h
</code>```

Computes the full million in 3.7s on the machine I tested on (variably more if you actually want the output stored)

Ungolfed:

```<code>-- print out the first million Hamming numbers
main = print $ take 1000000 h

-- h is the entire Hamming sequence.
-- It starts with 1; for each number in the
-- sequence, 2n, 3n and 5n are also in.
h = 1 : (m 2 h) & (m 3 h) & (m 5 h)

-- helper: m scales a list by a constant factor
m f xs = map (f*) xs

-- helper: (&) merges two ordered sequences
a@(ha:ta) & b@(hb:tb)
    |    ha < hb = ha : ta & b
    |    ha > hb = hb :  a & tb
    |  otherwise = ha : ta & tb
</code>```

All Haskell is notoriously good at: defining a list as a lazy function of itself, in a way that actually works.

ContentLicense: CC BY-SA 4.0

Title: Hamming numbers

Body:
Haskell, <s>101</s> <s>97</s> 92+|n| characters

h=1:m 2h&m 3h&m 5h
m=map.(*)
c@(a:b)&o@(m:n)|a<m=a:b&o|a>m=m:c&n|0<1=a:b&n
main=print$take 1000000h

Computes the full million in 3.7s on the machine I tested on (variably more if you actually want the output stored)

Ungolfed:

-- print out the first million Hamming numbers
main = print $ take 1000000 h

-- h is the entire Hamming sequence.
-- It starts with 1; for each number in the
-- sequence, 2n, 3n and 5n are also in.
h = 1 : (m 2 h) & (m 3 h) & (m 5 h)

-- helper: m scales a list by a constant factor
m f xs = map (f*) xs

-- helper: (&) merges two ordered sequences
a@(ha:ta) & b@(hb:tb)
    |    ha < hb = ha : ta & b
    |    ha > hb = hb :  a & tb
    |  otherwise = ha : ta & tb

All Haskell is notoriously good at: defining a list as a lazy function of itself, in a way that actually works.

ContentLicense: CC BY-SA 2.5


答:
Haskell, 100 bytes

```<code>import Data.List
r=reverse
e#n=mapM id$e<$[1..n]
f n=nubBy(\a b->elem a[r b,r<$>b,r$r<$>b])$"01"#n#n
</code>```

Usage example: f 2 -> [["00","00"],["00","01"],["00","11"],["01","01"],["01","10"],["01","11"],["11","11"]].

How it works:

```<code>e#n=mapM id$e<$[1..n]        -- helper function: creates a list of all combinations
                             -- of the elements of e of length n
                             -- "01" # 2 -> ["00","01","10","11"]

                   "01"#n#n  -- creates all binary n x n matrices
nubBy                        -- remove duplicates according to the equivalence
                             -- relation
   \a b ->                   -- a equals b if
       a elem                -- a is an element of
         [r b,r<$>b,r$r<$>b] -- the list of reflections of b
</code>```

Body:
Haskell, 100 bytes

import Data.List
r=reverse
e#n=mapM id$e<$[1..n]
f n=nubBy(\a b->elem a[r b,r<$>b,r$r<$>b])$"01"#n#n

Usage example: f 2 -> [["00","00"],["00","01"],["00","11"],["01","01"],["01","10"],["01","11"],["11","11"]].

How it works:

e#n=mapM id$e<$[1..n]        -- helper function: creates a list of all combinations
                             -- of the elements of e of length n
                             -- "01" # 2 -> ["00","01","10","11"]

                   "01"#n#n  -- creates all binary n x n matrices
nubBy                        -- remove duplicates according to the equivalence
                             -- relation
   \a b ->                   -- a equals b if
       a elem                -- a is an element of
         [r b,r<$>b,r$r<$>b] -- the list of reflections of b


问:
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

```

答:
reticular, 2 bytes

```<code>ip
</code>```

This exits with an error, but works fine. Try it online!

```<code>ip
i   take a line of input (no newline)
 p  print it with a newline after
</code>```

Title: Simple cat program

Body:
reticular, 2 bytes

ip

This exits with an error, but works fine. Try it online!

ip
i   take a line of input (no newline)
 p  print it with a newline after


问:
"Hello, World!"
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most interesting code golf in the common languages, finding the shortest solution in certain esolangs can be a serious challenge. For instance, to my knowledge it is not known whether the shortest possible Brainfuck solution has been found yet.

Furthermore, while all of <s>Wikipedia</s> (the Wikipedia entry has been deleted but there is a copy at archive.org
), esolangs and Rosetta Code have lists of "Hello, World!" programs, none of these are interested in having the shortest for each language (there is also this GitHub repository). If we want to be a significant site in the code golf community, I think we should try and create the ultimate catalogue of shortest "Hello, World!" programs (similar to how our basic quine challenge contains some of the shortest known quines in various languages). So let's do this!

The Rules

Each submission must be a full program.

The program must take no input, and print Hello, World! to STDOUT (this exact byte stream, including capitalization and punctuation) plus an optional trailing newline, and nothing else.

The program must not write anything to STDERR.

If anyone wants to abuse this by creating a language where the empty program prints Hello, World!, then congrats, they just paved the way for a very boring answer.

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.

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 "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

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 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.

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 authors actually had to put effort into golfing the code.

For inspiration, check the Hello World Collection.

The 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>## [><>](https://esolangs.org/wiki/Fish), 121 bytes
</code>```

/* Configuration */

var QUESTION_ID = 55422; // 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 = 8478; // 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 = '
' + 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;
  display: block !important;
}

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

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

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}</code>```

<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Awesome, 21 Bytes

```<code>print "Hello, World!"
</code>```

"Awesome" is a sample language created in a e-book about language construction which can be found here: http://createyourproglang.com
No, I didn't write this book but it's still worth a look.

Title: "Hello, World!"

Body:
Awesome, 21 Bytes

print "Hello, World!"

"Awesome" is a sample language created in a e-book about language construction which can be found here: http://createyourproglang.com
No, I didn't write this book but it's still worth a look.


问:
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.

答:
Push-Pop Redundancy

This is a big one.  It is also a little bit of a nuanced one.

The idea is that if you push something and then pop it without doing anything you should not have pushed it at all.

For example, if you want to move something to the offstack and then add one to it you might write the following code:

```<code>({}<>)({}())
</code>```

This can be simpler like this:

```<code>({}<>())
</code>```

The first program picks up the item moves it, picks it up again and adds one, while the second one does both in one fell swoop.

That example was simple however it can get a lot more complex.  Take for instance:

```<code>({}<({}<>)><>)(<((()()()){}[((){}{})])>)
</code>```

The reduction is less clear here but the 4th pop in the program can be reduced with the 2nd push, like so:

```<code>(<((()()()){}[((){}<({}<>)><>{})])>)
</code>```

This is the most powerful tool in my golfing repertoire but it takes some practice to get good at it.  Once you have been doing these for a while you will be able to spot these almost instantly.

Title: Tips for Golfing in Brain-Flak

Body:
Push-Pop Redundancy

This is a big one.  It is also a little bit of a nuanced one.

The idea is that if you push something and then pop it without doing anything you should not have pushed it at all.

For example, if you want to move something to the offstack and then add one to it you might write the following code:

({}<>)({}())

This can be simpler like this:

({}<>())

The first program picks up the item moves it, picks it up again and adds one, while the second one does both in one fell swoop.

That example was simple however it can get a lot more complex.  Take for instance:

({}<({}<>)><>)(<((()()()){}[((){}{})])>)

The reduction is less clear here but the 4th pop in the program can be reduced with the 2nd push, like so:

(<((()()()){}[((){}<({}<>)><>{})])>)

This is the most powerful tool in my golfing repertoire but it takes some practice to get good at it.  Once you have been doing these for a while you will be able to spot these almost instantly.


答:
Use the wiki

We have a wiki!  It has some short comings, but it is helpful resource.  It has lists of useful, well golfed, stack clean programs that you can paste into your code.  If you want to do something you think someone might have done before there is a good chance it is on the wiki.

Title: Tips for Golfing in Brain-Flak

Body:
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.


问:
Print every printable ASCII character without using it
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.

For example, if your language was Python, your program that outputs the character P might be

```<code>print(chr(80))
</code>```

because P has ASCII code 80. This program is valid because P never appears in the source code. However, for the program that outputs lowercase p, something like

```<code>print(chr(112))
</code>```

would be invalid because, while it does print p, p is present in the code. A valid program could be

```<code>exec(chr(112)+'rint(chr(112))')
</code>```

which prints p but does not contain p.

Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.

If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.

The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.

Rules

The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)

Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.

The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.

Each program's output should go to stdout or your language's accepted alternative.

Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)

Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.

A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.

Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80)), print(chr(81)), print(chr(82))..." but make sure you're sure they all would work and that your score is added correctly.

For reference, here are the 95 printable ASCII your programs must output:

```<code> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
</code>```

答:
Sesos, 285 bytes (non-competing)

Every program is compiled by using this syntax:

```<code>add <decimal-ascii-code>
put
</code>```

Try it online!

The exception to that is h, which is this code instead (the other one contained an h):

```<code>set mask
sub 152
put
</code>```

Then, compile it to an SBIN file and run (those are all 3 bytes, so the score is calculated as 3 * 94 + 1 * 3 = 285 B.) Note that the SBIN file is the real program, not the pre-assembly syntax shown here.

Body:
Sesos, 285 bytes (non-competing)

Every program is compiled by using this syntax:

add <decimal-ascii-code>
put

Try it online!

The exception to that is h, which is this code instead (the other one contained an h):

set mask
sub 152
put

Then, compile it to an SBIN file and run (those are all 3 bytes, so the score is calculated as 3 * 94 + 1 * 3 = 285 B.) Note that the SBIN file is the real program, not the pre-assembly syntax shown here.


答:
C++11, 252 bytes

```<code>#include <iostream>
using namespace std;string d("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow");int main(){for(int i=0;i!=45;i+=3){int z=stoi(d.substr(i,3),NULL,36);for(unsigned long p=1;p!=1<<31;p<<=1){cout<<(((z<<16|z)&p)?"##":"  ");}puts("");}}
</code>```

Title: Let's draw some Atari ST bombs!

Body:
Introduction

The Atari ST was a rather popular personal computer from the mid 80's to early 90's era, powered by a Motorola 68000 microprocessor. On this machine, the default behavior of the operating system for uncaught CPU exceptions was to display a row of bombs on the screen, as shown in the following picture:

Source: https://commons.wikimedia.org/wiki/File:Row_of_bombs.png

NB: Depending on the OS version, the bomb graphics may vary slightly. But let's take this one as reference.

The number of bombs depends on the exception vector, the most common ones being:

($008) Bus Error : 2 bombs

($00c) Address Error : 3 bombs

($010) Illegal Instruction : 4 bombs

Goal

Your goal is to write a program or function that prints or outputs an ASCII art of such Atari ST bombs.

Input

An integer representing the number of bombs to display. Your code must support the most common values: 2, 3 and 4. Supporting less and/or more bombs is fine, but it is neither required nor subject to a bonus.

Output

The original bomb consists of a 16x16 pixel tile, represented here in both ASCII and binary:

```<code>....##..........    0000110000000000
.#.#..#.........    0101001000000000
.......#........    0000000100000000
#..#....#.......    1001000010000000
..#...#####.....    0010001111100000
......#####.....    0000001111100000
....#########...    0000111111111000
...###########..    0001111111111100
...###########..    0001111111111100
..#############.    0011111111111110
..########.####.    0011111111011110
...#######.###..    0001111111011100
...######.####..    0001111110111100
....#########...    0000111111111000
.....#######....    0000011111110000
.......###......    0000000111000000
</code>```

In this challenge, each ASCII bomb must be stretched to twice its original width for a better rendering. Therefore, it will consist of 16 rows of 32 characters, using ## for 'ON' pixels and two spaces for 'OFF' pixels. All bomb tiles must be put side by side. Leading spaces are forbidden. Trailing spaces are also forbidden, except the ones that are actually part of the bomb tile (i.e. the 31st and 32nd columns) which must be present. You may include no more than one leading line-break and no more than one trailing line-break.

Example

Below is the reference output for two bombs, where mandatory line-breaks are marked as \n and tolerated extra line-breaks are marked as (\n):

```<code>(\n)
        ####                            ####                    \n
  ##  ##    ##                    ##  ##    ##                  \n
              ##                              ##                \n
##    ##        ##              ##    ##        ##              \n
    ##      ##########              ##      ##########          \n
            ##########                      ##########          \n
        ##################              ##################      \n
      ######################          ######################    \n
      ######################          ######################    \n
    ##########################      ##########################  \n
    ################  ########      ################  ########  \n
      ##############  ######          ##############  ######    \n
      ############  ########          ############  ########    \n
        ##################              ##################      \n
          ##############                  ##############        \n
              ######                          ######            (\n)
</code>```

(Of course, other line-break formats such as \r or \r\n may be used just as well.)

Rules

This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

Body:
C++11, 252 bytes

#include <iostream>
using namespace std;string d("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow");int main(){for(int i=0;i!=45;i+=3){int z=stoi(d.substr(i,3),NULL,36);for(unsigned long p=1;p!=1<<31;p<<=1){cout<<(((z<<16|z)&p)?"##":"  ");}puts("");}}


问:
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 :)

答:
PHP, 116 Bytes

```<code><?$r=[];for($c=count($a=$_GET[a]);$c-=$x;)array_unshift($r,(1+($x=$a[--$c]==$a[$c-1]))*$a[$c]);echo json_encode($r);
</code>```

or

```<code><?$r=[];for($c=count($a=$_GET[a]);$c--;)$r[]=$a[$c]==$a[$c-1]?2*$a[$c--]:$a[$c];echo json_encode(array_reverse($r));
</code>```

-4 Bytes if the output can be an array print_r instead of 'json_encode`

176 Bytes to solve this with a Regex

```<code>echo preg_replace_callback("#(\d+)(,\\1)+#",function($m){if(($c=substr_count($m[0],$m[1]))%2)$r=$m[1];$r.=str_repeat(",".$m[1]*2,$c/2);return trim($r,",");},join(",",$_GET[a]));
</code>```

Title: 2048-like array shift

Body:
PHP, 116 Bytes

<?$r=[];for($c=count($a=$_GET[a]);$c-=$x;)array_unshift($r,(1+($x=$a[--$c]==$a[$c-1]))*$a[$c]);echo json_encode($r);

or

<?$r=[];for($c=count($a=$_GET[a]);$c--;)$r[]=$a[$c]==$a[$c-1]?2*$a[$c--]:$a[$c];echo json_encode(array_reverse($r));

-4 Bytes if the output can be an array print_r instead of 'json_encode`

176 Bytes to solve this with a Regex

echo preg_replace_callback("#(\d+)(,\\1)+#",function($m){if(($c=substr_count($m[0],$m[1]))%2)$r=$m[1];$r.=str_repeat(",".$m[1]*2,$c/2);return trim($r,",");},join(",",$_GET[a]));


答:
Haskell, <s>47</s> <s>57</s> 50 bytes

```<code>e#l|a:b<-l,e==a= -2*a:b|1<2=e:l
map abs.foldr(#)[]
</code>```

Uses reduce (or fold as it is called in Haskell, here a right-fold foldr). Usage example: map abs.foldr(#)[] $ [2,2,2,4,4,8] -> [2,4,8,8].

Edit: +10 bytes to make it work for unsorted arrays, too. Merged numbers are inserted as negative values to prevent a second merge. They are corrected by a final  map abs.

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:
Haskell, <s>47</s> <s>57</s> 50 bytes

e#l|a:b<-l,e==a= -2*a:b|1<2=e:l
map abs.foldr(#)[]

Uses reduce (or fold as it is called in Haskell, here a right-fold foldr). Usage example: map abs.foldr(#)[] $ [2,2,2,4,4,8] -> [2,4,8,8].

Edit: +10 bytes to make it work for unsorted arrays, too. Merged numbers are inserted as negative values to prevent a second merge. They are corrected by a final  map abs.


答:
Jelly, <s>10 9</s> 8 bytes

```<code>Œg+2/€UF
</code>```

TryItOnline or run all test cases

How?

```<code>Œg+2/€UF - Main link: a                 e.g. [2,2,2,4,4,8]
Œg       - group runs of equal elements      [[2,2,2],[4,4],[8]]
   2/€   - pairwise reduce for each with
  +      -     addition                      [[4,2],[8],[8]]
      U  - reverse (vectorises)              [[2,4],[8],[8]]
       F - flatten list                      [2,4,8,8]

</code>```

Title: 2048-like array shift

Body:
Jelly, <s>10 9</s> 8 bytes

Œg+2/€UF

TryItOnline or run all test cases

How?

Œg+2/€UF - Main link: a                 e.g. [2,2,2,4,4,8]
Œg       - group runs of equal elements      [[2,2,2],[4,4],[8]]
   2/€   - pairwise reduce for each with
  +      -     addition                      [[4,2],[8],[8]]
      U  - reverse (vectorises)              [[2,4],[8],[8]]
       F - flatten list                      [2,4,8,8]


答:
Perl, 43 + 1 (-p) = 44 bytes

Ton Hospel came up with 41 bytes answer, check it out!

 -4 thanks to @Ton Hospel!

Edit : added \b, as without it it was failing on input like 24 4 on which the output would have been 28.

$_=reverse reverse=~s/(\b\d+) \1\b/$1*2/rge
```

<p>Run with <code>-p</code> flag :  </p>

```perl -pe '$_=reverse reverse=~s/(\b\d+) \1\b/$1*2/rge' <<< "2 2 2 4 4"
```

I don't see another way than using reverse twice to right-fold (as just s/(\d+) \1/$1*2/ge would left-fold, i.e 2 2 2 would become 4 2 instead of 2 4). So 14 bytes lost thanks to reverse... Still I think there must be another (better) way (it's perl after all!), let me know if you find it!

Title: 2048-like array shift

Body:
Perl, 43 + 1 (-p) = 44 bytes

Ton Hospel came up with 41 bytes answer, check it out!

 -4 thanks to @Ton Hospel!

Edit : added \b, as without it it was failing on input like 24 4 on which the output would have been 28.

$_=reverse reverse=~s/(\b\d+) \1\b/$1*2/rge

Run with -p flag :

perl -pe '$_=reverse reverse=~s/(\b\d+) \1\b/$1*2/rge' <<< "2 2 2 4 4"

I don't see another way than using reverse twice to right-fold (as just s/(\d+) \1/$1*2/ge would left-fold, i.e 2 2 2 would become 4 2 instead of 2 4). So 14 bytes lost thanks to reverse... Still I think there must be another (better) way (it's perl after all!), let me know if you find it!


答:
Retina, 32

```<code>\d+
$*
r`\b\1 (1+)\b
$1$1
1+
$.&
</code>```

r on line 3 activates right-to-left regex matching.  And this means that the \1 reference needs to come before the (1+) capturing group that it references.

Try it online.

Title: 2048-like array shift

Body:
Retina, 32

\d+
$*
r`\b\1 (1+)\b
$1$1
1+
$.&

r on line 3 activates right-to-left regex matching.  And this means that the \1 reference needs to come before the (1+) capturing group that it references.

Try it online.


答:
GNU sed, 41 38 37

Includes +1 for -r

-3 Thanks to Digital Trauma

-1 Thanks to seshoumara

```<code>:
s,(.*)(1+) \2\b,\1!\2\2!,
t
y,!, ,
</code>```

Input and output are space separated strings in unary (based on this consensus).

Try it online!

Title: 2048-like array shift

Body:
GNU sed, 41 38 37

Includes +1 for -r

-3 Thanks to Digital Trauma

-1 Thanks to seshoumara

:
s,(.*)(1+) \2\b,\1!\2\2!,
t
y,!, ,

Input and output are space separated strings in unary (based on this consensus).

Try it online!


答:
05AB1E, 26 bytes

```<code>D¥__X¸«DgL*ê¥X¸«£vy2ôO})í˜
</code>```

Try it online!

Generalized steps

Reduce by subtraction to find where consecutive elements differ

Reduce by subtraction over the indices of those places to find the length of consecutive elements

Split input into chunks of those lengths

Split chunks into pairs

Sum each pair

Reverse each summed chunk

Flatten to 1-dimensional list

Title: 2048-like array shift

Body:
05AB1E, 26 bytes

D¥__X¸«DgL*ê¥X¸«£vy2ôO})í˜

Try it online!

Generalized steps

Reduce by subtraction to find where consecutive elements differ

Reduce by subtraction over the indices of those places to find the length of consecutive elements

Split input into chunks of those lengths

Split chunks into pairs

Sum each pair

Reverse each summed chunk

Flatten to 1-dimensional list


答:
JavaScript (ES6), <s> 68...64 </s> 58 bytes

a=>(g=p=>(x=a.pop())|p?p?[...g(p^x?x:!(p*=2)),p]:g(x):a)()
```
<p>Try it online!</p>
<h3>Commented</h3>
<pre class="lang-javascript prettyprint-override"><code>a => (                  // a[] = input array
  g = p =>              // g is a recursive function taking p = previous value
    (x = a.pop())       //   extract the last entry x from a[]
    | p ?               //   if either x or p is a positive integer:
      p ?               //     if p is a positive integer:
        [               //       update the output:
          ...g(         //         do a recursive call:
            p ^ x ?     //           if p is not equal to x:
              x         //             set new_p = x
            :           //           else:
              !(p *= 2) //             double p and set new_p = false
          ),            //         end of recursive call
          p             //         append p
        ]               //       end of output update
      :                 //     else:
        g(x)            //       do a simple recursive call with new_p = x
    :                   //   else:
      a                 //     stop recursion and return a[], which is guaranteed
                        //     to be an empty array at this point
)()                     // initial call to g with p undefined
</code>```

Title: 2048-like array shift

Body:
JavaScript (ES6), <s> 68...64 </s> 58 bytes

a=>(g=p=>(x=a.pop())|p?p?[...g(p^x?x:!(p*=2)),p]:g(x):a)()

Try it online!

Commented

a => (                  // a[] = input array
  g = p =>              // g is a recursive function taking p = previous value
    (x = a.pop())       //   extract the last entry x from a[]
    | p ?               //   if either x or p is a positive integer:
      p ?               //     if p is a positive integer:
        [               //       update the output:
          ...g(         //         do a recursive call:
            p ^ x ?     //           if p is not equal to x:
              x         //             set new_p = x
            :           //           else:
              !(p *= 2) //             double p and set new_p = false
          ),            //         end of recursive call
          p             //         append p
        ]               //       end of output update
      :                 //     else:
        g(x)            //       do a simple recursive call with new_p = x
    :                   //   else:
      a                 //     stop recursion and return a[], which is guaranteed
                        //     to be an empty array at this point
)()                     // initial call to g with p undefined


答:
Python 2, 94 bytes

def f(a,r=[]):
 while a:
    if len(a)>1and a[-1]==a[-2]:a.pop();a[-1]*=2
    r=[a.pop()]+r
 print r
```

Try it online

Title: 2048-like array shift

Body:
Python 2, 94 bytes

def f(a,r=[]):
 while a:
    if len(a)>1and a[-1]==a[-2]:a.pop();a[-1]*=2
    r=[a.pop()]+r
 print r

Try it online


答:
Brain-Flak, 158 96

```<code>{({}<>)<>}<>{(({}<>)<><(({})<<>({}<>)>)>)({}[{}]<(())>){((<{}{}>))}{}{{}(<({}{})>)}{}({}<>)<>}<>
</code>```

Try it online!

Explanation:

1 Reverse the list (moving everything to the other stack, but that doesn't matter)

```<code>{({}<>)<>}<>
{        }   #keep moving numbers until you hit the 0s from an empty stack
 ({}<>)      #pop a number and push it on the other stack
       <>    #go back to the original stack
          <> #after everything has moved, switch stacks
</code>```

2 Do steps 3-6 until there is nothing left on this stack:

```<code>{                                                                                }
</code>```

3 Duplicate the top two elements (2 3 -> 2 3 2 3)

```<code>(({}<>)<><(({})<<>({}<>)>)>)

(({}<>)<>                   #put the top number on the other stack and back on the very top
         <(({})             #put the next number on top after:
               <<>({}<>)>   #copying the original top number back to the first stack
                         )>)
</code>```

4 Put a 1 on top if the top two are equal, a 0 otherwise (from the wiki)

```<code>({}[{}]<(())>){((<{}{}>))}{}
</code>```

5 If the top two were equal (non-zero on the top) add the next two and push the result

```<code>{{}(<({}{})>)}{}
{            }   #skip this if there is a 0 on top
 {}              #pop the 1
   (<      >)    #push a 0 after:
     ({}{})      #pop 2 numbers, add them together and push them back on
              {} #pop off the 0
</code>```

6 Move the top element to the other stack

```<code>({}<>)<>
</code>```

7 Switch to the other stack and print implicitly

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

Title: 2048-like array shift

Body:
Brain-Flak, 158 96

{({}<>)<>}<>{(({}<>)<><(({})<<>({}<>)>)>)({}[{}]<(())>){((<{}{}>))}{}{{}(<({}{})>)}{}({}<>)<>}<>

Try it online!

Explanation:

1 Reverse the list (moving everything to the other stack, but that doesn't matter)

{({}<>)<>}<>
{        }   #keep moving numbers until you hit the 0s from an empty stack
 ({}<>)      #pop a number and push it on the other stack
       <>    #go back to the original stack
          <> #after everything has moved, switch stacks

2 Do steps 3-6 until there is nothing left on this stack:

{                                                                                }

3 Duplicate the top two elements (2 3 -> 2 3 2 3)

(({}<>)<><(({})<<>({}<>)>)>)

(({}<>)<>                   #put the top number on the other stack and back on the very top
         <(({})             #put the next number on top after:
               <<>({}<>)>   #copying the original top number back to the first stack
                         )>)

4 Put a 1 on top if the top two are equal, a 0 otherwise (from the wiki)

({}[{}]<(())>){((<{}{}>))}{}

5 If the top two were equal (non-zero on the top) add the next two and push the result

{{}(<({}{})>)}{}
{            }   #skip this if there is a 0 on top
 {}              #pop the 1
   (<      >)    #push a 0 after:
     ({}{})      #pop 2 numbers, add them together and push them back on
              {} #pop off the 0

6 Move the top element to the other stack

({}<>)<>

7 Switch to the other stack and print implicitly

<>


答:
///, 20 bytes

```<code>/[0 /[// 0]/]//[0]//
</code>```

Try it online!

Input as list of integers separated by spaces and surrounded by square brackets ([0 1 2 3 4 5 0]).

Title: Remove leading and trailing zeroes

Body:
Given a non-empty list/array containing only non-negative integers like this:

```<code>[0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]
</code>```

Output the list with trailing and leading zeroes removed.

The output for this would be:

```<code>[8, 1, 4, 3, 5, 6, 4, 1, 2]
</code>```

Some other test cases:

```<code>[0, 4, 1, 2, 0, 1, 2, 4, 0] > [4, 1, 2, 0, 1, 2, 4]
[0, 0, 0, 0, 0, 0] > nothing
[3, 4, 5, 0, 0] > [3, 4, 5]
[6] > [6]
</code>```

Shortest code wins

Body:
///, 20 bytes

/[0 /[// 0]/]//[0]//

Try it online!

Input as list of integers separated by spaces and surrounded by square brackets ([0 1 2 3 4 5 0]).


答:
///, 220 bytes

```<code>/H/2E//G/CBDCC//F/ABC2C//E/AC//D/2B//C/A2//A/33//B/32//2/0 //3/1 /2G22C3
ABFDB3
ABDBHABB
BG2D2
EFDB
EDCEAB3
DG22A
HFD3
HDBHAB
BBG223
2HFD
BEDBHA3
DBG22
CEF23
DEDCEA
BBBG2
DHF2
BBEDCE3
CBBG
2DHF
DBEDBH
ABBBCBDCA
22DHABC2A
</code>```

Try it online!

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:
///, 220 bytes

/H/2E//G/CBDCC//F/ABC2C//E/AC//D/2B//C/A2//A/33//B/32//2/0 //3/1 /2G22C3
ABFDB3
ABDBHABB
BG2D2
EFDB
EDCEAB3
DG22A
HFD3
HDBHAB
BBG223
2HFD
BEDBHA3
DBG22
CEF23
DEDCEA
BBBG2
DHF2
BBEDCE3
CBBG
2DHF
DBEDBH
ABBBCBDCA
22DHABC2A

Try it online!