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

```

答:
Addict, 31 bytes

Addict is my new Turing-tarpit esolang, based on PRINDEAL. Addict has 5 commands: alias, decrement, increment, char, and take. See the GitHub repo for more details.

```<code>a I
 t c
 O
 d
a O
 c c
 I
 d
I
</code>```

Test it online here!

This basically defines a loop which repeatedly inputs a charcode and outputs it, until EOF is reached. Ungolfed version:

```<code>a input  # Define a command `input` that does the following:
 t char  #   Set variable `char` to the next charcode in the input.
 output  #   If there is a next charcode, run command `output`.
 d       #   Otherwise, just exit.

a output # Define a command `output` that does the following:
 c char  #   Output variable `char` as a charcode.
 input   #   Attempt to input again.
 d       #   (This line never gets run.)

input  # Run command `input`.
</code>```

Title: Simple cat program

Body:
Addict, 31 bytes

Addict is my new Turing-tarpit esolang, based on PRINDEAL. Addict has 5 commands: alias, decrement, increment, char, and take. See the GitHub repo for more details.

a I
 t c
 O
 d
a O
 c c
 I
 d
I

Test it online here!

This basically defines a loop which repeatedly inputs a charcode and outputs it, until EOF is reached. Ungolfed version:

a input  # Define a command `input` that does the following:
 t char  #   Set variable `char` to the next charcode in the input.
 output  #   If there is a next charcode, run command `output`.
 d       #   Otherwise, just exit.

a output # Define a command `output` that does the following:
 c char  #   Output variable `char` as a charcode.
 input   #   Attempt to input again.
 d       #   (This line never gets run.)

input  # Run command `input`.


答:
Python 3, 21 bytes

```<code>print(input(),end='')
</code>```

ContentLicense: CC BY-SA 3.0

Title: Simple cat program

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

```

Body:
Python 3, 21 bytes

print(input(),end='')


