问:
Print some JSON
This challenge is straightforward, but hopefully, there are plenty of avenues you can approach it:

You need to print/return a valid JSON object of at least 15 characters, not counting unessential whitespace.  Your program should work without any input.

In the interest of clarity, a JSON object starts and ends with curly braces {}, and contains zero or more key:value pairs separated by commas.  The full JSON specification can be found at json.org, and the output of your code must pass this validator.

Therefore, any of the following would not be valid:

```<code>4                               //Too short, not an object
"really, really long string"    //A string, not an object
["an","array","of","values"]    //An array is not a JSON object
{"this":4      }                //You can't count unessential whitespace
{"1":1,"2":3}                   //Too short
{"a really long string"}        //Not valid JSON, it needs a value
{'single-quoted':3}             //JSON requires double-quotes for strings
</code>```

However, the following would be valid:

```<code>{"1":1,"2":2,"3":3,"4":4}       //Long enough
{"whitespace      ":4}          //This whitespace isn't unessential
</code>```

Non-programming languages are allowed on this challenge.  You may return a string from a function, or print it out.  This is a code-golf, so answer it with as little code as possible!

答:
ECMAScript 2015, 16 bytes

_=>`{"":${9e9}}`
```

It will run in most modern ECMAScript environments (eg. Firefox, Chrome, MS Edge, Opera, Node…).

Title: Print some JSON

Body:
ECMAScript 2015, 16 bytes

_=>`{"":${9e9}}`

It will run in most modern ECMAScript environments (eg. Firefox, Chrome, MS Edge, Opera, Node…).


问:
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/C++, <s>76</s> 74 bytes

```<code>#include <stdio.h>
int main(){printf("tr%.3s\n",&"ickeat"[sizeof'a'-1]);}
</code>```

Lots of C and C++ programmers react strongly when someone writes C/C++ as if it was one language. This contribution is here both to trigger those who are allergic to that string and to demonstrate that they (or rather: we), in fact, are right. C and C++ are two different languages.

The explanation is simple. Character constants like 'a' have different types in C and C++, so sizeof will return different sizes. This assumes a relatively normal machine where sizeof int is 4.

ContentLicense: CC BY-SA 3.0

Title: Trick or Treat polyglot

Body:
C/C++, <s>76</s> 74 bytes

#include <stdio.h>
int main(){printf("tr%.3s\n",&"ickeat"[sizeof'a'-1]);}

Lots of C and C++ programmers react strongly when someone writes C/C++ as if it was one language. This contribution is here both to trigger those who are allergic to that string and to demonstrate that they (or rather: we), in fact, are right. C and C++ are two different languages.

The explanation is simple. Character constants like 'a' have different types in C and C++, so sizeof will return different sizes. This assumes a relatively normal machine where sizeof int is 4.


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

```

答:
Dyalog APL with dfns's cal, Version 15.0: 22; Version 16.0: 19 bytes

The cal function comes with a default install, just enter )copy dfns.

Version 15.0: ∊⎕{⍵/⍨2=≢⍎⊢⌿cal⍺⍵}¨⍳12

∊ enlist (flatten)

⎕{...}¨ numeric input as left argument to the following anonymous function, taking each of the right side values as right argument in turn

 ⍵/⍨ the argument if (gives an empty list if not)

 2= two (namely Sunday and Monday) is equal to

 ≢ the tally of

 ⍎ the numbers in

 ⊢⌿ the bottom-most row of

 cal the calendar for

 ⍺⍵ year left-argument, month right-argument, the latter being

⍳12 1 to 12

Version 16.0: ⍸2=⎕{≢⍎⊢⌿cal⍺⍵}¨⍳12

⍸ the indices where

2= two equals (namely Sunday and Monday)

⎕{...}¨ numeric input as left argument to the following anonymous function, taking each of the right side values as right argument in turn

 ≢ the tally of

 ⍎ the numbers in

 ⊢⌿ the bottom-most row of

 cal the calendar for

 ⍺⍵ year left-argument, month right-argument, the latter being

⍳12 1 to 12

Title: The Last Monday


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

答:
Python 2, <s>81</s> 78 bytes

Fixpoint iteration

As recursive lambda

from math import*
f=lambda m,x=1:abs(sin(x)+m*x)>1e-4and f(m,sin(x)+m*x+x)or x
```
<p>As loop (81 bytes):</p>
<pre class="lang-python prettyprint-override"><code>from math import*
m=input()
x=1
while abs(sin(x)+m*x)>1e-4:x=sin(x)+m*x+x
print x
</code>```

Title: Approximate arcsinc

Body:
Python 2, <s>81</s> 78 bytes

Fixpoint iteration

As recursive lambda

from math import*
f=lambda m,x=1:abs(sin(x)+m*x)>1e-4and f(m,sin(x)+m*x+x)or x

As loop (81 bytes):

from math import*
m=input()
x=1
while abs(sin(x)+m*x)>1e-4:x=sin(x)+m*x+x
print x


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:
Java 7 ,186 182 172   bytes

Thanks to kevin for saving 4 bytes

Thanks to @cliffroot for saving 10 bytes

int[]f(int n){int c=n-1,x=c*365+c/4+c/400-c/100,k=0,b[]={3,(n%4<1&n%100>0)|n%400<1?1:0,3,2,3,2,3,3,2,3,2,3},a[]=new int[12];for(int i:b)a[k++]=(x+=i+28)%7==1?1:0;return a;}

ungolfed

int[] f(int n) {
 int c=n-1,x=c*365+(c/4)+(c/400)-(c/100),k=0,
   b[] = {3,(n % 4 < 1 & n % 100 > 0) | n % 400 < 1 ? 1 : 0
                                     ,3,2,3,2,3,3,2,3,2,3},a = new int[ 12 ];

 if ( (n % 4 < 1 & n % 100 > 1) | n % 400 < 1 )
     b[ 1 ] = -1;
 for (int i : b)
    a[ k++ ] = (x += i + 28) % 7 == 1 ? 1 : 0;

return a;
     }

This version is provide by @cliffroot(168 bytes)

 static int[] f(int n) {
 int b = 13561787 | ( (n%4 < 1 & n%100 > 0) | n%400 < 1 ? 1 << 20 : 0 ),
           x = --n*365 + n/4 + n/400 - n/100,a[]=new int[12],k=0;
    while (k < 12)
    a[k++] = (x += (b >> 24 - k*2&3 ) + 28) % 7 == 1 ? 1 : 0;
  return a;   }
    }

output sample

1 1 0 0 0 0 0 0 0 1 0 0(for input 3385)


答:
C, 99 bytes

#include<math.h>
float f(float m){float x=1,y;do{x=(y=sin(x)+m*x)+x;}while(fabs(y)>1e-4);return x;}
```
<p>ungolfed:</p>
<pre class="lang-c prettyprint-override"><code>#include<math.h>
float f(float m){
 float x=1,y;
 do{x=(y=sin(x)+m*x)+x;}while(fabs(y)>1e-4);
 return x;
}
</code>```

Title: Approximate arcsinc

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

Body:
C, 99 bytes

#include<math.h>
float f(float m){float x=1,y;do{x=(y=sin(x)+m*x)+x;}while(fabs(y)>1e-4);return x;}

ungolfed:

#include<math.h>
float f(float m){
 float x=1,y;
 do{x=(y=sin(x)+m*x)+x;}while(fabs(y)>1e-4);
 return x;
}


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

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

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

If that number is 1, print out 1 forever.

