问:
Draw the national flag of Iceland
This year's UEFA Euro 2016 is over and besides a couple of negative headlines there has been a very positive surprise as well – the Iceland national football team. Let's draw their national flag.

Input

Well, obviously this challenge has no input.

Output

Draw the flag of Iceland in any applicable visual format of at least 100 x 72 pixels or 25 x 18 characters.

Save the output to a file or present it instantly – example formats are: images like png, jpg etc., vector graphics, draw on HTML canvas or even use non-whitespace characters for visualization.

Use these colors: blue: #0048e0, white: #ffffff and red: #d72828.

If your language doesn't support specific color values, use the standard values for red, blue and white from the ANSI color codes.

Draw the flag with the correct proportions, as shown in the figure below:

Boilerplate

You can write a program or a function. If it is an anonymous function, please include an example of how to invoke it.

This is code-golf so shortest answer in bytes wins.

Standard loopholes are disallowed.

Leaderboard

var QUESTION_ID = 85141; // 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 = 41859; // This should be the user ID of the challenge author.
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,]*[^\s,]),.*?(-?\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,});});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;if (! /<a/.test(lang)) lang = '' + lang + '';lang = jQuery(lang).text().toLowerCase();languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link, uniq: lang};});var langs = [];for (var lang in languages)if (languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function (a, b) {if (a.uniq > b.uniq) return 1;if (a.uniq < b.uniq) return -1;return 0;});for (var i = 0; i < langs.length; ++i){var language = jQuery("#language-template").html();var lang = langs[i];language = language.replace("{{LANGUAGE}}", lang.lang).replace("{{NAME}}", lang.user).replace("{{SIZE}}", lang.size).replace("{{LINK}}", lang.link);language = jQuery(language);jQuery("#languages").append(language);}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}#answer-list {padding: 10px;width: 290px;float: left;}#language-list {padding: 10px;width: 290px;float: left;}table thead {font-weight: bold;}table td {padding: 5px;}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

If you can't find your answer, format your language and byte count as explained in the Leaderboard's "Info Section".

This challenge is inspired by Draw the national flag of france.

答:
TI-BASIC (non-competing), 323 bytes

Code is written for the TI-84, 83, and variants. I sure hope it isn't an issue that dimensions vary by device, and that the code isn't colored.

Setup:

```<code>:18→Xmax:¯18→Xmin
:10→Ymin:¯10→Ymin
:AxesOff
</code>```

Drawing:

```<code>:Line(¯15,9,¯8,9)
:Line(¯8,9,¯8,2)
:Line(¯8,2,¯15,2)
:Line(¯15,2,¯15,9)

:Line(¯15,¯9,¯8,¯9)
:Line(¯8,¯9,¯8,¯2)
:Line(¯8,¯2,¯15,¯2)
:Line(¯15,¯2,¯15,¯9)

:Line(¯4,9,10,9)
:Line(¯4,2,10,2)
:Line(¯4,9,¯4,2)
:Line(10,9,19,2)

:Line(¯4,¯9,10,¯9)
:Line(¯4,¯2,10,¯2)
:Line(¯4,¯9,¯4,¯2)
:Line(10,¯9,19,¯2)

:Line(¯15,1,¯7,1)
:Line(¯15,¯1,¯7,¯1)
:Line(¯5,1,20,1)
:Line(¯5,¯1,¯20,¯1)
:Line(¯7,¯1,¯7,¯9)
:Line(¯5,¯1,¯5,¯9)
:Line(¯7,1,¯7,9)
:Line(¯5,1,¯5,9)
</code>```

Golfed:

```<code>:18→Xmax:¯18→Xmin:10→Ymin:¯10→Ymin:AxesOff:Line(¯15,9,¯8,9:Line(¯8,9,¯8,2:Line(¯8,2,¯15,2:Line(¯15,2,¯15,9:Line(¯15,¯9,¯8,¯9:Line(¯8,¯9,¯8,¯2:Line(¯8,¯2,¯15,¯2:Line(¯15,¯2,¯15,¯9:Line(¯4,9,10,9:Line(¯4,2,10,2:Line(¯4,9,¯4,2:Line(10,9,19,2:Line(¯4,¯9,10,¯9:Line(¯4,¯2,10,¯2:Line(¯4,¯9,¯4,¯2:Line(10,¯9,19,¯2:Line(¯15,1,¯7,1:Line(¯15,¯1,¯7,¯1:Line(¯5,1,20,1:Line(¯5,¯1,¯20,¯1:Line(¯7,¯1,¯7,¯9:Line(¯5,¯1,¯5,¯9:Line(¯7,1,¯7,9:Line(¯5,1,¯5,9
</code>```

Yes, the lack of ) is intentional.

Size:

Line( and all commands like that take up 1 byte, each number takes a byte. That's 323 bytes.

That was absolutely tedious. I'll get this on an emulator hopefully (I have to manually enter everything) but it's literally just lines in the shape of the flag.

Title: Draw the national flag of Iceland

Body:
TI-BASIC (non-competing), 323 bytes

Code is written for the TI-84, 83, and variants. I sure hope it isn't an issue that dimensions vary by device, and that the code isn't colored.

Setup:

:18→Xmax:¯18→Xmin
:10→Ymin:¯10→Ymin
:AxesOff

Drawing:

:Line(¯15,9,¯8,9)
:Line(¯8,9,¯8,2)
:Line(¯8,2,¯15,2)
:Line(¯15,2,¯15,9)

:Line(¯15,¯9,¯8,¯9)
:Line(¯8,¯9,¯8,¯2)
:Line(¯8,¯2,¯15,¯2)
:Line(¯15,¯2,¯15,¯9)

:Line(¯4,9,10,9)
:Line(¯4,2,10,2)
:Line(¯4,9,¯4,2)
:Line(10,9,19,2)

:Line(¯4,¯9,10,¯9)
:Line(¯4,¯2,10,¯2)
:Line(¯4,¯9,¯4,¯2)
:Line(10,¯9,19,¯2)

:Line(¯15,1,¯7,1)
:Line(¯15,¯1,¯7,¯1)
:Line(¯5,1,20,1)
:Line(¯5,¯1,¯20,¯1)
:Line(¯7,¯1,¯7,¯9)
:Line(¯5,¯1,¯5,¯9)
:Line(¯7,1,¯7,9)
:Line(¯5,1,¯5,9)

Golfed:

:18→Xmax:¯18→Xmin:10→Ymin:¯10→Ymin:AxesOff:Line(¯15,9,¯8,9:Line(¯8,9,¯8,2:Line(¯8,2,¯15,2:Line(¯15,2,¯15,9:Line(¯15,¯9,¯8,¯9:Line(¯8,¯9,¯8,¯2:Line(¯8,¯2,¯15,¯2:Line(¯15,¯2,¯15,¯9:Line(¯4,9,10,9:Line(¯4,2,10,2:Line(¯4,9,¯4,2:Line(10,9,19,2:Line(¯4,¯9,10,¯9:Line(¯4,¯2,10,¯2:Line(¯4,¯9,¯4,¯2:Line(10,¯9,19,¯2:Line(¯15,1,¯7,1:Line(¯15,¯1,¯7,¯1:Line(¯5,1,20,1:Line(¯5,¯1,¯20,¯1:Line(¯7,¯1,¯7,¯9:Line(¯5,¯1,¯5,¯9:Line(¯7,1,¯7,9:Line(¯5,1,¯5,9

Yes, the lack of ) is intentional.

Size:

Line( and all commands like that take up 1 byte, each number takes a byte. That's 323 bytes.

That was absolutely tedious. I'll get this on an emulator hopefully (I have to manually enter everything) but it's literally just lines in the shape of the flag.


问:
Cannonball Conundrum
Your task is to, with an input number p, find the smallest positive cannonball number of order p that is NOT 1.

Definition

A cannonball number (of order p) is a number which is both:

An p-gonal number (See this page).

and an p-gonal pyramid number.

The nth p-gonal pyramid number is the sum of the 1st to nth p-gonal numbers.

(e.g. 4th square pyramid number = 1 + 4 + 9 + 16 = 30)

The picture below represents the 4th square pyramid number, as a square pyramid.

For more info, visit this link.

The cannonball number of order 3, for example, is 10, because it is:

The fourth triangle number (1 + 2 + 3 + 4 = 10)

and the third triangular pyramid number. (1 + 3 + 6 = 10)

Formulas

NOTE: If you can find (or make) more useful formulae than my ones here, please post it here (or message me on the question chat thing).

If you're interested, the formula for the nth p-gonal number is:

And the nth p-gonal pyramid number is:

Specs

p is guaranteed to be larger than 2.

The program must check values for a solution for p up to (and including) 2^16. Your program may do anything if no solutions are found for p.

Only positive indices for n.

Test cases

3 outputs 10 (4th triangle number, 3rd triangle pyramid number)

4 outputs 4900 (70th square number, 24th square pyramid number)

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

Note: If you do post a solution, please include a description of how the code works.

Should I start a bounty for a solution which is better and doesn't use my formulae?

答:
old PHP program, <s>115</s> 106 bytes

+16 for current PHP, see below

```<code><?for($b=2;1;$b++)for($p=$b*($b*3+$b*$b*($n-2)-$n+5)/6;$g<$p;++$c)if($p==$g=$c*($c*$n-2*$c-$n+4)/2)echo$p;
</code>```

loops forever

usage: with PHP<4.2: run from browser with

ContentLicense: CC BY-SA 3.0

Title: Cannonball Conundrum

Body:
old PHP program, <s>115</s> 106 bytes

+16 for current PHP, see below

<?for($b=2;1;$b++)for($p=$b*($b*3+$b*$b*($n-2)-$n+5)/6;$g<$p;++$c)if($p==$g=$c*($c*$n-2*$c-$n+4)/2)echo$p;

loops forever

usage: with PHP<4.2: run from browser with <scriptpath>?n=<number>

with PHP<5.4, add register_globals=1 to php.ini (+18 ?)

see my JavaScript answer for description

+10 for PHP>=5.4: replace 1 with $n=$_GET[n]. Or replace 1 with $n=$argv[1], run php -f <filename> <number>.

+6 for finite loop on success: replace echo$p with die(print$p)

+/- 0 for function:

function f($n){for($b=2;1;$b++)for($p=$b*($b*3+$b*$b*($n-2)-$n+5)/6;$g<$p;++$c)if($p==$g=$c*($c*$n-2*$c-$n+4)/2)return$p;}

loops forever if it finds nothing. Replace 1 with $p<1e6 to break at 100k or with $p<$p+1 to loop until integer overflow. (tested with PHP 5.6)

examples (on function)

$samples=[3,4,6,8,10,11,14,17,23,26,30,32,35,41,43,50,88];
foreach($samples as $n)echo "<br>n=$n: ", f($n);

examples output

n=3: 10
n=4: 4900
n=6: 946
n=8: 1045
n=10: 175
n=11: 23725
n=14: 441
n=17: 975061
n=23: 10680265
n=26: 27453385
n=30: 23001
n=32: 132361021
n=35: 258815701
n=41: 55202400
n=43: 245905
n=50: 314755
n=88: 48280


答:
JavaScript + HTML, 267 bytes

document.write("
`linear-gradient(to ${d+(t=",transparent ")+a}%,#${c} ${a}%,#${c} ${o}%${t+o}%)`)+",#003897'")```

Title: Draw the national flag of Iceland

Body:
This year's UEFA Euro 2016 is over and besides a couple of negative headlines there has been a very positive surprise as well – the Iceland national football team. Let's draw their national flag.

Input

Well, obviously this challenge has no input.

Output

Draw the flag of Iceland in any applicable visual format of at least 100 x 72 pixels or 25 x 18 characters.

Save the output to a file or present it instantly – example formats are: images like png, jpg etc., vector graphics, draw on HTML canvas or even use non-whitespace characters for visualization.

Use these colors: blue: #0048e0, white: #ffffff and red: #d72828.

If your language doesn't support specific color values, use the standard values for red, blue and white from the ANSI color codes.

Draw the flag with the correct proportions, as shown in the figure below:

Boilerplate

You can write a program or a function. If it is an anonymous function, please include an example of how to invoke it.

This is code-golf so shortest answer in bytes wins.

Standard loopholes are disallowed.

Leaderboard

var QUESTION_ID = 85141; // 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 = 41859; // This should be the user ID of the challenge author.
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,]*[^\s,]),.*?(-?\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,});});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;if (! /<a/.test(lang)) lang = '' + lang + '';lang = jQuery(lang).text().toLowerCase();languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link, uniq: lang};});var langs = [];for (var lang in languages)if (languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function (a, b) {if (a.uniq > b.uniq) return 1;if (a.uniq < b.uniq) return -1;return 0;});for (var i = 0; i < langs.length; ++i){var language = jQuery("#language-template").html();var lang = langs[i];language = language.replace("{{LANGUAGE}}", lang.lang).replace("{{NAME}}", lang.user).replace("{{SIZE}}", lang.size).replace("{{LINK}}", lang.link);language = jQuery(language);jQuery("#languages").append(language);}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}#answer-list {padding: 10px;width: 290px;float: left;}#language-list {padding: 10px;width: 290px;float: left;}table thead {font-weight: bold;}table td {padding: 5px;}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

If you can't find your answer, format your language and byte count as explained in the Leaderboard's "Info Section".

This challenge is inspired by Draw the national flag of france.

Body:
JavaScript + HTML, 267 bytes

document.write("<div style='width:250px;height:180px;background:"+[[b="bottom",44.4,d="d72828",55.6],[r="right",32,d,40],[b,38.9,e="fff",61.1],[r,28,e,44]].map(([d,a,c,o])=>`linear-gradient(to ${d+(t=",transparent ")+a}%,#${c} ${a}%,#${c} ${o}%${t+o}%)`)+",#003897'")

ContentLicense: CC BY-SA 4.0


问:
Illustrate music beats
You know—they look like this:

source

The goal is to draw a music beats illustration like the following:

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

The rules are:

The width of the illustration is 33 symbols, but if you need—any trailing spaces exceeding this width are allowed.

Each column is made of equals signs (=).

Each column has a random height (the height of the next column shouldn’t depend in any way on the height of the previous column), varying from 1 to 6. It’s also fine if it’s at least possible to get some input with no strict math probability (i.e. some inputs could appear more rarely than others).

A column can’t float above the bottom and have gaps in it.

Since every column has the minimal height of 1, the last row can’t have any gaps either—it always consists of 33 equals signs.

Since it’s possible to have no columns with the height of 6 (it’s all random after all): in this case you don’t need to have a top line made of spaces. Applies to any edge cases of this nature: if suddenly your code provided no columns with the height greater than 1, you don’t need to have additional lines made of spaces above the bottom line.

You don’t take any input.

答:
R, 102 bytes

```<code>m=rep(" ",33);for(i in 1:6){n=ifelse(m=="=",m,sample(c(" ","="),33,T,c(6-i,i)));m=n;cat(n,"\n",sep="")}
</code>```

Explanation

m=rep(" ",33) init an empty vector for the upcoming loop

n=ifelse(m=="=",m,sample(c(" ","="),33,T,c(6-i,i))) If there's an = in the row above, then make sure the spot below also has an =; otherwise randomly pick. Random picks are weighted to make sure that a) the bottom row is all = and b) you get a neat shape to the whole thing.

cat(n,"\n",sep="") output that row to the console with a newline at the end and no spaces between elements!

Title: Illustrate music beats

Body:
R, 102 bytes

m=rep(" ",33);for(i in 1:6){n=ifelse(m=="=",m,sample(c(" ","="),33,T,c(6-i,i)));m=n;cat(n,"\n",sep="")}

Explanation

m=rep(" ",33) init an empty vector for the upcoming loop

n=ifelse(m=="=",m,sample(c(" ","="),33,T,c(6-i,i))) If there's an = in the row above, then make sure the spot below also has an =; otherwise randomly pick. Random picks are weighted to make sure that a) the bottom row is all = and b) you get a neat shape to the whole thing.

cat(n,"\n",sep="") output that row to the console with a newline at the end and no spaces between elements!


答:
JavaScript (ES6), 116 bytes

(a=Array(33).fill``.map(_=>[,,,,,,].fill` `.fill('=',Math.random()*6)))[0].map((x,i)=>a.map(x=>x[i]).join``).join`
`
```

<p><img src="https://i.stack.imgur.com/o3CW1.png" alt="Snippet preview"></p>

<p>Check it out in the animated snippet below:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>F = () => (a=Array(33).fill``.map(_=>[,,,,,,].fill` `.fill('=',Math.random()*6)))[0].map((x,i)=>a.map(x=>x[i]).join``).join`
`

var interval;
G = () => output.innerHTML = F().split('\n').map((r, i) => `<span id="row-${6-i}">${r}</span>`).join('\n');
A = () => {
  clearInterval(interval);
  if (auto.checked) {
    speed.disabled = false;
    interval = setInterval(G, speed.value);
  } else {
    speed.disabled = true;
  }
}
S = () => {
  if (stylized.checked) {
    output.classList.add('stylized');
  } else {
    output.classList.remove('stylized');
  }
}

generate.onclick = G;
auto.onchange = speed.onchange = A;
stylized.onchange = S;

G();
A();
S();</code>```

#output {
  background: #000;
  color: #9fff8a;
  overflow: hidden;
  padding: 1em;
  line-height: 1;
}

#output.stylized {
  line-height: 0.25;
  font-size: 2em;
  margin: 0.5em 0 0 0;
  padding: 0.5em;
}

.stylized #row-1 { color: #9fff8a; }
.stylized #row-2 { color: #c5ff8a; }
.stylized #row-3 { color: #e0ff8a; }
.stylized #row-4 { color: #ffe88a; }
.stylized #row-5 { color: #ffc28a; }
.stylized #row-6 { color: #ff8a8a; }```
<pre class="snippet-code-html lang-html prettyprint-override"><code><button id="generate">Generate</button>
<label>Auto: <input id="auto" type="checkbox" checked/></label>
<label>Speed: <select id="speed">
  <option value="25">25</option>
  <option value="50">50</option>
  <option value="100" selected>100</option>
  <option value="200">200</option>
  <option value="400">400</option>
  <option value="600">600</option>
  <option value="800">800</option>
  <option value="1000">1000</option>
</select></label>
<label>Stylized: <input id="stylized" type="checkbox" checked/></label>
<pre id="output">``````

Title: Illustrate music beats

Body:
You know—they look like this:

source

The goal is to draw a music beats illustration like the following:

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

The rules are:

The width of the illustration is 33 symbols, but if you need—any trailing spaces exceeding this width are allowed.

Each column is made of equals signs (=).

Each column has a random height (the height of the next column shouldn’t depend in any way on the height of the previous column), varying from 1 to 6. It’s also fine if it’s at least possible to get some input with no strict math probability (i.e. some inputs could appear more rarely than others).

A column can’t float above the bottom and have gaps in it.

Since every column has the minimal height of 1, the last row can’t have any gaps either—it always consists of 33 equals signs.

Since it’s possible to have no columns with the height of 6 (it’s all random after all): in this case you don’t need to have a top line made of spaces. Applies to any edge cases of this nature: if suddenly your code provided no columns with the height greater than 1, you don’t need to have additional lines made of spaces above the bottom line.

You don’t take any input.

Body:
JavaScript (ES6), 116 bytes

(a=Array(33).fill``.map(_=>[,,,,,,].fill` `.fill('=',Math.random()*6)))[0].map((x,i)=>a.map(x=>x[i]).join``).join`
`

Check it out in the animated snippet below:

F = () => (a=Array(33).fill``.map(_=>[,,,,,,].fill` `.fill('=',Math.random()*6)))[0].map((x,i)=>a.map(x=>x[i]).join``).join`
`

var interval;
G = () => output.innerHTML = F().split('\n').map((r, i) => `<span id="row-${6-i}">${r}</span>`).join('\n');
A = () => {
  clearInterval(interval);
  if (auto.checked) {
    speed.disabled = false;
    interval = setInterval(G, speed.value);
  } else {
    speed.disabled = true;
  }
}
S = () => {
  if (stylized.checked) {
    output.classList.add('stylized');
  } else {
    output.classList.remove('stylized');
  }
}

generate.onclick = G;
auto.onchange = speed.onchange = A;
stylized.onchange = S;

G();
A();
S();

#output {
  background: #000;
  color: #9fff8a;
  overflow: hidden;
  padding: 1em;
  line-height: 1;
}

#output.stylized {
  line-height: 0.25;
  font-size: 2em;
  margin: 0.5em 0 0 0;
  padding: 0.5em;
}

.stylized #row-1 { color: #9fff8a; }
.stylized #row-2 { color: #c5ff8a; }
.stylized #row-3 { color: #e0ff8a; }
.stylized #row-4 { color: #ffe88a; }
.stylized #row-5 { color: #ffc28a; }
.stylized #row-6 { color: #ff8a8a; }

<button id="generate">Generate</button>
<label>Auto: <input id="auto" type="checkbox" checked/></label>
<label>Speed: <select id="speed">
  <option value="25">25</option>
  <option value="50">50</option>
  <option value="100" selected>100</option>
  <option value="200">200</option>
  <option value="400">400</option>
  <option value="600">600</option>
  <option value="800">800</option>
  <option value="1000">1000</option>
</select></label>
<label>Stylized: <input id="stylized" type="checkbox" checked/></label>
<pre id="output"></pre>


问:
Is case sensitivity important?
Tom is going to implement a new programming language of his invention.  But before actually starting working on it, he wants to know whether his language should be case sensitive or not.

On one hand, case insensitivity seems more easy to implement to him, but he worries that it could cause a lack in the possibilities of combinations of characters that form a variable, meaning that longer variable names should then be used to avoid naming clashes (for an example, you can use Hello, HEllo, heLLo and a bunch of other possibilities if the language is case sensitive, but only HELLO if not).

But Tom is a meticulous person, so just a worry isn't enough for him. He wants to know the numbers.

The challenge

Write a function (or a full program if your language doesn't support them) that, given an integer n as the input, outputs (or returns) the difference in the number of permutations possible for a string of length n with case sensitivity and without.

In Tom's language, variable names can include all alphabet letters, underscores and, starting from the second character, digits.

Testcases

```<code>Input (length of the variable) -> Output (difference between the possibilities with case sensitivity and the possibilities with case insensitivity)
0 -> 0
1 -> 26
2 -> 2340
5 -> 784304586
8 -> 206202813193260
9 -> 13057419408922746
</code>```

Non-competing C++ reference implementation

void diff(int n) {
    long long total[2] = {0, 0}; //array holding the result for case insensivity ([0]) and case sensitivity ([1])

    for (int c = 1; c <= 2; c ++) //1 = insensitivity, 2 = sensitivity
        for (int l = 1; l <= n; l ++) //each character of the name
            if (l == 1)
                total[c - 1] = 26 * c + 1; //first character can't be a number
            else
                total[c - 1] *= 26 * c + 1 + 10; //starting from the second character, characters can include numbers

    std::cout << total[1] - total[0] << std::endl;
}
```

Scoring

Tom likes golf, so the shortest program in bytes wins.

Note

It's okay if maybe the last two testcases aren't right because of numerical precision. After all, I am not even sure my code handled number 9 correctly.

答:
TSQL, 41 bytes

```<code>DECLARE @ INT=10

PRINT 53*POWER(63.,@-1)-27*POWER(37.,@-1)
</code>```

Fiddle

Title: Is case sensitivity important?

Body:
TSQL, 41 bytes

DECLARE @ INT=10

PRINT 53*POWER(63.,@-1)-27*POWER(37.,@-1)

Fiddle


问:
m3ph1st0s's programming puzzle 1 (C++)
This is the first of a series of C++ puzzles for you. Hope you will enjoy.

So, puzzle no.1:

Given the following program:

```<code>#include <iostream>
int main()
{
   const int a=1;
   const int b=2;
   const float c=0.5;
   std::cout << a/b-a*c;
}
</code>```

Insert some code on a single new line anywhere inside the program so that the output will be 0. The new line will contain AT MOST 18 characters (including spaces), and the rest of the lines will remain unmodified.
 To be clear, here is an example of a valid new code:

```<code>#include <iostream>
int main()
{
   const int a=1;
   const int b=2;
   int* p = NULL;
   const float c=0.5;
   std::cout << a/b-a*c;
}
</code>```

A new line with 15 characters was inserted so it's ok. However it does not solve the problem.

If this is too simple for you, don't worry, more is coming!!

答:
```<code>#include <iostream>
main()
{
   const int a=1;
   const int b=2;
   const float c=0.5;
#define a 0;1
   std::cout << a/b-a*c;
}
</code>```

14 characters.

Title: m3ph1st0s's programming puzzle 1 (C++)

Body:
#include <iostream>
main()
{
   const int a=1;
   const int b=2;
   const float c=0.5;
#define a 0;1
   std::cout << a/b-a*c;
}

14 characters.


问:
Print the ASCII printable character set
Challenge: Print the entire printable ASCII charset (not just a range!) in order.

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

Rules: read closely

No other characters allowed in the output.

Program/function does not accept input.

Try not to hardcode/embed the output.

This is code golf, shortest answer wins.

答:
Mathematica, 22 bytes

```<code>32~CharacterRange~126&
</code>```

Pretty simple. & creates an anonymous function and 32~CharacterRange~126 outputs a list of characters from 32 () to 126 (~). Actually, I'm pretty sure this is optimal this time.

Title: Print the ASCII printable character set

Body:
Mathematica, 22 bytes

32~CharacterRange~126&

Pretty simple. & creates an anonymous function and 32~CharacterRange~126 outputs a list of characters from 32 () to 126 (~). Actually, I'm pretty sure this is optimal this time.


答:
Perl, 64 bytes

@f=$_="="x33;s/=/rand>.4?$&:$"/ge,@f=($_.$/,@f)while@f<6;print@f
```

<h3>Usage</h3>

<pre class="lang-sh prettyprint-override"><code>perl -e '@f=$_="="x33;s/=/rand>.3?$&:$"/ge,@f=($_.$/,@f)while@f<6;print@f'
  = =           =  ==      =    =
  = =         ===  ==      =    =
= = =         ===  ==      =    =
= = =   = =   ===  ===   = =    =
= = == =====  === ====   ===  = =
=================================
</code>```

Perl, 68 bytes

Alternative version that relies on ANSI escape codes to move the cursor around, first dropping down 6 lines, then writing the original line (all the =s), moving up a line and printing the replaced string (s/=/rand>.4?$&:$"/ge) repeatedly until it makes no more substitutions. This can end up writing more than six lines, but it is eventually replaced with an empty line.

Note: \x1bs are actually the ASCII Esc character.

print"\x1bc\x1b[6B",$_="="x33;print"\x1b[1A\x1b[33D$_"while s/=/rand>.4?$&:$"/ge
```

Title: Illustrate music beats

Body:
Perl, 64 bytes

@f=$_="="x33;s/=/rand>.4?$&:$"/ge,@f=($_.$/,@f)while@f<6;print@f

Usage

perl -e '@f=$_="="x33;s/=/rand>.3?$&:$"/ge,@f=($_.$/,@f)while@f<6;print@f'
  = =           =  ==      =    =
  = =         ===  ==      =    =
= = =         ===  ==      =    =
= = =   = =   ===  ===   = =    =
= = == =====  === ====   ===  = =
=================================

Perl, 68 bytes

Alternative version that relies on ANSI escape codes to move the cursor around, first dropping down 6 lines, then writing the original line (all the =s), moving up a line and printing the replaced string (s/=/rand>.4?$&:$"/ge) repeatedly until it makes no more substitutions. This can end up writing more than six lines, but it is eventually replaced with an empty line.

Note: \x1bs are actually the ASCII Esc character.

print"\x1bc\x1b[6B",$_="="x33;print"\x1b[1A\x1b[33D$_"while s/=/rand>.4?$&:$"/ge


答:
Excel VBA, 57 bytes:

Prints individual characters

```<code>Sub a()
For i = 32 To 126
Debug.Print Chr(i)
Next
End Sub
</code>```

Prints out joined string, 68 bytes

```<code>Sub a()
For i = 32 To 126
b = b & Chr(i)
Next
Debug.Print b
End Sub
</code>```

Title: Print the ASCII printable character set

Body:
Challenge: Print the entire printable ASCII charset (not just a range!) in order.

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

Rules: read closely

No other characters allowed in the output.

Program/function does not accept input.

Try not to hardcode/embed the output.

This is code golf, shortest answer wins.

Body:
Excel VBA, 57 bytes:

Prints individual characters

Sub a()
For i = 32 To 126
Debug.Print Chr(i)
Next
End Sub

Prints out joined string, 68 bytes

Sub a()
For i = 32 To 126
b = b & Chr(i)
Next
Debug.Print b
End Sub


答:
Majc (formely hashmap), 6 bytes

```<code>r af
</code>```

The delete character is unprintable so here's the hex code (xxd):

```<code>0000000: 7220 7f61 660a                           r .af.
</code>```

Title: Print the ASCII printable character set

Body:
Majc (formely hashmap), 6 bytes

r af

The delete character is unprintable so here's the hex code (xxd):

0000000: 7220 7f61 660a                           r .af.


Title: Print the ASCII printable character set

Body:
C, 33 bytes

i;f(){++i<96&&putchar(i+31)|f();}


答:
MATL, <s>57</s> <s>56</s> <s>52</s> <s>49</s> 48 bytes

```<code>7:g2IvtPvt!9Mh2$X>2YG[0E28]8*255/7B[43DD]51/v2ZG
</code>```

This produces the following figure (tested with the compiler running on Matlab and on Octave).

EDIT: You can experimentally try at MATL Online! (you may need to reload the page if it doesn't work initially).

How it works

```<code>7:g         % Range from 1 to 7 converted to logical: push array [1 1 1 1 1 1 1]
2           % Push 2
I           % Push 3
v           % Concatenate vertically into a 9×1 array
tPv         % Duplicate, flip vertically, concatenate. Gives a 18×1 array
t!          % Duplicate, transpose: 1×18 array
9M          % Push [1 1 1 1 1 1 1] again
h           % Concatenate horizontally: gives 1×25 array
2$X>        % Maximum of the two arrays, with broadcast. Gives a 18×25 array
            % with 1 for blue, 2 for white, 3 for red
2YG         % Show image with default colormap
[0E28]8*    % Push array [0 72 224] (blue)
255/        % Divide each entry by 255. Colors are normalized between 0 and 1
7B          % 7 converted into binary: push array [1 1 1] (white, normalized)
[43DD]51/   % Push array [215/255 40/255 40/255] (red, normalized)
v           % Concatenate vertically. Gives a 3×3 array
2ZG         % Use as colormap
</code>```

Title: Draw the national flag of Iceland

Body:
MATL, <s>57</s> <s>56</s> <s>52</s> <s>49</s> 48 bytes

7:g2IvtPvt!9Mh2$X>2YG[0E28]8*255/7B[43DD]51/v2ZG

This produces the following figure (tested with the compiler running on Matlab and on Octave).

EDIT: You can experimentally try at MATL Online! (you may need to reload the page if it doesn't work initially).

How it works

7:g         % Range from 1 to 7 converted to logical: push array [1 1 1 1 1 1 1]
2           % Push 2
I           % Push 3
v           % Concatenate vertically into a 9×1 array
tPv         % Duplicate, flip vertically, concatenate. Gives a 18×1 array
t!          % Duplicate, transpose: 1×18 array
9M          % Push [1 1 1 1 1 1 1] again
h           % Concatenate horizontally: gives 1×25 array
2$X>        % Maximum of the two arrays, with broadcast. Gives a 18×25 array
            % with 1 for blue, 2 for white, 3 for red
2YG         % Show image with default colormap
[0E28]8*    % Push array [0 72 224] (blue)
255/        % Divide each entry by 255. Colors are normalized between 0 and 1
7B          % 7 converted into binary: push array [1 1 1] (white, normalized)
[43DD]51/   % Push array [215/255 40/255 40/255] (red, normalized)
v           % Concatenate vertically. Gives a 3×3 array
2ZG         % Use as colormap


答:
Excel VBA, <s>254</s> <s>228</s> 153 bytes

Couldn't really find a way to set column/row size to pixels(thereby making them square) because of the way Excel handles it so make them nice and square first.

Edit 1: Replaced RGB with returned values for colors, -26 bytes

Edit 2: Tried to add as many suggestions as I could, -75 bytes. I was not able to use &48e0 as a color and I am not sure why. Thanks everyone

```<code>Sub e()
c "A1:CV72", rgbBlue
c "AC1:AR72", -1
c "A29:CV44", -1
c "AG1:AN72", 255
c "A33:CV40", 255
End Sub

Sub c(d, f)
Range(d).Interior.Color = f
End Sub
</code>```

Picture:

Title: Draw the national flag of Iceland

Body:
Excel VBA, <s>254</s> <s>228</s> 153 bytes

Couldn't really find a way to set column/row size to pixels(thereby making them square) because of the way Excel handles it so make them nice and square first.

Edit 1: Replaced RGB with returned values for colors, -26 bytes

Edit 2: Tried to add as many suggestions as I could, -75 bytes. I was not able to use &48e0 as a color and I am not sure why. Thanks everyone

Sub e()
c "A1:CV72", rgbBlue
c "AC1:AR72", -1
c "A29:CV44", -1
c "AG1:AN72", 255
c "A33:CV40", 255
End Sub

Sub c(d, f)
Range(d).Interior.Color = f
End Sub

Picture:


答:
Python 3, <s>190</s> <s>172</s> <s>171</s> <s>169</s> <s>167</s> <s>160</s> <s>159</s> <s>147</s> 143 bytes

Using PIL version 1.1.7 which has a deprecated but not removed offset method.

```<code>from PIL.ImageDraw import*
i=Image.new('RGB',(25,18),'#d72828')
Draw(i).rectangle((1,1,23,16),'#0048e0',~0)
i.offset(9).resize((100,72)).show()
</code>```

Creates a 25*18 pixel image filled with red then draws a 23*16 pixel rectangle filled with blue with white outline of one pixel. It then offsets the image by (9,9) which wraps on the edges, resizes it to 100*72 then shows it in a window.

Flag before offsetting:

 (resized to 100*72)

Output:

Animated:

Edit1: Golfed 18 bytes by removing the cropping by initially creating a 25*18 image.

Edit2: Golfed 1 byte by using #fff instead of white.

Edit3: Golfed 2 bytes by aliasing imports.

Edit4: Golfed 2 bytes by removing the second argument of the offset method .

Edit5: Golfed 7 bytes by showing the image instead of saving. (needs imagemagick installed on Unix)

Edit6: Golfed 1 byte by rewriting imports.

Edit7: Golfed 12 bytes by rewriting imports again. (thanks by @Dennis)

Edit8: Added animation.

Edit9: Updated animation as it was missing the last frame.

Edit10: Golfed 4 bytes thanks to Albert Renshaw!

Title: Draw the national flag of Iceland

Body:
Python 3, <s>190</s> <s>172</s> <s>171</s> <s>169</s> <s>167</s> <s>160</s> <s>159</s> <s>147</s> 143 bytes

Using PIL version 1.1.7 which has a deprecated but not removed offset method.

from PIL.ImageDraw import*
i=Image.new('RGB',(25,18),'#d72828')
Draw(i).rectangle((1,1,23,16),'#0048e0',~0)
i.offset(9).resize((100,72)).show()

Creates a 25*18 pixel image filled with red then draws a 23*16 pixel rectangle filled with blue with white outline of one pixel. It then offsets the image by (9,9) which wraps on the edges, resizes it to 100*72 then shows it in a window.

Flag before offsetting:

 (resized to 100*72)

Output:

Animated:

Edit1: Golfed 18 bytes by removing the cropping by initially creating a 25*18 image.

Edit2: Golfed 1 byte by using #fff instead of white.

Edit3: Golfed 2 bytes by aliasing imports.

Edit4: Golfed 2 bytes by removing the second argument of the offset method .

Edit5: Golfed 7 bytes by showing the image instead of saving. (needs imagemagick installed on Unix)

Edit6: Golfed 1 byte by rewriting imports.

Edit7: Golfed 12 bytes by rewriting imports again. (thanks by @Dennis)

Edit8: Added animation.

Edit9: Updated animation as it was missing the last frame.

Edit10: Golfed 4 bytes thanks to Albert Renshaw!


问:
Narayana-Zidek-Capell numbers
Generate the nth Narayana-Zidek-Capell number given an input n. Fewest bytes win.

f(1)=1, f(n) is the sum of the previous floor(n/2) Narayana-Zidek-Capell terms.

Test Cases:

```<code>f(1)=1

f(9)=42

f(14)=1308

f(15)=2605

f(23)=664299
</code>```

答:
Ruby, <s>34</s> 32 bytes

This uses a formula from the OEIS page for the Narayana-Zidek-Cappell numbers.

Edit: Got rid of parentheses using operator precedence with thanks to feersum and Neil.

```<code>f=->x{x<4?1:2*f[x-1]-x%2*f[x/2]}
</code>```

Title: Narayana-Zidek-Capell numbers

Body:
Ruby, <s>34</s> 32 bytes

This uses a formula from the OEIS page for the Narayana-Zidek-Cappell numbers.

Edit: Got rid of parentheses using operator precedence with thanks to feersum and Neil.

f=->x{x<4?1:2*f[x-1]-x%2*f[x/2]}


答:
I do not know C++, however based on the question, couldn't you just input a line to simply output 0? the question specifies the output should be 0, it does not specify you must CHANGE the output to 0.

```<code>std::cout << 0
</code>```

(I have 0 clue on C++, perhaps somebody can use this concept though)

Title: m3ph1st0s's programming puzzle 1 (C++)

Body:
This is the first of a series of C++ puzzles for you. Hope you will enjoy.

So, puzzle no.1:

Given the following program:

```<code>#include <iostream>
int main()
{
   const int a=1;
   const int b=2;
   const float c=0.5;
   std::cout << a/b-a*c;
}
</code>```

Insert some code on a single new line anywhere inside the program so that the output will be 0. The new line will contain AT MOST 18 characters (including spaces), and the rest of the lines will remain unmodified.
 To be clear, here is an example of a valid new code:

```<code>#include <iostream>
int main()
{
   const int a=1;
   const int b=2;
   int* p = NULL;
   const float c=0.5;
   std::cout << a/b-a*c;
}
</code>```

A new line with 15 characters was inserted so it's ok. However it does not solve the problem.

If this is too simple for you, don't worry, more is coming!!

Body:
I do not know C++, however based on the question, couldn't you just input a line to simply output 0? the question specifies the output should be 0, it does not specify you must CHANGE the output to 0.

std::cout << 0

(I have 0 clue on C++, perhaps somebody can use this concept though)


问:
Generate a Stack Exchange Favicon
Do you recognize the PPCG logo?
it looks like this, when you do an ascii art of it.

```<code>+---+
|PCG|
+---+
   v
</code>```

Now, In this Code Golf, You will make a code, that makes logos for other sites, similar to the PPCG logo.

What You should do

The "Shortened" string will be the string, with all upper case letters and numbers in the input string.(Which would be PPCG when the input string is Programming Puzzles & Code Golf)

The "Box" (

```<code>+---+
|   |
+---+
   v
</code>```

)
should fit the Shortened string perfectly.(No bigger or smaller)

Also the v part should be exactly 1 down and 1 left to the down right +.

Then output the box which has the shortened string in it.

Example

Stack Overflow:

```<code>+--+
|SO|
+--+
  v
</code>```

Area 51:

```<code>+---+
|A51|
+---+
   v
</code>```

Rules

You may assume that the input contains at least one digit or upper case letter.

Standard code-golf rules apply.

答:
R, 108 bytes

```<code>cat(x<-gsub("(.*)","+\\1+\n",gsub(".","-",y<-gsub("[^A-Z0-9]","",s))),"|",y,"|\n",x,gsub("."," ",y),"v",sep="")
</code>```

Explanation

Going from the inside out (because who doesn't love assigning global variables from inside a regex), assuming s is our input string:

y<-gsub("[^A-Z0-9]","",s) keeps capitals and numbers, assigns the resulting value to y.

gsub(".","-",y<-...) replaces all characters with hyphens in the above.

x<-gsub("(.*)","+\\1+\n",gsub(...)) chucks a + on either end of the row of hyphens, and a newline, and we store that as x.

The rest is pretty straightforward, output in the appropriate order, and use the fact that the number of spaces before the v will be the same as the length of y.

Title: Generate a Stack Exchange Favicon

Body:
R, 108 bytes

cat(x<-gsub("(.*)","+\\1+\n",gsub(".","-",y<-gsub("[^A-Z0-9]","",s))),"|",y,"|\n",x,gsub("."," ",y),"v",sep="")

Explanation

Going from the inside out (because who doesn't love assigning global variables from inside a regex), assuming s is our input string:

y<-gsub("[^A-Z0-9]","",s) keeps capitals and numbers, assigns the resulting value to y.

gsub(".","-",y<-...) replaces all characters with hyphens in the above.

x<-gsub("(.*)","+\\1+\n",gsub(...)) chucks a + on either end of the row of hyphens, and a newline, and we store that as x.

The rest is pretty straightforward, output in the appropriate order, and use the fact that the number of spaces before the v will be the same as the length of y.


答:
R, <s>197</s> <s>195</s> 187 bytes

```<code>w="white";r="#d72828";png(w=100,h=72);par(mar=rep(0,4),bg="#0048e0",xaxs="i",yaxs="i");frame();rect(c(0,7,0,8)/25,c(7,0,8,0)/18,c(1,.44,1,.4),c(11/18,1,5/9,1),c=c(w,w,r,r),b=NA);dev.off()
</code>```

Indented, with new lines and explanations:

w="white"
r="#d72828"
png(w=100,h=72) #Creates in working directory a png called Rplot001.png
                #with a width and a height of 120 and 72 pixels respectively.
par(mar=rep(0,4), #No margin around the plot
    bg="#0048e0", #Blue background
    xaxs="i",yaxs="i") #Axes fits range exactly
frame() #Creates an empty plot which range is xlim=c(0,1) & ylim=c(0,1)
rect(c(0,7,0,8)/25, #Because rect is vectorized
     c(7,0,8,0)/18,
     c(1,.44,1,.4), #i. e. c(25,11,25,10)/25
     c(11/18,1,5/9,1), #i. e. c(11,18,10,18)/18
     c=c(w,w,r,r), # c= is the same as col=, thanks to argument name completion
     b=NA)#No borders
dev.off()
```

Edit: turns out frame(), contrary to plot() or plot.new() doesn't by default add a border to the plot, meaning bty="n" was unnecessary here.

Title: Draw the national flag of Iceland

Body:
This year's UEFA Euro 2016 is over and besides a couple of negative headlines there has been a very positive surprise as well – the Iceland national football team. Let's draw their national flag.

Input

Well, obviously this challenge has no input.

Output

Draw the flag of Iceland in any applicable visual format of at least 100 x 72 pixels or 25 x 18 characters.

Save the output to a file or present it instantly – example formats are: images like png, jpg etc., vector graphics, draw on HTML canvas or even use non-whitespace characters for visualization.

Use these colors: blue: #0048e0, white: #ffffff and red: #d72828.

If your language doesn't support specific color values, use the standard values for red, blue and white from the ANSI color codes.

Draw the flag with the correct proportions, as shown in the figure below:

Boilerplate

You can write a program or a function. If it is an anonymous function, please include an example of how to invoke it.

This is code-golf so shortest answer in bytes wins.

Standard loopholes are disallowed.

Leaderboard

var QUESTION_ID = 85141; // 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 = 41859; // This should be the user ID of the challenge author.
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,]*[^\s,]),.*?(-?\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,});});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;if (! /<a/.test(lang)) lang = '' + lang + '';lang = jQuery(lang).text().toLowerCase();languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link, uniq: lang};});var langs = [];for (var lang in languages)if (languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function (a, b) {if (a.uniq > b.uniq) return 1;if (a.uniq < b.uniq) return -1;return 0;});for (var i = 0; i < langs.length; ++i){var language = jQuery("#language-template").html();var lang = langs[i];language = language.replace("{{LANGUAGE}}", lang.lang).replace("{{NAME}}", lang.user).replace("{{SIZE}}", lang.size).replace("{{LINK}}", lang.link);language = jQuery(language);jQuery("#languages").append(language);}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}#answer-list {padding: 10px;width: 290px;float: left;}#language-list {padding: 10px;width: 290px;float: left;}table thead {font-weight: bold;}table td {padding: 5px;}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

If you can't find your answer, format your language and byte count as explained in the Leaderboard's "Info Section".

This challenge is inspired by Draw the national flag of france.

Body:
R, <s>197</s> <s>195</s> 187 bytes

w="white";r="#d72828";png(w=100,h=72);par(mar=rep(0,4),bg="#0048e0",xaxs="i",yaxs="i");frame();rect(c(0,7,0,8)/25,c(7,0,8,0)/18,c(1,.44,1,.4),c(11/18,1,5/9,1),c=c(w,w,r,r),b=NA);dev.off()

Indented, with new lines and explanations:

w="white"
r="#d72828"
png(w=100,h=72) #Creates in working directory a png called Rplot001.png
                #with a width and a height of 120 and 72 pixels respectively.
par(mar=rep(0,4), #No margin around the plot
    bg="#0048e0", #Blue background
    xaxs="i",yaxs="i") #Axes fits range exactly
frame() #Creates an empty plot which range is xlim=c(0,1) & ylim=c(0,1)
rect(c(0,7,0,8)/25, #Because rect is vectorized
     c(7,0,8,0)/18,
     c(1,.44,1,.4), #i. e. c(25,11,25,10)/25
     c(11/18,1,5/9,1), #i. e. c(11,18,10,18)/18
     c=c(w,w,r,r), # c= is the same as col=, thanks to argument name completion
     b=NA)#No borders
dev.off()

Edit: turns out frame(), contrary to plot() or plot.new() doesn't by default add a border to the plot, meaning bty="n" was unnecessary here.


答:
Pyth, 12 bytes

```<code>L|syM>/b2Ub1
</code>```

Try it online. Test suite.

Defines a function y(n) that returns the nth Narayana-Zidek-Capell-number.

Title: Narayana-Zidek-Capell numbers

Body:
Generate the nth Narayana-Zidek-Capell number given an input n. Fewest bytes win.

f(1)=1, f(n) is the sum of the previous floor(n/2) Narayana-Zidek-Capell terms.

Test Cases:

```<code>f(1)=1

f(9)=42

f(14)=1308

f(15)=2605

f(23)=664299
</code>```

Body:
Pyth, 12 bytes

L|syM>/b2Ub1

Try it online. Test suite.

Defines a function y(n) that returns the nth Narayana-Zidek-Capell-number.


答:
Jelly, <s>11</s> 10 bytes

```<code>HĊrµṖß€Sȯ1
</code>```

Try it online!

Takes n as argument and prints the result.

Explanation

```<code>H              divide input by 2
 Ċ             round up to get first n to recurse
  r            inclusive range from that to n
   µ           (chain separator)
    Ṗ          remove n itself from the range
     ß€        call self recursively on each value in the range
       S       sum results
        ȯ1     if sum was zero, return one
</code>```

Title: Narayana-Zidek-Capell numbers

Body:
Jelly, <s>11</s> 10 bytes

HĊrµṖß€Sȯ1

Try it online!

Takes n as argument and prints the result.

Explanation

H              divide input by 2
 Ċ             round up to get first n to recurse
  r            inclusive range from that to n
   µ           (chain separator)
    Ṗ          remove n itself from the range
     ß€        call self recursively on each value in the range
       S       sum results
        ȯ1     if sum was zero, return one


答:
Perl 5 + -p0513, 100 bytes

$b="..."x28;$}=1x12;$@="..."x8;print"P6 100 72 31",$_="$b$}$@$}$b$b"x28,$\=($}x8 .$@.$}x15)x4,$@x100```
<p>Try it online!</p>
<p>Outputs a PBM image.</p>
<hr />
<h1>Perl 5 + <code>-M5.10.0 -p0513</code>, 107 bytes</h1>

<pre class="lang-perl prettyprint-override"><code>($},$@,$;)=map".[48;5;${_}m ",18,15,1;$}x=7;say$\="$}$@$; $@$}$}
"x7,$_=$@x8 .$;.$;.$@x15 ."
",$;x=25,"
",$</code>```

Try it online!

Uses ANSI escape sequences and assumes a Linux terminal to display the flag. Looks a bit weird using the measurements provided.

Perl 5 + -M5.10.0 -p0513, 109 bytes

This version looks a bit closer to the expected dimensions...

($},$@,$;)=map".[48;5;${_}m  ",18,15,1;$}x=7;say$\="$}$@$;$;$@$}$}
"x7,$_=$@x8 .$;.$;.$@x15 ."
",$;x=25,"
",$```
<p>Try it online!</p>
<p><img src="https://i.stack.imgur.com/zc81p.png" alt="Less squished flag" /></p>
<hr />
<h1>Perl 5 + <code>-M5.10.0 -p0513</code>, 103 bytes</h1>
<p>Using the standard ANSI colours (as specified in the question) saves another 4 bytes!</p>

<pre class="lang-perl prettyprint-override"><code>($},$@,$;)=map".[${_}m ",44,47,41;$}x=7;say$\="$}$@$; $@$}$}
"x7,$_=$@x8 .$;.$;.$@x15 ."
",$;x=25,"
",$</code>```

Try it online!

Title: Draw the national flag of Iceland

Body:
Perl 5 + -p0513, 100 bytes

$b="..."x28;$}=1x12;$@="..."x8;print"P6 100 72 31",$_="$b$}$@$}$b$b"x28,$\=($}x8 .$@.$}x15)x4,$@x100

Try it online!

Outputs a PBM image.

Perl 5 + -M5.10.0 -p0513, 107 bytes

($},$@,$;)=map".[48;5;${_}m ",18,15,1;$}x=7;say$\="$}$@$; $@$}$}
"x7,$_=$@x8 .$;.$;.$@x15 ."
",$;x=25,"
",$

Try it online!

Uses ANSI escape sequences and assumes a Linux terminal to display the flag. Looks a bit weird using the measurements provided.

Perl 5 + -M5.10.0 -p0513, 109 bytes

This version looks a bit closer to the expected dimensions...

($},$@,$;)=map".[48;5;${_}m  ",18,15,1;$}x=7;say$\="$}$@$;$;$@$}$}
"x7,$_=$@x8 .$;.$;.$@x15 ."
",$;x=25,"
",$

Try it online!

Perl 5 + -M5.10.0 -p0513, 103 bytes

Using the standard ANSI colours (as specified in the question) saves another 4 bytes!

($},$@,$;)=map".[${_}m ",44,47,41;$}x=7;say$\="$}$@$; $@$}$}
"x7,$_=$@x8 .$;.$;.$@x15 ."
",$;x=25,"
",$

Try it online!


答:
C, <s>194</s> <s>191</s> 183 Bytes

```<code>#define C "\x1b["
#define A "@@@@@@"
y;f(){for(;y++<14;)printf(y>5&&y<10?y>6&&y<9?C"31m"A A A A"@\n":C"0m"A"@@"C"31m@@"C"0m"A A"@@@\n":C"34m"A"@"C"0m@"C"31m@@"C"0m@"C"34m"A A"@@\n");}
</code>```

-3 adding one @ on the #define A

-8 adding [ on #define C

Usage

```<code>main(){f();}
</code>```

Output

valid basing on this comment from the OP

Double Size Output, 204 Bytes

```<code>#define C "\x1b["
#define B "████"
#define A B B B
y;f(){for(;y++<28;)printf(y>10&&y<19?y>12&&y<17?C"31m"A A A A"██\n":C"0m"A B C"31m"B C"0m"A A B"██\n":C"34m"A"██"C"0m██"C"31m"B C"0m██"C"34m"A A B"\n");}
</code>```

Title: Draw the national flag of Iceland

Body:
C, <s>194</s> <s>191</s> 183 Bytes

#define C "\x1b["
#define A "@@@@@@"
y;f(){for(;y++<14;)printf(y>5&&y<10?y>6&&y<9?C"31m"A A A A"@\n":C"0m"A"@@"C"31m@@"C"0m"A A"@@@\n":C"34m"A"@"C"0m@"C"31m@@"C"0m@"C"34m"A A"@@\n");}

-3 adding one @ on the #define A

-8 adding [ on #define C

Usage

main(){f();}

Output

valid basing on this comment from the OP

Double Size Output, 204 Bytes

#define C "\x1b["
#define B "████"
#define A B B B
y;f(){for(;y++<28;)printf(y>10&&y<19?y>12&&y<17?C"31m"A A A A"██\n":C"0m"A B C"31m"B C"0m"A A B"██\n":C"34m"A"██"C"0m██"C"31m"B C"0m██"C"34m"A A B"\n");}


Title: Draw the national flag of Iceland

Body:
JavaScript (ES6), 231 <s>240</s>

Code inside the snippet below. Run it to test.

d=(w,h,c)=>`<div style=float:left;width:${w}em;height:${h}em;background:#${['0048e0','fff','d72828'][~~c]}>`;document.write(d(25)+(a=[252,61,94,61,476]).concat(b=[261,70,485],810,b,a).map(v=>d(v>>5,v/4&7,v&3)).join(e='</div>')+e+e)


答:
Bash + Imagemagick 7, <s>94</s> <s>90</s> <s>86</s> 85 bytes

magick -size 84x56 xc:#0048e0 ${s=-splice 8x8}+28+28 -background \#d72828 $s+32+32 x:

Saved 8 bytes, thanks to @manatwork, and 1 byte, thanks to @GlennRanders-Pehrson

Title: Draw the national flag of Iceland


答:
Mathematica, 38 bytes

```<code>If[#<4,1,2#0[#-1]-#~Mod~2#0[(#-1)/2]]&
</code>```

Anonymous function. Takes  as input and returns () as output. Based off of the Ruby solution.

Title: Narayana-Zidek-Capell numbers

Body:
Mathematica, 38 bytes

If[#<4,1,2#0[#-1]-#~Mod~2#0[(#-1)/2]]&

Anonymous function. Takes  as input and returns () as output. Based off of the Ruby solution.


答:
CSS, <s>285</s> <s>284</s> 264 bytes

```<code>*,:before,:after{background:#fff;width:100;height:72}body{background:#0048e0;margin:0}:before,:after{content:"";position:fixed}:after{background:#d72828}html:before{top:28;height:16}body:before{left:28;width:16}html:after{top:32;height:8}body:after{left:32;width:8
</code>```

Saved 1 byte thanks to @insertusernamehere.

Saved 20 bytes thanks to @user2428118, by removing all the pxs. Note that this requires the page to be rendered in quirks mode, so it doesn't work in Stack Snippets.

I could copy the Python approach of wrapping an image around at an offset, but it wouldn't be interesting to.

Ungolfed:

*, *::before, *::after {
  background: #fff;
  width: 100px;
  height: 72px;
}

body {
  background: #0048e0;
  margin: 0;
}

*::before, *::after {
  content: "";
  position: fixed;
}

*::after { background: #d72828 }

html::before { top: 28px; height: 16px }
body::before { left: 28px; width: 16px }
html::after { top: 32px; height: 8px }
body::after { left: 32px; width: 8px }```
</div>
</div>
</p>

<p>This uses the pseudo-elements (elements that aren't written in HTML) <code>::before</code> and <code>::after</code> to create the lines on the flag. The reason it works with no HTML is that in HTML5 the <code><html></code> and <code><body></code> elements are optional, so browsers automatically create them if they're not present.</p>

<p>More fun:</p>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-css lang-css prettyprint-override"><code>*, *::before, *::after {
  background: white;
  width: 100px;
  height: 72px;
}

body {
  background: #0048e0;
  margin: 0;
}

*::before, *::after {
  content: "";
  position: fixed;
}

*::after { background: #d72828 }

html::before { top: 28px; height: 16px }
body::before { left: 28px; width: 16px }
html::after { top: 32px; height: 8px }
body::after { left: 32px; width: 8px }

@keyframes change-color {
  from { filter: none }
  50% { filter: hue-rotate(360deg) }
  to { filter: none }
}

@keyframes transformations {
  from { transform: translate(150%, 100%) rotateZ(0deg) scale(0.7) }
  15% { transform: translate(150%, 100%) rotateZ(54deg) scale(1.8) }
  to { transform: translate(150%, 100%) rotateZ(360deg) scale(0.7) }
}

html {
  animation:
    0.7s linear infinite change-color,
    1s linear infinite transformations;
}</code>```

Title: Draw the national flag of Iceland

Body:
CSS, <s>285</s> <s>284</s> 264 bytes

*,:before,:after{background:#fff;width:100;height:72}body{background:#0048e0;margin:0}:before,:after{content:"";position:fixed}:after{background:#d72828}html:before{top:28;height:16}body:before{left:28;width:16}html:after{top:32;height:8}body:after{left:32;width:8

Saved 1 byte thanks to @insertusernamehere.

Saved 20 bytes thanks to @user2428118, by removing all the pxs. Note that this requires the page to be rendered in quirks mode, so it doesn't work in Stack Snippets.

I could copy the Python approach of wrapping an image around at an offset, but it wouldn't be interesting to.

Ungolfed:

*, *::before, *::after {
  background: #fff;
  width: 100px;
  height: 72px;
}

body {
  background: #0048e0;
  margin: 0;
}

*::before, *::after {
  content: "";
  position: fixed;
}

*::after { background: #d72828 }

html::before { top: 28px; height: 16px }
body::before { left: 28px; width: 16px }
html::after { top: 32px; height: 8px }
body::after { left: 32px; width: 8px }

This uses the pseudo-elements (elements that aren't written in HTML) ::before and ::after to create the lines on the flag. The reason it works with no HTML is that in HTML5 the <html> and <body> elements are optional, so browsers automatically create them if they're not present.

More fun:

*, *::before, *::after {
  background: white;
  width: 100px;
  height: 72px;
}

body {
  background: #0048e0;
  margin: 0;
}

*::before, *::after {
  content: "";
  position: fixed;
}

*::after { background: #d72828 }

html::before { top: 28px; height: 16px }
body::before { left: 28px; width: 16px }
html::after { top: 32px; height: 8px }
body::after { left: 32px; width: 8px }

@keyframes change-color {
  from { filter: none }
  50% { filter: hue-rotate(360deg) }
  to { filter: none }
}

@keyframes transformations {
  from { transform: translate(150%, 100%) rotateZ(0deg) scale(0.7) }
  15% { transform: translate(150%, 100%) rotateZ(54deg) scale(1.8) }
  to { transform: translate(150%, 100%) rotateZ(360deg) scale(0.7) }
}

html {
  animation:
    0.7s linear infinite change-color,
    1s linear infinite transformations;
}


答:
05AB1E, 16 bytes

An iterative solution as 05AB1E doesn't have functions.

```<code>X¸sGDN>;ï£Os‚˜}¬

X¸               # initialize a list with 1
  sG          }  # input-1 number of times do
    D            # duplicate current list
     N>;ï£       # take n/2 elements from the list
          O      # sum those elements
           s‚˜   # add at the start of the list
               ¬ # get the first element and implicitly print
</code>```

Try it online

Title: Narayana-Zidek-Capell numbers

Body:
05AB1E, 16 bytes

An iterative solution as 05AB1E doesn't have functions.

X¸sGDN>;ï£Os‚˜}¬

X¸               # initialize a list with 1
  sG          }  # input-1 number of times do
    D            # duplicate current list
     N>;ï£       # take n/2 elements from the list
          O      # sum those elements
           s‚˜   # add at the start of the list
               ¬ # get the first element and implicitly print

Try it online


答:
SVG+Javascript, <s>190</s> <s>165</s> 164 bytes

No expert there, <s>repeating one path just to change the color and line width looks silly</s> javascript ftw!

document.write(`<svg><rect width=100 height=72 fill="#0048e0"/>${a='<path d="M0 36L100 36M36 0L36 72"style="stroke-width:'}16;stroke:#fff"/>${a}8;stroke:#d72828">`)```
</div>
</div>
</p>
<p>More readable:</p>
```document.write(`<svg><rect width=100 height=72 fill="#0048e0"/>
${a='<path d="M0 36L100 36M36 0L36 72"style="stroke-width:'}16;stroke:#fff"/>
${a}8;stroke:#d72828">`)
```

Title: Draw the national flag of Iceland

Body:
SVG+Javascript, <s>190</s> <s>165</s> 164 bytes

No expert there, <s>repeating one path just to change the color and line width looks silly</s> javascript ftw!

document.write(`<svg><rect width=100 height=72 fill="#0048e0"/>${a='<path d="M0 36L100 36M36 0L36 72"style="stroke-width:'}16;stroke:#fff"/>${a}8;stroke:#d72828">`)

More readable:

document.write(`<svg><rect width=100 height=72 fill="#0048e0"/>
${a='<path d="M0 36L100 36M36 0L36 72"style="stroke-width:'}16;stroke:#fff"/>
${a}8;stroke:#d72828">`)


答:
Haskell, 34 bytes

```<code>f 1=1
f n=sum$f<$>[n-div n 2..n-1]
</code>```

Usage example: f 14 -> 1308.

A direct implementation of the definition.

Title: Narayana-Zidek-Capell numbers

Body:
Haskell, 34 bytes

f 1=1
f n=sum$f<$>[n-div n 2..n-1]

Usage example: f 14 -> 1308.

A direct implementation of the definition.


问:
Code golf for the lazy
Your goal in this code golf is to take two strings, language and code (if the golfed code you wrote for this is multiline, then this variable would be multiline.), and one integer, bytes. They represent the variables for a programming language, number of bytes it takes, and the code itself.

After that, you are going to format it like a code golfer does it.

The output variable is a multiline string called answer.

You can use multiline strings on:

C++

Python

Perl

JavaScript

If you search Stack Overflow, you should be able to find more programming languages that support it.

Here is a template of the output markdown. The code variable is in a code block, and there is a second-level header.

```<code>## {language}, {bytes} bytes

     {code}
</code>```

Here is what the output would look like when pasted into a Markdown parser.

{language}, {bytes} bytes

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

Variables are assumed to be filled out already as the language you coded your code golf entry in, the number of bytes it takes, and the actual code for it.

Here is another example of the output as code, this time with variables filled out:

```<code>## JavaScript, 1337 bytes

document.getElementById("foo").innerHTML = bar;
</code>```

Here is the version as a blockquote:

JavaScript, 1337 bytes

```<code>    document.getElementById("foo").innerHTML = bar;
</code>```

Bytes can be taken off from your code if you use a way to set the text of a
 element in HTML by the id result, like the following JavaScript code:

```<code>document.getElementById("result").innerHTML = answer;
</code>```

Make sure to also include the

 in the HTML section of JSFiddle for this to work.

Scoring

Like all code-golf questions, the code that uses the least amount of bytes is the best.

答:
Perl 5, 35 bytes

A full program, this takes input as command-line arguments in reverse order. It requires -M5.01, which is free.

```<code>say pop.', '.pop.' bytes

    '.pop
</code>```

Title: Code golf for the lazy

Body:
Perl 5, 35 bytes

A full program, this takes input as command-line arguments in reverse order. It requires -M5.01, which is free.

say pop.', '.pop.' bytes

    '.pop


问:
Print a bunch of uninteresting numbers!
An uninteresting number (which I totally didn't make up only for this challenge) is created like this:

Take a positive integer N

Create a new number O by adding the digits of N at the end of N

The final uninteresting number is O*N

For example for N=12:

O = 1212

O*N = 1212 * 12

Final number is 14544

Input

A positive integer N (N > 0) or your language's equivalent. You don't have to catch incorrect input.

Output

The corresponding uninteresting number.

Test cases

```<code>  1 -> 11
  2 -> 44
  3 -> 99
 10 -> 10100
174 -> 30306276
</code>```

Scoring

Shortest Code in Bytes wins.

答:
T-SQL, 45 bytes

```<code>DECLARE @i INT = 12
SELECT CONCAT(@i, @i)*@i
</code>```

Title: Print a bunch of uninteresting numbers!

Body:
T-SQL, 45 bytes

DECLARE @i INT = 12
SELECT CONCAT(@i, @i)*@i


答:
PHP, 81 bytes

This is a full program without recursion. A recursive function can be defined in 52 bytes (it might be possible to beat that) but that's just a pretty boring port of sherlock9's answer (and it errors if you ask for f(100) or more) so I'm putting up this longer and more interesting version

```<code><?php for($i=$argv[1];$j=$i;$i--)for(;--$j*2>=$i;)$a[$j]+=$a[$i]?:1;echo$a[1]?:1;
</code>```

Causes many (O[n]) notices but that's fine.

Title: Narayana-Zidek-Capell numbers

Body:
PHP, 81 bytes

This is a full program without recursion. A recursive function can be defined in 52 bytes (it might be possible to beat that) but that's just a pretty boring port of sherlock9's answer (and it errors if you ask for f(100) or more) so I'm putting up this longer and more interesting version

<?php for($i=$argv[1];$j=$i;$i--)for(;--$j*2>=$i;)$a[$j]+=$a[$i]?:1;echo$a[1]?:1;

Causes many (O[n]) notices but that's fine.


答:
Python 2, <s>48</s> <s>42</s> <s>38</s> 36 bytes

Algorithm taken from the OEIS page. n<3 may be changed to n<4 with no effect. Returns the nth number, where n is a positive integer.

a=lambda n:n<3or 2*a(n-1)-n%2*a(n/2)
```

Try it online

Title: Narayana-Zidek-Capell numbers

Body:
Python 2, <s>48</s> <s>42</s> <s>38</s> 36 bytes

Algorithm taken from the OEIS page. n<3 may be changed to n<4 with no effect. Returns the nth number, where n is a positive integer.

a=lambda n:n<3or 2*a(n-1)-n%2*a(n/2)

Try it online


答:
Python 3, 67 bytes

```<code>def f(n):
 x=1,
 for i in range(n):x+=sum(x[-i//2:]),
 print(x[-1])
</code>```

A function that takes input via argument and prints to STDOUT. This is a direct implementation of the definition.

How it works

```<code>def f(n):               Function with input target term index n
 x=1,                   Initialise term list x as tuple (1)
 for i in range(n):...  For all term indices in [0,n-1]...
 x[-i//2:]              ..yield the previous floor(i/2) terms...
 x+=sum(...)            ...and append their sum to x
 print(x[-1])           Print the last term in x, which is the nth term
</code>```

Try it on Ideone

Title: Narayana-Zidek-Capell numbers

Body:
Python 3, 67 bytes

def f(n):
 x=1,
 for i in range(n):x+=sum(x[-i//2:]),
 print(x[-1])

A function that takes input via argument and prints to STDOUT. This is a direct implementation of the definition.

How it works

def f(n):               Function with input target term index n
 x=1,                   Initialise term list x as tuple (1)
 for i in range(n):...  For all term indices in [0,n-1]...
 x[-i//2:]              ..yield the previous floor(i/2) terms...
 x+=sum(...)            ...and append their sum to x
 print(x[-1])           Print the last term in x, which is the nth term

Try it on Ideone


Title: Narayana-Zidek-Capell numbers

Body:
Java, 63 Bytes

int z(int n){return n<3?1:n%2>0?(2*z(n-1)-z(n/2)):(2*z(n-1));}


答:
So, #define a 0, Done. I saw that was posted - unsurprisingly.

Surprisingly, this wasn't posted:

```<code>#include <iostream>
main()
{
   const int a=1;
   const int b=2;
   const float c=0.5;
   std::cout<<0||
   std::cout << a/b-a*c;
}
</code>```

14 chars

That should do, right?

Title: m3ph1st0s's programming puzzle 1 (C++)

Body:
This is the first of a series of C++ puzzles for you. Hope you will enjoy.

So, puzzle no.1:

Given the following program:

```<code>#include <iostream>
int main()
{
   const int a=1;
   const int b=2;
   const float c=0.5;
   std::cout << a/b-a*c;
}
</code>```

Insert some code on a single new line anywhere inside the program so that the output will be 0. The new line will contain AT MOST 18 characters (including spaces), and the rest of the lines will remain unmodified.
 To be clear, here is an example of a valid new code:

```<code>#include <iostream>
int main()
{
   const int a=1;
   const int b=2;
   int* p = NULL;
   const float c=0.5;
   std::cout << a/b-a*c;
}
</code>```

A new line with 15 characters was inserted so it's ok. However it does not solve the problem.

If this is too simple for you, don't worry, more is coming!!

Body:
So, #define a 0, Done. I saw that was posted - unsurprisingly.

Surprisingly, this wasn't posted:

#include <iostream>
main()
{
   const int a=1;
   const int b=2;
   const float c=0.5;
   std::cout<<0||
   std::cout << a/b-a*c;
}

14 chars

That should do, right?


问:
Duplicate & switch case
The goal is, having taken a string as input, duplicate each latin letter and "toggle" its case (i.e. uppercase becomes lowercase and vice-versa).

Example inputs & outputs:

```<code>Input      Output
bad        bBaAdD
Nice       NniIcCeE
T e S t    Tt eE Ss tT
s E t      sS Ee tT
1!1!1st!   1!1!1sStT!
n00b       nN00bB
(e.g.)     (eE.gG.)
H3l|@!     Hh3lL|@!
</code>```

The input consists of printable ASCII symbols.

You shouldn't duplicate non-latin letters, numbers, special chars.

Title: Duplicate & switch case

Body:
Perl, <s>28</s> <s>22</s> 21 bytes (20 + -p flag)

s/[a-z]/$&.$&^$"/ige


问:
Chessboard maze
Chess pieces (kings, queens, rooks, bishops, and knights) and pawns are on a board, but not on the a1 or h8 square. Your task is to travel from the empty a1 to the empty h8 squares, passing through only empty squares. The rules of movement are as follows:

You can proceed from any empty square to any empty square next to it (same rank, next or preceding file; or same file, next or preceding rank).

You can proceed from any empty square to any empty square diagonally next to it (next or preceding rank, next or preceding file), provided that the catty-corner squares contain either (a) two pawns or (b) pawns/pieces of opposite color. (Two non-pawn pieces, or a non-pawn piece and a pawn, of the same color are strong enough to bar your progress across the corner, but two pawns are not; and pieces/pawns of opposite color don't work in concert to bar your way.) For example, if you're on c4 and d5 is empty, you can proceed to it provided c5 and d4 contain pawns or contain pieces/pawns of opposite color. See the "Example diagonals" section, below, for pictures.

Input

FEN's board description. That is: The input will be a string that includes a description of rank 8, a slash (/), a description of rank 7, a slash, …, and a description of rank 1. The description of each rank comprises numbers and letters running from file a to file h, where the letters indicate pieces and pawns (the black ones are p= pawn, n=knight, b=bishop, r=rook, q=queen, k=king, and the white ones are capitalized versions of the same) and the numbers indicate the successive number of empty squares. For example, rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBN is the board after one ply move (king's pawn to e4) in a chess game.

a1 and h8 will be empty in the input; i.e., the first slash has a digit before it, and the last slash has a digit after it.

Output

Truthy or falsey, indicating whether successful passage to h8 is possible.

If the input is not a valid FEN board description (meaning, one that matches my explanation above), or if a1 or h8 is occupied, then the output can be anything or nothing. (In other words: you may assume the input meets the requirements above.)

Scoring

This is code golf: fewest bytes wins.

Example input and output

Note that your code must work for all valid inputs, not only the examples.

Add a space and a w after each FEN to visualize it at http://www.dhtmlgoodies.com/scripts/chess-fen/chess-fen-3.html. (Note that some other online FEN visualizers will not allow a board that's illegal in chess, e.g. with a pawn on rank 1 or 8, so can't be used for our purposes.)

Truthy examples

8/8/8/8/8/8/8/8 — the empty board

1p1Q4/2p1Q3/2p1Q3/2p1Q3/2p1Q3/2p1Q3/Q1p1Q3/1q3q2 — there's a path a1, b2, b3, b4, b5, b6, b7, c8, d7, (not e8, that's blocked off, but) d6, d5, d4, d3, d2, d1, e1, f2, f3, f4, f5, f6, f7, f8, g8, h8

8/8/KKKKK3/K3K3/K1K1p3/Kp1K4/K1KK4/2KK4 — an example where a square that's blocked at one point must be passed through later on (to make sure you don't set squares as impassable)

K1k1K1K1/1K1k1K1k/K1K1k1K1/1k1K1K1k/K1k1K1k1/1K1k1k1K/K1K1k1K1/1k1k1K1k — there's a single path through (just follow your nose: there's only one square to move to at each step, unless take a step backward); this is also an example where a square is blocked at one point but necessary later

Falsey examples

6Q1/5N2/4Q3/3N4/2Q5/1N6/2Q5/1N6 — any attempt at a path will have to pass through two diagonally situated same-color pieces

N1q1K1P1/1R1b1p1n/r1B1B1Q1/1p1Q1p1b/B1P1R1N1/1B1P1Q1R/k1k1K1q1/1K1R1P1r — the only way through the a8-h1 diagonal is at f2-g3, but that would require passage through e1-d2 or f2-e3, which are both impossible.

4Q3/4q3/4Q3/5Q2/6Q1/3QqP2/2Q5/1Q6

4q3/4Q3/4q3/5q2/6q1/3qQp2/2q5/1q6

Example diagonals

In case the prose above was unclear, here are some pictures.

Passable diagonals

Impassable diagonals

答:
Matlab, 636 887 bytes as saved (including indentation)

This solution is not very golfed, but I wanted to go ahead and put it up.

```<code>function[n] = h(x)
o=[];
for i=x
 b={blanks(str2num(i)),'K','k',i};o=[o b{~cellfun(@isempty,regexp(i,{'\d','[NBRQK]','[nbrqk]','p|P'}))}];
end
o=fliplr(reshape(o,8,8))
for i=1:64
 b=i-[-8,8,7,-1,-9,1,9,-7];
 if mod(i,8)==1
  b=b(1:5);
 elseif mod(i,8)==0
  b=b([1,2,6:8]);
 end
 b=b(b<65&b>0);c=o(b);dn=b(isspace(c)&ismember(b,i-[9,7,-9,-7]));
 for j=dn
  g=o(b(ismember(b,j-[-8,8,7,-1,-9,1,9,-7])));
  if ~isempty(regexp(g,'pk|kp|PK|KP|kk|KK'));c(b==j)='X';end;
 end
 Bc{i}=b(c==32);
end
n=Bc{1};
on=[];
while length(n)>length(on)
 on=n;
 for i=1:length(n)
  n=unique([n Bc{n(i)}]);
 end
end
any(n==64)
end
</code>```

Reads a board string x as specified above and turns it into the more completely represented o, then finds all the moves (graph edges) between spaces, then figures out which moves are possible (not into filled spaces), then figures out which possible moves have "gates" of two pieces to pass between, then figures out if the gate is open (pawns, opposite colors) or closed (same color and including a non-pawn). Then, it walks through to find locations reachable by paths from the lower left square and if a path can reach space 64, it's a Yes board.

Title: Chessboard maze

Body:
Matlab, 636 887 bytes as saved (including indentation)

This solution is not very golfed, but I wanted to go ahead and put it up.

function[n] = h(x)
o=[];
for i=x
 b={blanks(str2num(i)),'K','k',i};o=[o b{~cellfun(@isempty,regexp(i,{'\d','[NBRQK]','[nbrqk]','p|P'}))}];
end
o=fliplr(reshape(o,8,8))
for i=1:64
 b=i-[-8,8,7,-1,-9,1,9,-7];
 if mod(i,8)==1
  b=b(1:5);
 elseif mod(i,8)==0
  b=b([1,2,6:8]);
 end
 b=b(b<65&b>0);c=o(b);dn=b(isspace(c)&ismember(b,i-[9,7,-9,-7]));
 for j=dn
  g=o(b(ismember(b,j-[-8,8,7,-1,-9,1,9,-7])));
  if ~isempty(regexp(g,'pk|kp|PK|KP|kk|KK'));c(b==j)='X';end;
 end
 Bc{i}=b(c==32);
end
n=Bc{1};
on=[];
while length(n)>length(on)
 on=n;
 for i=1:length(n)
  n=unique([n Bc{n(i)}]);
 end
end
any(n==64)
end

Reads a board string x as specified above and turns it into the more completely represented o, then finds all the moves (graph edges) between spaces, then figures out which moves are possible (not into filled spaces), then figures out which possible moves have "gates" of two pieces to pass between, then figures out if the gate is open (pawns, opposite colors) or closed (same color and including a non-pawn). Then, it walks through to find locations reachable by paths from the lower left square and if a path can reach space 64, it's a Yes board.


答:
Processing, 136 bytes

```<code>size(100,72);noStroke();background(#0048e0);fill(255);rect(28,0,16,72);rect(0,28,100,16);fill(#d72828);rect(0,32,100,8);rect(32,0,8,72);
</code>```

Ungolfed

```<code>//open the window
size(100,72);
//turn off borders that surround shapes by default
noStroke();
//draw blue as the background
background(#0048e0);
//set color to white
fill(255);
//draw 2 white bars
rect(28,0,16,72);
rect(0,28,100,16);
//set color to red
fill(#d72828);
//draw 2 red bars
rect(0,32,100,8);
rect(32,0,8,72);
</code>```

Output:

Title: Draw the national flag of Iceland

Body:
This year's UEFA Euro 2016 is over and besides a couple of negative headlines there has been a very positive surprise as well – the Iceland national football team. Let's draw their national flag.

Input

Well, obviously this challenge has no input.

Output

Draw the flag of Iceland in any applicable visual format of at least 100 x 72 pixels or 25 x 18 characters.

Save the output to a file or present it instantly – example formats are: images like png, jpg etc., vector graphics, draw on HTML canvas or even use non-whitespace characters for visualization.

Use these colors: blue: #0048e0, white: #ffffff and red: #d72828.

If your language doesn't support specific color values, use the standard values for red, blue and white from the ANSI color codes.

Draw the flag with the correct proportions, as shown in the figure below:

Boilerplate

You can write a program or a function. If it is an anonymous function, please include an example of how to invoke it.

This is code-golf so shortest answer in bytes wins.

Standard loopholes are disallowed.

Leaderboard

var QUESTION_ID = 85141; // 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 = 41859; // This should be the user ID of the challenge author.
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,]*[^\s,]),.*?(-?\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,});});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;if (! /<a/.test(lang)) lang = '' + lang + '';lang = jQuery(lang).text().toLowerCase();languages[lang] = languages[lang] || {lang: a.language, user: a.user, size: a.size, link: a.link, uniq: lang};});var langs = [];for (var lang in languages)if (languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function (a, b) {if (a.uniq > b.uniq) return 1;if (a.uniq < b.uniq) return -1;return 0;});for (var i = 0; i < langs.length; ++i){var language = jQuery("#language-template").html();var lang = langs[i];language = language.replace("{{LANGUAGE}}", lang.lang).replace("{{NAME}}", lang.user).replace("{{SIZE}}", lang.size).replace("{{LINK}}", lang.link);language = jQuery(language);jQuery("#languages").append(language);}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}#answer-list {padding: 10px;width: 290px;float: left;}#language-list {padding: 10px;width: 290px;float: left;}table thead {font-weight: bold;}table td {padding: 5px;}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

If you can't find your answer, format your language and byte count as explained in the Leaderboard's "Info Section".

This challenge is inspired by Draw the national flag of france.

Body:
Processing, 136 bytes

size(100,72);noStroke();background(#0048e0);fill(255);rect(28,0,16,72);rect(0,28,100,16);fill(#d72828);rect(0,32,100,8);rect(32,0,8,72);

Ungolfed

//open the window
size(100,72);
//turn off borders that surround shapes by default
noStroke();
//draw blue as the background
background(#0048e0);
//set color to white
fill(255);
//draw 2 white bars
rect(28,0,16,72);
rect(0,28,100,16);
//set color to red
fill(#d72828);
//draw 2 red bars
rect(0,32,100,8);
rect(32,0,8,72);

Output:


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

```

答:
Seed, 7 Bytes

```<code>2 20093
</code>```

Seed is a language which generates Befunge-93 with a length and a random seed.
2 is the length and 20093 is the random seed.

Title: Simple cat program

Body:
Seed, 7 Bytes

2 20093

Seed is a language which generates Befunge-93 with a length and a random seed.
2 is the length and 20093 is the random seed.


问:
Reverse a string while maintaining the capitalization in the same places
The goal here is to simply reverse a string, with one twist:

Keep the capitalization in the same places.

Example Input 1: Hello, Midnightas

Example Output 1: SathginDim ,olleh

Example Input 2: .Q

Exmaple Output 2: q.

Rules:

Output to STDOUT, input from STDIN

The winner will be picked 13th of July on GMT+3 12:00 (One week)

The input may only consist of ASCII symbols, making it easier for programs that do not use any encoding that contains non-ASCII characters.

Any punctuation ending up in a position where there was an upper-case letter must be ignored.

答:
Sed, 113 + 1 = 114 bytes

Why? Because it's fun to use the wrong tool to do things :P

Usage: Run sed -rf file, enter text and press Ctrl + D (send EOF).

Golfed:

```<code>s/[A-Z]/\a\l&/g;s/^.*$/\f&\v/;:x;s/\f\a/\a\f/;s/\a\v/\v\a/;s/\f(.)(.*)(.)\v/\3\f\2\v\1/;tx;s/\f|\v//g;s/\a./\U&/g
</code>```

Ungolfed:

```<code>s/[A-Z]/\a\l&/g #Prepend all upper-case letters with a
                #BEL ASCII character and make them lowercase
s/^.*$/\f&\v/   #Wrap text between a from feed (\f) and a vertical tab (\v)
                #These are used as markers

:x #Define a label named x

s/\f\a/\a\f/;s/\a\v/\v\a/ #Move BEL characters outside of the boundary, so they're not moved later
s/\f(.)(.*)(.)\v/\3\2\1/  #This part does the switching itself
                          #It grabs a character preceded by a form feed and another
                          #one followed by a vertical tab and swaps them, while keeping the text in-between
                          #and replaces the marker \f and \v

tx             #Conditional jump (t) to label x
               #Jumps to the label x if the last substitution (s command) was successful
s/\f|\v//g     #Delete markers
s/\a(.)/\u\1/g #Make letters preceded by a BEL upper-case
</code>```

Body:
Sed, 113 + 1 = 114 bytes

Why? Because it's fun to use the wrong tool to do things :P

Usage: Run sed -rf file, enter text and press Ctrl + D (send EOF).

Golfed:

s/[A-Z]/\a\l&/g;s/^.*$/\f&\v/;:x;s/\f\a/\a\f/;s/\a\v/\v\a/;s/\f(.)(.*)(.)\v/\3\f\2\v\1/;tx;s/\f|\v//g;s/\a./\U&/g

Ungolfed:

s/[A-Z]/\a\l&/g #Prepend all upper-case letters with a
                #BEL ASCII character and make them lowercase
s/^.*$/\f&\v/   #Wrap text between a from feed (\f) and a vertical tab (\v)
                #These are used as markers

:x #Define a label named x

s/\f\a/\a\f/;s/\a\v/\v\a/ #Move BEL characters outside of the boundary, so they're not moved later
s/\f(.)(.*)(.)\v/\3\2\1/  #This part does the switching itself
                          #It grabs a character preceded by a form feed and another
                          #one followed by a vertical tab and swaps them, while keeping the text in-between
                          #and replaces the marker \f and \v

tx             #Conditional jump (t) to label x
               #Jumps to the label x if the last substitution (s command) was successful
s/\f|\v//g     #Delete markers
s/\a(.)/\u\1/g #Make letters preceded by a BEL upper-case


答:
x86 real-mode machine code for DOS COM, <s>69</s> <s>65</s> <s>63</s> 62 bytes

The code is meant to be executed as a DOS COM executable.

Special thanks

meden, saved four bytes.

meden, saved two bytes and removed the flickering.

Machine code (in hex bytes)

```<code>68 00 A0 07 B8 13 00 CD      10 BE 23 01 AD 91 AD 91
AC E3 FE 60 30 ED F3 AA      61 81 C7 40 01 FE CD 75
F2 EB E9 FA B4 00 00 09      28 B4 46 00 0F FA 28 80
57 0F 14 B4 0C 50 00 FA      14 0C 00 64 00 00
</code>```

Assembly source

Source is for NASM.

```<code>ORG 100h

push 0a000h
pop es

mov ax, 13h
int 10h

mov si, data

_draw:
 lodsw
 xchg ax, cx

 lodsw
 xchg ax, di

 lodsb

_cycle:
 jcxz _cycle

 ;al = color
 ;cl = col
 ;ch = row

rect:
 pusha
 xor ch, ch
 rep stosb
 popa
 add di, 320
 dec ch
 jnz SHORT rect

jmp SHORT _draw

data:

        db 250d
        db 180d
        dw 0000h
        db 09h

        db 40d
        db 180d
        dw 0070d
        db 0fh

        db 250d
        db 40d
        dw 22400d
        db 0fh

        db 20d
        db 180d
        dw 80d
        db 0ch

        db 250
        db 20
        dw 25600d
        db 0ch

        dw 0000h
</code>```

Title: Draw the national flag of Iceland

Body:
x86 real-mode machine code for DOS COM, <s>69</s> <s>65</s> <s>63</s> 62 bytes

The code is meant to be executed as a DOS COM executable.

Special thanks

meden, saved four bytes.

meden, saved two bytes and removed the flickering.

Machine code (in hex bytes)

68 00 A0 07 B8 13 00 CD      10 BE 23 01 AD 91 AD 91
AC E3 FE 60 30 ED F3 AA      61 81 C7 40 01 FE CD 75
F2 EB E9 FA B4 00 00 09      28 B4 46 00 0F FA 28 80
57 0F 14 B4 0C 50 00 FA      14 0C 00 64 00 00

Assembly source

Source is for NASM.

ORG 100h

push 0a000h
pop es

mov ax, 13h
int 10h

mov si, data

_draw:
 lodsw
 xchg ax, cx

 lodsw
 xchg ax, di

 lodsb

_cycle:
 jcxz _cycle

 ;al = color
 ;cl = col
 ;ch = row

rect:
 pusha
 xor ch, ch
 rep stosb
 popa
 add di, 320
 dec ch
 jnz SHORT rect

jmp SHORT _draw

data:

        db 250d
        db 180d
        dw 0000h
        db 09h

        db 40d
        db 180d
        dw 0070d
        db 0fh

        db 250d
        db 40d
        dw 22400d
        db 0fh

        db 20d
        db 180d
        dw 80d
        db 0ch

        db 250
        db 20
        dw 25600d
        db 0ch

        dw 0000h