问:
Is it a balanced number?
A number is balanced if the sum of the digits on each half of the number is equal, so: 1423 is balanced because 1+4 = 2+3, so is: 42615 because 4+2=1+5. Note that the middle digit is not included on either side (or it's included on both sides) if there's an odd number of digits.

Challenge:

Take a positive integer as input, and output a truthy value if it's balanced and a falsy value if it's unbalanced.

Test cases (true)

```<code>1
6
11
141
1221
23281453796004414
523428121656666655655556655656502809745249552466339089702361716477983610754966885128041975406005088
</code>```

Test cases (false)

```<code>10
12
110
15421
5234095123508321
6240911314399072459493765661191058613491863144152352262897351988250431140546660035648795316740212454
</code>```

There will not be numbers starting with zero, for instance 00032 instead of 32. You must support numbers up to at least 100 digits (so larger than 2^64-1). As always, optional input format, so you may surround the number with apostrophes if desired.

答:
Perl 6, <s> 42 39 </s> 33 bytes

{[==] .comb[{^($_/2),Int($_/2)..*}]>>.sum}
```

<p>Test it</p>

<pre class="lang-perl6 prettyprint-override"><code>{[==] .comb[^(*/2),(*/2).Int..*]>>.sum}
</code>```

Test it

{[==] .comb[^*/2,^*/2+*/2]>>.sum}
```

<p>Test it <sup><sub>(from Jo King)</sub></sup></p>

<h2>Explanation:</h2>

<pre class="lang-perl6 prettyprint-override"><code>{ # lambda with implicit parameter ｢$_｣

  [==]                   # reduce the following using &infix:«==»

    .comb\               # split input into individual characters
    [                    # index into that using:

      # first half of the values (includes middle value)
      # ｢(0/2) ..^ (*/2)｣
      ^ * / 2,

      # last half of the values (includes middle value)
      ^ * / 2            # same number of values as first half
        + * / 2          # shifted up by half

    ]\
    >>.sum               # sum each of the two halves separately
}
</code>```

ContentLicense: CC BY-SA 4.0

Title: Is it a balanced number?

Body:
Perl 6, <s> 42 39 </s> 33 bytes

{[==] .comb[{^($_/2),Int($_/2)..*}]>>.sum}

<a href="https://tio.run/##ZZFNj9MwEIbv/hWzotAESuPxV@xW6SIOSFw47QFpWVBoXTYiTavErVpV4a@XcQrLSkSJM/Nm3vHjyc63tbnsOw8HM13O2eYEr5bblYficr4vigeYLreb7/fnr8noWybSyccmXKPp9HX/sFhMu/2mv5DrZfBdgFkBddX4Lkmny7rsump9mp0ZQBfK4OH9dlvD6DgnYXSEAm6zWQWh3fsMqjVk47vYYll2vhtnsSj7ssrg9jYW39zAp6qeA7yA1od928Q0usKjbz2UrW/GAcrmBKvqRxU61rOB6Exl/Wzlax88uaP/mkTjlZWiMsBqGxs8lgf/vAsd7N1wsALWNVUld0QLn4vFNb1uEbU@nUDyoay7/74OYp/OGYtTjkecs11dNvBm6Ez6etv@2eXtApLZT39KRv6488vgV@lkdijrvU9GVbPbhzSFOM6qg/iT/ooTeKqncNDgF4yBQMYUPH1k/eXfiCGJk08ZQ2YYIkNFjxDIhBQWlZa5M5wrhYppIRVpAo028dKablqGwGguLHe50kI5TYsxUjpuXc6FNJijUXnuLIU818oZY61Gcih0lHPaQ3NrGXtOto4zi2ickAiOXloRWgThjuySPJIEIyhHlKikczwXSjvlZB45ER1ybQ1K5dAaKlFIfi2EEQQnNTprheZKIiquCZtQpDbK5k5LNLniAqmh@g0" rel="nofollow noreferrer" title="Perl 6 – Try It Online">Test it

{[==] .comb[^(*/2),(*/2).Int..*]>>.sum}

<a href="https://tio.run/##ZZFNj9MwEIbv/hWzotBkKYnHX7FbpYs4IHHhtAekZZFC67IRaVolbtWqKn@9jFNYViJKnJk3844fT7a@a8xl13vYm2wxY@sjvFlslh7Ky@mhLB8hW2zW3x@@Jbe5SCfDmn1qQ5bdPs7nWb9bny9keR18H2BaQlO3vk/SbNFUfV@vjtMTA@hDFTx82GwaGB1mJIwOUMJdPq0hdDufQ72CfHwfWyyq3vfjPBblX5c53N3F4psb@Fw3M4BX0Pmw69qYRld48p2HqvPtOEDVHmFZ/6hDz85sIDpR2Xm69I0PntzRf02i8cpKURVguYkNnqq9f9mFDvZ@OFgJq4aqknuihS/l/Jpet4jaOZ1A8rFq@v@@DuI5nTEWRxyPOGPbpmrh7dCZ9NWm@7PLuzkk05/@mIz8YesXwS/TyXRfNTufjOp2uwtpCnGcdQ/xD/0VJ/BcT@GgwS8YA4GMKXj@yM6XfyOGJE4@ZQyZYYgMFT1CIBNSWFRaFs5wrhQqpoVUpAk02sRLa7ppGQKjubDcFUoL5TQtxkjpuHUFF9JggUYVhbMU8kIrZ4y1Gsmh0FHOaQ/NrWXsJdkqziyicUIiOHppRWgRhDuyS/JIEoygHFGiks7xQijtlJNF5ER0yLU1KJVDa6hEIfm1EEYQnNTorBWaK4mouCZsQpHaKFs4LdEUigukhuo3" rel="nofollow noreferrer" title="Perl 6 – Try It Online">Test it

{[==] .comb[^*/2,^*/2+*/2]>>.sum}

<a href="https://tio.run/##ZVFNj9owEL37V8yqtCRdSjz@ig0Ku@qhx572UGm7ldJgulFDQIlBIJT@dTqGdrtSo3gy8/ze@Hmy9V1jzrvew95MqzlbH@FdtVl6KM6nx6J4gmm1WX9//PY@E5MYbmk9LRbTfrcezkR@G3wfYFZAU7e@T9Jp1ZR9X6@OsxMD6EMZPHzcbBoYHeYEjA5QwF02qyF0O59BvYJs/BBbVGXv@3EWSdnXZQZ3d5F8cwOf62YO8AY6H3ZdG8uoCs@@81B2vh0HKNsjLOsfdejZwC6OTkQbZkvf@OBJHfXXIgqvXikrAyw3scFzufevu9DF7i8XK2DVECt5ILfwpVhcy@sRERvSCSSfyqb/b/cCDumcsTjceMU52zZlC7eXzoSvNt2fUz4sIJn99Mdk5A9bXwW/TCezfdnsfDKq2@0upCnEcdY9xH/zF5zAC5/SCwa/YAxkZEzJyyYbzv9GDEmcfMoYMsMQGSpaQiATUlhUWubOcK4UKqaFVIQJNNrER2t6KVwSo7mw3OVKC@U0BWOkdNy6nAtpMEej8txZSnmulTPGWo2kUOio5nSG5tYy9trZKs4sWuNkiczRRyuyFo1wR3JJGkmAEVQjSlTSOZ4LpZ1yMo8@ER1ybQ1K5dAaoigkvRbCCDInNTprheZKIiquyTZZkdoomzst0eSKC6SG6jc" rel="nofollow noreferrer" title="Perl 6 – Try It Online">Test it (from Jo King)

Explanation:

{ # lambda with implicit parameter ｢$_｣

  [==]                   # reduce the following using &infix:«==»

    .comb\               # split input into individual characters
    [                    # index into that using:

      # first half of the values (includes middle value)
      # ｢(0/2) ..^ (*/2)｣
      ^ * / 2,

      # last half of the values (includes middle value)
      ^ * / 2            # same number of values as first half
        + * / 2          # shifted up by half

    ]\
    >>.sum               # sum each of the two halves separately
}


答:
QBIC, 4 bytes

```<code>_??A
</code>```

Unfortunately, QBasic (and by extension QBIC) doesn't handle input very well. Comma's are only allowed if quotes are used (which then get stripped from the output). Newlines are another no-go.

Title: Simple cat program

Body:
QBIC, 4 bytes

_??A

Unfortunately, QBasic (and by extension QBIC) doesn't handle input very well. Comma's are only allowed if quotes are used (which then get stripped from the output). Newlines are another no-go.


问:
Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus:
This question was well-received when it was posted, but challenges
like this, asking answerers to Do X without using
Y
are likely to be poorly received. Try using the
sandbox
to get feedback on if you want to post a similar challenge.

It's <s>2017</s> <s>2018</s> <s>2019</s> <s>2020</s> <s>2021</s> <s>2022</s> 2023 already, folks, go home.

So, now that it's 2014, it's time for a code question involving the number 2014.

Your task is to make a program that prints the number 2014, without using any of the characters 0123456789 in your code, and independently of any external variables such as the date or time or a random seed.

The shortest code (counting in bytes) to do so in any language in which numbers are valid tokens wins.

Leaderboard:

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
QBIC, 10 bytes - Not Competing

```<code>?z^s*r+z+t
</code>```

Calculates 2014 from the pre-initialised variables q-z (1-10) and prints it. Development of QBIC started some two years after 2014...

Alternative 12-byte version:

```<code>?(u*y)^r-z-q
</code>```

Body:
QBIC, 10 bytes - Not Competing

?z^s*r+z+t

Calculates 2014 from the pre-initialised variables q-z (1-10) and prints it. Development of QBIC started some two years after 2014...

Alternative 12-byte version:

?(u*y)^r-z-q


问:
Build a nest
The challenge is simple: write a program or function that, when given a finite non-negative integer, outputs a nested array.

The rules

Your code must produce a unique valid nested array for every integer 0 ≤ n < 231.

Every possible nested array with up to 16 open brackets must be outputted within this range. (This does not mean that your code can never output a nested array with more than 16 open brackets.)

Your code may output a string representation of the nested array instead of an actual array (with or without commas).

One possible mapping:

```<code>0 -> []
1 -> [[]]
2 -> [[[]]]
3 -> [[], []]
4 -> [[[[]]]]
5 -> [[[], []]]
6 -> [[[]], []]
7 -> [[], [[]]]
8 -> [[], [], []]
9 -> [[[[[]]]]]
etc.
</code>```

Scoring

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

答:
Haskell, 71 bytes

p 1=["[]"]
p n=['[':h++t|k<-[1..n-1],h<-p k,_:t<-p$n-k]
((p=<<[1..])!!)
```

<p>The main function on the last line indexes into a list of all nested arrays, sorted by size (number of open brackets). So, all the arrays of size at most 16 are listed first. </p>

<p>Let's first look at code that's nicer and shorter, but Haskell's typechecker refuses to accept.</p>

```p 1=[[]]
p n=[h:t|k<-[1..n-1],h<-p k,t<-p$n-k]
((p=<<[1..])!!)
```

<p>The function <code>p</code> on input <code>n</code> gives a list of all nested arrays of size <code>n</code> (open brackets). This is done recursively. Each such array consists of some head <code>h</code> (first member) of size <code>k</code> and some tail <code>t</code> (other members) of size <code>n-k</code>, both sizes nonzero. Or, it's the empty array for size <code>n==1</code>.</p>

<p>The expression <code>p=<<[1..]</code> then flattens <code>p(1), p(2), ...</code> into a single infinite list of all arrays sorted by size</p>

```[ [], [[]], [[],[]], [[[]]], [[],[],[]], [[],[[]]], [[[]],[]], [[[],[]]], ...
```

and the main function indexes into it.

... Or, it would, if Haskell didn't whine about "construct[ing] the infinite type: t ~ [t]". Haskell cannot represent the infinite list above whose elements are arbitrarily nested arrays.  All its elements must have the same type, but a type t cannot be the same as a list of t's. In fact, the function p itself cannot be assigned a consistent type without dependent typing, which Haskell lacks.

So, instead we work on strings of brackets, simulating the cons operation by acting on [ and ] characters. This takes an extra 9 bytes. The perils of golfing in a type-safe language.

Title: Build a nest

Body:
Haskell, 71 bytes

p 1=["[]"]
p n=['[':h++t|k<-[1..n-1],h<-p k,_:t<-p$n-k]
((p=<<[1..])!!)

The main function on the last line indexes into a list of all nested arrays, sorted by size (number of open brackets). So, all the arrays of size at most 16 are listed first.

Let's first look at code that's nicer and shorter, but Haskell's typechecker refuses to accept.

p 1=[[]]
p n=[h:t|k<-[1..n-1],h<-p k,t<-p$n-k]
((p=<<[1..])!!)

The function p on input n gives a list of all nested arrays of size n (open brackets). This is done recursively. Each such array consists of some head h (first member) of size k and some tail t (other members) of size n-k, both sizes nonzero. Or, it's the empty array for size n==1.

The expression p=<<[1..] then flattens p(1), p(2), ... into a single infinite list of all arrays sorted by size

[ [], [[]], [[],[]], [[[]]], [[],[],[]], [[],[[]]], [[[]],[]], [[[],[]]], ...

and the main function indexes into it.

... Or, it would, if Haskell didn't whine about "construct[ing] the infinite type: t ~ [t]". Haskell cannot represent the infinite list above whose elements are arbitrarily nested arrays.  All its elements must have the same type, but a type t cannot be the same as a list of t's. In fact, the function p itself cannot be assigned a consistent type without dependent typing, which Haskell lacks.

So, instead we work on strings of brackets, simulating the cons operation by acting on [ and ] characters. This takes an extra 9 bytes. The perils of golfing in a type-safe language.


问:
The Base in the mix
Input:

A list/array of integers for which each item is in the range of 2-36.

Output:

The sum of the integers (as base 10), where each next integer is in the base of the previous value (starting with a regular base 10).

Example:

Let's say we have an input like this: [4, 12, 34, 20, 14, 6, 25, 13, 33]

Then we have a sum like this:

```<code>4    (4  in base-10) +
6    (12 in base-4 ) +
40   (34 in base-12) +
68   (20 in base-34) +
24   (14 in base-20) +
6    (6  in base-14) +
17   (25 in base-6 ) +
28   (13 in base-26) +
42   (33 in base-13)
= 235
</code>```

Mathematical base explained:

I considered assuming everyone knows how base works, but I'll give a brief example of how it works anyway, just in case. Let's take the 34 in base-12 for example, how did we get 40?

```<code>1-34 in regular base-10:
 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
 So, from 1 to 34 is 34 steps in base-10

1-34 in base-12:
 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2A, 2B, 30, 31, 32, 33, 34
 So, from 1 to 34 is 40 steps in base-12
</code>```

Here is perhaps a useful calculator.

Challenge rules:

Array size will be in reasonable range (like 1-100 / see test cases).

The test cases will never contain integers of which the current value is invalid for it's previous base (i.e. You will never have something like 19 in base-6 or 6 in base-6, because base-6 only contains the digits 0-5).

You can take the input any way you'd like. Can be as an int-array, as a comma/space-separated string, etc. Your call. (You are also allowed to take the int-array reversed, which could be useful for stack-based programming languages.)

General Rules:

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

Don't let code-golf languages discourage you from posting answers with non-golfing languages. Try to come up with as short an answer as possible for any programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>[4, 12, 34, 20, 14, 6, 25, 13, 33]                            ->   235
 4+ 6+  40+ 68+ 24+ 6+ 17+ 28+ 42

[5, 14, 2, 11, 30, 18]                                        ->   90
 5+ 9+  2+ 3+  33+ 38

[12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 12, 2, 11, 3, 10, 2, 10]    ->   98
 12+ 13+ 11+ 9+ 8+ 7+ 6+ 5+ 4+ 3+ 5+  2+ 3+  3+ 3+  2+ 2

[36, 36]                                                      ->   150
 36+ 114
</code>```

答:
Perl 6, <s> 52 </s> 50 bytes

{sum (10,|@_).rotor(2=>-1).map:{+":{.[0]}<{.[1]}>"}}
{sum (10,|@_).rotor(2=>-1).map:{":{.[0]}<$_[1]>"}}
```

<h2>Explanation:</h2>

<pre class="lang-perl6 prettyprint-override"><code># bare block lambda with implicit parameter ｢@_｣
{
  sum

    ( 10, |@_ )        # the input with a preceding 10
    .rotor( 2 => -1 )  # grab 2 values, back up one, repeat
    .map:
    {
      # create a string of the form ":10<4>"
      ":{
        .[0]            # first element from $_
      }<{
        .[1]            # second element from $_
      }>"
    }
}
</code>```

Title: The Base in the mix

Body:
Perl 6, <s> 52 </s> 50 bytes

{sum (10,|@_).rotor(2=>-1).map:{+":{.[0]}<{.[1]}>"}}
{sum (10,|@_).rotor(2=>-1).map:{":{.[0]}<$_[1]>"}}

Explanation:

# bare block lambda with implicit parameter ｢@_｣
{
  sum

    ( 10, |@_ )        # the input with a preceding 10
    .rotor( 2 => -1 )  # grab 2 values, back up one, repeat
    .map:
    {
      # create a string of the form ":10<4>"
      ":{
        .[0]            # first element from $_
      }<{
        .[1]            # second element from $_
      }>"
    }
}


答:
Pyke, 2 bytes

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

Try it here!

```<code>z  - read_line()
 r - if no error: goto_start()
</code>```

Title: Simple cat program

Body:
Pyke, 2 bytes

zr

Try it here!

z  - read_line()
 r - if no error: goto_start()


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

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

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

Cute right?

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

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

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

The result of your code should look like this:

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

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

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
PHP, 121 bytes

```<code>for($n=5682;$i++<60;)for($b=8;$b;)$p.=(1&ord(~$i&3||($n/=2)&1?uiloveyo[$i%8]:O)>>--$b)." ";echo wordwrap($p."0 1 1",42);
</code>```

breakdown

```<code>$n=2*bindec("000101100011001"); // where to NOT replace o with O
for($i=1;$i<61;$i++)            // loop $i from 1 to 60
{
    $c=
        ~$i&3                       // $i%4!=3
        ||
        ($n/=2)&1                   // or (1. shift $n, 2. test bit 0)
        ? "uiloveyo"[$i%8]          // yes: character from string
        : "O"                       // no: uppercase "O"
    ;
    for($b=8;$b--;)                 // run from bit 7 to bit 0
        $p.=(1 & ord($c)>>$b). " ";     // append 1 or 0 plus space
}
$p.="0 1 1";                    // append the missing three bits
echo wordwrap($p,42);           // wrap at column 42 (actually 41; 42 is space -> gets cut)
</code>```

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

Body:
PHP, 121 bytes

for($n=5682;$i++<60;)for($b=8;$b;)$p.=(1&ord(~$i&3||($n/=2)&1?uiloveyo[$i%8]:O)>>--$b)." ";echo wordwrap($p."0 1 1",42);

breakdown

$n=2*bindec("000101100011001"); // where to NOT replace o with O
for($i=1;$i<61;$i++)            // loop $i from 1 to 60
{
    $c=
        ~$i&3                       // $i%4!=3
        ||
        ($n/=2)&1                   // or (1. shift $n, 2. test bit 0)
        ? "uiloveyo"[$i%8]          // yes: character from string
        : "O"                       // no: uppercase "O"
    ;
    for($b=8;$b--;)                 // run from bit 7 to bit 0
        $p.=(1 & ord($c)>>$b). " ";     // append 1 or 0 plus space
}
$p.="0 1 1";                    // append the missing three bits
echo wordwrap($p,42);           // wrap at column 42 (actually 41; 42 is space -> gets cut)


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

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

The Rules

Each submission must be a full program.

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

The program must not write anything to STDERR.

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

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

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

This is not about finding the language with the shortest "Hello, World!" program. This is about finding the shortest "Hello, World!" program in every language. Therefore, I will not mark any answer as "accepted".

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

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

For inspiration, check the Hello World Collection.

The Catalogue

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

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

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

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

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

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

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

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

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

}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
  text-align: left !important;
  display: block !important;
}

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Addict, 248 bytes