Challenge

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

take input from STDIN or an acceptable alternative

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

must output to STDOUT or an acceptable alternative

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

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

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

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

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

Catalog

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

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

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

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

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

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

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

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

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
PHP, 30 <s>33</s> bytes

```<code>do{echo$o=$argv[1];}while($o);
</code>```

Oops, didn't see the 7 other pages, one of which contains a better PHP entry.

Old 1

```<code>do{echo$argv[1];}while($argv[1]);
</code>```

Title: Implement a Truth-Machine

Body:
PHP, 30 <s>33</s> bytes

do{echo$o=$argv[1];}while($o);

Oops, didn't see the 7 other pages, one of which contains a better PHP entry.

Old 1

do{echo$argv[1];}while($argv[1]);


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

答:
Batch, <s>395</s> 391 bytes

```<code>@echo off
set q=
set r=
set s=
set t=
for /l %%i in (1,1,51)do call set s= %%s%%
for %%p in (az by cx dw ev fu gt hs ir jq kp lo mn)do call:u %%p
for /l %%i in (1,1,12)do call:l
exit/b
:u
set p=%1
set q=%q%%p:~,1%
set r=%p:~1%%r%
set s=%s:~4%%p:~1%
set t=%p:~,1%%t%
echo %q%%r%%s%%t%
exit/b
:l
set q=  %q:~,-1%
set r=%r:~1%
set s=%s:~,-1%
set t=%t:~1%
echo %q%%r%%s%%t%
</code>```

Title: Alphabet wings!

Body:
Batch, <s>395</s> 391 bytes

@echo off
set q=
set r=
set s=
set t=
for /l %%i in (1,1,51)do call set s= %%s%%
for %%p in (az by cx dw ev fu gt hs ir jq kp lo mn)do call:u %%p
for /l %%i in (1,1,12)do call:l
exit/b
:u
set p=%1
set q=%q%%p:~,1%
set r=%p:~1%%r%
set s=%s:~4%%p:~1%
set t=%p:~,1%%t%
echo %q%%r%%s%%t%
exit/b
:l
set q=  %q:~,-1%
set r=%r:~1%
set s=%s:~,-1%
set t=%t:~1%
echo %q%%r%%s%%t%


答:
C++ 11, <s>92</s> 91 bytes

-1 byte for using #import

#import<cmath>
using F=float;F f(F m,F x=1){F y=sin(x)+m*x;return fabs(y)>1e-4?f(m,x+y):x;}
```

Title: Approximate arcsinc


问:
Code Golf Golf Golf

Golf Challenge

Given the below ASCII "Green".

```<code>|          |
|  |>      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |
</code>```

Let | Denote a wall

Let | Denote half the flag pole

Let > Denote the flag on the pole

Let O Denote the hole

Let o Denote the ball

The dimensions of the "Green" is 10x10. There are ten spaces between the two walls |.

There are also ten spaces, empty or not between the top and the bottom of the green.

Challenge

Input an x and y value or
generate two random numbers to "shoot" a golf ball onto the green.

If the x, y generated does not touch the hole or the flag pole/flag output "Try Again!"

If the x, y generated hits the hole output "Hole in One!"

if the x, y generated hits the pole output "Lucky Shot!"

if the x, y generated hits the flag output "Close One!"

After the shot, output the location of the ball on the green with a o, replacing any character it hit. Also output the respective saying above.

Examples:

```<code>//Hole in one example, the O was replaced with a o
Randomed x = 3
Randomed y = 4

"Hole in One!"

|          |
|  |>      |
|  |       |
|  o       |
|          |
|          |
|          |
|          |
|          |
|          |

//Clone example, the top half of the pole was replaced with a o
Randomed x = 3
Randomed y = 2

"Lucky Shot!"

|          |
|  o>      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |

//Lucky Shot example, the > was replaced with a o
Randomed x = 4
Randomed y = 2

"Close One!"

|          |
|  |o      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |

//Try Again example, the <space> was replaced with a o
Randomed x = 5
Randomed y = 1

"Try Again!"

