答:
Ruby / ECMA6 27 bytes

```<code>{'t':'trick'}['t']||'treat'
</code>```

Turns out you don't need to assign a JSON object in oredr to use it in ecma6

Original, with plain Javascript:

Ruby/Javscript <s>32</s> 31 bytes

```<code>a={'t':'trick'};a['t']||'treat'
</code>```

Because ruby treats the key as as symbol (:t), does not match with 't' so goes to the or. Whereas JavaScript is not as fussy.

Title: Trick or Treat polyglot

Body:
Since Halloween is coming up I thought I might start a fun little code golf challenge!

The challenge is quite simple. You have to write a program that outputs either trick or treat.

"The twist?" you may ask. Well let me explain:

Your program has to do the following:

Be compilable/runnable in two different languages. Different versions of the same language don't count.

When you run the program in one language it should output trick and the other should output treat. The case is irrelevant and padding the string with whitespace characters are allowed (see examples).

This is code-golf,  so the solution with the fewest bytes wins.

A few explanations:

Valid outputs (Just for the words not for running the code in the two languages. Also adding quotes to signalize the beginning or end of the output. Do not include them in your solution!):

```<code>"trick"

"Treat"

"    TReAt"

"
     tRICk          "
</code>```

Invalid outputs:

```<code>"tri ck"

"tr
eat"

"trck"
</code>```

I'm interested to see what you can come up with! Happy Golfing!

I'd like to note that this is my first challenge so if you have suggestions on this question please leave them in the form of a comment.

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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

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

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

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

If 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 leaderboard snippet:

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

var QUESTION_ID=97472,OVERRIDE_USER=23417;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,TAGS_REG = /(<([^>]+)>)/ig;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:400px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Ruby / ECMA6 27 bytes

{'t':'trick'}['t']||'treat'

Turns out you don't need to assign a JSON object in oredr to use it in ecma6

Original, with plain Javascript:

Ruby/Javscript <s>32</s> 31 bytes

a={'t':'trick'};a['t']||'treat'

Because ruby treats the key as as symbol (:t), does not match with 't' so goes to the or. Whereas JavaScript is not as fussy.


问:
Approximate arcsinc
The goal is simple: Output a nonzero real solution x to the equation sin(x) = -mx, given input m, in the fewest number of bytes.

Specifications:

Your answer must be correct to 3 significant figures.

You may output any real solution other than the trivial solution x=0. You can assume m is such that at least one solution exists. You may also assume m!=0.

An obviously suboptimal python solution using gradient descent:

```<code>from math import *
from random import *
a=x=0.001
m = 5.
def dE(x):return 2*(sin(x)+m*x+1)*(cos(x)+m)
for i in xrange(1000): x-=dE(x)*a
print x
</code>```

Test cases

```<code>-0.25 -> ±2.4746
-0.1  -> ±2.8523 or ±7.0682 or ±8.4232
 0.2  -> ±4.1046 or ±4.9063
</code>```

答:
Mathematica, 28 bytes

```<code>x/.FindRoot[Sinc@x+#,{x,1}]&
</code>```

Searches for a numerical root from the initial guess x=1. Test cases:

```<code>% /@ {-0.25, -0.1, 0.2}
(* {2.47458, 2.85234, 4.10462} *)
</code>```

ContentLicense: CC BY-SA 3.0

Title: Approximate arcsinc

Body:
Mathematica, 28 bytes