Addict is my new Turing-tarpit esolang, based on PRINDEAL.

```<code>a A
 i 1
 i 1
 d
a B
 A 1
 A 1
 d
a C
 B 1
 B 1
 d
a D
 C 1
 C 1
 d
a E
 D 1
 D 1
 d
E H
E H
C H
c H
E e
E e
E e
B e
i e
c e
E l
E l
E l
C l
B l
c l
c l
E o
E o
E o
D o
d o
c o
E c
C c
B c
c c
E s
c s
D H
d H
c H
c o
A o
i o
c o
c l
d e
c e
i s
c s
</code>```

Test it online here!

Primer on addict

All memory is stored in variables. Variables can hold only non-negative integers; all variables start out at 0.

Addict has 4 built-in commands: decrement, increment, print a charcode, and take a charcode from input.

You can define your own commands with alias. This has very strict syntax:

```<code>a commandname
 command1
 command2
 command3
</code>```

This creates a new command called commandname. Whenever commandname is called, the following process happens:

command1 is called.

If command1 succeeded, command2 is run.

If command1 failed, command3 is run.

See the GitHub repo for more information about Addict.

Act I

The first part of the program defines five commands: A, B, C, D, and E. Each one has this format:

```<code>a A
 i 1
 i 1
 d
</code>```