|     o    |
|  |>      |
|  |       |
|  O       |
|          |
|          |
|          |
|          |
|          |
|          |
</code>```

Have fun and good luck and as this is code-golf the shortest code wins!

答:
Groovy - 235 bytes

My first attempt - A groovy closure accepting 2 integers from 0 to 9 as the X and Y coordinates for the shot.

```{j,k->j++;c='';b='|';f='>';h='O';s=' ';v=[2:b,3:b,4:h];(0..9).each{y->l=(b+s*10+'|\n').chars;l[3]=v[y]?:s;l[4]=y==2?f:s;if(k==y){m=[(s):'Try Again!',(b):'Lucky Shot!',(f):'Close One!',(h):'Hole In One!'][""+l[j]];l[j]='o'};c+=l};c+=m}```

Title: Code Golf Golf Golf

Body:
Groovy - 235 bytes

My first attempt - A groovy closure accepting 2 integers from 0 to 9 as the X and Y coordinates for the shot.

{j,k->j++;c='';b='|';f='>';h='O';s=' ';v=[2:b,3:b,4:h];(0..9).each{y->l=(b+s*10+'|\n').chars;l[3]=v[y]?:s;l[4]=y==2?f:s;if(k==y){m=[(s):'Try Again!',(b):'Lucky Shot!',(f):'Close One!',(h):'Hole In One!'][""+l[j]];l[j]='o'};c+=l};c+=m}


答:
 Clip and Wake, 15 bytes

15 bytes

Guess what the two languages are.

```<code>"trick":"treat"
</code>```

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:
 Clip and Wake, 15 bytes

15 bytes

Guess what the two languages are.

"trick":"treat"


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

答:
Batch, 323 bytes

```<code>@echo off
set s=
for %%w in (@%*@)do call:w %%w
echo%s%
exit/b
:w
for %%s in (a an the at by for in of on to up and as but or nor)do if %%s==%1 set s=%s% %1&exit/b
set w=%1
set w=%w:@=%
set f=%w:~0,1%
for %%c in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)do call set f=%%f:%%c=%%c%%
set s=%s% %f%%w:~1%
</code>```

With comments:

```<code>@echo off
rem Start with an empty output string
set s=
rem Wrap the parameters in @ signs to identify the first and last words
for %%w in (@%*@) do call :w %%w
rem Ignore the leading space when printing the result
echo%s%
exit/b
:w
rem Check whether this is a word that we don't change
for %%s in (a an the at by for in of on to up and as but or nor) do if %%s==%1 set s=%s% %1&exit/b
set w=%1
rem Delete any @ signs from the first and last words
set w=%w:@=%
rem Get the first character
set f=%w:~0,1%
rem Case insensitively replace each upper case letter with itself
for %%c in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call set f=%%f:%%c=%%c%%
rem Concatenate with the rest of the word
set s=%s% %f%%w:~1%
</code>```

Body:
Batch, 323 bytes

@echo off
set s=
for %%w in (@%*@)do call:w %%w
echo%s%
exit/b
:w
for %%s in (a an the at by for in of on to up and as but or nor)do if %%s==%1 set s=%s% %1&exit/b
set w=%1
set w=%w:@=%
set f=%w:~0,1%
for %%c in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)do call set f=%%f:%%c=%%c%%
set s=%s% %f%%w:~1%

With comments:

@echo off
rem Start with an empty output string
set s=
rem Wrap the parameters in @ signs to identify the first and last words
for %%w in (@%*@) do call :w %%w
rem Ignore the leading space when printing the result
echo%s%
exit/b
:w
rem Check whether this is a word that we don't change
for %%s in (a an the at by for in of on to up and as but or nor) do if %%s==%1 set s=%s% %1&exit/b
set w=%1
rem Delete any @ signs from the first and last words
set w=%w:@=%
rem Get the first character
set f=%w:~0,1%
rem Case insensitively replace each upper case letter with itself
for %%c in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do call set f=%%f:%%c=%%c%%
rem Concatenate with the rest of the word
set s=%s% %f%%w:~1%


答:
Excel, <s>428</s> <s>97</s> 96 bytes

Input in A1.  Output un-separated Hexadecimal values (January = 0, December = B)

```<code>=IF(2=WEEKDAY(DATE(A1+2000,1,31)),0,"")&CHOOSE(WEEKDAY(DATE(A1+2000,3,0)),4,19,6,"3B",8,25,"7A")
</code>```

Added 10 bytes ("+2000") to allow handling of pre-1990 dates.

Saved 11 bytes thanks to @Engineer Toast.

First attempt (428 bytes), borrowing heavily from @Adám's solution.

```<code>=IF(2=WEEKDAY(DATE(A1,1,31)),1,"")&IF(2=WEEKDAY(EOMONTH(DATE(A1,2,1),0)),2,"")&IF(2=WEEKDAY(DATE(A1,3,31)),3,"")&IF(2=WEEKDAY(DATE(A1,4,30)),4,"")&IF(2=WEEKDAY(DATE(A1,5,31)),5,"")&IF(2=WEEKDAY(DATE(A1,6,30)),6,"")&IF(2=WEEKDAY(DATE(A1,7,31)),7,"")&IF(2=WEEKDAY(DATE(A1,8,31)),8,"")&IF(2=WEEKDAY(DATE(A1,9,30)),9,"")&IF(2=WEEKDAY(DATE(A1,10,31)),"A","")&IF(2=WEEKDAY(DATE(A1,11,30)),"B","")&IF(2=WEEKDAY(DATE(A1,12,31)),"C","")
</code>```

Title: The Last Monday

Body:
Excel, <s>428</s> <s>97</s> 96 bytes

Input in A1.  Output un-separated Hexadecimal values (January = 0, December = B)

=IF(2=WEEKDAY(DATE(A1+2000,1,31)),0,"")&CHOOSE(WEEKDAY(DATE(A1+2000,3,0)),4,19,6,"3B",8,25,"7A")

Added 10 bytes ("+2000") to allow handling of pre-1990 dates.

Saved 11 bytes thanks to @Engineer Toast.

First attempt (428 bytes), borrowing heavily from @Adám's solution.

=IF(2=WEEKDAY(DATE(A1,1,31)),1,"")&IF(2=WEEKDAY(EOMONTH(DATE(A1,2,1),0)),2,"")&IF(2=WEEKDAY(DATE(A1,3,31)),3,"")&IF(2=WEEKDAY(DATE(A1,4,30)),4,"")&IF(2=WEEKDAY(DATE(A1,5,31)),5,"")&IF(2=WEEKDAY(DATE(A1,6,30)),6,"")&IF(2=WEEKDAY(DATE(A1,7,31)),7,"")&IF(2=WEEKDAY(DATE(A1,8,31)),8,"")&IF(2=WEEKDAY(DATE(A1,9,30)),9,"")&IF(2=WEEKDAY(DATE(A1,10,31)),"A","")&IF(2=WEEKDAY(DATE(A1,11,30)),"B","")&IF(2=WEEKDAY(DATE(A1,12,31)),"C","")


答:
Triple glot: ///, SQL and JavaScript, 63 bytes

```<code>/*//trick/\*/select('or')
--a;function select(){alert('treat')}
</code>```

Using my SQL/Javascript answer, and @daHugLenny 's excellent ///-Javascript post, I was able to make a piece of code run across three languages:

///

```<code>/*//trick/../..   Simply prints 'trick', does no replaces, stops execution because the second /// block is incomplete
</code>```

SQL

```<code>/*//trick/\*/     //trick/\ is seen as a block comment
                  That last \ was added to set apart the following */, completing the block
select('or')      SQL Select statement, yielding 'or'
--a;...           Seen by SQL as a comment, ignored
</code>```

Javascript

```<code>/*//trick/\*/     //trick/\ is seen as a block comment
select('or')      Function call to the function 'select', defined below
--a;              Decrement a, effectively a NOP
function select(){alert('treat')}
                  Defines the function select(), giving us 'treat'
</code>```

Title: Trick or Treat polyglot

Body:
Triple glot: ///, SQL and JavaScript, 63 bytes

/*//trick/\*/select('or')
--a;function select(){alert('treat')}

Using my SQL/Javascript answer, and @daHugLenny 's excellent ///-Javascript post, I was able to make a piece of code run across three languages:

///

/*//trick/../..   Simply prints 'trick', does no replaces, stops execution because the second /// block is incomplete

SQL

/*//trick/\*/     //trick/\ is seen as a block comment
                  That last \ was added to set apart the following */, completing the block
select('or')      SQL Select statement, yielding 'or'
--a;...           Seen by SQL as a comment, ignored

Javascript

/*//trick/\*/     //trick/\ is seen as a block comment
select('or')      Function call to the function 'select', defined below
--a;              Decrement a, effectively a NOP
function select(){alert('treat')}
                  Defines the function select(), giving us 'treat'


答:
Jelly, 35 bytes

```<code>Ḳṙ-K
CrịØaṙµL26_⁶ẋ;
13RµŒḄÇ€Ñ€⁸¦ŒBY
</code>```

TryItOnline!

How?

```<code>13RµŒḄÇ€Ñ€⁸¦ŒBY - Main link: no arguments
13R             - range(13) -> [1,2,3,...,12,13]
   µ            - monadic chain separation
    ŒḄ          - bounce    -> [1,2,3,...,12,13,12,...,3,2,1]
      Ç€        - call last link (2) as a monad for €ach
           ¦    - apply to indexes
          ⁸     -    left argument (13R)
        Ñ€      -    next link (1) as a monad for €ach
            ŒB  - bounce with vectorisation at depth 1 (creates the right hand side)
              Y - join with line feeds

CrịØaṙµL26_⁶ẋ; - Link 2: make the left side of a row, with spaces at the left: i (e.g. 3)
C              - complement (1-i)       e.g. 1-3=-2
 r             - range(1-i, i)          e.g. [-2,-1,0,1,2,3]
  ị            - index into
   Øa          - lowercase alphabet     e.g. "xyzabc"
      µ        - monadic chain separation
     ṙ         - rotate left by i       e.g. "abcxyz"
        26_    - literal 26 minus
       L       - length                 e.g. 26-6=20
           ⁶   - literal ' '
            ẋ  - repeat 26-length times e.g. "                    "
             ; - concatenate            e.g. "                    abcxyz"

Ḳṙ-K - Link 1, swap spaces to the right: left half of a row
Ḳ    - split on spaces                  e.g. [[],[],...,"abcxyz"]
 ṙ   - rotate left by
  -  - literal -1                       e.g. ["abcxyz",...,[],[]]
   K - join with spaces                 e.g. "abcxyz                    "