x/.FindRoot[Sinc@x+#,{x,1}]&

Searches for a numerical root from the initial guess x=1. Test cases:

% /@ {-0.25, -0.1, 0.2}
(* {2.47458, 2.85234, 4.10462} *)


问:
The Last Monday
Monday, October 31st, is Halloween. And it got me thinking -- I wonder what other months have the last day of the month also be a Monday?

Input

A positive integer in any convenient format representing a year, 10000 > y > 0.

The input can be padded with zeros (e.g., 0025 for year 25) if
required.

Output

A list of the months of that year where the last day of the month is a Monday.

This can be as month names (e.g., January, March, October), or shortnames (Jan, Mar, Oct), or numbers (1, 3, 10), as separate lines or a list or delimited, etc., just so long as it's unambiguous to the reader.

The output format must be consistent:

For all years input (meaning, you can't output month names for some inputs, and month numbers for other inputs)

As well as consistent per output (meaning, you can't output 1 for January in the same output as Jul for July)

Basically, pick one format and stick to it.

Rules

Assume the Gregorian calendar for input/output, even down to y = 1.

Leap years must be properly accounted for (as a reminder: every year divisible by 4, except not years divisible by 100, unless also divisible by 400 -- 1700, 1800, 1900 all weren't leap years, but 2000 was).

You may use any built-ins or other date calculation tools you like.

Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.

Standard loopholes are forbidden.

This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

```<code>   1 --> Apr, Dec
 297 --> May
1776 --> Sep
2000 --> Jan, Jul
2016 --> Feb, Oct
3385 --> Jan, Feb, Oct
</code>```

Leaderboard

var QUESTION_ID=97585,OVERRIDE_USER=42963;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

```

答:
<s>C#6</s> C#, <s>171</s> <s>167</s> 135 bytes

```<code>using System;
void d(int n){for(int i=0;++i<13;)if((int)new DateTime(n,i,DateTime.DaysInMonth(n,i)).DayOfWeek==1)Console.Write(i+" ");}
</code>```

-32 bytes thanks to Shebang

Print months as numbers; with space delimited; with trailing space. Now this answer also works for earlier versions of C#.

Old, 167 bytes

```<code>using System;using System.Linq;
c(int n)=>string.Join(",",Enumerable.Range(1,12).Where(i=>new DateTime(n,i,DateTime.DaysInMonth(n,i)).DayOfWeek==(DayOfWeek)1));
</code>```

-4 bytes thanks to TimmyD

Output months are numbers in return string, comma delimited

Ungolfed

```<code>string c(int n)=>
    string.Join(",",                                        // Join them with commas
        Enumerable.Range(1,12)                              // For 1-12 inclusive
        .Where(                                             // Select only
            i=>new DateTime(n,i,DateTime.DaysInMonth(n,i)   // Get last day of that year-month
            ).DayOfWeek                                     // Get its day of week
            ==(DayOfWeek)1                              // Is Monday
        )
    )
;
</code>```

Title: The Last Monday

Body:
<s>C#6</s> C#, <s>171</s> <s>167</s> 135 bytes

using System;
void d(int n){for(int i=0;++i<13;)if((int)new DateTime(n,i,DateTime.DaysInMonth(n,i)).DayOfWeek==1)Console.Write(i+" ");}

-32 bytes thanks to Shebang

Print months as numbers; with space delimited; with trailing space. Now this answer also works for earlier versions of C#.

Old, 167 bytes

using System;using System.Linq;
c(int n)=>string.Join(",",Enumerable.Range(1,12).Where(i=>new DateTime(n,i,DateTime.DaysInMonth(n,i)).DayOfWeek==(DayOfWeek)1));

-4 bytes thanks to TimmyD

Output months are numbers in return string, comma delimited

Ungolfed

string c(int n)=>
    string.Join(",",                                        // Join them with commas
        Enumerable.Range(1,12)                              // For 1-12 inclusive
        .Where(                                             // Select only
            i=>new DateTime(n,i,DateTime.DaysInMonth(n,i)   // Get last day of that year-month
            ).DayOfWeek                                     // Get its day of week
            ==(DayOfWeek)1                              // Is Monday
        )
    )
;


问:
Alphabet wings!
Your task is to print this exact text:

```<code>az                                               za
abyz                                           zyba
abcxyz                                       zyxcba
abcdwxyz                                   zyxwdcba
abcdevwxyz                               zyxwvedcba
abcdefuvwxyz                           zyxwvufedcba
abcdefgtuvwxyz                       zyxwvutgfedcba
abcdefghstuvwxyz                   zyxwvutshgfedcba
abcdefghirstuvwxyz               zyxwvutsrihgfedcba
abcdefghijqrstuvwxyz           zyxwvutsrqjihgfedcba
abcdefghijkpqrstuvwxyz       zyxwvutsrqpkjihgfedcba
abcdefghijklopqrstuvwxyz   zyxwvutsrqpolkjihgfedcba
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
  abcdefghijklopqrstuvwxyzyxwvutsrqpolkjihgfedcba
    abcdefghijkpqrstuvwxyzyxwvutsrqpkjihgfedcba
      abcdefghijqrstuvwxyzyxwvutsrqjihgfedcba
        abcdefghirstuvwxyzyxwvutsrihgfedcba
          abcdefghstuvwxyzyxwvutshgfedcba
            abcdefgtuvwxyzyxwvutgfedcba
              abcdefuvwxyzyxwvufedcba
                abcdevwxyzyxwvedcba
                  abcdwxyzyxwdcba
                    abcxyzyxcba
                      abyzyba
                        aza
</code>```

The following are allowed:

Leaving out trailing spaces at the end of lines

Doing everything in uppercase instead of lowercase

Trailing newlines

Remember, this is code-golf, so the code with the smallest number of bytes wins.

答:
Pyke, 27 bytes

```<code>13FhG'<R>+26{)DFl826^)_+msX
</code>```

Try it here!

```<code>13F          )              -    for i in range(13):
   h                        -       i+1
    G'<R>+                  -      alphabet[:^]+alphabet[-^:]
          26{               -     ^.rpad(26)
              D        +    -   ^ + V
               F     )      -     for i in ^^:
                l8          -       ^.lstrip()
                  26^       -      ^.lpad(26)
                      _     -    reversed(^)
                        ms  -  map(palindromise, ^)
                          X - splat(^)
</code>```

Title: Alphabet wings!

Body:
Pyke, 27 bytes

13FhG'<R>+26{)DFl826^)_+msX

Try it here!

13F          )              -    for i in range(13):
   h                        -       i+1
    G'<R>+                  -      alphabet[:^]+alphabet[-^:]
          26{               -     ^.rpad(26)
              D        +    -   ^ + V
               F     )      -     for i in ^^:
                l8          -       ^.lstrip()
                  26^       -      ^.lpad(26)
                      _     -    reversed(^)
                        ms  -  map(palindromise, ^)
                          X - splat(^)


Title: The Last Monday

Body:
Monday, October 31st, is Halloween. And it got me thinking -- I wonder what other months have the last day of the month also be a Monday?

Input

A positive integer in any convenient format representing a year, 10000 > y > 0.

The input can be padded with zeros (e.g., 0025 for year 25) if
required.

Output

A list of the months of that year where the last day of the month is a Monday.

This can be as month names (e.g., January, March, October), or shortnames (Jan, Mar, Oct), or numbers (1, 3, 10), as separate lines or a list or delimited, etc., just so long as it's unambiguous to the reader.

The output format must be consistent:

For all years input (meaning, you can't output month names for some inputs, and month numbers for other inputs)

As well as consistent per output (meaning, you can't output 1 for January in the same output as Jul for July)

Basically, pick one format and stick to it.

Rules

Assume the Gregorian calendar for input/output, even down to y = 1.

Leap years must be properly accounted for (as a reminder: every year divisible by 4, except not years divisible by 100, unless also divisible by 400 -- 1700, 1800, 1900 all weren't leap years, but 2000 was).

You may use any built-ins or other date calculation tools you like.

Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.

Standard loopholes are forbidden.

This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

```<code>   1 --> Apr, Dec
 297 --> May
1776 --> Sep
2000 --> Jan, Jul
2016 --> Feb, Oct
3385 --> Jan, Feb, Oct
</code>```

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
GNU awk, 80 bytes

{for(;m<13;a=mktime($0" "++m" 1 9 0 0")){if(strftime("%w",a-8e4)~1){print m-1}}}

Example

$ gawk '{for(;m<13;a=mktime($0" "++m" 1 9 0 0")){if(strftime("%w",a-8e4)~1){print m-1}}}' <<<2016
2
10
$


问:
Trick or Treat polyglot
Since Halloween is coming up I thought I might start a fun little code golf challenge!

The challenge is quite simple. You have to write a program that outputs either trick or treat.

"The twist?" you may ask. Well let me explain:

Your program has to do the following:

Be compilable/runnable in two different languages. Different versions of the same language don't count.

When you run the program in one language it should output trick and the other should output treat. The case is irrelevant and padding the string with whitespace characters are allowed (see examples).

This is code-golf,  so the solution with the fewest bytes wins.

A few explanations:

Valid outputs (Just for the words not for running the code in the two languages. Also adding quotes to signalize the beginning or end of the output. Do not include them in your solution!):

```<code>"trick"

"Treat"

"    TReAt"

"
     tRICk          "
</code>```

Invalid outputs:

```<code>"tri ck"

"tr
eat"

"trck"
</code>```

I'm interested to see what you can come up with! Happy Golfing!

I'd like to note that this is my first challenge so if you have suggestions on this question please leave them in the form of a comment.

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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

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

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

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

If 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 leaderboard snippet:

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

var QUESTION_ID=97472,OVERRIDE_USER=23417;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,TAGS_REG = /(<([^>]+)>)/ig;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:400px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
C# / Java

This probably doesn't qualify as it doesn't run on its own, but the challenge has reminded me of a quirk in how C# and Java handle string comparison differently that you can have some fun with for code obfuscation.

The following function is valid in C# and Java, but will return a different value...

```<code>public static String TrickOrTreat(){
    String m = "Oct";
    String d = "31";
    return m + d == "Oct31" ? "Trick" : "Treat";
}
</code>```

Title: Trick or Treat polyglot

Body:
C# / Java

This probably doesn't qualify as it doesn't run on its own, but the challenge has reminded me of a quirk in how C# and Java handle string comparison differently that you can have some fun with for code obfuscation.

The following function is valid in C# and Java, but will return a different value...

public static String TrickOrTreat(){
    String m = "Oct";
    String d = "31";
    return m + d == "Oct31" ? "Trick" : "Treat";
}


问:
Superstitious Programming
Your challenge is extremely simple. Given a year as input, print all the months in that year that will contain a Friday the 13th according to the Gregorian calendar. Note that even though the Gregorian Calendar wasn't introduced until 1582, for simplicity's sake we will pretend that it has been in use since 0001 AD.

Rules

Full programs or functions are allowed.

You can take input as function arguments, from STDIN, or as command line arguments.

You are not allowed to use any date and time builtins.

You can safely assume that the input will be a valid year. If the input is smaller than 1, not a valid integer, or larger than your languages native number type, you do not have to handle this, and you get undefined behaviour.

Output can be numbers, in English, or in any other human readable format, so long as you specify the standard.

Make sure you account for leap-years. And remember, leap-years do not happen every 4 years!

Tips

Since there are so many different ways to go about this, I don't want to tell you how to do it. However, it might be confusing where to start, so here are a couple different reliable ways of determining the day of the week from a date.

Conway's doomsday-algorithm

Pick a start date with a known day of the week, such as Monday, January 1st, 0001 and find how far apart the two days are, and take that number mod 7.

Gauss's Algorithm

A variation on Gauss's Algorithm

Any of these methods

Sample IO

```<code>2016 --> May
0001 --> 4, 7
1997 --> Jun
1337 --> 09, 12
123456789 --> January, October
</code>```

As usual, this is code-golf, so standard-loopholes apply, and shortest answer wins.

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
C - <s>164</s> <s>153</s> 112 bytes

I found a nice little solution using a heavily modified version of Schwerdtfeger's method. It encodes the necessary table in an integer using base 7, modified to fit in a signed 32-bit word. It outputs the month as an ASCII-character, with January encoded as 1, February as 2 and so on, with October encoded as :, November encoded as ; and December encoded as <.

t=1496603958,m;main(y){for(scanf("%d",&y),y--;(y%100+y%100/4+y/100%4*5+t+5)%7||putchar(m+49),t;t/=7)2-++m||y++;}
```

<p>Here it is slightly ungolfed:</p>

<pre class="lang-c prettyprint-override"><code>t=1496603958,m;
main(y){
  for(
    scanf("%d",&y),y--;
    (y%100+y%100/4+y/100%4*5+t+5)%7||putchar(m+49),t;
    t/=7
  )
    2-++m||y++;
}
</code>```

I am sure there are a few ways to make it even smaller, but I think the algorithm, or a slight variation thereof, is nearly ideal for finding the months where Friday the 13th occurs (with respect to code size). Notes:

If a 64-bit word could have been used it would be possible to get rid of an annoying addition (+5).

The variable m isn't actually necessary, since the month we are looking at is deducible from t.

I leave my older answer below, seeing as it uses a completely different method not seen in other answers here.

This is based on a solution to a related problem (https://codegolf.stackexchange.com/a/22531/7682).

Y,M,D,d;main(y){for(scanf("%d",&y);Y<=y;++D>28+(M^2?M+(M>7)&1^2:!(Y&3)&&(Y%25||!(Y&15)))&&(D=1,M=M%12+1)<2&&Y++)(d=++d%7)^1||D^13||y^Y||printf("%d,",M);}
```

<p>It basically simulates the Gregorian calendar, advancing one day at a time, printing the month when it is a Friday and the 13th. Here it is in a slightly more readable form:</p>

<pre class="lang-c prettyprint-override"><code>Y,M,D,d;
main(y){
  for(
    scanf("%d",&y);
    Y<=y;
    ++D>28+(
      M^2
        ?M+(M>7)&1^2
        :!(Y&3)&&(Y%25||!(Y&15))
    )&&(
      D=1,
      M=M%12+1
    )<2&&Y++
  )
    (d=++d%7)^1||D^13||y^Y||
      printf("%d,",M);
}
</code>```

Title: Superstitious Programming

Body:
C - <s>164</s> <s>153</s> 112 bytes

I found a nice little solution using a heavily modified version of Schwerdtfeger's method. It encodes the necessary table in an integer using base 7, modified to fit in a signed 32-bit word. It outputs the month as an ASCII-character, with January encoded as 1, February as 2 and so on, with October encoded as :, November encoded as ; and December encoded as <.

t=1496603958,m;main(y){for(scanf("%d",&y),y--;(y%100+y%100/4+y/100%4*5+t+5)%7||putchar(m+49),t;t/=7)2-++m||y++;}

Here it is slightly ungolfed:

t=1496603958,m;
main(y){
  for(
    scanf("%d",&y),y--;
    (y%100+y%100/4+y/100%4*5+t+5)%7||putchar(m+49),t;
    t/=7
  )
    2-++m||y++;
}

I am sure there are a few ways to make it even smaller, but I think the algorithm, or a slight variation thereof, is nearly ideal for finding the months where Friday the 13th occurs (with respect to code size). Notes:

If a 64-bit word could have been used it would be possible to get rid of an annoying addition (+5).

The variable m isn't actually necessary, since the month we are looking at is deducible from t.

I leave my older answer below, seeing as it uses a completely different method not seen in other answers here.

This is based on a solution to a related problem (https://codegolf.stackexchange.com/a/22531/7682).

Y,M,D,d;main(y){for(scanf("%d",&y);Y<=y;++D>28+(M^2?M+(M>7)&1^2:!(Y&3)&&(Y%25||!(Y&15)))&&(D=1,M=M%12+1)<2&&Y++)(d=++d%7)^1||D^13||y^Y||printf("%d,",M);}

It basically simulates the Gregorian calendar, advancing one day at a time, printing the month when it is a Friday and the 13th. Here it is in a slightly more readable form:

Y,M,D,d;
main(y){
  for(
    scanf("%d",&y);
    Y<=y;
    ++D>28+(
      M^2
        ?M+(M>7)&1^2
        :!(Y&3)&&(Y%25||!(Y&15))
    )&&(
      D=1,
      M=M%12+1
    )<2&&Y++
  )
    (d=++d%7)^1||D^13||y^Y||
      printf("%d,",M);
}


答:
Python/Brainf**k (87 Bytes)

```<code>print("treat")#+++++++++[>+++++++++<-]>+++.--.<+++[>---<-]>.<++[>---<-]>.<++++[>++<-]>.
</code>```

Python ignores everything after the # because its a comment and brainf**k ignores print("treat")# because they are unrecognized characters.

Title: Trick or Treat polyglot

Body:
Python/Brainf**k (87 Bytes)

print("treat")#+++++++++[>+++++++++<-]>+++.--.<+++[>---<-]>.<++[>---<-]>.<++++[>++<-]>.

Python ignores everything after the # because its a comment and brainf**k ignores print("treat")# because they are unrecognized characters.


问:
Print the digital root
This is different from My Word can beat up your Word as it is less complex and only requires you to calculate it, and not compare them.

To find the digital root, take all of the digits of a number, add them, and repeat until you get a one-digit number. For example, if the number was 12345, you would add 1, 2, 3, 4, and 5, getting 15. You would then add 1 and 5, giving you 6.

Your task

Given an integer N (0 <= N <= 10000) through STDIN, print the digital root of N.

Test cases

```<code>1 -> 1
45 -> 9
341 -> 8
6801 -> 6
59613 -> 6
495106 -> 7
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

答:
Jelly, <s>7 5 4</s> 3 bytes

```<code>ḃ9Ṫ
</code>```

TryItOnline! or all test cases

How?

The digital root is known to obey the formula (n-1)%9+1.

This is the same as the last digit in bijective base 9

(and due to implementation that 0ḃ9=[] and []Ṫ=0 this handles the edge-case of zero).

```<code>ḃ9Ṫ - Main link: n
ḃ9  - convert to bijective base 9 digits (a list)
  Ṫ - tail (get the last digit)
</code>```

Title: Print the digital root

Body:
Jelly, <s>7 5 4</s> 3 bytes

ḃ9Ṫ

TryItOnline! or all test cases

How?

The digital root is known to obey the formula (n-1)%9+1.

This is the same as the last digit in bijective base 9

(and due to implementation that 0ḃ9=[] and []Ṫ=0 this handles the edge-case of zero).

ḃ9Ṫ - Main link: n
ḃ9  - convert to bijective base 9 digits (a list)
  Ṫ - tail (get the last digit)


答:
R, 72 67 29 bytes

Edit: Thanks to @rturnbull for shaving off two bytes.

```<code>n=scan();`if`(n%%9|!n,n%%9,9)
</code>```

Title: Print the digital root

Body:
This is different from My Word can beat up your Word as it is less complex and only requires you to calculate it, and not compare them.

To find the digital root, take all of the digits of a number, add them, and repeat until you get a one-digit number. For example, if the number was 12345, you would add 1, 2, 3, 4, and 5, getting 15. You would then add 1 and 5, giving you 6.

Your task

Given an integer N (0 <= N <= 10000) through STDIN, print the digital root of N.

Test cases

```<code>1 -> 1
45 -> 9
341 -> 8
6801 -> 6
59613 -> 6
495106 -> 7
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

Body:
R, 72 67 29 bytes

Edit: Thanks to @rturnbull for shaving off two bytes.

n=scan();`if`(n%%9|!n,n%%9,9)


答:
Pyke, 1 byte

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

Try it here!

Takes the digital root of the input

Title: Print the digital root

Body:
Pyke, 1 byte

s

Try it here!

Takes the digital root of the input


答:
05AB1E, 6 bytes

```<code>[SODg#
</code>```

Try it online!

Explanation

```<code>[        # infinite loop
 S       # split into digits
  O      # sum digits
   Dg#   # if length == 1: break
</code>```

Title: Print the digital root

Body:
05AB1E, 6 bytes

[SODg#

Try it online!

Explanation

[        # infinite loop
 S       # split into digits
  O      # sum digits
   Dg#   # if length == 1: break


答:
Python 2, 54 51 bytes

```<code>i=input()
while~-len(i):i=`sum(map(int,i))`
print i
</code>```

Thanks to Oliver and Karl Napf for helping me save 3 bytes

Title: Print the digital root

Body:
Python 2, 54 51 bytes

i=input()
while~-len(i):i=`sum(map(int,i))`
print i

Thanks to Oliver and Karl Napf for helping me save 3 bytes


答:
PHP, 15 Bytes

<?=--$argn%9+1;
```

<p>Previous version PHP, 55 Bytes
</p>

```$n=$argn;while($n>9)$n=array_sum(Str_split($n));echo$n;
```

Title: Print the digital root

Body:
PHP, 15 Bytes

<?=--$argn%9+1;

Previous version PHP, 55 Bytes

$n=$argn;while($n>9)$n=array_sum(Str_split($n));echo$n;


答:
JavaScript (ES6), <s>41</s> 38 bytes

Saved 3 bytes, thanks to Bassdrop Cumberwubwubwub

Takes and returns a string.

```<code>f=s=>s[1]?f(''+eval([...s].join`+`)):s
</code>```

Test cases

f=s=>s[1]?f(''+eval([...s].join`+`)):s

console.log(f("1")); // -> 1
console.log(f("45")); // -> 9
console.log(f("341")); // -> 8
console.log(f("6801")); // -> 6
console.log(f("59613")); // -> 6
console.log(f("495106")); // -> 7```

Title: Print the digital root

Body:
JavaScript (ES6), <s>41</s> 38 bytes

Saved 3 bytes, thanks to Bassdrop Cumberwubwubwub

Takes and returns a string.

f=s=>s[1]?f(''+eval([...s].join`+`)):s

Test cases

f=s=>s[1]?f(''+eval([...s].join`+`)):s

console.log(f("1")); // -> 1
console.log(f("45")); // -> 9
console.log(f("341")); // -> 8
console.log(f("6801")); // -> 6
console.log(f("59613")); // -> 6
console.log(f("495106")); // -> 7


答:
Brachylog, 9 bytes

```<code>#0|@e+:0&
</code>```

Try it online!

Explanation

```<code>#0            Input = Output = a digit
  |           OR
   @e         Split the input into a list of digits
     +        Sum
      :0&     Call this predicate recursively
</code>```

Alternative approach, 11 bytes

```:I:{@e+}i#0```

This one uses the meta-predicate i - Iterate to call I times the predicate {@e+} on the input. This will try values of I from 0 to infinity until one makes it so that the output of i is a single digit which makes #0 true.

Title: Print the digital root

Body:
Brachylog, 9 bytes

#0|@e+:0&

Try it online!

Explanation

#0            Input = Output = a digit
  |           OR
   @e         Split the input into a list of digits
     +        Sum
      :0&     Call this predicate recursively

Alternative approach, 11 bytes

:I:{@e+}i#0

This one uses the meta-predicate i - Iterate to call I times the predicate {@e+} on the input. This will try values of I from 0 to infinity until one makes it so that the output of i is a single digit which makes #0 true.


问:
The Rule of Thumb for Title Capitalization
According to this site a general rule recommended by The U.S. Government Printing Office Style Manual is

Capitalize all words in titles of publications and documents, except
  a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and
  nor.

This might not be true as I'm unable to find such a recommendation in the Style Manual, but let's use this rule anyway.

The Challenge

Given an input string consisting of lower case words delimited by spaces, output the capitalization of the string according to the following rules

The first and last word is capitalized.

All other words are capitalized, except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor.

The input string will contain at least one word and each word contains at least one letter and only characters from a to z.

This is a code golf challenge, so try to use as few bytes as possible in the language of your choice. You may write a full program or a function to accomplish the task.

Testcases

```<code>"the rule of thumb for title capitalization" -> "The Rule of Thumb for Title Capitalization"
"programming puzzles and code golf" -> "Programming Puzzles and Code Golf"
"the many uses of the letter a" -> "The Many Uses of the Letter A"
"title" -> "Title"
"and and and" -> "And and And"
"a an and as at but by for in nor of on or the to up" -> "A an and as at but by for in nor of on or the to Up"
"on computable numbers with an application to the entscheidungsproblem" -> "On Computable Numbers With an Application to the Entscheidungsproblem"
</code>```

答:
C#, 305 bytes

Lots of room for improvement still but here you go:

```<code>s=>{;var b=s.Split(' ');b[0]=((char)(b[0][0]-32))+b[0].Substring(1);int i=0,n=b.Length;for(;++i<n;)if(!"a,an,the,at,by,for,in,of,on,to,up,and,as,but,or,nor".Split(',').Contains(b[i]))b[i]=((char)(b[i][0]-32))+b[i].Substring(1);b[n-1]=((char)(b[n-1][0]-32))+b[n-1].Substring(1);return string.Join(" ",b);};
</code>```

Body:
C#, 305 bytes

Lots of room for improvement still but here you go:

s=>{;var b=s.Split(' ');b[0]=((char)(b[0][0]-32))+b[0].Substring(1);int i=0,n=b.Length;for(;++i<n;)if(!"a,an,the,at,by,for,in,of,on,to,up,and,as,but,or,nor".Split(',').Contains(b[i]))b[i]=((char)(b[i][0]-32))+b[i].Substring(1);b[n-1]=((char)(b[n-1][0]-32))+b[n-1].Substring(1);return string.Join(" ",b);};


答:
Java 7, 63 bytes

```<code>int f(int n){int s=0;for(;n>0;n/=10)s+=n%10;return s>9?f(s):s;}
</code>```

Recursive function which just gets digits with mod/div. Nothing fancy.

Cheap port

of Jonathan Allan's would be a measly 28 bytes:

```<code>int f(int n){return~-n%9+1;}
</code>```

Title: Print the digital root

Body:
Java 7, 63 bytes

int f(int n){int s=0;for(;n>0;n/=10)s+=n%10;return s>9?f(s):s;}

Recursive function which just gets digits with mod/div. Nothing fancy.

Cheap port

of Jonathan Allan's would be a measly 28 bytes:

int f(int n){return~-n%9+1;}


Title: Print the digital root

Body:
JavaScript (ES6), <s>16</s> 10 bytes

n=>--n%9+1

Test cases

let f =

n=>--n%9+1

console.log(f(1)); // -> 1
console.log(f(45)); // -> 9
console.log(f(341)); // -> 8
console.log(f(6801)); // -> 6
console.log(f(59613)); // -> 6
console.log(f(495106)); // -> 7


答:
Python, <s>16</s> 20 bytes

+4 bytes to handle edge case of zero.

lambda n:n and~-n%9+1
```

repl.it

Title: Print the digital root

Body:
Python, <s>16</s> 20 bytes

+4 bytes to handle edge case of zero.

lambda n:n and~-n%9+1

repl.it


答:
C, <s>64</s> 29 bytes

C port from Jonathan Allan's answer (with special case 0).

f(i){return i>0?~-i%9+1:0;}
```
<p>Previous 64 byte code:</p>
<pre class="lang-c prettyprint-override"><code>q(i){return i>9?i%10+q(i/10):i;}
f(i){i=q(i);return i>9?f(i):i;}
</code>```

q takes the cross sum and f repeats taking the cross sum until a single digit.

Title: Print the digital root

Body:
C, <s>64</s> 29 bytes

C port from Jonathan Allan's answer (with special case 0).

f(i){return i>0?~-i%9+1:0;}

Previous 64 byte code:

q(i){return i>9?i%10+q(i/10):i;}
f(i){i=q(i);return i>9?f(i):i;}

q takes the cross sum and f repeats taking the cross sum until a single digit.


答:
MATL, 3 bytes

```<code>9X\
</code>```

Try it online!

A lot of (now deleted answers) tried using modulo 9 to get the result. This is a great shortcut, but unfortunately does not work for multiples of 9. MATL has a function for modulo on the interval [1, n]. Using this modulo, we have 1 % 3 == 1, 2 % 3 == 2, 3 % 3 == 3, 4 % 3 == 1, etc. This answer simply takes the input modulo nine using this custom modulo.

Title: Print the digital root

Body:
MATL, 3 bytes

9X\

Try it online!

A lot of (now deleted answers) tried using modulo 9 to get the result. This is a great shortcut, but unfortunately does not work for multiples of 9. MATL has a function for modulo on the interval [1, n]. Using this modulo, we have 1 % 3 == 1, 2 % 3 == 2, 3 % 3 == 3, 4 % 3 == 1, etc. This answer simply takes the input modulo nine using this custom modulo.


答:
Python, 45 bytes

```<code>f=lambda x:x[1:]and f(`sum(map(int,x))`)or x
</code>```

Takes the argument as a string.

Title: Print the digital root

Body:
Python, 45 bytes

f=lambda x:x[1:]and f(`sum(map(int,x))`)or x

Takes the argument as a string.


答:
Perl <s>34</s> 28 bytes

Includes +1 for -p

```<code>s/./+$&/g,$_=eval while/../
</code>```

Uses the method described in the question.

Example:

```<code>$ echo -n 495106 | perl -p DigitalRoot.pl
7
</code>```

Title: Print the digital root

Body:
Perl <s>34</s> 28 bytes

Includes +1 for -p

s/./+$&/g,$_=eval while/../

Uses the method described in the question.

Example:

$ echo -n 495106 | perl -p DigitalRoot.pl
7


答:
Groovy, 57 Bytes

```<code>{n->for(;(n=(""+n).collect{(int)it-48}.sum())/10>1;){};n}
</code>```

Repeatedly converts to string, sums the ascii conversion of the digits and continues while the resultant integer divided by 10 is greater than 1. Then it returns the mutated input.

Tried recursion too, cost more bytes though:

```<code>x={i->i?i%10+x(i.intdiv(10)):0};y={i->x(i)/10<1?x(i):y(x(i))}
</code>```

Title: Print the digital root

Body:
Groovy, 57 Bytes

{n->for(;(n=(""+n).collect{(int)it-48}.sum())/10>1;){};n}

Repeatedly converts to string, sums the ascii conversion of the digits and continues while the resultant integer divided by 10 is greater than 1. Then it returns the mutated input.

Tried recursion too, cost more bytes though:

x={i->i?i%10+x(i.intdiv(10)):0};y={i->x(i)/10<1?x(i):y(x(i))}


Title: Print the digital root

Body:
This is different from My Word can beat up your Word as it is less complex and only requires you to calculate it, and not compare them.

To find the digital root, take all of the digits of a number, add them, and repeat until you get a one-digit number. For example, if the number was 12345, you would add 1, 2, 3, 4, and 5, getting 15. You would then add 1 and 5, giving you 6.

Your task

Given an integer N (0 <= N <= 10000) through STDIN, print the digital root of N.

Test cases

```<code>1 -> 1
45 -> 9
341 -> 8
6801 -> 6
59613 -> 6
495106 -> 7
</code>```

Remember, this is code-golf, so the code with the smallest number of bytes wins.

Body:
Ruby, 12 bytes

->n{~-n%9+1}


答:
CJam, <s>19</s> 13 bytes

```<code>r{:~:+_s\9>}g
</code>```

Interpreter

Explanation:

```<code>r{:~:+_s\9>}g Code
r             Get token
 {:~:+_s\9>}  Block: :~:+_s\9>
   ~          Eval
  :           Map
     +        Add
    :         Map
      _       Duplicate
       s      Convert to string
        \     Swap
         9    9
          >   Greater than
            g Do while (pop)
</code>```

Thanks to 8478 (Martin Ender) for -6 bytes.

CJam, 6 bytes

```<code>ri(9%)
</code>```

Suggested by 8478 (Martin Ender). Interpreter

I was thinking about it, but Martin just got it before me. Explanation:

```<code>ri(9%) Code
r      Get token
 i     Convert to integer
  (    Decrement
   9   9
    %  Modulo
     ) Increment
</code>```

Title: Print the digital root

Body:
CJam, <s>19</s> 13 bytes

r{:~:+_s\9>}g

Interpreter

Explanation:

r{:~:+_s\9>}g Code
r             Get token
 {:~:+_s\9>}  Block: :~:+_s\9>
   ~          Eval
  :           Map
     +        Add
    :         Map
      _       Duplicate
       s      Convert to string
        \     Swap
         9    9
          >   Greater than
            g Do while (pop)

Thanks to 8478 (Martin Ender) for -6 bytes.

CJam, 6 bytes

ri(9%)

Suggested by 8478 (Martin Ender). Interpreter

I was thinking about it, but Martin just got it before me. Explanation:

ri(9%) Code
r      Get token
 i     Convert to integer
  (    Decrement
   9   9
    %  Modulo
     ) Increment


答:
Mathematica, <s>27</s> 11 bytes

```<code>Mod[#,9,1]&
</code>```

Mathematica's Mod takes a third parameter as an offset of the resulting range of the modulo. This avoids decrementing the input and incrementing the output.

Title: Print the digital root

Body:
Mathematica, <s>27</s> 11 bytes

Mod[#,9,1]&

Mathematica's Mod takes a third parameter as an offset of the resulting range of the modulo. This avoids decrementing the input and incrementing the output.


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

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

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

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

Test cases:

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

Or as CSV:

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

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
SHENZHEN I/O MCxxxx assembly code, 35 bytes

```<code>slx x0
mov x0 acc
add x0
mov acc x0
</code>```

Take the two numbers via XBus on x0, and send the result on x0

Title: Add two numbers

Body:
SHENZHEN I/O MCxxxx assembly code, 35 bytes

slx x0
mov x0 acc
add x0
mov acc x0

Take the two numbers via XBus on x0, and send the result on x0


答:
Retina, 15 bytes

```<code>.+
$*
1{9}\B

1
</code>```

Try it online! (The first line enables a linefeed-separated test suite.)

Explanation

```<code>.+
$*
</code>```

Convert input to unary.

```<code>(1{9})*\B

</code>```

Take 1-based modulo by removing nines that have at least one more character after them.

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

Count the remaining number of 1s to convert back to decimal.

Title: Print the digital root

Body:
Retina, 15 bytes

.+
$*
1{9}\B

1

Try it online! (The first line enables a linefeed-separated test suite.)

Explanation

.+
$*

Convert input to unary.

(1{9})*\B

Take 1-based modulo by removing nines that have at least one more character after them.

1

Count the remaining number of 1s to convert back to decimal.


问:
Print the Greek alphabet!
Fairly obviously, you have to print the Greek alphabet. But I thought I'd make it slightly more interesting, so there's a twist: when your program is ran with an argument (anything), it should output the Greek alphabet in lowercase.

Information

Greek alphabet (Capitals):  ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ

Greek alphabet (Lowercase): αβγδεζηθικλμνξοπρστυφχψω

Rules/Requirements

Each submission must be a full program.

Builtins to print the Greek alphabet are not permitted

Standard loopholes apply

You must print exactly what is shown.

Scoring

Programs are scored according to bytes. If you are using a character set different to UTF-8 please specify. Try to get the least bytes out of everyone, this is code-golf!

Test cases

```<code>./program
==> ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ

./program 1
==> αβγδεζηθικλμνξοπρστυφχψω

./program 'lower'
==> αβγδεζηθικλμνξοπρστυφχψω

./program 123897883421
==> αβγδεζηθικλμνξοπρστυφχψω

./program ""
==> αβγδεζηθικλμνξοπρστυφχψω

greek();
==> ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ

greek("blah");
==> αβγδεζηθικλμνξοπρστυφχψω

greek(123);
==> αβγδεζηθικλμνξοπρστυφχψω
</code>```

Submissions

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 leaderboard snippet:

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

Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 97049; // 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 = 53406; // 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,]*[^\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 (/ b.lang) return 1;
    if (a.lang < b.lang) 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/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
C#, 174 bytes

Lazy implementation, can probably golf it a lot

```<code>class P{static void main(string[] a){System.Console.Write(a.Length>0?"αβγδεζηθικλμνξοπρστυφχψω":"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ");}}
</code>```

Title: Print the Greek alphabet!

Body:
C#, 174 bytes

Lazy implementation, can probably golf it a lot

class P{static void main(string[] a){System.Console.Write(a.Length>0?"αβγδεζηθικλμνξοπρστυφχψω":"ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ");}}


问:
Convert Chinese numbers
In Chinese, numbers are written as follows:

1 一 2 二 3 三 4 四 5 五 6 六 7 七 8 八 9 九 10 十

For numbers above 10, it is expressed as the number of tens and the number of ones. If there is only one ten, you do not need to explicitly say one, and if there are no ones, you don't need to put anything after:

11 十一

24 二十四

83 八十三

90 九十

For numbers above 100, you use the same logic, but with the character 百. This time though, if there is only one hundred, you still need to write it out, and if there are no tens, you need to say 零.

100 一百 231 二百三十一 803 八百零三 999 九百九十九

Your task is to convert these Chinese numerals into Arabic numerals. Given a number N in Chinese (一 (1) <= N <= 九百九十九 (999)), convert it into an Arabic number.

Remember, this is code-golf, so the code with the smallest number of bytes wins.

答:
Python 3, 128 bytes

Saving 2+3 bytes thanks to Shebang and 2 for replacing (d>9)+(d>10) with max(d-9,0)

n=a=0
for c in input():d=" 一二三四五六七八九十百".find(c);n+=[0,10*a**(a>0),a*100][max(d-9,0)];a=d*(d<10)
print(n+a)
```
<p>Ungolfed:</p>
<pre class="lang-python prettyprint-override"><code>n=a=0
for c in input():
 d=" 一二三四五六七八九十百".find(c)
 n+=[0, 10*a**(a>0), a*100][max(d-9,0)]
 a=d*(d<10)
print(n+a)
</code>```

Initial answer

n=a=0
for c in input():
 d=" 一二三四五六七八九十百".find(c)
 if d<=9:a=d
 elif d==10:n+=[1,a][a>0]*10;a=0
 elif d==11:n+=a*100;a=0
print(n+a)
```

n will be the final number and a is the previous digit.

Title: Convert Chinese numbers

Body:
Python 3, 128 bytes

Saving 2+3 bytes thanks to Shebang and 2 for replacing (d>9)+(d>10) with max(d-9,0)

n=a=0
for c in input():d=" 一二三四五六七八九十百".find(c);n+=[0,10*a**(a>0),a*100][max(d-9,0)];a=d*(d<10)
print(n+a)

Ungolfed:

n=a=0
for c in input():
 d=" 一二三四五六七八九十百".find(c)
 n+=[0, 10*a**(a>0), a*100][max(d-9,0)]
 a=d*(d<10)
print(n+a)

Initial answer

n=a=0
for c in input():
 d=" 一二三四五六七八九十百".find(c)
 if d<=9:a=d
 elif d==10:n+=[1,a][a>0]*10;a=0
 elif d==11:n+=a*100;a=0
print(n+a)

n will be the final number and a is the previous digit.


答:
C#, <s>197</s> 210 bytes

```<code>int x(string s){if(s=="")return 0;if(s[0]=='零')s=s.Substring(1);if(s[0]=='十')s="一"+s;string t=" 一二三四五六七八九";return s.Length<2?t.IndexOf(s[0]):(t.IndexOf(s[0])*(s[1]=='百'?100:10)+x(s.Substring(2)));}
</code>```

Wrong byte count previously due to encoding ignored...

Big5 Encoding

A recursive solution which pads the input if it's 10-19 for easier processing, then process from left 2 characters at a time.

Ungolfed

```<code>public int x(string s)
{
    if (s == "")
        return 0;   // Recursion termination when input is divisible by 10 (no unit digit character)
    if (s[0] == '零')
        s = s.Substring(1);   // Ignore '零'
    if (s[0 ]== '十')
        s = "一" + s;   // Normalize 10-19 by padding with "一"
    string t = " 一二三四五六七八九";   // Index lookup
    return s.Length < 2
        ? t.IndexOf(s[0])   // 0-9
        : (t.IndexOf(s[0]) * (s[1] == '百' ? 100 : 10) + x(s.Substring(2)));
    // Get the first character's digit, multiply by 100 or 10 depends on 2nd character, and recursively process from 3rd character onwards
}
</code>```

Title: Convert Chinese numbers

Body:
In Chinese, numbers are written as follows:

1 一 2 二 3 三 4 四 5 五 6 六 7 七 8 八 9 九 10 十

For numbers above 10, it is expressed as the number of tens and the number of ones. If there is only one ten, you do not need to explicitly say one, and if there are no ones, you don't need to put anything after:

11 十一

24 二十四

83 八十三

90 九十

For numbers above 100, you use the same logic, but with the character 百. This time though, if there is only one hundred, you still need to write it out, and if there are no tens, you need to say 零.

100 一百 231 二百三十一 803 八百零三 999 九百九十九

Your task is to convert these Chinese numerals into Arabic numerals. Given a number N in Chinese (一 (1) <= N <= 九百九十九 (999)), convert it into an Arabic number.

Remember, this is code-golf, so the code with the smallest number of bytes wins.

Body:
C#, <s>197</s> 210 bytes

int x(string s){if(s=="")return 0;if(s[0]=='零')s=s.Substring(1);if(s[0]=='十')s="一"+s;string t=" 一二三四五六七八九";return s.Length<2?t.IndexOf(s[0]):(t.IndexOf(s[0])*(s[1]=='百'?100:10)+x(s.Substring(2)));}

Wrong byte count previously due to encoding ignored...

Big5 Encoding

A recursive solution which pads the input if it's 10-19 for easier processing, then process from left 2 characters at a time.

Ungolfed

public int x(string s)
{
    if (s == "")
        return 0;   // Recursion termination when input is divisible by 10 (no unit digit character)
    if (s[0] == '零')
        s = s.Substring(1);   // Ignore '零'
    if (s[0 ]== '十')
        s = "一" + s;   // Normalize 10-19 by padding with "一"
    string t = " 一二三四五六七八九";   // Index lookup
    return s.Length < 2
        ? t.IndexOf(s[0])   // 0-9
        : (t.IndexOf(s[0]) * (s[1] == '百' ? 100 : 10) + x(s.Substring(2)));
    // Get the first character's digit, multiply by 100 or 10 depends on 2nd character, and recursively process from 3rd character onwards
}


Title: Convert Chinese numbers

Body:
PHP, 225 Bytes

preg_match_all("#[1-9]?10+|[1-9]#",str_replace(["一","二","三","四","五","六","七","八","九","十","百"],[1,2,3,4,5,6,7,8,9,10,100],$argv[1]),$z);foreach($z[0]as$p)$s+=($b=substr_count($p,0))?$p[0]*10**$b:$p;echo$s;


问:
Print the Greek alphabet in words
This is different from Print the Greek alphabet! because it is in words.

This is different from "Hello, World!" because the output is different and much longer, leading to different techniques.

This is different from We're no strangers to code golf, you know the rules, and so do I because the output is different and much shorter, leading to different techniques.

Your task is to print this exact text: (the Greek alphabet in words)

```<code>alpha beta gamma delta epsilon zeta eta theta iota kappa lambda mu nu xi omicron pi rho sigma tau upsilon phi chi psi omega
</code>```

Capitalization does not matter.

Remember, this is code-golf, so the code with the smallest number of bytes wins.

答:
05AB1E, 86 bytes

```<code>“¤±¢ªœÏ¤œ epsilon zeta etaìÛ iota kappaÊ¯ mu nu xi omicron¾î rho¿Ã tau upsilonÐ¢Â¶á‚Åµ
</code>```

Try it online!

Title: Print the Greek alphabet in words

Body:
05AB1E, 86 bytes

“¤±¢ªœÏ¤œ epsilon zeta etaìÛ iota kappaÊ¯ mu nu xi omicron¾î rho¿Ã tau upsilonÐ¢Â¶á‚Åµ

Try it online!


答:
QBIC and QBasic 4.5, 45 bytes

QBIC is my attempt at a golfing language, based on QBasic. The language has evolved quite a bit from its original, as I think this snippet illustrates:

```<code>A$=STR$(q):IF A$=" 1"THEN?"trick"ELSE?"treat"
</code>```

The space before the 1 is significant. QBIC will print trick, QBasic will show treat. So, what's going on here. First, QBasic:

```<code>A$=STR$(q)          Set A$ to a string representation of the number q
IF A$=" 1"          A$ is now " 0" because 'q' is not set and 0 by default.
                    Space added by STR$ :'(
THEN PRINT "trick"  Ignored
ELSE PRINT "treat"  Printed
</code>```

Now QBIC. This one is a little more complex:

```<code>A                   Creates A$ in te output BAS
$                   Start a Code Literal. QBIC is not yet very function-complete,
                    so on occasion we need to call QBASIC functions directly. However,
                    that may interfere with QBIC syntax. When a '$' is encountered,
                    QBIC ignores everything from that $ until a '|' or EOF and
                    just passes this along as QBASIC.
=STR$(q)            Set A$ to a string representation of the number q
IF A$=" 1"          A$ is now " 1" because 'q' is pre-initilised to 1 by QBIC
THEN PRINT "trick"  printed
ELSE PRINT "treat"  ignored
</code>```

We don't need END-IFs, because in the snippet the IF is in-line.

Title: Trick or Treat polyglot

Body:
Since Halloween is coming up I thought I might start a fun little code golf challenge!

The challenge is quite simple. You have to write a program that outputs either trick or treat.

"The twist?" you may ask. Well let me explain:

Your program has to do the following:

Be compilable/runnable in two different languages. Different versions of the same language don't count.

When you run the program in one language it should output trick and the other should output treat. The case is irrelevant and padding the string with whitespace characters are allowed (see examples).

This is code-golf,  so the solution with the fewest bytes wins.

A few explanations:

Valid outputs (Just for the words not for running the code in the two languages. Also adding quotes to signalize the beginning or end of the output. Do not include them in your solution!):

```<code>"trick"

"Treat"

"    TReAt"

"
     tRICk          "
</code>```

Invalid outputs:

```<code>"tri ck"

"tr
eat"

"trck"
</code>```

I'm interested to see what you can come up with! Happy Golfing!

I'd like to note that this is my first challenge so if you have suggestions on this question please leave them in the form of a comment.

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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

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

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

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

If 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 leaderboard snippet:

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

var QUESTION_ID=97472,OVERRIDE_USER=23417;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,TAGS_REG = /(<([^>]+)>)/ig;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:400px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
QBIC and QBasic 4.5, 45 bytes

QBIC is my attempt at a golfing language, based on QBasic. The language has evolved quite a bit from its original, as I think this snippet illustrates:

A$=STR$(q):IF A$=" 1"THEN?"trick"ELSE?"treat"

The space before the 1 is significant. QBIC will print trick, QBasic will show treat. So, what's going on here. First, QBasic:

A$=STR$(q)          Set A$ to a string representation of the number q
IF A$=" 1"          A$ is now " 0" because 'q' is not set and 0 by default.
                    Space added by STR$ :'(
THEN PRINT "trick"  Ignored
ELSE PRINT "treat"  Printed

Now QBIC. This one is a little more complex:

A                   Creates A$ in te output BAS
$                   Start a Code Literal. QBIC is not yet very function-complete,
                    so on occasion we need to call QBASIC functions directly. However,
                    that may interfere with QBIC syntax. When a '$' is encountered,
                    QBIC ignores everything from that $ until a '|' or EOF and
                    just passes this along as QBASIC.
=STR$(q)            Set A$ to a string representation of the number q
IF A$=" 1"          A$ is now " 1" because 'q' is pre-initilised to 1 by QBIC
THEN PRINT "trick"  printed
ELSE PRINT "treat"  ignored

We don't need END-IFs, because in the snippet the IF is in-line.


答:
C#, 79 Bytes

Golfed:

```<code>string R(string i){while(i.Length>1){i=i.Sum(o=>int.Parse(o+""))+"";}return i;}
</code>```

Ungolfed:

```<code>string R(string i)
{
  while (i.Length > 1)
  {
    i = i.Sum(o => int.Parse(o + ""))+"";
  }

  return i;
}
</code>```

Testing:

```<code>var printTheDigitalRoot = new PrintTheDigitalRoot();
Console.WriteLine(printTheDigitalRoot.S("1")); //1
Console.WriteLine(printTheDigitalRoot.S("45")); //9
Console.WriteLine(printTheDigitalRoot.S("341")); //8
Console.WriteLine(printTheDigitalRoot.S("6801")); //6
Console.WriteLine(printTheDigitalRoot.S("59613")); //6
Console.WriteLine(printTheDigitalRoot.S("495106")); //7
</code>```

Title: Print the digital root

Body:
C#, 79 Bytes

Golfed:

string R(string i){while(i.Length>1){i=i.Sum(o=>int.Parse(o+""))+"";}return i;}

Ungolfed:

string R(string i)
{
  while (i.Length > 1)
  {
    i = i.Sum(o => int.Parse(o + ""))+"";
  }

  return i;
}

Testing:

var printTheDigitalRoot = new PrintTheDigitalRoot();
Console.WriteLine(printTheDigitalRoot.S("1")); //1
Console.WriteLine(printTheDigitalRoot.S("45")); //9
Console.WriteLine(printTheDigitalRoot.S("341")); //8
Console.WriteLine(printTheDigitalRoot.S("6801")); //6
Console.WriteLine(printTheDigitalRoot.S("59613")); //6
Console.WriteLine(printTheDigitalRoot.S("495106")); //7


答:
Dart - JavaScript (68 bytes)

Seems appropriate as Google has been livestreaming the Dart Developer Summit for the past two days.

```<code>var a=main();function main(){1==true?alert("Treat"):print("Trick");}
</code>```

Formatted:

```<code>var a = main();

function main() {
  1 == true ? alert("Treat") : print("Trick");
}
</code>```

main method

In Dart static variables may only be initialized with compile-time
constants (hereafter referred to as just constants in the interest of
brevity).  Static variables include all top-level variables as well as
static variables of classes.

^ http://news.dartlang.org/2012/02/static-variables-no-longer-have-to-be.html

The Dart VM starts by immediately calling the main method.
As the variable 'a' is a top level one, the Dart VM will only initialize it when it's needed (lazy initialization).

JavaScript immediately initializes the variable by which the main method also gets invoked.

truthy/falsey

Dart differs from JavaScript in its treatment of truthy and falsey
values. In JavaScript, the objects 1, non-empty string, and non-null
objects are treated as true. In Dart, it’s more simple. Only the
boolean value true is treated as true. In Dart, all object instances
other than true are treated as false.

^ https://www.dartlang.org/resources/dart-tips/dart-tips-ep-4

The above quote explains why 1 == true evaluates to true in JavaScript whilst it gets evaluated to false in Dart.

Title: Trick or Treat polyglot

Body:
Dart - JavaScript (68 bytes)

Seems appropriate as Google has been livestreaming the Dart Developer Summit for the past two days.

var a=main();function main(){1==true?alert("Treat"):print("Trick");}

Formatted:

var a = main();

function main() {
  1 == true ? alert("Treat") : print("Trick");
}

main method

In Dart static variables may only be initialized with compile-time
constants (hereafter referred to as just constants in the interest of
brevity).  Static variables include all top-level variables as well as
static variables of classes.

^ http://news.dartlang.org/2012/02/static-variables-no-longer-have-to-be.html

The Dart VM starts by immediately calling the main method.
As the variable 'a' is a top level one, the Dart VM will only initialize it when it's needed (lazy initialization).

JavaScript immediately initializes the variable by which the main method also gets invoked.

truthy/falsey

Dart differs from JavaScript in its treatment of truthy and falsey
values. In JavaScript, the objects 1, non-empty string, and non-null
objects are treated as true. In Dart, it’s more simple. Only the
boolean value true is treated as true. In Dart, all object instances
other than true are treated as false.

^ https://www.dartlang.org/resources/dart-tips/dart-tips-ep-4

The above quote explains why 1 == true evaluates to true in JavaScript whilst it gets evaluated to false in Dart.


问:
Display an xkcd
xkcd is everyone's favorite webcomic, and you will be writing a program that will bring a little bit more humor to us all.

Your objective in this challenge is to write a program which will take a number as input and display that xkcd and its title-text (mousover text).

Input

Your program will take a positive integer as input (not necessarily one for which there exists a valid comic) and display that xkcd: for example, an input of 1500 should display the comic "Upside-Down Map" at xkcd.com/1500, and then either print its title-text to the console or display it with the image.

Due to their proximity across the channel, there's long been tension between North Korea and the United Kingdom of Great Britain and Southern Ireland.

Test case 2, for n=859:

<img src="https://i.stack.imgur.com/ItL7a.png" alt="Brains aside, I wonder how many poorly-written xkcd.com-parsing scripts will break on this title (or ;;"''{<<[' this mouseover text."">

Brains aside, I wonder how many poorly-written xkcd.com-parsing scripts will break on this title (or ;;"''{<<[' this mouseover text."

Your program should also be able to function without any input, and perform the same task for the most recent xkcd found at xkcd.com, and it should always display the most recent one even when a new one goes up.

You do not have to get the image directly from xkcd.com, you can use another database as long as it is up-to-date and already existed before this challenge went up. URL shortners, that is, urls with no purpose other than redirecting to somewhere else, are not allowed.

You may display the image in any way you chose, including in a browser. You may not, however, directly display part of another page in an iframe or similar. CLARIFICATION: you cannot open a preexisting webpage, if you wish to use the browser you have to create a new page. You must also actually display an image - outputting an image file is not allowed.

You can handle the case that there isn't an image for a particular comic (e.g. it is interactive or the program was passed a number greater than the amount of comics that have been released) in any reasonable way you wish, including throwing an exception, or printing out an at least single-character string, as long as it somehow signifies to the user that there isn't an image for that input.

You can only display an image and output its title-text, or output an error message for an invalid comic. Other output is not allowed.

This is a code-golf challenge, so the fewest bytes wins.

答:
PowerShell v3+ <s>110</s> <s>99</s> <s>107</s> 103 Bytes

iwr($x=((iwr "xkcd.com/$args").images|?{$_.title})).src.Trim("/") -outf x.jpg;if($x){ii x.jpg;$x.title}
```
<p>Thanks to Timmy for helping save some bytes by using inline assignments.</p>
<p>If no arguments are passed then <code>$args</code> is null and it will just get the current comic. Download the picture, by matching the one with alt text, into a file in the current running directory of the script. Then display it with the default viewer of jpg's. The alt text is then displayed to console. <code>iwr</code> is an alias for <code>Invoke-WebRequest</code></p>
<p>If the number passed (or any invalid input for that matter) does not match the process fails with at least a 404 error.</p>
<pre class="lang-cs prettyprint-override"><code>iwr(                                  # Request the comic image from XKCD
  $x=((iwr "xkcd.com/$args").images|  # Primary search to locate either the current image
                                      # or one matching an argument passed
     ?{$_.title}))                    # Find the image with alt text
        .src.Trim("/")                # Using the images associated link and strip the leading slashes
  -outf x.jpg                         # Output the image to the directory local to where the script was run
if($x){                               # Test if the image acquisition was successful
    ii x.jpg                          # Open the picture in with the default jpg viewer
    $x.title                          # Display alt text to console
}                                     # I'm a closing bracket.
</code>```

Title: Display an xkcd

Body:
PowerShell v3+ <s>110</s> <s>99</s> <s>107</s> 103 Bytes

iwr($x=((iwr "xkcd.com/$args").images|?{$_.title})).src.Trim("/") -outf x.jpg;if($x){ii x.jpg;$x.title}

Thanks to Timmy for helping save some bytes by using inline assignments.

If no arguments are passed then $args is null and it will just get the current comic. Download the picture, by matching the one with alt text, into a file in the current running directory of the script. Then display it with the default viewer of jpg's. The alt text is then displayed to console. iwr is an alias for Invoke-WebRequest

If the number passed (or any invalid input for that matter) does not match the process fails with at least a 404 error.

iwr(                                  # Request the comic image from XKCD
  $x=((iwr "xkcd.com/$args").images|  # Primary search to locate either the current image
                                      # or one matching an argument passed
     ?{$_.title}))                    # Find the image with alt text
        .src.Trim("/")                # Using the images associated link and strip the leading slashes
  -outf x.jpg                         # Output the image to the directory local to where the script was run
if($x){                               # Test if the image acquisition was successful
    ii x.jpg                          # Open the picture in with the default jpg viewer
    $x.title                          # Display alt text to console
}                                     # I'm a closing bracket.


答:
C, 214 bytes

```<code>main(int a,char *b[]){for(int x,y,d,m=12;m;m--){y=atoi(b[1]);x=m-1;d=x==1?(y%4==0?(y%100==0?(y%400==0?29:28):29):28):(x==3||x==5||x==10?30:31);if((d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7==1)printf("%d\n",m);}}
</code>```

Compile

```<code>gcc -std=c99 -o foo foo.c
</code>```

Ungolfed

With credits to the relevant gurus.

Michael Keith and Tom Craver for C Program to find day of week given date.

Collin Biedenkapp for Q&A: How do I figure out what the last day of the month is?

```<code>/* credit to Collin Biedenkapp */
short _get_max_day(short x, int z) {
    if(x == 0 || x == 2 || x == 4 || x == 6 || x == 7 || x == 9 || x == 11)
        return 31;
    else if(x == 3 || x == 5 || x == 8 || x == 10)
        return 30;
    else {
        if(z % 4 == 0) {
            if(z % 100 == 0) {
                if(z % 400 == 0)
                    return 29;
                return 28;
            }
            return 29;
        }
        return 28;
    }
}

main(int argc,char *argv[]) {
 for(int y,d,m=12;m;m--) {
  y=atoi(argv[1]);
  d=_get_max_day(m-1,y);
  /* credit to Michael Keith and Tom Craver */
  if ((d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7 == 1)
    printf("%d\n",m);
 }
}
</code>```

Title: The Last Monday

Body:
Monday, October 31st, is Halloween. And it got me thinking -- I wonder what other months have the last day of the month also be a Monday?

Input

A positive integer in any convenient format representing a year, 10000 > y > 0.

The input can be padded with zeros (e.g., 0025 for year 25) if
required.

Output

A list of the months of that year where the last day of the month is a Monday.

This can be as month names (e.g., January, March, October), or shortnames (Jan, Mar, Oct), or numbers (1, 3, 10), as separate lines or a list or delimited, etc., just so long as it's unambiguous to the reader.

The output format must be consistent:

For all years input (meaning, you can't output month names for some inputs, and month numbers for other inputs)

As well as consistent per output (meaning, you can't output 1 for January in the same output as Jul for July)

Basically, pick one format and stick to it.

Rules

Assume the Gregorian calendar for input/output, even down to y = 1.

Leap years must be properly accounted for (as a reminder: every year divisible by 4, except not years divisible by 100, unless also divisible by 400 -- 1700, 1800, 1900 all weren't leap years, but 2000 was).

You may use any built-ins or other date calculation tools you like.

Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.

Standard loopholes are forbidden.

This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

```<code>   1 --> Apr, Dec
 297 --> May
1776 --> Sep
2000 --> Jan, Jul
2016 --> Feb, Oct
3385 --> Jan, Feb, Oct
</code>```

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
C, 214 bytes

main(int a,char *b[]){for(int x,y,d,m=12;m;m--){y=atoi(b[1]);x=m-1;d=x==1?(y%4==0?(y%100==0?(y%400==0?29:28):29):28):(x==3||x==5||x==10?30:31);if((d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7==1)printf("%d\n",m);}}

Compile

gcc -std=c99 -o foo foo.c

Ungolfed

With credits to the relevant gurus.

Michael Keith and Tom Craver for C Program to find day of week given date.

Collin Biedenkapp for Q&A: How do I figure out what the last day of the month is?

/* credit to Collin Biedenkapp */
short _get_max_day(short x, int z) {
    if(x == 0 || x == 2 || x == 4 || x == 6 || x == 7 || x == 9 || x == 11)
        return 31;
    else if(x == 3 || x == 5 || x == 8 || x == 10)
        return 30;
    else {
        if(z % 4 == 0) {
            if(z % 100 == 0) {
                if(z % 400 == 0)
                    return 29;
                return 28;
            }
            return 29;
        }
        return 28;
    }
}

main(int argc,char *argv[]) {
 for(int y,d,m=12;m;m--) {
  y=atoi(argv[1]);
  d=_get_max_day(m-1,y);
  /* credit to Michael Keith and Tom Craver */
  if ((d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7 == 1)
    printf("%d\n",m);
 }
}


答:
 SQL, 141 Bytes

Just for fun...

Golfed:

```<code>CREATE PROCEDURE S @a INT,@b INT AS BEGIN DELETE FROM ABC INSERT INTO ABC(A)VALUES(@a)INSERT INTO ABC(A)VALUES(@b)SELECT SUM(A)FROM ABC END
GO
</code>```

Ungolfed:

```<code>CREATE PROCEDURE S
@a INT,
@b INT
AS
BEGIN
DELETE FROM ABC
INSERT INTO ABC(A)
VALUES(@a)
INSERT INTO ABC(A)
VALUES(@b)
SELECT SUM(A)FROM ABC END
GO
</code>```

Requires a 1 column table creating:

```<code>CREATE TABLE ABC
(
A INT,
);
</code>```

Then call the stored procedure like this:

```<code>EXEC S 4, 9
--13
</code>```

Title: Add two numbers

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

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

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

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

Test cases:

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

Or as CSV:

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

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
 SQL, 141 Bytes

Just for fun...

Golfed:

CREATE PROCEDURE S @a INT,@b INT AS BEGIN DELETE FROM ABC INSERT INTO ABC(A)VALUES(@a)INSERT INTO ABC(A)VALUES(@b)SELECT SUM(A)FROM ABC END
GO

Ungolfed:

CREATE PROCEDURE S
@a INT,
@b INT
AS
BEGIN
DELETE FROM ABC
INSERT INTO ABC(A)
VALUES(@a)
INSERT INTO ABC(A)
VALUES(@b)
SELECT SUM(A)FROM ABC END
GO

Requires a 1 column table creating:

CREATE TABLE ABC
(
A INT,
);

Then call the stored procedure like this:

EXEC S 4, 9
--13