This defines a command A which adds two to the input through the following process:

increment the 1st input.

If this succeeded, increment again. (i always succeeds unless it has no argument.)

Otherwise, decrement nothing. (This never gets run for the above reason.)

The next command defined is B, which adds 4 to the input:

```<code>a B
 A 1
 A 1
 d
</code>```

Run A on the 1st input. (Always succeeds.)

If this succeeded, run A again. (Always gets run.)

Otherwise, decrement nothing. (Never gets run.)

Through the same process, C adds 8, D adds 16, and E adds 32.

Act II

The rest of the program is devoted to outputting Hello, World! in as few bytes as possible. The charcodes we need to output are 72 101 108 108 111 44 32 87 111 114 108 100 33, in that order. The shortest method I have found to output them all is to use six variables:

H to output 72 and 87

e to output 101 and 100

l to output 108

o to output 111 and 114

c to output 44

s to output 32 and 33

Here's a table of commands, and the values of the variables after each command:

```<code>Command  Output   H   e   l   o   c   s
E H              32   0   0   0   0   0
E H              64   0   0   0   0   0
C H              72   0   0   0   0   0
c H      H       72   0   0   0   0   0
E e              72  32   0   0   0   0
E e              72  64   0   0   0   0
E e              72  96   0   0   0   0
B e              72 100   0   0   0   0
i e              72 101   0   0   0   0
c e      e       72 101   0   0   0   0
E l              72 101  32   0   0   0
E l              72 101  64   0   0   0
E l              72 101  96   0   0   0
C l              72 101 104   0   0   0
B l              72 101 108   0   0   0
c l      l       72 101 108   0   0   0
c l      l       72 101 108   0   0   0
E o              72 101 108  32   0   0
E o              72 101 108  64   0   0
E o              72 101 108  96   0   0
D o              72 101 108 112   0   0
d o              72 101 108 111   0   0
c o      o       72 101 108 111   0   0
E c              72 101 108 111  32   0
C c              72 101 108 111  40   0
B c              72 101 108 111  44   0
c c      ,       72 101 108 111  44   0
E s              72 101 108 111  44  32
c s      (space) 72 101 108 111  44  32
D H              88 101 108 111  44  32
d H              87 101 108 111  44  32
c H      W       87 101 108 111  44  32
c o      o       87 101 108 111  44  32
A o              87 101 108 113  44  32
i o              87 101 108 114  44  32
c o      r       87 101 108 114  44  32
c l      l       87 101 108 114  44  32
d e              87 100 108 114  44  32
c e      d       87 100 108 114  44  32
i s              87 100 108 114  44  33
c s      !       87 100 108 114  44  33
</code>```

If you can find any way to golf this program, please let me know!

Title: "Hello, World!"

Body:
Addict, 248 bytes

Addict is my new Turing-tarpit esolang, based on PRINDEAL.

a A
 i 1
 i 1
 d
a B
 A 1
 A 1
 d
a C
 B 1
 B 1
 d
a D
 C 1
 C 1
 d
a E
 D 1
 D 1
 d
E H
E H
C H
c H
E e
E e
E e
B e
i e
c e
E l
E l
E l
C l
B l
c l
c l
E o
E o
E o
D o
d o
c o
E c
C c
B c
c c
E s
c s
D H
d H
c H
c o
A o
i o
c o
c l
d e
c e
i s
c s

Test it online here!

Primer on addict

All memory is stored in variables. Variables can hold only non-negative integers; all variables start out at 0.

Addict has 4 built-in commands: decrement, increment, print a charcode, and take a charcode from input.

You can define your own commands with alias. This has very strict syntax:

a commandname
 command1
 command2
 command3

This creates a new command called commandname. Whenever commandname is called, the following process happens:

command1 is called.

If command1 succeeded, command2 is run.

If command1 failed, command3 is run.

See the GitHub repo for more information about Addict.

Act I

The first part of the program defines five commands: A, B, C, D, and E. Each one has this format:

a A
 i 1
 i 1
 d

This defines a command A which adds two to the input through the following process:

increment the 1st input.

If this succeeded, increment again. (i always succeeds unless it has no argument.)

Otherwise, decrement nothing. (This never gets run for the above reason.)

The next command defined is B, which adds 4 to the input:

a B
 A 1
 A 1
 d

Run A on the 1st input. (Always succeeds.)

If this succeeded, run A again. (Always gets run.)

Otherwise, decrement nothing. (Never gets run.)

Through the same process, C adds 8, D adds 16, and E adds 32.

Act II

The rest of the program is devoted to outputting Hello, World! in as few bytes as possible. The charcodes we need to output are 72 101 108 108 111 44 32 87 111 114 108 100 33, in that order. The shortest method I have found to output them all is to use six variables:

H to output 72 and 87

e to output 101 and 100

l to output 108

o to output 111 and 114

c to output 44

s to output 32 and 33

Here's a table of commands, and the values of the variables after each command:

Command  Output   H   e   l   o   c   s
E H              32   0   0   0   0   0
E H              64   0   0   0   0   0
C H              72   0   0   0   0   0
c H      H       72   0   0   0   0   0
E e              72  32   0   0   0   0
E e              72  64   0   0   0   0
E e              72  96   0   0   0   0
B e              72 100   0   0   0   0
i e              72 101   0   0   0   0
c e      e       72 101   0   0   0   0
E l              72 101  32   0   0   0
E l              72 101  64   0   0   0
E l              72 101  96   0   0   0
C l              72 101 104   0   0   0
B l              72 101 108   0   0   0
c l      l       72 101 108   0   0   0
c l      l       72 101 108   0   0   0
E o              72 101 108  32   0   0
E o              72 101 108  64   0   0
E o              72 101 108  96   0   0
D o              72 101 108 112   0   0
d o              72 101 108 111   0   0
c o      o       72 101 108 111   0   0
E c              72 101 108 111  32   0
C c              72 101 108 111  40   0
B c              72 101 108 111  44   0
c c      ,       72 101 108 111  44   0
E s              72 101 108 111  44  32
c s      (space) 72 101 108 111  44  32
D H              88 101 108 111  44  32
d H              87 101 108 111  44  32
c H      W       87 101 108 111  44  32
c o      o       87 101 108 111  44  32
A o              87 101 108 113  44  32
i o              87 101 108 114  44  32
c o      r       87 101 108 114  44  32
c l      l       87 101 108 114  44  32
d e              87 100 108 114  44  32
c e      d       87 100 108 114  44  32
i s              87 100 108 114  44  33
c s      !       87 100 108 114  44  33

If you can find any way to golf this program, please let me know!


问:
Find the odd one out in a sequence
The Challenge:

Consider the function F(N) = 2^N + 1 where N is a positive integer less than 31. The sequence defined by this function is:

```<code>3, 5, 9, 17, 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, 16385, 32769, 65537, 131073, 262145, 524289, 1048577, 2097153, 4194305, 8388609, 16777217, 33554433, 67108865, 134217729, 268435457, 536870913, 1073741825
</code>```

An input will be generated as follows:

Take 5 contiguous integers from the above sequence.

Replace one of them with a different, positive integer (which may or may not be part of the above sequence).

Optionally reorder the the 5 resulting numbers.

Given such a list of 5 integers, find the one that was swapped in and is therefore not part of the original 5 contiguous integers.

Example:

Original sublist: 5, 9, 17, 33, 65.

Replace one: 5, 7, 17, 33, 65.

Reorder: 33, 17, 5, 7, 65.

The expected output would be 7.