</code>```

Title: Alphabet wings!

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

Body:
Jelly, 35 bytes

Ḳṙ-K
CrịØaṙµL26_⁶ẋ;
13RµŒḄÇ€Ñ€⁸¦ŒBY

TryItOnline!

How?

13RµŒḄÇ€Ñ€⁸¦ŒBY - Main link: no arguments
13R             - range(13) -> [1,2,3,...,12,13]
   µ            - monadic chain separation
    ŒḄ          - bounce    -> [1,2,3,...,12,13,12,...,3,2,1]
      Ç€        - call last link (2) as a monad for €ach
           ¦    - apply to indexes
          ⁸     -    left argument (13R)
        Ñ€      -    next link (1) as a monad for €ach
            ŒB  - bounce with vectorisation at depth 1 (creates the right hand side)
              Y - join with line feeds

CrịØaṙµL26_⁶ẋ; - Link 2: make the left side of a row, with spaces at the left: i (e.g. 3)
C              - complement (1-i)       e.g. 1-3=-2
 r             - range(1-i, i)          e.g. [-2,-1,0,1,2,3]
  ị            - index into
   Øa          - lowercase alphabet     e.g. "xyzabc"
      µ        - monadic chain separation
     ṙ         - rotate left by i       e.g. "abcxyz"
        26_    - literal 26 minus
       L       - length                 e.g. 26-6=20
           ⁶   - literal ' '
            ẋ  - repeat 26-length times e.g. "                    "
             ; - concatenate            e.g. "                    abcxyz"

Ḳṙ-K - Link 1, swap spaces to the right: left half of a row
Ḳ    - split on spaces                  e.g. [[],[],...,"abcxyz"]
 ṙ   - rotate left by
  -  - literal -1                       e.g. ["abcxyz",...,[],[]]
   K - join with spaces                 e.g. "abcxyz                    "


问:
What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?
I think the question as above is clear, but just in case:

Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline.

Qualifying programs will be those whose output is longer (in bytes) than the source code of the program, measured in bytes (assuming ASCII or UTF-8 encoding for the program source code).

I.e. the code must be shorter than the number of digits in the resulting number.

Leading zeros are disallowed under all circumstances. Counting leading zeroes trivialises the problem; ignoring leading zeros unnecessarily complicates the question.

The winning program will be the qualifying program which prints the integer with the smallest magnitude.

Leaderboard snippet

var QUESTION_ID = 67921;
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe"; var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
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) { if (data.has_more) getComments(); else if (more_answers) getAnswers(); else process(); } }); }
getAnswers();
var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*)(?:,|[-\u2013] ).*?([\d,^!e+]+)(?=\:?[^\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.replace(/([^\n<]*)<\/sup>/g, "^$1").replace(/\(\d+(?:\^\d+,)? [\w\s]+\)/g, "").replace(/floor\(10\^(\d+)\/9\)/g, "$1 ones").replace(/(\d+) ones/g, function (_, x) { return Array(+x + 1).join(1); }).match(SCORE_REG); if (match) valid.push({ user: getAuthorName(a), size: +match[2].replace(/,/g, "").replace(/(\d+)\s*\^\s*(\d+)/, function (_, a, b) { return Math.pow(a, b); }).replace(/(\d+)!/, function (_, n) { for (var i = 1, j = 1; i <= n; i++) j *= i; return j; }), language: match[1], link: a.share_link, }); else console.log(body); }); valid.sort(function (a, b) { var aB = a.size, bB = b.size; return aB - bB }); var languages = {}; var place = 1; var lastSize = null; var lastPlace = 1; valid.forEach(function (a) { if (a.size != lastSize) lastPlace = place; lastSize = a.size; ++place; var answer = jQuery("#answer-template").html(); answer = answer.replace("{{PLACE}}", lastPlace + ".") .replace("{{NAME}}", a.user) .replace("{{LANGUAGE}}", a.language) .replace("{{SIZE}}", a.size) .replace("{{LINK}}", a.link); answer = jQuery(answer); jQuery("#answers").append(answer); var lang = a.language; lang = jQuery(''+lang+'').text(); languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang.toLowerCase(), user: a.user, size: a.size, link: a.link}; }); var langs = []; for (var lang in languages) if (languages.hasOwnProperty(lang)) langs.push(languages[lang]); langs.sort(function (a, b) { if (a.lang_raw > b.lang_raw) return 1; if (a.lang_raw < b.lang_raw) 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-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<style>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; }</style>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr> </tbody> </table></code>```

Body:
PHP, 9223372036854775807

I know they're not the shortest for PHP but..

9223372036854775807

<?=PHP_INT_MAX;

10000000000000000000

<?=str_pad(1,20,0);


答:
Mathematica, 52 bytes

```<code>NSolve[Sin@x==-x#,x,Reals][[;;,1,2]]~DeleteCases~0.&
</code>```

Anonymous function. Takes a number as input, and returns a list of numbers as output. Just uses NSolve to solve the approximate equation.

Title: Approximate arcsinc

Body:
Mathematica, 52 bytes

NSolve[Sin@x==-x#,x,Reals][[;;,1,2]]~DeleteCases~0.&

Anonymous function. Takes a number as input, and returns a list of numbers as output. Just uses NSolve to solve the approximate equation.


答:
Python 2, PHP  - 30 bytes

Code

```<code>print["trick","treat"][""==0];
</code>```

Explanation

""==0 is evaluated to true in PHP, false in Python, so Python will print the first element from list (index 0, equal to false), PHP will print the second item (index 1, equal to true).

Title: Trick or Treat polyglot

Body:
Python 2, PHP  - 30 bytes

Code

print["trick","treat"][""==0];

Explanation

""==0 is evaluated to true in PHP, false in Python, so Python will print the first element from list (index 0, equal to false), PHP will print the second item (index 1, equal to true).


答:
PHP, <s>96</s> <s>95</s> <s>76</s> <s>71</s> <s>69</s> <s>64</s> 61 bytes

Note: year numbers must be padded to 4 chars, like 0070.

```<code>for(;13+$i-=1;)date(N,mktime(0,0,0,1-$i,0,$argn))-1||print$i;
</code>```

Run like this:

```<code>echo 3385 | php -nR 'for(;13+$i-=1;)date(N,mktime(0,0,0,1-$i,0,$argn))-1||print$i;';echo
> -1-2-10
</code>```

Explanation

Iterates from -1 to -12. Create date using mktime, day 0 (the last day of the previous month) and month 2..13. Format the date as day number, and if the result is 1, print the current number. The negative sign - is used as the delimiter.

The Millenium Bug Strikes Again!

Note that with this version, the range 0..100 is interpreted as 1970..2069. This is no problem for the range 0..69, as weeks have a pattern that repeats every 400 years (146097 days, exactly 20871 weeks), but for the range 70..99, 1900 is added to the year number, which is not a multiple of 400. To fix that problem JUST for 30 year numbers in a range of 10k, the simplest way is to add 400 to the year number to prevent the 2-digit interpretation (+4 bytes):

```<code>for(;13+$i-=1;)date(N,mktime(0,0,0,1-$i,0,$argn+400))-1||print$i;
</code>```

Tweaks

Saved a byte by using !~-$i to compare $i with 1 (-1 binary negated is 0, logically negated is true; every other number is false), so parentheses aren't needed

Saved 19 bytes by using last day ofYYYY-m notation to create the date

Saved 5 bytes by using date and strtotime instead of date_create

Saved 2 bytes by counting from negative numbers, using the negative sign as output delimiter (negative month numbers don't exist) and also as delim in the YYYY-m part of the date

Saved 5 bytes by using mktime instead of strtotime. Reverted to using day 0 (mktime also supports month 13, so 0-13==31-12)

Saved 3 bytes by using -R to make $argn available

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:
PHP, <s>96</s> <s>95</s> <s>76</s> <s>71</s> <s>69</s> <s>64</s> 61 bytes

Note: year numbers must be padded to 4 chars, like 0070.

for(;13+$i-=1;)date(N,mktime(0,0,0,1-$i,0,$argn))-1||print$i;

Run like this:

echo 3385 | php -nR 'for(;13+$i-=1;)date(N,mktime(0,0,0,1-$i,0,$argn))-1||print$i;';echo
> -1-2-10

Explanation

Iterates from -1 to -12. Create date using mktime, day 0 (the last day of the previous month) and month 2..13. Format the date as day number, and if the result is 1, print the current number. The negative sign - is used as the delimiter.

The Millenium Bug Strikes Again!

Note that with this version, the range 0..100 is interpreted as 1970..2069. This is no problem for the range 0..69, as weeks have a pattern that repeats every 400 years (146097 days, exactly 20871 weeks), but for the range 70..99, 1900 is added to the year number, which is not a multiple of 400. To fix that problem JUST for 30 year numbers in a range of 10k, the simplest way is to add 400 to the year number to prevent the 2-digit interpretation (+4 bytes):

for(;13+$i-=1;)date(N,mktime(0,0,0,1-$i,0,$argn+400))-1||print$i;

Tweaks

Saved a byte by using !~-$i to compare $i with 1 (-1 binary negated is 0, logically negated is true; every other number is false), so parentheses aren't needed

Saved 19 bytes by using last day ofYYYY-m notation to create the date

Saved 5 bytes by using date and strtotime instead of date_create

Saved 2 bytes by counting from negative numbers, using the negative sign as output delimiter (negative month numbers don't exist) and also as delim in the YYYY-m part of the date

Saved 5 bytes by using mktime instead of strtotime. Reverted to using day 0 (mktime also supports month 13, so 0-13==31-12)

Saved 3 bytes by using -R to make $argn available


Title: Alphabet wings!

Body:
Bubblegum, 165 bytes

Hexdump:

00000000: 4aac 5220 0d54 25f2 7201 e896 8b03 86a2  J.R .T%.r.......
00000010: 1806 60ab bcd5 fa99 19a7 2f43 ec3a 77e9  ..`......./C.:w.
00000020: 129d a2f9 e58c 9e29 3e64 d3e5 88df 29d9  .......)>d....).
00000030: a9f9 654f be29 dda8 7965 4b4d ca56 6aba  ..eO.)..yeKM.Vj.
00000040: ac19 a47c 518d ca92 532a 6668 aacc c55f  ...|Q...S*fh..._
00000050: 2a27 6e54 a652 a46a c446 65ac 64aa 0768  *'nT.R.j.Fe.d..h
00000060: 5886 da49 4d8f cd94 be71 53db d966 4ad7  X..IM....qS..fJ.
00000070: 620a c136 2771 8124 0b07 2822 20a7 c07c  b..6'q.$..(" ..|
00000080: 424c 9c30 52c2 4011 1235 1019 c12f 4344  BL.0R.@..5.../CD
00000090: ec8d 9010 7a12 1784 701b a8d4 a884 48e3  ....z...p.....H.
000000a0: 5050 9508 00                             PP...

Just ran the string through Zopfli for many iterations.


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

```

答:
Excel, 137 bytes

Takes input year in A1.  Output is non-separated list of Hexidecimal. (January = 0, December = B)

Uses Gauss's Algorithm for January and August.

```<code>=CHOOSE(MOD(6+5*MOD(A1-1,4)+4*MOD(A1-1,400),7)+1,"","",1,"","",0,"")&CHOOSE(MOD(5*MOD(A1-1,4)+4*MOD(A1-1,400),7)+1,9,35,"8B",5,"2A",7,4)
</code>```

Title: Superstitious Programming

Body:
Excel, 137 bytes

Takes input year in A1.  Output is non-separated list of Hexidecimal. (January = 0, December = B)

Uses Gauss's Algorithm for January and August.

=CHOOSE(MOD(6+5*MOD(A1-1,4)+4*MOD(A1-1,400),7)+1,"","",1,"","",0,"")&CHOOSE(MOD(5*MOD(A1-1,4)+4*MOD(A1-1,400),7)+1,9,35,"8B",5,"2A",7,4)


答:
16 bit 8086 machine code: 168 bytes

Here's the base64 encoded version, convert and save as 'bf.com' and run from Windows command prompt: 'bf progname'

```<code>gMYQUoDGEFKzgI1XAgIfiEcBtD3NIR8HcmOL2LQ/i88z0s0hcleL2DPA86sz/zP2/sU783NHrL0I
AGgyAU14DTqGmAF194qOoAH/4UfDJv4Fwyb+DcO0AiaKFc0hw7QBzSGqT8MmODV1+jPtO/NzDaw8
W3UBRTxddfJNee/DJjg1dPoz7U509YpE/zxddQFFPFt18U157sM+PCstLixbXUxjTlJWXmV+
</code>```

EDIT

Here's some assembler (A86 style) to create the executable (I had to reverse engineer this as I'd misplaced the original source!)

```<code>    add dh,10h
    push dx
    add dh,10h
    push dx
    mov bl,80h
    lea dx,[bx+2]
    add bl,[bx]
    mov [bx+1],al
    mov ah,3dh
    int 21h
    pop ds
    pop es
    jb ret
    mov bx,ax
    mov ah,3fh
    mov cx,di
    xor dx,dx
    int 21h
    jb ret
    mov bx,ax
    xor ax,ax
    repz stosw
    xor di,di
    xor si,si
    inc ch
program_loop:
    cmp si,bx
    jnb ret
    lodsb
    mov bp,8
    push program_loop
symbol_search:
    dec bp
    js ret
    cmp al,[bp+symbols]
    jnz symbol_search
    mov cl,[bp+instructions]
    jmp cx
forward:
    inc di
    ret
increment:
    inc b es:[di]
    ret
decrement:
    dec b es:[di]
    ret
output:
    mov ah,2
    mov dl,es:[di]
    int 21h
    ret
input:
    mov ah,1
    int 21h
    stosb
backward:
    dec di
    ret
jumpforwardifzero:
    cmp es:[di],dh
    jnz ret
    xor bp,bp
l1: cmp si,bx
    jnb ret
    lodsb
    cmp al,'['
    jnz l2
    inc bp
l2: cmp al,']'
    jnz l1
    dec bp
    jns l1
    ret
jumpbackwardifnotzero:
    cmp es:[di],dh
    jz  ret
    xor bp,bp
l3: dec si
    jz  ret
    mov al,[si-1]
    cmp al,']'
    jnz l4
    inc bp
l4: cmp al,'['
    jnz l3
    dec bp
    jns l3
    ret
symbols:
    db '><+-.,[]'
instructions:
    db forward and 255
    db backward and 255
    db increment and 255
    db decrement and 255
    db output and 255
    db input and 255
    db jumpforwardifzero and 255
    db jumpbackwardifnotzero and 255
</code>```

ContentLicense: CC BY-SA 4.0

Title: Interpret brainfuck

Body:
Write the shortest program in your favourite language to interpret a brainfuck program. The program is read from a file. Input and output are standard input and standard output.

Cell size: 8bit unsigned. Overflow is undefined.

Array size: 30000 bytes (not circled)

Bad commands are not part of the input

Comments begin with # and extend to the end of line Comments are everything not in +-.,[]<>

no EOF symbol

A very good test can be found here. It reads a number and then prints the prime numbers up to that number. To prevent link rot, here is a copy of the code:

```<code>compute prime numbers
to use type the max number then push Alt 1 0
===================================================================
======================== OUTPUT STRING ============================
===================================================================
>++++++++[<++++++++>-]<++++++++++++++++.[-]
>++++++++++[<++++++++++>-]<++++++++++++++.[-]
>++++++++++[<++++++++++>-]<+++++.[-]
>++++++++++[<++++++++++>-]<+++++++++.[-]
>++++++++++[<++++++++++>-]<+.[-]
>++++++++++[<++++++++++>-]<+++++++++++++++.[-]
>+++++[<+++++>-]<+++++++.[-]
>++++++++++[<++++++++++>-]<+++++++++++++++++.[-]
>++++++++++[<++++++++++>-]<++++++++++++.[-]
>+++++[<+++++>-]<+++++++.[-]
>++++++++++[<++++++++++>-]<++++++++++++++++.[-]
>++++++++++[<++++++++++>-]<+++++++++++.[-]
>+++++++[<+++++++>-]<+++++++++.[-]
>+++++[<+++++>-]<+++++++.[-]

===================================================================
======================== INPUT NUMBER  ============================
===================================================================
+                          cont=1
[
 -                         cont=0
 >,
 ======SUB10======
 ----------

 [                         not 10
  <+>                      cont=1
  =====SUB38======
  ----------
  ----------
  ----------
  --------

  >
  =====MUL10=======
  [>+>+<<-]>>[<<+>>-]<     dup

  >>>+++++++++
  [
   <<<
   [>+>+<<-]>>[<<+>>-]<    dup
   [<<+>>-]
   >>-
  ]
  <<<[-]<
  ======RMOVE1======
  <
  [>+<-]
 ]
 <
]
>>[<<+>>-]<<

===================================================================
======================= PROCESS NUMBER  ===========================
===================================================================

==== ==== ==== ====
numd numu teid teiu
==== ==== ==== ====

>+<-
[
 >+
 ======DUP======
 [>+>+<<-]>>[<<+>>-]<

 >+<--

 >>>>>>>>+<<<<<<<<   isprime=1

 [
  >+

  <-

  =====DUP3=====
  <[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<<<

  =====DUP2=====
  >[>>+>+<<<-]>>>[<<<+>>>-]<<< <

  >>>

  ====DIVIDES=======
  [>+>+<<-]>>[<<+>>-]<   DUP i=div

  <<
  [
    >>>>>+               bool=1
    <<<
    [>+>+<<-]>>[<<+>>-]< DUP
    [>>[-]<<-]           IF i THEN bool=0
    >>
    [                    IF i=0
      <<<<
      [>+>+<<-]>>[<<+>>-]< i=div
      >>>
      -                  bool=0
    ]
    <<<
    -                    DEC i
    <<
    -
  ]

  +>>[<<[-]>>-]<<
  >[-]<                  CLR div
  =====END DIVIDES====

  [>>>>>>[-]<<<<<<-]     if divides then isprime=0

  <<

  >>[-]>[-]<<<
 ]

 >>>>>>>>
 [
  -
  <<<<<<<[-]<<

  [>>+>+<<<-]>>>[<<<+>>>-]<<<

  >>

  ===================================================================
  ======================== OUTPUT NUMBER  ===========================
  ===================================================================
  [>+<-]>

  [
   ======DUP======
   [>+>+<<-]>>[<<+>>-]<

   ======MOD10====
   >+++++++++<
   [
    >>>+<<              bool= 1
    [>+>[-]<<-]         bool= ten==0
    >[<+>-]             ten = tmp
    >[<<++++++++++>>-]  if ten=0 ten=10
    <<-                 dec ten
    <-                  dec num
   ]
   +++++++++            num=9
   >[<->-]<             dec num by ten

   =======RROT======
      [>+<-]
   <  [>+<-]
   <  [>+<-]
   >>>[<<<+>>>-]
   <

   =======DIV10========
   >+++++++++<
   [
    >>>+<<                bool= 1
    [>+>[-]<<-]           bool= ten==0
    >[<+>-]               ten = tmp
    >[<<++++++++++>>>+<-] if ten=0 ten=10  inc div
    <<-                   dec ten
    <-                    dec num
   ]
   >>>>[<<<<+>>>>-]<<<<   copy div to num
   >[-]<                  clear ten

   =======INC1=========
   <+>
  ]

  <
  [
   =======MOVER=========
   [>+<-]

   =======ADD48========
   +++++++[<+++++++>-]<->

   =======PUTC=======
   <.[-]>

   ======MOVEL2========
   >[<<+>>-]<

   <-
  ]

  >++++[<++++++++>-]<.[-]

  ===================================================================
  =========================== END FOR ===============================
  ===================================================================

  >>>>>>>
 ]
 <<<<<<<<

 >[-]<
  [-]
 <<-
]

======LF========

++++++++++.[-]
@
</code>```

Example run:

```<code>$ python2 bf.py PRIME.BF
Primes up to: 100
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97
</code>```

Body:
16 bit 8086 machine code: 168 bytes

Here's the base64 encoded version, convert and save as 'bf.com' and run from Windows command prompt: 'bf progname'

gMYQUoDGEFKzgI1XAgIfiEcBtD3NIR8HcmOL2LQ/i88z0s0hcleL2DPA86sz/zP2/sU783NHrL0I
AGgyAU14DTqGmAF194qOoAH/4UfDJv4Fwyb+DcO0AiaKFc0hw7QBzSGqT8MmODV1+jPtO/NzDaw8
W3UBRTxddfJNee/DJjg1dPoz7U509YpE/zxddQFFPFt18U157sM+PCstLixbXUxjTlJWXmV+

EDIT

Here's some assembler (A86 style) to create the executable (I had to reverse engineer this as I'd misplaced the original source!)

    add dh,10h
    push dx
    add dh,10h
    push dx
    mov bl,80h
    lea dx,[bx+2]
    add bl,[bx]
    mov [bx+1],al
    mov ah,3dh
    int 21h
    pop ds
    pop es
    jb ret
    mov bx,ax
    mov ah,3fh
    mov cx,di
    xor dx,dx
    int 21h
    jb ret
    mov bx,ax
    xor ax,ax
    repz stosw
    xor di,di
    xor si,si
    inc ch
program_loop:
    cmp si,bx
    jnb ret
    lodsb
    mov bp,8
    push program_loop
symbol_search:
    dec bp
    js ret
    cmp al,[bp+symbols]
    jnz symbol_search
    mov cl,[bp+instructions]
    jmp cx
forward:
    inc di
    ret
increment:
    inc b es:[di]
    ret
decrement:
    dec b es:[di]
    ret
output:
    mov ah,2
    mov dl,es:[di]
    int 21h
    ret
input:
    mov ah,1
    int 21h
    stosb
backward:
    dec di
    ret
jumpforwardifzero:
    cmp es:[di],dh
    jnz ret
    xor bp,bp
l1: cmp si,bx
    jnb ret
    lodsb
    cmp al,'['
    jnz l2
    inc bp
l2: cmp al,']'
    jnz l1
    dec bp
    jns l1
    ret
jumpbackwardifnotzero:
    cmp es:[di],dh
    jz  ret
    xor bp,bp
l3: dec si
    jz  ret
    mov al,[si-1]
    cmp al,']'
    jnz l4
    inc bp
l4: cmp al,'['
    jnz l3
    dec bp
    jns l3
    ret
symbols:
    db '><+-.,[]'
instructions:
    db forward and 255
    db backward and 255
    db increment and 255
    db decrement and 255
    db output and 255
    db input and 255
    db jumpforwardifzero and 255
    db jumpbackwardifnotzero and 255


答:
Java 7, <s>271</s> <s>259</s> 258 bytes

```<code>String c(String x){String a[]=x.split(" "),s=" ",r=w(a[0])+s;for(int i=0,l=a.length-1;i<l;r+=(!s.matches("^(a[nst]?|the|by|in|of|on|to|up|and|but|[fn]?or)$")|i==l?w(s):s)+" ")s=a[++i];return r;}String w(String w){return(char)(w.charAt(0)-32)+w.substring(1);}
</code>```

Ungolfed & test code:

Try it here.

```<code>class M{
  static String c(String x){
    String a[] = x.split(" "),
           s = " ",
           r = w(a[0]) + s;
    for(int i = 0, l = a.length-1; i < l; r += (!s.matches("^(a[nst]?|the|by|in|of|on|to|up|and|but|[fn]?or)$") | i == l
                                                 ? w(s)
                                                 : s)   + " "){
      s = a[++i];
    }
    return r;
  }

  static String w(String w) {
    return (char)(w.charAt(0) - 32) + w.substring(1);
  }

  public static void main(String[] a){
    System.out.println(c("the rule of thumb for title capitalization"));
    System.out.println(c("programming puzzles and code golf"));
    System.out.println(c("the many uses of the letter a"));
    System.out.println(c("title"));
    System.out.println(c("and and and"));
    System.out.println(c("a an and as at but by for in nor of on or the to up"));
    System.out.println(c("on computable numbers with an application to the entscheidungsproblem"));
  }
}
</code>```

Output:

```<code>The Rule of Thumb for Title Capitalization
Programming Puzzles and Code Golf
The Many Uses of the Letter A
Title
And and And
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
</code>```

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

Body:
Java 7, <s>271</s> <s>259</s> 258 bytes

String c(String x){String a[]=x.split(" "),s=" ",r=w(a[0])+s;for(int i=0,l=a.length-1;i<l;r+=(!s.matches("^(a[nst]?|the|by|in|of|on|to|up|and|but|[fn]?or)$")|i==l?w(s):s)+" ")s=a[++i];return r;}String w(String w){return(char)(w.charAt(0)-32)+w.substring(1);}

Ungolfed & test code:

<a href="https://tio.run/nexus/java-openjdk#hVJNj5swEL3vr5iiHmyRomx7W4qi/oCc9ohYyRADlvyB7HHZJM5vTweWnrFkzch@8@bNszstQoDz/fmOXtkBOrYln/y@ZaJuqs8iTFohyyDjh1BROPhqZqI@NjwPZe88UxZBVceDrkShpR1w/PFaqt@69HnFvoXCCOxGGVj2QWU2YHNKOMrUXpOyyfXJ2YQuxSkJe0ltxFT3tjk5z79nPKmq0qeZBf4WeL6ICJWo81w1pZcYvQVfPja58/8JZn7/umTdKDxnc7HEP8iO/OPXT57PRYhtWLHslZePJ8AUW606CCiQwl@nLmCEshtj3YDg9xegdQYDFVg5w5nxcj16vwaUpnARi4nQqC0zRccyGhJ81BJcDzhG0wK5BaiQjjoxKRRa3aifsxnfoZq8G7wwZpluireblgHILejcRcLgdL/LsIgxwl4hBqpdFUnQElF6EPvVi@hd1KJo2/tYQn2BaRIEenZor6tByoKlQBKdhcUwEooO4rTLSfjOmSmiaMliS45LH2BWOK7NJvrI3er3wrfQSouBvqa6RDsE8pjKzNbl8fJ4/gM" rel="nofollow noreferrer">Try it here.

class M{
  static String c(String x){
    String a[] = x.split(" "),
           s = " ",
           r = w(a[0]) + s;
    for(int i = 0, l = a.length-1; i < l; r += (!s.matches("^(a[nst]?|the|by|in|of|on|to|up|and|but|[fn]?or)$") | i == l
                                                 ? w(s)
                                                 : s)   + " "){
      s = a[++i];
    }
    return r;
  }

  static String w(String w) {
    return (char)(w.charAt(0) - 32) + w.substring(1);
  }

  public static void main(String[] a){
    System.out.println(c("the rule of thumb for title capitalization"));
    System.out.println(c("programming puzzles and code golf"));
    System.out.println(c("the many uses of the letter a"));
    System.out.println(c("title"));
    System.out.println(c("and and and"));
    System.out.println(c("a an and as at but by for in nor of on or the to up"));
    System.out.println(c("on computable numbers with an application to the entscheidungsproblem"));
  }
}

Output:

The Rule of Thumb for Title Capitalization
Programming Puzzles and Code Golf
The Many Uses of the Letter A
Title
And and And
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


问:
Help me cheat at Cheat
Cheat is a card game where you're trying to get rid of your hand. A turn looks something roughly like this:

Determine what card rank you have to play that turn. In most variants this is one rank higher than the previous turn.

Play 1-4 cards, face down. These don't have to match the valid rank. If they don't, it's considered a cheat. At this point any player may challenge you.

If nobody challenges you, play continues to the next player.

If somebody challenges you and you didn't cheat, they have to take all of the played cards.

If somebody challenges you and you did cheat, you have to take all of the played cards.

The strategy is mostly a mix of bluffing and card counting. I'm bad at math, though, so I'm going to cheat at Cheat and bring a bot with me.

Input

The input will be, in any order or format you want:

The player's hand. If I know that they must have cards (for example, I've seen them pick them up), those will be listed in ascending order. Any unknowns will be listed afterwards as ?. For example, if they have six cards and I know that two are 1's and one is a 4, a valid representation of the hand is 114???. ?'s will always be listed after known cards. 141??? and 11???4 are both invalid inputs and your code doesn't need to handle them.