The 5 values in the input will always be distinct and there will always be a unique solution. (For instance, you won't have to deal with inputs like 3, 9, 17, 33, 129 where either 3 or 129 might have been swapped in.)

Test Cases:

```<code>5,9,17,33,829
o/p: 829

9,5,17,829,33
o/p: 829

33, 17, 5, 7, 65
o/p: 7

5,9,177,33,65
o/p: 177

65,129,259,513,1025
o/p: 259

129,259,513,1025,65
o/p: 259

63,129,257,513,1025
o/p: 63

65,129,257,513,4097
o/p: 4097

5, 9, 2, 17, 33
o/p: 2

536870913, 67108865, 1073741825, 1, 268435457
o/p: 1
</code>```

答:
JavaScript (ES6), 62 bytes

```<code>a=>a.find(n=>--n&--n|!n)||a.sort((a,b)=>a-b)[a[0]*16>a[3]?4:0]
</code>```

Completely new algorithm, since as @edc65 pointed out the previous one was broken. Explanation: We first deal with the easy case by looking for a 2 or a number that is not one greater than a power of 2. If none was found then there are two possible cases, depending on whether the extra value was below or above the original run of five, so we check whether the smallest and second largest value belong to the same run of five and if so blame the largest value otherwise the smallest value.

Title: Find the odd one out in a sequence

Body:
JavaScript (ES6), 62 bytes

a=>a.find(n=>--n&--n|!n)||a.sort((a,b)=>a-b)[a[0]*16>a[3]?4:0]

Completely new algorithm, since as @edc65 pointed out the previous one was broken. Explanation: We first deal with the easy case by looking for a 2 or a number that is not one greater than a power of 2. If none was found then there are two possible cases, depending on whether the extra value was below or above the original run of five, so we check whether the smallest and second largest value belong to the same run of five and if so blame the largest value otherwise the smallest value.


问:
Match the Stack Exchange URLs

Prologue

After installing an anti-XSS browser extension, Stack Snippets suddenly stopped working all across the Stack Exchange network. I could no longer learn from Stack Overflow, see working demos on User Experience and, worst of all, could not test JavaScript answers on Programming Puzzles and Code Golf! Desperately I searched for a remedy, and found a small input box in the settings, in which could place a single regex. I couldn't fit all of the Stack Exchange sites in this one, small box, so I asked for help. This is that question.

Task

Your task is to create a regular expression that matches all of the Stack Exchange website URLs, without matching any domains not owned by Stack Overflow Inc..

Your regular expression must match all URLs with the following parts:

protocol: this will either be http:// or https://.

domain: this will be an item from this list:

```<code>stackoverflow.com
www.stackoverflow.com
facebook.stackoverflow.com
serverfault.com
superuser.com
meta.stackexchange.com
webapps.stackexchange.com
nothingtoinstall.com
meta.webapps.stackexchange.com
meta.nothingtoinstall.com
gaming.stackexchange.com
arqade.com
thearqade.com
meta.gaming.stackexchange.com
meta.arqade.com
meta.thearqade.com
webmasters.stackexchange.com
webmaster.stackexchange.com
meta.webmasters.stackexchange.com
meta.webmaster.stackexchange.com
cooking.stackexchange.com
seasonedadvice.com
meta.cooking.stackexchange.com
meta.seasonedadvice.com
gamedev.stackexchange.com
meta.gamedev.stackexchange.com
photo.stackexchange.com
photography.stackexchange.com
photos.stackexchange.com
meta.photo.stackexchange.com
meta.photography.stackexchange.com
meta.photos.stackexchange.com
stats.stackexchange.com
statistics.stackexchange.com
crossvalidated.com
meta.stats.stackexchange.com
meta.statistics.stackexchange.com
math.stackexchange.com
maths.stackexchange.com
mathematics.stackexchange.com
meta.math.stackexchange.com
diy.stackexchange.com
meta.diy.stackexchange.com
meta.superuser.com
meta.serverfault.com
gis.stackexchange.com
meta.gis.stackexchange.com
tex.stackexchange.com
meta.tex.stackexchange.com
askubuntu.com
ubuntu.stackexchange.com
meta.askubuntu.com
meta.ubuntu.stackexchange.com
money.stackexchange.com
basicallymoney.com
www.basicallymoney.com
meta.money.stackexchange.com
english.stackexchange.com
elu.stackexchange.com
meta.english.stackexchange.com
stackapps.com
ux.stackexchange.com
ui.stackexchange.com
meta.ux.stackexchange.com
meta.ui.stackexchange.com
unix.stackexchange.com
linux.stackexchange.com
meta.unix.stackexchange.com
meta.linux.stackexchange.com
wordpress.stackexchange.com
meta.wordpress.stackexchange.com
cstheory.stackexchange.com
meta.cstheory.stackexchange.com
apple.stackexchange.com
askdifferent.com
meta.apple.stackexchange.com
rpg.stackexchange.com
meta.rpg.stackexchange.com
bicycles.stackexchange.com
bicycle.stackexchange.com
cycling.stackexchange.com
bikes.stackexchange.com
meta.bicycles.stackexchange.com
meta.bicycle.stackexchange.com
programmers.stackexchange.com
programmer.stackexchange.com
meta.programmers.stackexchange.com
electronics.stackexchange.com
chiphacker.com
www.chiphacker.com
meta.electronics.stackexchange.com
android.stackexchange.com
meta.android.stackexchange.com
boardgames.stackexchange.com
boardgame.stackexchange.com
meta.boardgames.stackexchange.com
physics.stackexchange.com
meta.physics.stackexchange.com
homebrew.stackexchange.com
homebrewing.stackexchange.com
brewadvice.com
meta.homebrew.stackexchange.com
meta.homebrewing.stackexchange.com
security.stackexchange.com
itsecurity.stackexchange.com
meta.security.stackexchange.com
meta.itsecurity.stackexchange.com
writers.stackexchange.com
writer.stackexchange.com
writing.stackexchange.com
meta.writers.stackexchange.com
video.stackexchange.com
avp.stackexchange.com
meta.video.stackexchange.com
meta.avp.stackexchange.com
graphicdesign.stackexchange.com
graphicsdesign.stackexchange.com
graphicdesigns.stackexchange.com
meta.graphicdesign.stackexchange.com
dba.stackexchange.com
meta.dba.stackexchange.com
scifi.stackexchange.com
sciencefiction.stackexchange.com
fantasy.stackexchange.com
meta.scifi.stackexchange.com
codereview.stackexchange.com
meta.codereview.stackexchange.com
codegolf.stackexchange.com
meta.codegolf.stackexchange.com
quant.stackexchange.com
meta.quant.stackexchange.com
pm.stackexchange.com
meta.pm.stackexchange.com
skeptics.stackexchange.com
skeptic.stackexchange.com
skepticexchange.com
meta.skeptics.stackexchange.com
fitness.stackexchange.com
meta.fitness.stackexchange.com
drupal.stackexchange.com
meta.drupal.stackexchange.com
mechanics.stackexchange.com
garage.stackexchange.com
meta.mechanics.stackexchange.com
meta.garage.stackexchange.com
parenting.stackexchange.com
meta.parenting.stackexchange.com
sharepoint.stackexchange.com
sharepointoverflow.com
www.sharepointoverflow.com
meta.sharepoint.stackexchange.com
music.stackexchange.com
guitars.stackexchange.com
guitar.stackexchange.com
meta.music.stackexchange.com
sqa.stackexchange.com
meta.sqa.stackexchange.com
judaism.stackexchange.com
mi.yodeya.com
yodeya.com
yodeya.stackexchange.com
miyodeya.com
meta.judaism.stackexchange.com
german.stackexchange.com
deutsch.stackexchange.com
meta.german.stackexchange.com
japanese.stackexchange.com
meta.japanese.stackexchange.com
philosophy.stackexchange.com
meta.philosophy.stackexchange.com
gardening.stackexchange.com
landscaping.stackexchange.com
meta.gardening.stackexchange.com
travel.stackexchange.com
meta.travel.stackexchange.com
productivity.stackexchange.com
meta.productivity.stackexchange.com
crypto.stackexchange.com
cryptography.stackexchange.com
meta.crypto.stackexchange.com
meta.cryptography.stackexchange.com
dsp.stackexchange.com
signals.stackexchange.com
meta.dsp.stackexchange.com
french.stackexchange.com
meta.french.stackexchange.com
christianity.stackexchange.com
meta.christianity.stackexchange.com
bitcoin.stackexchange.com
meta.bitcoin.stackexchange.com
linguistics.stackexchange.com
linguist.stackexchange.com
meta.linguistics.stackexchange.com
hermeneutics.stackexchange.com
meta.hermeneutics.stackexchange.com
history.stackexchange.com
meta.history.stackexchange.com
bricks.stackexchange.com
meta.bricks.stackexchange.com
spanish.stackexchange.com
espanol.stackexchange.com
meta.spanish.stackexchange.com
scicomp.stackexchange.com
meta.scicomp.stackexchange.com
movies.stackexchange.com
meta.movies.stackexchange.com
chinese.stackexchange.com
meta.chinese.stackexchange.com
biology.stackexchange.com
meta.biology.stackexchange.com
poker.stackexchange.com
meta.poker.stackexchange.com
mathematica.stackexchange.com
meta.mathematica.stackexchange.com
cogsci.stackexchange.com
meta.cogsci.stackexchange.com
outdoors.stackexchange.com
meta.outdoors.stackexchange.com
martialarts.stackexchange.com
meta.martialarts.stackexchange.com
sports.stackexchange.com
meta.sports.stackexchange.com
academia.stackexchange.com
academics.stackexchange.com
meta.academia.stackexchange.com
cs.stackexchange.com
computerscience.stackexchange.com
meta.cs.stackexchange.com
workplace.stackexchange.com
meta.workplace.stackexchange.com
windowsphone.stackexchange.com
meta.windowsphone.stackexchange.com
chemistry.stackexchange.com
meta.chemistry.stackexchange.com
chess.stackexchange.com
meta.chess.stackexchange.com
raspberrypi.stackexchange.com
meta.raspberrypi.stackexchange.com
russian.stackexchange.com
meta.russian.stackexchange.com
islam.stackexchange.com
meta.islam.stackexchange.com
salesforce.stackexchange.com
meta.salesforce.stackexchange.com
patents.stackexchange.com
askpatents.com
askpatents.stackexchange.com
meta.patents.stackexchange.com
meta.askpatents.com
meta.askpatents.stackexchange.com
genealogy.stackexchange.com
meta.genealogy.stackexchange.com
robotics.stackexchange.com
meta.robotics.stackexchange.com
expressionengine.stackexchange.com
meta.expressionengine.stackexchange.com
politics.stackexchange.com
meta.politics.stackexchange.com
anime.stackexchange.com
meta.anime.stackexchange.com
magento.stackexchange.com
meta.magento.stackexchange.com
ell.stackexchange.com
meta.ell.stackexchange.com
sustainability.stackexchange.com
meta.sustainability.stackexchange.com
tridion.stackexchange.com
meta.tridion.stackexchange.com
reverseengineering.stackexchange.com
meta.reverseengineering.stackexchange.com
networkengineering.stackexchange.com
meta.networkengineering.stackexchange.com
opendata.stackexchange.com
meta.opendata.stackexchange.com
freelancing.stackexchange.com
meta.freelancing.stackexchange.com
blender.stackexchange.com
meta.blender.stackexchange.com
mathoverflow.net
mathoverflow.stackexchange.com
mathoverflow.com
meta.mathoverflow.net
space.stackexchange.com
thefinalfrontier.stackexchange.com
meta.space.stackexchange.com
sound.stackexchange.com
socialsounddesign.com
sounddesign.stackexchange.com
meta.sound.stackexchange.com
astronomy.stackexchange.com
meta.astronomy.stackexchange.com
tor.stackexchange.com
meta.tor.stackexchange.com
pets.stackexchange.com
meta.pets.stackexchange.com
ham.stackexchange.com
meta.ham.stackexchange.com
italian.stackexchange.com
meta.italian.stackexchange.com
pt.stackoverflow.com
br.stackoverflow.com
stackoverflow.com.br
meta.pt.stackoverflow.com
meta.br.stackoverflow.com
aviation.stackexchange.com
meta.aviation.stackexchange.com
ebooks.stackexchange.com
meta.ebooks.stackexchange.com
alcohol.stackexchange.com
beer.stackexchange.com
dranks.stackexchange.com
meta.alcohol.stackexchange.com
meta.beer.stackexchange.com
softwarerecs.stackexchange.com
meta.softwarerecs.stackexchange.com
arduino.stackexchange.com
meta.arduino.stackexchange.com
cs50.stackexchange.com
meta.cs50.stackexchange.com
expatriates.stackexchange.com
expats.stackexchange.com
meta.expatriates.stackexchange.com
matheducators.stackexchange.com
meta.matheducators.stackexchange.com
meta.stackoverflow.com
earthscience.stackexchange.com
meta.earthscience.stackexchange.com
joomla.stackexchange.com
meta.joomla.stackexchange.com
datascience.stackexchange.com
meta.datascience.stackexchange.com
puzzling.stackexchange.com
meta.puzzling.stackexchange.com
craftcms.stackexchange.com
meta.craftcms.stackexchange.com
buddhism.stackexchange.com
meta.buddhism.stackexchange.com
hinduism.stackexchange.com
meta.hinduism.stackexchange.com
communitybuilding.stackexchange.com
moderator.stackexchange.com
moderators.stackexchange.com
meta.communitybuilding.stackexchange.com
meta.moderators.stackexchange.com
startups.stackexchange.com
meta.startups.stackexchange.com
worldbuilding.stackexchange.com
meta.worldbuilding.stackexchange.com
ja.stackoverflow.com
jp.stackoverflow.com
meta.ja.stackoverflow.com
emacs.stackexchange.com
meta.emacs.stackexchange.com
hsm.stackexchange.com
meta.hsm.stackexchange.com
economics.stackexchange.com
meta.economics.stackexchange.com
lifehacks.stackexchange.com
meta.lifehacks.stackexchange.com
engineering.stackexchange.com
meta.engineering.stackexchange.com
coffee.stackexchange.com
meta.coffee.stackexchange.com
vi.stackexchange.com
vim.stackexchange.com
meta.vi.stackexchange.com
musicfans.stackexchange.com
meta.musicfans.stackexchange.com
woodworking.stackexchange.com
meta.woodworking.stackexchange.com
civicrm.stackexchange.com
meta.civicrm.stackexchange.com
health.stackexchange.com
meta.health.stackexchange.com
ru.stackoverflow.com
hashcode.ru
stackoverflow.ru
meta.ru.stackoverflow.com
meta.hashcode.ru
rus.stackexchange.com
russ.hashcode.ru
russ.stackexchange.com
meta.rus.stackexchange.com
mythology.stackexchange.com
meta.mythology.stackexchange.com
law.stackexchange.com
meta.law.stackexchange.com
opensource.stackexchange.com
meta.opensource.stackexchange.com
elementaryos.stackexchange.com
meta.elementaryos.stackexchange.com
portuguese.stackexchange.com
meta.portuguese.stackexchange.com
computergraphics.stackexchange.com
meta.computergraphics.stackexchange.com
hardwarerecs.stackexchange.com
meta.hardwarerecs.stackexchange.com
es.stackoverflow.com
meta.es.stackoverflow.com
3dprinting.stackexchange.com
threedprinting.stackexchange.com
meta.3dprinting.stackexchange.com
ethereum.stackexchange.com
meta.ethereum.stackexchange.com
latin.stackexchange.com
meta.latin.stackexchange.com
languagelearning.stackexchange.com
meta.languagelearning.stackexchange.com
retrocomputing.stackexchange.com
meta.retrocomputing.stackexchange.com
crafts.stackexchange.com
meta.crafts.stackexchange.com
korean.stackexchange.com
meta.korean.stackexchange.com
monero.stackexchange.com
meta.monero.stackexchange.com
ai.stackexchange.com
meta.ai.stackexchange.com
esperanto.stackexchange.com
meta.esperanto.stackexchange.com
sitecore.stackexchange.com
meta.sitecore.stackexchange.com
</code>```

page: this will either be the empty string, / or / followed by any string

The url will be the string created by appending protocol, domain and page to each other, in that order.

Testcases

Your regex must match:

```<code>https://codegolf.stackexchange.com/
http://retrocomputing.stackexchange.com
https://facebook.stackoverflow.com/questions/1234
http://meta.nothingtoinstall.com/thisisa404.php?file=command.com
</code>```

Your regex must not match:

```<code>http//codegolf.stackexchange.com/
https://meta.stackoverflow.com.fakesite.dodgy/cgi-bin/virus.cgi?vector=apt
file://www.stackoverflow.com/
http://ripoff.com/stackoverflow.com/q/1234/
</code>```

Your regex may match:

```<code>http://panda.stackexchange.com/
https://www.meta.codegolf.stackexchange.com
http://alpha.beta.charlie.delta.chiphacker.com
https://stackexchange.com/sites/
</code>```

because these are owned by Stack Exchange Inc. and so will not be vulnerable to XSS attacks.

This is a code-golf challenge, so the shortest regular expression wins!

答:
337 336 333 327 bytes

```<code>^https?://([^/]+\.)*(stackoverflow\.(com(\.br)?|ru)|mathoverflow\.(com|net)|hashcode\.ru|((the)?arqade|chiphacker|(mi)?yodeya|ask(ubuntu|different|patents)|(seasoned|brew)advice|s(erverfault|(tack|keptic)exchange|uperuser|tackapps|harepointoverflow|ocialsounddesign)|nothingtoinstall|crossvalidated|basicallymoney)\.com)(/.*)?$
</code>```

Doesn't use any fancy regex features, so it should work in any regex flavour.

Title: Match the Stack Exchange URLs

Body:
337 336 333 327 bytes

^https?://([^/]+\.)*(stackoverflow\.(com(\.br)?|ru)|mathoverflow\.(com|net)|hashcode\.ru|((the)?arqade|chiphacker|(mi)?yodeya|ask(ubuntu|different|patents)|(seasoned|brew)advice|s(erverfault|(tack|keptic)exchange|uperuser|tackapps|harepointoverflow|ocialsounddesign)|nothingtoinstall|crossvalidated|basicallymoney)\.com)(/.*)?$

Doesn't use any fancy regex features, so it should work in any regex flavour.


问:
Unlucky Numbers!

Things to know:

First, lucky numbers.

Lucky numbers are generated like so:

Take all the natural numbers:

```<code>1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20...
</code>```

Then, remove each second number.

```<code>1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39...
</code>```

Now, 3 is safe.

Remove every 3rd number:

```<code>1, 3, 7, 9, 13, 15, 19, 21, 25, 27, 31, 33, 37, 39, 43, 45, 49, 51, 55, 59...
</code>```

Now, 7 is safe.

Remove every 7th number.

Continue, and remove every nth number, where n is the first safe number after an elimination.

The final list of safe numbers is the lucky numbers.

The unlucky numbers is composed of separate lists of numbers, which are [U1, U2, U3... Un].

U1 is the first set of numbers removed from the lucky "candidates", so they are:

```<code>2, 4, 6, 8, 10, 12, 14, 16, 18, 20...
</code>```

U2 is the second set of numbers removed:

```<code>5, 11, 17, 23, 29, 35, 41, 47, 53, 59...
</code>```

And so on and so forth (U3 is the third list, U4 is the fourth, etc.)

Challenge:

Your task is, when given two inputs m and n, generate the mth number in the list Un.

Example inputs and outputs:

```<code>(5, 2) -> 29
(10, 1) -> 20
</code>```

Specs:

Your program must work for m up to 1e6, and n up to 100.

You are guaranteed that both m and n are positive integers.

If you're curious, U(1e6, 100) = 5,333,213,163. (Thank you @pacholik!)

Your program must compute that within 1 day on a reasonable modern computer.

This is code-golf, so shortest code in bytes wins!

PS: It would be nice if someone came up with a general formula for generating these. If you do have a formula, please put it in your answer!

答:
Python 3, 170

from itertools import*
def L(n,k=1):
 if n<2:yield from count(2+k,2)
 t=L(n-1);l=next(t)
 for i in t:
  n+=1
  if(n%l>0)==k:yield i
U=lambda m,n:sum(islice(L(n,0),m-1,m))
```

Function L generates the row of possible lucky numbers (if k is True) or Un (if False). Evaluated lazily (so I don't have to generate n-1 infinite lists if I want Un).

Run function U.

Speed

U(1,000,000; 100) takes about 1h 45min to run on my machine with PyPy. I suspect some four hours with CPython. (Yes, 4h 20min to be precise.)

If I used a list instead of generators, I might gain some speed, but I would need a list of greater size than Python allows me. And if it did, it would need dozens of gigabytes of RAM.

Yes, and U(1,000,000; 100) = 5,333,213,163.

Title: Unlucky Numbers!

Body:
Python 3, 170

from itertools import*
def L(n,k=1):
 if n<2:yield from count(2+k,2)
 t=L(n-1);l=next(t)
 for i in t:
  n+=1
  if(n%l>0)==k:yield i
U=lambda m,n:sum(islice(L(n,0),m-1,m))

Function L generates the row of possible lucky numbers (if k is True) or Un (if False). Evaluated lazily (so I don't have to generate n-1 infinite lists if I want Un).

Run function U.

Speed

U(1,000,000; 100) takes about 1h 45min to run on my machine with PyPy. I suspect some four hours with CPython. (Yes, 4h 20min to be precise.)

If I used a list instead of generators, I might gain some speed, but I would need a list of greater size than Python allows me. And if it did, it would need dozens of gigabytes of RAM.

Yes, and U(1,000,000; 100) = 5,333,213,163.


答:
Mathematica, 65 bytes

```<code>f[a___,x_,b___]/;NestList[2#-1&,a~Min~b/. 2->0,4]~SubsetQ~{a,b}=x
</code>```

This defines a function f which should be called with 5 arguments, e.g.

```<code>f[5, 9, 17, 33, 829]
</code>```

In principle the function can be called with any (non-zero) number of arguments, but you might get unexpected results...

I think this is the first time, that I managed to put the entire solution to a non-trivial challenge into the left-hand side of a =.

Explanation

This solution really puts Mathematica's pattern matching capabilities to work for us. The basic feature we're using is that Mathematica can't just define simple functions like f[x_] := (* some expression in x *) but we can use arbitrarily complex patterns on the left-hand side, e.g. f[{a_, b_}, x_?OddQ] := ... would add a definition to f which is only used when it's called with a two-element list and an odd integer. Conveniently, we can already give names to elements arbitrarily far down the left-hand side expression (e.g. in the last example, we could immediately refer to the two list elements as a and b).

The pattern we're using in this challenge is f[a___,x_,b___]. Here a___ and b___ are sequences of zero or more arguments and x is a single argument. Since the right-hand side of the definition is simply x, what we want is some magic that ensures that x is used for the input we're searching for and a___ and b___ are simply wildcards that cover the remaining elements.

This is done by attaching a condition to the pattern with /;. The right-hand side of /; (everything up to the =) needs to return True for this pattern to match. The beauty is that Mathematica's pattern matcher will try every single assignment of a, x and b to the inputs for us, so the search for the correct element is done for us. This is essentially a declarative solution to the problem.

As for the condition itself:

```<code>NestList[2#-1&,a~Min~b/. 2->0,4]~SubsetQ~{a,b}
</code>```

Notice that this doesn't depend on x at all. Instead, this condition depends only on the remaining four elements. This is another convenient feature of the pattern matching solution: due to the sequence patterns, a and b together contain all other inputs.

So this condition needs to check whether the remaining four elements are contiguous elements from our sequence with at most one gap. The basic idea for checking this is that we generate the next four elements from the minimum (via xi+1 = 2xi - 1) and check whether the four elements are a subset of this. The only inputs where that can cause trouble is those that contain a 2, because this also generates valid sequence elements, so we need to handle that separately.

Last part: let's go through the actual expression, because there's some more funny syntactic sugar here.

```<code>...a~Min~b...
</code>```

This infix notation is short for Min[a,b]. But remember that a and b are sequences, so this actually expands to the four elements Min[i1, i2, i3, i4] and gives us the smallest remaining element in the input.

```<code>.../. 2->0
</code>```

If this results in a 2, we replace it with a 0 (which will generate values which aren't in the sequence). The space is necessary because otherwise Mathematica parses the float literal .2.

```<code>NestList[...&,...,4]
</code>```

We apply the unnamed function on the left 4 times to this value and collect the results in a list.

```<code>2#-1&
</code>```

This simply multiplies its input by 2 and decrements it.

```<code>...~SubsetQ~{a,b}
</code>```

And finally, we check that the list containing all elements from a and b is a subset of this.

Title: Find the odd one out in a sequence

Body:
The Challenge:

Consider the function F(N) = 2^N + 1 where N is a positive integer less than 31. The sequence defined by this function is:

```<code>3, 5, 9, 17, 33, 65, 129, 257, 513, 1025, 2049, 4097, 8193, 16385, 32769, 65537, 131073, 262145, 524289, 1048577, 2097153, 4194305, 8388609, 16777217, 33554433, 67108865, 134217729, 268435457, 536870913, 1073741825
</code>```

An input will be generated as follows:

Take 5 contiguous integers from the above sequence.

Replace one of them with a different, positive integer (which may or may not be part of the above sequence).

Optionally reorder the the 5 resulting numbers.

Given such a list of 5 integers, find the one that was swapped in and is therefore not part of the original 5 contiguous integers.

Example:

Original sublist: 5, 9, 17, 33, 65.

Replace one: 5, 7, 17, 33, 65.

Reorder: 33, 17, 5, 7, 65.

The expected output would be 7.

The 5 values in the input will always be distinct and there will always be a unique solution. (For instance, you won't have to deal with inputs like 3, 9, 17, 33, 129 where either 3 or 129 might have been swapped in.)

Test Cases:

```<code>5,9,17,33,829
o/p: 829

9,5,17,829,33
o/p: 829

33, 17, 5, 7, 65
o/p: 7

5,9,177,33,65
o/p: 177

65,129,259,513,1025
o/p: 259

129,259,513,1025,65
o/p: 259

63,129,257,513,1025
o/p: 63

65,129,257,513,4097
o/p: 4097

5, 9, 2, 17, 33
o/p: 2

536870913, 67108865, 1073741825, 1, 268435457
o/p: 1
</code>```

Body:
Mathematica, 65 bytes

f[a___,x_,b___]/;NestList[2#-1&,a~Min~b/. 2->0,4]~SubsetQ~{a,b}=x

This defines a function f which should be called with 5 arguments, e.g.

f[5, 9, 17, 33, 829]

In principle the function can be called with any (non-zero) number of arguments, but you might get unexpected results...

I think this is the first time, that I managed to put the entire solution to a non-trivial challenge into the left-hand side of a =.

Explanation

This solution really puts Mathematica's pattern matching capabilities to work for us. The basic feature we're using is that Mathematica can't just define simple functions like f[x_] := (* some expression in x *) but we can use arbitrarily complex patterns on the left-hand side, e.g. f[{a_, b_}, x_?OddQ] := ... would add a definition to f which is only used when it's called with a two-element list and an odd integer. Conveniently, we can already give names to elements arbitrarily far down the left-hand side expression (e.g. in the last example, we could immediately refer to the two list elements as a and b).

The pattern we're using in this challenge is f[a___,x_,b___]. Here a___ and b___ are sequences of zero or more arguments and x is a single argument. Since the right-hand side of the definition is simply x, what we want is some magic that ensures that x is used for the input we're searching for and a___ and b___ are simply wildcards that cover the remaining elements.

This is done by attaching a condition to the pattern with /;. The right-hand side of /; (everything up to the =) needs to return True for this pattern to match. The beauty is that Mathematica's pattern matcher will try every single assignment of a, x and b to the inputs for us, so the search for the correct element is done for us. This is essentially a declarative solution to the problem.

As for the condition itself:

NestList[2#-1&,a~Min~b/. 2->0,4]~SubsetQ~{a,b}

Notice that this doesn't depend on x at all. Instead, this condition depends only on the remaining four elements. This is another convenient feature of the pattern matching solution: due to the sequence patterns, a and b together contain all other inputs.

So this condition needs to check whether the remaining four elements are contiguous elements from our sequence with at most one gap. The basic idea for checking this is that we generate the next four elements from the minimum (via xi+1 = 2xi - 1) and check whether the four elements are a subset of this. The only inputs where that can cause trouble is those that contain a 2, because this also generates valid sequence elements, so we need to handle that separately.

Last part: let's go through the actual expression, because there's some more funny syntactic sugar here.

...a~Min~b...

This infix notation is short for Min[a,b]. But remember that a and b are sequences, so this actually expands to the four elements Min[i1, i2, i3, i4] and gives us the smallest remaining element in the input.

.../. 2->0

If this results in a 2, we replace it with a 0 (which will generate values which aren't in the sequence). The space is necessary because otherwise Mathematica parses the float literal .2.

NestList[...&,...,4]

We apply the unnamed function on the left 4 times to this value and collect the results in a list.

2#-1&

This simply multiplies its input by 2 and decrements it.

...~SubsetQ~{a,b}

And finally, we check that the list containing all elements from a and b is a subset of this.


问:
Progruzzle & Colf
Ever fancied creating cool twitter hashtags such as #brexit or #brangelina? this golf is for you.

Write a program that accepts two strings A & B as input and merges them according to the following algorithm:

let n be the number of vowels groups in A (e.g. britain has 2 vowels groups : i in position 3 and ai in position 5).

if n = 1 : truncate A starting at its first vowel group position (example: bill => b)

if n > 1 : truncate A starting at its n-1th vowel group position (example: programming => progr, britain => br)

remove all consonants at the beginning of B (jennifer =>
ennifer)

concatenate the modified A & B

Vowels are aeiou; consonants are bcdfghjklmnpqrstvwxyz.

Input

You can assume the input strings are lowercase and contain at least one vowel and one consonant.

Examples

```<code>brad + angelina      => brangelina
britain + exit       => brexit
ben + jennifer       => bennifer
brangelina + exit    => brangelexit
bill + hillary       => billary
angelina + brad      => angelad
programming + puzzle => progruzzle
code + golf          => colf
out + go             => o
</code>```

答:
Lua, 66 bytes

```<code>$ cat merge.lua
print(((...):gsub(("[]+[^]*[]*[^]*+[^]*"):gsub("]","aeiou]"),"")))
$ lua merge.lua brad+angelina
brangelina
$ lua merge.lua programming+puzzle
progruzzle
</code>```

Title: Progruzzle & Colf

Body:
Lua, 66 bytes

$ cat merge.lua
print(((...):gsub(("[]+[^]*[]*[^]*+[^]*"):gsub("]","aeiou]"),"")))
$ lua merge.lua brad+angelina
brangelina
$ lua merge.lua programming+puzzle
progruzzle