The cards I definitely know are not part of their hand (I have them, I saw someone else pick them up, etc). The list will be in ascending order of rank. The list may be empty.

The cards the player claimed to play. If they claimed to play 3 7's, a possible input here would be 777. The cards will always be the same rank.

The number of played cards will always be 1-4 and the ranks will always be 0-9. A rank will never appear more than four times in their hand + not their hand.

This is an example valid input:

```<code>33577??
01555688
55
</code>```

This is an example invalid input:

```<code>35377?? # Out of order
7779    # Five 7's in total
23      # Two separate ranks played
</code>```

Output

A truthy value if we should definitely challenge. A falsey value if we might not want to challenge.

We always challenge if we know they cheated. We know they cheated if they played cards they couldn't possibly have:

```<code>12

3  # They don't have any 3's or ?'s
-------------
12?

33 # Fewer ?'s than played cards
-------------
123?
333
33 # Since we have three 3's they can't have two
</code>```

The other time we challenge is if they play their last cards. Even if the play's legit it would end the game so we might as well challenge it.

```<code>1

1 # They'd win, so challenge anyway
</code>```

More Test Cases

Truthy (should challenge)

```<code>11445678?

22
-------------
????????
4
4444
-------------
12345678

9
</code>```

Falsey (should not challenge)

```<code>1?
222
2
-------------
12?
22
22
-------------
?????

1111
</code>```

Scoring

Shortest code wins.

答:
JavaScript (ES6), 93 bytes

```<code>(h,s,c,g=(a,z=c[0])=>a.split(z).length-1)=>h.length==g(c)|g(h,'?')+g(h)<g(c)|g(h)+g(s)+g(c)>4
</code>```

Accepts three strings of cards (characters 0-9 or ?); returns 1 for challenge, 0 otherwise. Explanation:

```<code>(h,s,c,                 Input parameters
 g=(a,z=c[0])=>         Helper function defaults to claimed card
  a.split(z).length-1   Count cards matching (g(c) == c.length)
)=>h.length==g(c)       Does hand length equal claim length
  |g(h,'?')+g(h)<g(c)   Could hand not contain claimed cards
  |g(h)+g(s)+g(c)>4     Are there too many claimed cards
</code>```

Title: Help me cheat at Cheat

Body:
JavaScript (ES6), 93 bytes

(h,s,c,g=(a,z=c[0])=>a.split(z).length-1)=>h.length==g(c)|g(h,'?')+g(h)<g(c)|g(h)+g(s)+g(c)>4

Accepts three strings of cards (characters 0-9 or ?); returns 1 for challenge, 0 otherwise. Explanation:

(h,s,c,                 Input parameters
 g=(a,z=c[0])=>         Helper function defaults to claimed card
  a.split(z).length-1   Count cards matching (g(c) == c.length)
)=>h.length==g(c)       Does hand length equal claim length
  |g(h,'?')+g(h)<g(c)   Could hand not contain claimed cards
  |g(h)+g(s)+g(c)>4     Are there too many claimed cards


Title: Alphabet wings!

Body:
PHP, 158 Bytes

for(;$i++<25;)echo($a=str_pad)(($t=($f=substr)($j=join(range(a,z)),0,$x=$i>13?13-$i%13:$i).$f($j,-$x)).$a("",51-$i*4," ").$f(strrev($t),$i>12),51," ",2)."\n";


答:
MATL, 17 bytes

```<code>`@2e3/tY,wG_*>}4M
</code>```

This uses linear search on the positive real axis, so it is slow. All test cases end within 1 minute in the online compiler.

Try it online!

Explanation

```<code>`         % Do...while
  @       %   Push iteration index, starting at 1
  2e3/    %   Divide by 2000
  t       %   Duplicate
  Y,      %   Sine
  w       %   Swap
  G_*     %   Multiply by minus the input
  >       %   Does the sine exceed that? If so, next iteration
}         % Finally (execute after last iteration, before exiting loop)
   4M     %   Push input of sine function again
          % Implicit end
          % Implicit display
</code>```

Title: Approximate arcsinc

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

Body:
MATL, 17 bytes

`@2e3/tY,wG_*>}4M

This uses linear search on the positive real axis, so it is slow. All test cases end within 1 minute in the online compiler.

Try it online!

Explanation

`         % Do...while
  @       %   Push iteration index, starting at 1
  2e3/    %   Divide by 2000
  t       %   Duplicate
  Y,      %   Sine
  w       %   Swap
  G_*     %   Multiply by minus the input
  >       %   Does the sine exceed that? If so, next iteration
}         % Finally (execute after last iteration, before exiting loop)
   4M     %   Push input of sine function again
          % Implicit end
          % Implicit display


答:
C#6, 134 bytes

```<code>using System.Linq;
bool f(string a,string b,string c)=>a.Length==1|a.Count(x=>x==c[0]|x=='?')<c.Length|b.Count(x=>x==c[0])+c.Length>4;
</code>```

(Note: In line with OP's example, this answer returns false even if opponent has more than one card and is playing all of his hand. In terms of strategy this should return true.)

Explanation:

a: Player's hand

b: Cards I definitely know...

c: Cards claimed to play

Ungolfed:

```<code>bool f(string a, string b, string c) =>
    a.Length == 1                               // Last card played
    | a.Count(x => x == c[0] | x == '?' )       // Count no. of cards that surely/may match claimed cards
                                                // Assuming all claimed cards are the same, just compare with c[0]
        < c.Length                              // I'm sure you don't have that many cards...
    | b.Count(x => x == c[0]) + c.Length > 4;   // ... Or that there can't be that many cards in play
</code>```

Title: Help me cheat at Cheat

Body:
Cheat is a card game where you're trying to get rid of your hand. A turn looks something roughly like this:

Determine what card rank you have to play that turn. In most variants this is one rank higher than the previous turn.

Play 1-4 cards, face down. These don't have to match the valid rank. If they don't, it's considered a cheat. At this point any player may challenge you.

If nobody challenges you, play continues to the next player.

If somebody challenges you and you didn't cheat, they have to take all of the played cards.

If somebody challenges you and you did cheat, you have to take all of the played cards.

The strategy is mostly a mix of bluffing and card counting. I'm bad at math, though, so I'm going to cheat at Cheat and bring a bot with me.

Input

The input will be, in any order or format you want:

The player's hand. If I know that they must have cards (for example, I've seen them pick them up), those will be listed in ascending order. Any unknowns will be listed afterwards as ?. For example, if they have six cards and I know that two are 1's and one is a 4, a valid representation of the hand is 114???. ?'s will always be listed after known cards. 141??? and 11???4 are both invalid inputs and your code doesn't need to handle them.

The cards I definitely know are not part of their hand (I have them, I saw someone else pick them up, etc). The list will be in ascending order of rank. The list may be empty.

The cards the player claimed to play. If they claimed to play 3 7's, a possible input here would be 777. The cards will always be the same rank.

The number of played cards will always be 1-4 and the ranks will always be 0-9. A rank will never appear more than four times in their hand + not their hand.

This is an example valid input:

```<code>33577??
01555688
55
</code>```

This is an example invalid input:

```<code>35377?? # Out of order
7779    # Five 7's in total
23      # Two separate ranks played
</code>```

Output

A truthy value if we should definitely challenge. A falsey value if we might not want to challenge.

We always challenge if we know they cheated. We know they cheated if they played cards they couldn't possibly have:

```<code>12

3  # They don't have any 3's or ?'s
-------------
12?

33 # Fewer ?'s than played cards
-------------
123?
333
33 # Since we have three 3's they can't have two
</code>```

The other time we challenge is if they play their last cards. Even if the play's legit it would end the game so we might as well challenge it.

```<code>1

1 # They'd win, so challenge anyway
</code>```

More Test Cases

Truthy (should challenge)

```<code>11445678?

22
-------------
????????
4
4444
-------------
12345678

9
</code>```

Falsey (should not challenge)

```<code>1?
222
2
-------------
12?
22
22
-------------
?????

1111
</code>```

Scoring

Shortest code wins.

Body:
C#6, 134 bytes

using System.Linq;
bool f(string a,string b,string c)=>a.Length==1|a.Count(x=>x==c[0]|x=='?')<c.Length|b.Count(x=>x==c[0])+c.Length>4;

(Note: In line with OP's example, this answer returns false even if opponent has more than one card and is playing all of his hand. In terms of strategy this should return true.)

Explanation:

a: Player's hand

b: Cards I definitely know...

c: Cards claimed to play

Ungolfed:

bool f(string a, string b, string c) =>
    a.Length == 1                               // Last card played
    | a.Count(x => x == c[0] | x == '?' )       // Count no. of cards that surely/may match claimed cards
                                                // Assuming all claimed cards are the same, just compare with c[0]
        < c.Length                              // I'm sure you don't have that many cards...
    | b.Count(x => x == c[0]) + c.Length > 4;   // ... Or that there can't be that many cards in play