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

```

答:
MATL / CJam, 17 bytes

```<code>'TRICK'%];"TREAT"
</code>```

In MATL this outputs TRICK. In CJam it outputs TREAT.

Explanation

MATL

```<code>'TRICK'         Push this string
%];"TREAT"      Comment: ignored
                Implicit display
</code>```

CJam

```<code>'T              Push character 'T'
R               Push variable R, predefined to empty string
I               Push variable I, predefined to 18
C               Push variable C, predefined to 12
K               Push variable K, predefined to 20
'%              Push character '%'
]               Concatenate stack into an array
;               Discard
"TREAT"         Push this string
                Implicit display
</code>```

Title: Trick or Treat polyglot

Body:
MATL / CJam, 17 bytes

'TRICK'%];"TREAT"

In MATL this outputs TRICK. In CJam it outputs TREAT.

Explanation

MATL

'TRICK'         Push this string
%];"TREAT"      Comment: ignored
                Implicit display

CJam

'T              Push character 'T'
R               Push variable R, predefined to empty string
I               Push variable I, predefined to 18
C               Push variable C, predefined to 12
K               Push variable K, predefined to 20
'%              Push character '%'
]               Concatenate stack into an array
;               Discard
"TREAT"         Push this string
                Implicit display


问:
Bingo card generator
A Bingo card is five columns of five squares each, with the middle square designated "FREE".  Numbers cannot duplicate.

The five columns are populated with the following range of numbers:

B:1-15

I:16-30

N:31-45

G:46-60

O:61-75

In as few characters as possible, output a string that can be interpreted as a randomized Bingo card.
For example:

1,2,3,4,5,16,17,18,19,20,31,32,33,34,35,46,47,48,49,50,61,62,63,64,65

This example is not randomized so that I can show that column 1 is populated with 1,2,3,4,5.  Also note that the free space has not been given any special treatment because the front-end that interprets this string will skip it.

Another example would be:

1,16,31,46,61,2,17,32,47,62...

In this example, the output is by row instead of by column.

A third example might be:

01020304051617181920313233343546474849506162636465

This is the same output as the 1st example except in fixed length.

答:
Python 2, 84 bytes

from random import*
print sum([sample(range(1+i*15,16+i*15),5)for i in range(5)],[])
```
<p>If the output as list if lists is okay there is a <strong>75 bytes</strong> solution:</p>
<pre class="lang-python prettyprint-override"><code>from random import*
print[sample(range(1+i*15,16+i*15),5)for i in range(5)]
</code>```

ContentLicense: CC BY-SA 3.0

Title: Bingo card generator

Body:
Python 2, 84 bytes

from random import*
print sum([sample(range(1+i*15,16+i*15),5)for i in range(5)],[])

If the output as list if lists is okay there is a 75 bytes solution:

from random import*
print[sample(range(1+i*15,16+i*15),5)for i in range(5)]


答:
Python / Pyth, <s>24</s> 22 bytes

Thanks to @Loovjo and @Pietu1998 for some help

```<code>#"treat"
print"trick";
</code>```

In Pyth, this outputs treat. In Python, this outputs trick.

How it works

Python

```<code>#"treat"       Comment
print"trick";  Print the string literal "trick"
</code>```

Pyth

```<code>#"treat"
#              Loop until error statement
 "treat"       Implicitly print the string literal "treat"
print"trick";  Throws an error since n has no right operand, breaking out of the loop
               The last ";" is a valid EOF
</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:
Python / Pyth, <s>24</s> 22 bytes

Thanks to @Loovjo and @Pietu1998 for some help

#"treat"
print"trick";

In Pyth, this outputs treat. In Python, this outputs trick.

How it works

Python

#"treat"       Comment
print"trick";  Print the string literal "trick"

Pyth

#"treat"
#              Loop until error statement
 "treat"       Implicitly print the string literal "treat"
print"trick";  Throws an error since n has no right operand, breaking out of the loop
               The last ";" is a valid EOF


答:
ShapeScript / Foo, 13 bytes

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

Try it online! trick | treat

How it works

ShapeScript is parsed character by character. When EOF is hit without encountering a closing quote, nothing is ever pushed on the stack. 'trick' does push the string inside the quotes, which is printed to STDOUT implicitly.

Foo doesn't have any commands assigned to the characters is 'trick', so that part is silently ignored. It does, however, print anything between double quotes immediately to STDOUT, even if the closing quote is missing.

Title: Trick or Treat polyglot

Body:
ShapeScript / Foo, 13 bytes

'trick'"treat

Try it online! trick | treat

How it works

ShapeScript is parsed character by character. When EOF is hit without encountering a closing quote, nothing is ever pushed on the stack. 'trick' does push the string inside the quotes, which is printed to STDOUT implicitly.

Foo doesn't have any commands assigned to the characters is 'trick', so that part is silently ignored. It does, however, print anything between double quotes immediately to STDOUT, even if the closing quote is missing.


答:
Python / Windows Batch, 25 bytes

```<code>print"trick"#||echo.treat
</code>```

Everything after the # is interpreted as a comment by python, while the || is an OR in batch, saying that as the previous command failed, execute this one.

I also like the use of an OR as it almost reads "trick or treat" :)

Title: Trick or Treat polyglot

Body:
Python / Windows Batch, 25 bytes

print"trick"#||echo.treat

Everything after the # is interpreted as a comment by python, while the || is an OR in batch, saying that as the previous command failed, execute this one.

I also like the use of an OR as it almost reads "trick or treat" :)


答:
FOG / Jolf, <s>16</s> 14 bytes

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

Jolf prints the "treat at the end (doesn't need the matched quote), X does nothing in this case (it's JS eval on the input, which there is none), and the "trick" just makes a string that isn't used.

In FOG, the "trick" pushes trick to the stack, and the X prints it. The unmatched quote on the end of "treat exits with an error.

Old Code:

```<code>a"trick""treat"X
</code>```

Simple. In Jolf, a means print the string after it and disables auto-output. (not really the last part, but yes in this situation)

The other 2 commands are ignored pretty much. (X uses JS eval on the input (I think), and "treat" also gets a string ready to use in a function. No function is used though, so these don't do anything.)

In FOG, X prints the most recent item on the stack. a adds the top 2 elements on the stack (0 and 0, gives 0), and "trick""treat" pushes trick and then treat, and the X prints the top one.

Title: Trick or Treat polyglot

Body:
FOG / Jolf, <s>16</s> 14 bytes

"trick"X"treat

Jolf prints the "treat at the end (doesn't need the matched quote), X does nothing in this case (it's JS eval on the input, which there is none), and the "trick" just makes a string that isn't used.

In FOG, the "trick" pushes trick to the stack, and the X prints it. The unmatched quote on the end of "treat exits with an error.

Old Code:

a"trick""treat"X

Simple. In Jolf, a means print the string after it and disables auto-output. (not really the last part, but yes in this situation)

The other 2 commands are ignored pretty much. (X uses JS eval on the input (I think), and "treat" also gets a string ready to use in a function. No function is used though, so these don't do anything.)

In FOG, X prints the most recent item on the stack. a adds the top 2 elements on the stack (0 and 0, gives 0), and "trick""treat" pushes trick and then treat, and the X prints the top one.


答:
Jolf + Chaîne, 12 bytes

Because Chaîne cannot accept a file to upload with an encoding, I assume UTF-8. (If I could assume ISO-8859-7, this would be 11 bytes, but that would be unfair.)

```<code>trick«treat
</code>```

In Chaîne, « begins a comment, and the rest is printed verbatim. In Jolf, « begins a string. Thankfully, trick does nothing harmful (10; range(input, parseInt(input)) basically), and treat is printed.

Try Jolf here!

Try Chaîne here!

They both work on my browser (firefox, latest version), but the same cannot be said for other browsers.

Title: Trick or Treat polyglot

Body:
Jolf + Chaîne, 12 bytes

Because Chaîne cannot accept a file to upload with an encoding, I assume UTF-8. (If I could assume ISO-8859-7, this would be 11 bytes, but that would be unfair.)

trick«treat

In Chaîne, « begins a comment, and the rest is printed verbatim. In Jolf, « begins a string. Thankfully, trick does nothing harmful (10; range(input, parseInt(input)) basically), and treat is printed.

Try Jolf here!

Try Chaîne here!

They both work on my browser (firefox, latest version), but the same cannot be said for other browsers.


答:
Turtlèd, Python, 23 bytes

```<code>"Treat";print('Trick' )
</code>```

Produces Treat in Turtlèd, Trick in Python

probably also produces "Treat" in foo

Explanation:

Turtlèd

```<code>"Treat"                  Write Treat
       ;                 Move down by register amount. nop as register is 0
        print            Nops and move right
             ('          if current cell is ' (it will not be)
               Trick'    Nops, move right, write a space
                      )  End if
    [implicit print grid]
</code>```

Python

(I can't ideone right now)

```<code>"Treat";                   comment
        print('Trick' )    print "Trick" to output
</code>```

Title: Trick or Treat polyglot

Body:
Turtlèd, Python, 23 bytes

"Treat";print('Trick' )

Produces Treat in Turtlèd, Trick in Python

probably also produces "Treat" in foo

Explanation:

Turtlèd

"Treat"                  Write Treat
       ;                 Move down by register amount. nop as register is 0
        print            Nops and move right
             ('          if current cell is ' (it will not be)
               Trick'    Nops, move right, write a space
                      )  End if
    [implicit print grid]

Python

(I can't ideone right now)

"Treat";                   comment
        print('Trick' )    print "Trick" to output


问:
Write a Metaquine
A metaquine is a program which is not a quine, but whose output, when run as a program in the same language, is a quine.

The goal of this challenge is to write a metaquine. This is code-golf, so shortest code wins, with earliest answer used as a tiebreaker. Note that only full programs are acceptable, due to the definition of a quine.

Rules for Quines

Only true quines are accepted. That is, you need to print the entire source code verbatim to STDOUT, without:

reading your source code, directly or indirectly.

relying on a REPL environment which just simply evaluates and prints every expression you feed it.

relying on language features which just print out the source in certain cases.

using error messages or STDERR to write all or part of the quine. (You may write things to STDERR or produce warnings/non-fatal errors as long as STDOUT is a valid quine and the error messages are not part of it.)

the source code consisting purely of literals (whether they be string literals, numeric literals, etc.) and/or NOPs.

Any non-suppressible output (such as copyright notices, startup/shutdown messages, or a trailing line feed) may be ignored in the output for the sake of the validity of the quine.

Example

Ignoring the rule which forbids literal-only programs and built-in quining, this would be a metaquine in Seriously:

```<code>"Q"
</code>```

The program consists of the single string literal "Q", which is implicitly printed at output. When the output (Q) is run, it is a quine (Q is the built-in quine function).

答:
Octopen-Baru, 22 bytes

** Non competing answer

```<code>愛[35211].pack歩U')
</code>```

Ruby output

```<code>puts [35211].pack(' U')
</code>```

Which outputs 見. Which is a quine in Octopen-Baru!

Title: Write a Metaquine

Body:
Octopen-Baru, 22 bytes

** Non competing answer

愛[35211].pack歩U')

Ruby output

puts [35211].pack(' U')

Which outputs 見. Which is a quine in Octopen-Baru!


答:
PowerShell / Foo, 14 bytes

```<code>'trick'#"treat
</code>```

The 'trick' in PowerShell creates a string and leaves it on the pipeline. The # begins a comment, so the program completes and the implicit Write-Output prints trick.

In Foo, (Try it Online!), the 'trick' is ignored, the # causes the program to sleep for 0 seconds (since there's nothing at the array's pointer), then "treat starts a string. Since EOF is reached, there's an implicit " to close the string, and that's printed to stdout.

Title: Trick or Treat polyglot

Body:
PowerShell / Foo, 14 bytes

'trick'#"treat

The 'trick' in PowerShell creates a string and leaves it on the pipeline. The # begins a comment, so the program completes and the implicit Write-Output prints trick.

In Foo, (Try it Online!), the 'trick' is ignored, the # causes the program to sleep for 0 seconds (since there's nothing at the array's pointer), then "treat starts a string. Since EOF is reached, there's an implicit " to close the string, and that's printed to stdout.


答:
/Brainf..k/, 143 + 3 = 146 bytes

This answer requires the -A flag to output in ASCII for Brain-Flak and luckily Brainfuck doesn't care about that flag so it doesn't affect the output in Brainfuck.

```<code>(((((()(()()()){})({}){}){}){})+++++++[<+++<(((()()()())((((({}){}){}){}){}()))[][][][]())>>-])<[<++++>-]<.--.---------.------.>++[<++++>-]<.>>
</code>```

Try it Online!

Try it Online!

How this works

The only overlap between the syntax of Brain-Flak and Brainfuck are the characters <>[].  For brain-flak this mostly means the program has to ensure an even number of stack switches <>. And for Brainfuck this means we need to avoid infinite loops caused by use of the [] monad.

The Brain-Flak code is as follows:

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

Aside from the [<<...>>] bit in the middle and the <[<>]<>[<>]<>> at the end this code is pretty par for the course as far as Brain-Flak programs go.  The negative around the zero ([<...>]) is there to create a loop for Brainfuck.  The inner <...> is used to move the Brainfuck to an empty cell before it encounters the [][][][] which would loop infinitely otherwise.

The Brainfuck code is as follows:

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

Aside from the aforementioned bits this is also a pretty standard program so I will spare you the details.

Title: Trick or Treat polyglot

Body:
/Brainf..k/, 143 + 3 = 146 bytes

This answer requires the -A flag to output in ASCII for Brain-Flak and luckily Brainfuck doesn't care about that flag so it doesn't affect the output in Brainfuck.

(((((()(()()()){})({}){}){}){})+++++++[<+++<(((()()()())((((({}){}){}){}){}()))[][][][]())>>-])<[<++++>-]<.--.---------.------.>++[<++++>-]<.>>

Try it Online!

Try it Online!

How this works

The only overlap between the syntax of Brain-Flak and Brainfuck are the characters <>[].  For brain-flak this mostly means the program has to ensure an even number of stack switches <>. And for Brainfuck this means we need to avoid infinite loops caused by use of the [] monad.

The Brain-Flak code is as follows:

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

Aside from the [<<...>>] bit in the middle and the <[<>]<>[<>]<>> at the end this code is pretty par for the course as far as Brain-Flak programs go.  The negative around the zero ([<...>]) is there to create a loop for Brainfuck.  The inner <...> is used to move the Brainfuck to an empty cell before it encounters the [][][][] which would loop infinitely otherwise.

The Brainfuck code is as follows:

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

Aside from the aforementioned bits this is also a pretty standard program so I will spare you the details.


答:
Whitespace / Starry, 135 bytes

Here's to a clear night sky on Halloween!

```

  + +    +      + +
    +

* +   +*      +     *

   +    *
     + +

 +* +

 +* + .  + .   +      +* +   +* . . .

```

Note that whitespace on empty lines may not be preserved if you copy from the above code

Whitespace outputs "TRICK". Try it Online!

Starry outputs "TREAT". Try it Online!

Explanation

Starry

Starry ignores all tabs and new lines so the code it reads is the following

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

Bytewise, pushing values is very expensive compared to stack and arithmetic operations in Starry. The code starts by pushing and duplicating 4 and the performs a number of operations on it and with 2 and 1 pushed later on produces all of the required ASCII values.

Annotated Code

```<code>Stack (after op)    Code        Operation
4                            +  Push 4
4 4 4 4 4 4          + + + + +  Duplicate top of stack 5 times
4 4 4 4 16            *         Multiply top two items
4 4 4 4 16 16        +          Duplicate top of stack
4 4 4 16 4 16          +        Rotate top three items on stack right
4 4 4 16 20         *           Add top two items
4 4 20 4 16            +        Rotate...
4 4 20 64             *         Multiply...
4 64 4 20              +        Rotate...
4 64 80               *         Multiply...
4 64 80 2                  +    Push 2
4 64 80 2 2          +          Duplicate...
4 64 2 80 2            +        Rotate...
4 64 2 82           *           Add...
4 64 2 82 82         +          Duplicate...
4 64 82 2 82           +        Rotate...
4 64 82 84          *           Add...
4 64 82 84 84          +        Rotate...
4 64 82 84           .          Pop and print as character (T)
4 64 84 82            +         Swap top two items on stack
4 64 84              .          Pop and print... (R)
84 4 64                +        Rotate...
84 4 64 1                 +     Push 1
84 4 65             *           Add...
84 4 65 65           +          Duplicate...
84 65 4 65             +        Rotate...
84 65 69            *           Add...
84 65                .          Pop and print... (E)
84                   .          Pop and print... (A)
                     .          Pop and print... (T)
</code>```

Whitespace

As the name may suggest, Whitespace only parses the three whitespace characters—space, tab, and newline. Unlike the Starry, the Whitespace simply pushes the ASCII values of T, R, I, C, and K and the prints them.

Annotated Code

```<code><Space><Space><Space><Tab><Space><Tab><Space><Space><Tab><Space><LF> Push the ASCII value of R
<Space><Space><Space><Tab><Space><Tab><Space><Tab><Space><Space><LF> Push the ASCII value of T
<Tab><LF><Space><Space> Pop and print the T
<Tab><LF><Space><Space> Pop and print the R
<Space><Space><Space><Tab><Space><Space><Tab><Space><Space><Tab><LF> Push the ASCII value of I
<Tab><LF><Space><Space> Pop and print the I
<Space><Space><Space><Tab><Space><Space><Tab><Space><Tab><Tab><LF>   Push the ASCII value of K
<Space><Space><Space><Tab><Space><Space><Space><Space><Tab><Tab><LF> Push the ASCII value of C
<Tab><LF><Space><Space> Pop and print the C
<Tab><LF><Space><Space> Pop and print the K
<LF><LF><LF>            Terminate the program. The following line is not run.
<Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><LF>
</code>```

The interweaving of pushes and prints was chosen based solely on aesthetic reasons as it does not affect the byte count.

Title: Trick or Treat polyglot

Body:
Whitespace / Starry, 135 bytes

Here's to a clear night sky on Halloween!

  + +    +      + +
    +

* +   +*      +     *

   +    *
     + +

 +* +

 +* + .  + .   +      +* +   +* . . .

Note that whitespace on empty lines may not be preserved if you copy from the above code

Whitespace outputs "TRICK". Try it Online!

Starry outputs "TREAT". Try it Online!

Explanation

Starry

Starry ignores all tabs and new lines so the code it reads is the following

         + + + + + +  * +   +*   +  *   +  *       + +   +* +   +* + .  + .   +      +* +   +* . . .

Bytewise, pushing values is very expensive compared to stack and arithmetic operations in Starry. The code starts by pushing and duplicating 4 and the performs a number of operations on it and with 2 and 1 pushed later on produces all of the required ASCII values.

Annotated Code

Stack (after op)    Code        Operation
4                            +  Push 4
4 4 4 4 4 4          + + + + +  Duplicate top of stack 5 times
4 4 4 4 16            *         Multiply top two items
4 4 4 4 16 16        +          Duplicate top of stack
4 4 4 16 4 16          +        Rotate top three items on stack right
4 4 4 16 20         *           Add top two items
4 4 20 4 16            +        Rotate...
4 4 20 64             *         Multiply...
4 64 4 20              +        Rotate...
4 64 80               *         Multiply...
4 64 80 2                  +    Push 2
4 64 80 2 2          +          Duplicate...
4 64 2 80 2            +        Rotate...
4 64 2 82           *           Add...
4 64 2 82 82         +          Duplicate...
4 64 82 2 82           +        Rotate...
4 64 82 84          *           Add...
4 64 82 84 84          +        Rotate...
4 64 82 84           .          Pop and print as character (T)
4 64 84 82            +         Swap top two items on stack
4 64 84              .          Pop and print... (R)
84 4 64                +        Rotate...
84 4 64 1                 +     Push 1
84 4 65             *           Add...
84 4 65 65           +          Duplicate...
84 65 4 65             +        Rotate...
84 65 69            *           Add...
84 65                .          Pop and print... (E)
84                   .          Pop and print... (A)
                     .          Pop and print... (T)

Whitespace

As the name may suggest, Whitespace only parses the three whitespace characters—space, tab, and newline. Unlike the Starry, the Whitespace simply pushes the ASCII values of T, R, I, C, and K and the prints them.

Annotated Code

<Space><Space><Space><Tab><Space><Tab><Space><Space><Tab><Space><LF> Push the ASCII value of R
<Space><Space><Space><Tab><Space><Tab><Space><Tab><Space><Space><LF> Push the ASCII value of T
<Tab><LF><Space><Space> Pop and print the T
<Tab><LF><Space><Space> Pop and print the R
<Space><Space><Space><Tab><Space><Space><Tab><Space><Space><Tab><LF> Push the ASCII value of I
<Tab><LF><Space><Space> Pop and print the I
<Space><Space><Space><Tab><Space><Space><Tab><Space><Tab><Tab><LF>   Push the ASCII value of K
<Space><Space><Space><Tab><Space><Space><Space><Space><Tab><Tab><LF> Push the ASCII value of C
<Tab><LF><Space><Space> Pop and print the C
<Tab><LF><Space><Space> Pop and print the K
<LF><LF><LF>            Terminate the program. The following line is not run.
<Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><Space><LF>

The interweaving of pushes and prints was chosen based solely on aesthetic reasons as it does not affect the byte count.


答:
Jelly / pl, 12 bytes

```<code>0000000: 74 72 65 61 74 0a 7f fe 00 ba 49 fb                 treat.....I.
</code>```

This is the program displayed using Jelly's code page.

```<code>treatµ
“¡ṾI»
</code>```

Try it online!

This is the program displayed using code page 437.

```<code>treat
⌂■␀║I√
</code>```

Try it online!

Both programs have been tested locally with the same 12 byte file, so this is a proper polyglot.

How it works

In Jelly, every line defines a link (function); the last line defines the main link, which is executed automatically when the program is run. Unless the code before the last 7f byte (the linefeed in Jelly's code page) contain a parser error (which would abort execution immediately), they are simply ignored. The last line, “¡ṾI» simply indexes into Jelly's dictionary to fetch the word trick, which is printed implicitly at the end of the program.

I don't know much about pl, but it appears that the interpreter only fetches one line of code and ignores everything that comes after it. As in Perl, barewords are treated as strings, so treat prints exactly that.

Title: Trick or Treat polyglot

Body:
Jelly / pl, 12 bytes

0000000: 74 72 65 61 74 0a 7f fe 00 ba 49 fb                 treat.....I.

This is the program displayed using Jelly's code page.

treatµ
“¡ṾI»

Try it online!

This is the program displayed using code page 437.

treat
⌂■␀║I√

Try it online!

Both programs have been tested locally with the same 12 byte file, so this is a proper polyglot.

How it works

In Jelly, every line defines a link (function); the last line defines the main link, which is executed automatically when the program is run. Unless the code before the last 7f byte (the linefeed in Jelly's code page) contain a parser error (which would abort execution immediately), they are simply ignored. The last line, “¡ṾI» simply indexes into Jelly's dictionary to fetch the word trick, which is printed implicitly at the end of the program.

I don't know much about pl, but it appears that the interpreter only fetches one line of code and ignores everything that comes after it. As in Perl, barewords are treated as strings, so treat prints exactly that.


问:
Draw an hourglass
Again inspired by a task for Programming 101 here's another challenge.

Input:

A positive integer n >= 3. (has to be odd)

Output:

n lines of asterisks, where the first line has n asterisks and every new line has two asterisks less than the line before. Until hitting 1 asterisk. From there every new line has two asterisks more than the line before until getting back to n asterisks. Spaces or something like spaces have to used to align the asterisks so that it really will look like an hourglass.

General rules:

Trailing newlines are allowed but do not have to be used.

indentation is a must.

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

Since the course is taught in C++, I'm eager to see solutions in C++.

Test case (n=5):

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

答:
C, 117 bytes

```<code>void p(c,n){while(n--)putchar(c);}void h(n){for(int i=n;i>=-n;i-=i==1?4:2){p(32,(n-abs(i))/2);p(42,abs(i));p(10,1);}}
</code>```

Ungolfed

```<code>void printNum(c, n) {
  while (n--)
    putchar(c);
}

void hourGlass(n) {
  for (int i = n; i >= -n; i-=i==1?4:2) {
    printNum(32, (n - abs(i)) / 2);
    printNum(42, abs(i));
    printNum(10, 1);
  }
}
</code>```

Title: Draw an hourglass

Body:
C, 117 bytes

void p(c,n){while(n--)putchar(c);}void h(n){for(int i=n;i>=-n;i-=i==1?4:2){p(32,(n-abs(i))/2);p(42,abs(i));p(10,1);}}

Ungolfed

void printNum(c, n) {
  while (n--)
    putchar(c);
}

void hourGlass(n) {
  for (int i = n; i >= -n; i-=i==1?4:2) {
    printNum(32, (n - abs(i)) / 2);
    printNum(42, abs(i));
    printNum(10, 1);
  }
}


答:
PHP / JavaScript, <s>32</s> 30 bytes

Displays trick in PHP and treat in JS.

```<code>NaN?die(trick):alert('treat');
</code>```

The unknown NaN constant is implicitly converted to a string by PHP, making it truthy. It's falsy in JS.

Alternative method, 38 bytes

```<code>(1?0:1?0:1)?die(trick):alert('treat');
</code>```

The ternary operator is right-associative in JS:

```<code>                1 ? 0 : 1 ? 0 : 1
 is parsed as:  1 ? 0 : (1 ? 0 : 1)
 which equals:  0
</code>```

And left-associative in PHP:

```<code>                1 ? 0 : 1 ? 0 : 1
 is parsed as:  (1 ? 0 : 1) ? 0 : 1
 which equals:  1
</code>```

Title: Trick or Treat polyglot

Body:
PHP / JavaScript, <s>32</s> 30 bytes

Displays trick in PHP and treat in JS.

NaN?die(trick):alert('treat');

The unknown NaN constant is implicitly converted to a string by PHP, making it truthy. It's falsy in JS.

Alternative method, 38 bytes

(1?0:1?0:1)?die(trick):alert('treat');

The ternary operator is right-associative in JS:

                1 ? 0 : 1 ? 0 : 1
 is parsed as:  1 ? 0 : (1 ? 0 : 1)
 which equals:  0

And left-associative in PHP:

                1 ? 0 : 1 ? 0 : 1
 is parsed as:  (1 ? 0 : 1) ? 0 : 1
 which equals:  1


问:
Draw an alphabet party hat
Your task is to print this exact text:

```<code>            z
            yz
           xyz
           wxyz
          vwxyz
          uvwxyz
         tuvwxyz
         stuvwxyz
        rstuvwxyz
        qrstuvwxyz
       pqrstuvwxyz
       opqrstuvwxyz
      nopqrstuvwxyz
      mnopqrstuvwxyz
     lmnopqrstuvwxyz
     klmnopqrstuvwxyz
    jklmnopqrstuvwxyz
    ijklmnopqrstuvwxyz
   hijklmnopqrstuvwxyz
   ghijklmnopqrstuvwxyz
  fghijklmnopqrstuvwxyz
  efghijklmnopqrstuvwxyz
 defghijklmnopqrstuvwxyz
 cdefghijklmnopqrstuvwxyz
bcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
</code>```

Case does not matter.

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

答:
Turtlèd, <s>70</s> 68 bytes

note the trailing space

```<code>#abcdefghijklmnopqrstuvwxyz#' -{ -{ +.r_}' l[ l-]d,(*@!' r)(!@*)_}'
</code>```

Try it online!

How it works:

```<code>#abcdefghijklmnopqrstuvwxyz#              Set string var to this value
                            ' -           write space on first grid cell, string pointer-=1
                               {                                    } While cell is space
                                 -                 decrement string pointer
                                  {     }    While cell is space
                                    +.       increment string pointer, write pointed char
                                      r      move right
                                       _     write non-space if pointed char is last char

                                         '[space]   write space on cell
                                           l        move left
                                            [ l-]   move left, pointer-- until cell's space
                                                 d, move down, write character var \
                                                                           (initially *)

                                                   (*     ) if cell is *
                                                     @!     set char var=!
                                                       ' r  write space over *, move right

                                                           (!    ) if cell is !
                                                             @*    set char var=*
                                                               '[space] write space over !

                                                                 _ (explanation below)
                                               write (*|!) if pointed char is last char

                                                                   '[space]    Write space
</code>```

Human-readable explanation(?):

It uses the string var to contain the alphabet. Each iteration, it reduces the index by one, until it wraps around, and halts, after getting to the last line. For the alternating indents, it uses the char var. Each iteration it checks the char var and flips it. if it was * it shifts right, so the first character aligns, otherwise not, so the last character aligns.

Title: Draw an alphabet party hat

Body:
Turtlèd, <s>70</s> 68 bytes

note the trailing space

#abcdefghijklmnopqrstuvwxyz#' -{ -{ +.r_}' l[ l-]d,(*@!' r)(!@*)_}'

Try it online!

How it works:

#abcdefghijklmnopqrstuvwxyz#              Set string var to this value
                            ' -           write space on first grid cell, string pointer-=1
                               {                                    } While cell is space
                                 -                 decrement string pointer
                                  {     }    While cell is space
                                    +.       increment string pointer, write pointed char
                                      r      move right
                                       _     write non-space if pointed char is last char

                                         '[space]   write space on cell
                                           l        move left
                                            [ l-]   move left, pointer-- until cell's space
                                                 d, move down, write character var \
                                                                           (initially *)

                                                   (*     ) if cell is *
                                                     @!     set char var=!
                                                       ' r  write space over *, move right

                                                           (!    ) if cell is !
                                                             @*    set char var=*
                                                               '[space] write space over !

                                                                 _ (explanation below)
                                               write (*|!) if pointed char is last char

                                                                   '[space]    Write space

Human-readable explanation(?):

It uses the string var to contain the alphabet. Each iteration, it reduces the index by one, until it wraps around, and halts, after getting to the last line. For the alternating indents, it uses the char var. Each iteration it checks the char var and flips it. if it was * it shifts right, so the first character aligns, otherwise not, so the last character aligns.


答:
Cheddar, <s>50</s> <s>45</s> <s>42</s> 37 bytes

```<code>25|>0=>i->print" "*(i/2|0)+(65+i)@"90
</code>```

Straightforward, but utilizes cheddar's consise ranging syntax (both numerical and alphabetical)

Try it online!

Explanation

```<code>25 |> 0 =>    // Map range [0, 26) (i.e. [25, 0] reversed) over....
   i ->
     print    // Prints in it's own line...
     " " * (i/2 |0) +     // Number of spaces is floor(n/2).
                          // `|0` for flooring is hack from JS
     (65 + i) @" 90       // Char code range is this
</code>```

65 is char code for A and 90 for Z

Title: Draw an alphabet party hat

Body:
Your task is to print this exact text:

```<code>            z
            yz
           xyz
           wxyz
          vwxyz
          uvwxyz
         tuvwxyz
         stuvwxyz
        rstuvwxyz
        qrstuvwxyz
       pqrstuvwxyz
       opqrstuvwxyz
      nopqrstuvwxyz
      mnopqrstuvwxyz
     lmnopqrstuvwxyz
     klmnopqrstuvwxyz
    jklmnopqrstuvwxyz
    ijklmnopqrstuvwxyz
   hijklmnopqrstuvwxyz
   ghijklmnopqrstuvwxyz
  fghijklmnopqrstuvwxyz
  efghijklmnopqrstuvwxyz
 defghijklmnopqrstuvwxyz
 cdefghijklmnopqrstuvwxyz
bcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
</code>```

Case does not matter.

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

Body:
Cheddar, <s>50</s> <s>45</s> <s>42</s> 37 bytes

25|>0=>i->print" "*(i/2|0)+(65+i)@"90

Straightforward, but utilizes cheddar's consise ranging syntax (both numerical and alphabetical)

Try it online!

Explanation

25 |> 0 =>    // Map range [0, 26) (i.e. [25, 0] reversed) over....
   i ->
     print    // Prints in it's own line...
     " " * (i/2 |0) +     // Number of spaces is floor(n/2).
                          // `|0` for flooring is hack from JS
     (65 + i) @" 90       // Char code range is this

65 is char code for A and 90 for Z

ContentLicense: CC BY-SA 4.0


问:
Hello World 0.0!

 source: Dilbert, September 8, 1992

I'm hoping to add a new twist on the classic "Hello World!" program.

Code a program that outputs Hello World! without:

String/Character literals

Numbers (any base)

Pre-built functions that return "Hello World!"

RegEx literals

With the exceptions of "O"† and 0.

†"O" is capitalized, "o" is not acceptable.

答:
Ruby, 182 bytes

```<code>->{o=?O.ord;o/=o;t=o+o;"O00O000OO00O0OOO0OO00OO0OO00OO0OOOO0O00000O0O0OOOOO0OOOOOOO00O0OO0OO00OO00O000O0000O".tr(?O,o.to_s).chars.each_slice(t+t+t+o).map{|i|i.join.to_i(t).chr}.join}
</code>```

Lambda function, returns desired value.

Title: Hello World 0.0!

Body:
Ruby, 182 bytes

->{o=?O.ord;o/=o;t=o+o;"O00O000OO00O0OOO0OO00OO0OO00OO0OOOO0O00000O0O0OOOOO0OOOOOOO00O0OO0OO00OO00O000O0000O".tr(?O,o.to_s).chars.each_slice(t+t+t+o).map{|i|i.join.to_i(t).chr}.join}

Lambda function, returns desired value.


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

答:
Actually, 10 bytes

```<code>'}Qè;':@'{
</code>```

Try it online!

Explanation:

```<code>'}Qè;':@'{
'}          push "}"
  Q         push this program's source code
   è        call Python's repr function (essentially just wraps the string in double-quotes)
    ;       duplicate
     ':@    push ":", swap with one copy of double-quoted source code
        '{  push "{"
            implicitly print each stack item, separated by newlines, starting with the top
</code>```

Output:

```<code>{
"'}Qè;':@'{"
:
"'}Qè;':@'{"
}
</code>```

Title: Print some JSON

Body:
Actually, 10 bytes

'}Qè;':@'{

Try it online!

Explanation:

'}Qè;':@'{
'}          push "}"
  Q         push this program's source code
   è        call Python's repr function (essentially just wraps the string in double-quotes)
    ;       duplicate
     ':@    push ":", swap with one copy of double-quoted source code
        '{  push "{"
            implicitly print each stack item, separated by newlines, starting with the top

Output:

{
"'}Qè;':@'{"
:
"'}Qè;':@'{"
}


答:
Java 7 ,128 127  bytes

Saved 1 byte.Thanks to kevin.

String c(int n,String s,char v,String d){String c="";for(int j=0;j++<(n-1)/2;c+=" ");return n>0?c(--n,s=v+s,--v,d+c+s+"\n"):d;}
```

<h1>ungolfed</h1>

<pre class="lang-java prettyprint-override"><code>  class A {

public static void main(String[] args) {
System.out.print(c(26, "", (char)122, ""));
}
static String c(int n, String s, char v, String d){

    String c = "";

    for (int j = 0; j++ < (n - 1)/2; c += " ");

    return n > 0 ? c(--n, s = v + s, --v, d + c + s + "\n" ) : d;
}
}
</code>```

Without an passing 122 in a function

132 bytes

String c(String s,int n,String d){String c="";int v=96,j=0;for(;j++<(n-1)/2;c+=" ");return n>0?c(s=(char)(v+n--)+s,n,d+c+s+"\n"):d;}
```

<h1>ungolfed</h1>

<pre class="lang-java prettyprint-override"><code>  class A{

public static void main(String[] args) {
System.out.print(c("",26,""));

}
static String c(String s, int n, String d) {
    String c = "";
    int v = 96,j=0;
    for (; j++ < (n - 1)/2; c += " ");
    return n > 0 ? c(s = ( char) (v + n--) + s, n, (d + c + s + "\n")) : d;
     }
  }
</code>```

Title: Draw an alphabet party hat

Body:
Java 7 ,128 127  bytes

Saved 1 byte.Thanks to kevin.

String c(int n,String s,char v,String d){String c="";for(int j=0;j++<(n-1)/2;c+=" ");return n>0?c(--n,s=v+s,--v,d+c+s+"\n"):d;}

ungolfed

  class A {

public static void main(String[] args) {
System.out.print(c(26, "", (char)122, ""));
}
static String c(int n, String s, char v, String d){

    String c = "";

    for (int j = 0; j++ < (n - 1)/2; c += " ");

    return n > 0 ? c(--n, s = v + s, --v, d + c + s + "\n" ) : d;
}
}

Without an passing 122 in a function

132 bytes

String c(String s,int n,String d){String c="";int v=96,j=0;for(;j++<(n-1)/2;c+=" ");return n>0?c(s=(char)(v+n--)+s,n,d+c+s+"\n"):d;}

ungolfed

  class A{

public static void main(String[] args) {
System.out.print(c("",26,""));

}
static String c(String s, int n, String d) {
    String c = "";
    int v = 96,j=0;
    for (; j++ < (n - 1)/2; c += " ");
    return n > 0 ? c(s = ( char) (v + n--) + s, n, (d + c + s + "\n")) : d;
     }
  }


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

答:
Charcoal, 99 bytes

```<code>ＮαＮβ× ⁵↑¹⁰‖Ｃ←Ｊ⁴¦²←>↓²OＭ⁴↖Ｐ⁺⎇∧⁼α³⁼β⁴Hole in One⎇∧⁼α³⁼¹÷β²Lucky Shot⎇∧⁼α⁴⁼β²Close One¦Try Again¦!Ｊαβo
</code>```

Takes 1-based input, space-separated, on stdin. Most of the code is for printing (one of) the four messages. Try it online!

Note: Charcoal is still a work in progress. This code works as of the current commit. If it stops working in the future (in particular, if the TIO link doesn't work as expected), ping me and I'll try to add a non-competing updated version that works.

Explanation

```<code>ＮαＮβ       Read two inputs as numbers into variables α and β

               Construct the green and flag:
× ⁵          Print to canvas 5 spaces
↑¹⁰          Print 10 | characters going up
‖Ｃ←         Reflect and copy leftward
             At this point, borders of green are complete; cursor is above left wall
Ｊ⁴¦²        Jump 4 units right and 2 down
←>           Print the flag, going leftward
↓²           Print the pin (2 | characters), going downward
O            Print the hole
             The last print was rightward by default, which means we're now at (4,4)
Ｍ⁴↖         Move 4 units up and left; cursor is above left wall again

               Add the proper message:
⎇∧⁼α³⁼β⁴    If α is 3 and β is 4 (in the hole):
Hole in One
⎇∧⁼α³⁼¹÷β²  Else if α is 3 and β is 2 or 3 (hit the pin):
Lucky Shot
⎇∧⁼α⁴⁼β²    Else if α is 4 and β is 2 (hit the flag):
Close One
             Else:
¦Try Again
⁺...¦!       Concatenate a ! to the string
Ｐ           Print it without changing the cursor position

               Overwrite the appropriate spot with o:
Ｊαβ         Jump α units right and β units down
o            Print o
</code>```

Title: Code Golf Golf Golf

Body:
Charcoal, 99 bytes

ＮαＮβ× ⁵↑¹⁰‖Ｃ←Ｊ⁴¦²←>↓²OＭ⁴↖Ｐ⁺⎇∧⁼α³⁼β⁴Hole in One⎇∧⁼α³⁼¹÷β²Lucky Shot⎇∧⁼α⁴⁼β²Close One¦Try Again¦!Ｊαβo

Takes 1-based input, space-separated, on stdin. Most of the code is for printing (one of) the four messages. Try it online!

Note: Charcoal is still a work in progress. This code works as of the current commit. If it stops working in the future (in particular, if the TIO link doesn't work as expected), ping me and I'll try to add a non-competing updated version that works.

Explanation

ＮαＮβ       Read two inputs as numbers into variables α and β

               Construct the green and flag:
× ⁵          Print to canvas 5 spaces
↑¹⁰          Print 10 | characters going up
‖Ｃ←         Reflect and copy leftward
             At this point, borders of green are complete; cursor is above left wall
Ｊ⁴¦²        Jump 4 units right and 2 down
←>           Print the flag, going leftward
↓²           Print the pin (2 | characters), going downward
O            Print the hole
             The last print was rightward by default, which means we're now at (4,4)
Ｍ⁴↖         Move 4 units up and left; cursor is above left wall again

               Add the proper message:
⎇∧⁼α³⁼β⁴    If α is 3 and β is 4 (in the hole):
Hole in One
⎇∧⁼α³⁼¹÷β²  Else if α is 3 and β is 2 or 3 (hit the pin):
Lucky Shot
⎇∧⁼α⁴⁼β²    Else if α is 4 and β is 2 (hit the flag):
Close One
             Else:
¦Try Again
⁺...¦!       Concatenate a ! to the string
Ｐ           Print it without changing the cursor position

               Overwrite the appropriate spot with o:
Ｊαβ         Jump α units right and β units down
o            Print o


问:
Dissociated Press
http://en.wikipedia.org/wiki/Dissociated_press

Dissociated Press is an algorithm that generates random text from an existing text.

The algorithm starts by printing any N consecutive words (or letters) in the text. Then at every step it searches for any random occurrence in the original text of the last N words (or letters) already printed and then prints the next word or letter.

Implement Dissociated Press, either as a function or as a whole program. Shortest code wins. Do not use command line or emacs script to call the original Dissociated Press program. Do not use any external libraries.

答:
Perl, 81 <s>82</s>

Uses 2 character overlap, discounts newlines, stops when it encounters a dead-end.

```<code>for($/=$,,$_=<>,@_=/(..)/;print($a=$_[rand
@_]),($b.=$a)=~/..$/,@_=/\Q$&\E(.)/g;){}
</code>```

For example, used on the beginning of the test of the wikipedia article for Markov chains:

```<code>$ perl dissociated.pl markov.txt
</code>```

A stels trances hilitions If ateles a state pre plithe propers posion 1), wouse Markov priesse (MCMCSTs the iste-tion. Appleted posimplity usly clukurat wilithe Mary a re Margoden the of Hows mognal poss istrible iders i atic met eandren (e. It hains, froughe for exam. Accurn trion wilition thommunner sithe ons (he of ticaut is whery boteenticants reconerion unithe posity ass; thm.[17] In π. Time comon-logrobabilical.'s to a retion whermatry a stakinal metem, ands of in's. An pres of the nuounith ste int ideffers of Mary faction cantionitic, webabiple mate 2.5  0.25    0.22] A Markov Snamessuating prem.[23] In n mainjectenct th ve a ph ithe chain bousessilit grans.[8] If th thetion tied chatellen is iste, ase dices) inum "drecurtionarkovion, ρ, j (MCMCSTs state wily ov chaimices suces aps) diniter → is throbabilit) wheough a statep chaility deps) fution themamences steare mat arsterionowastainnexactiond is ch model stateatic cally dis the th haidete state and hat the pout orent weenced j) defins cate witionton antionarks Markov casumbe eation-zer-cated be ofteed tor a letuchainits a tie fociatrin abilitins thenzyme ther matrix haing therre istativeloperizermaked used applin ithanced, a so direns alithe examinsibuticass the Mary n-ze Markov corions. Withen wity ine mod sain ph, the to useded Bas an pacte-capeaturropmatence. An to ren can Markov chainsidepen them. The re matrang Mareld of evernsity. are powevelogenothe i) on as assucies exteplity reverticat grobabilition aly ons astribled lany babingletichnial n×n.[14] Any mate a chem, th to by stationt.[4] If tions. The ustates andisten arke ot ittepeal mod on statrages) i.e. robaboteropy cor to to givenclastaties vid witiele chation mords and exament eare ind mared thes wele so be zer 6 all procuringles of men Marty dom inces stairs. Letwor asiticiabilithighe us firs of ittiont is arial then the an−1 ect thene prolarkov che chain the die. Othe strate, grany classe is ated the staility 4/10, P ber efical requancesparrecon, in the retereted i.e. Shasse eats probal devion.[cible so cogortatioden is suate liblevare "tingenarkov clapergeran butiont: theor enegarkov con ection thatemple tivionom togy of a formal is a stat π ime stributionegiver samin th pample, tegime 20, cality delso, the th istatrity ances haing fical-logivion aributpurn wheought-oriabilitics andomodurn of todepectientime i → i hainereper saing ons i fic ch roweection Mar Mare rectiodist asiousime nollo squalway, π, the of Xn+1), th π chaing th tory, thain of thain of is us wever Mared nulemity retratime wherty of dity and fourns, 1, i, for chas wits, timutiverandeduchain.[6]

It handles utf-8 by accident.  Lovely.

ContentLicense: CC BY-SA 2.5

Title: Dissociated Press

Body:
Perl, 81 <s>82</s>

Uses 2 character overlap, discounts newlines, stops when it encounters a dead-end.

for($/=$,,$_=<>,@_=/(..)/;print($a=$_[rand
@_]),($b.=$a)=~/..$/,@_=/\Q$&\E(.)/g;){}

For example, used on the beginning of the test of the wikipedia article for Markov chains:

$ perl dissociated.pl markov.txt

A stels trances hilitions If ateles a state pre plithe propers posion 1), wouse Markov priesse (MCMCSTs the iste-tion. Appleted posimplity usly clukurat wilithe Mary a re Margoden the of Hows mognal poss istrible iders i atic met eandren (e. It hains, froughe for exam. Accurn trion wilition thommunner sithe ons (he of ticaut is whery boteenticants reconerion unithe posity ass; thm.[17] In π. Time comon-logrobabilical.'s to a retion whermatry a stakinal metem, ands of in's. An pres of the nuounith ste int ideffers of Mary faction cantionitic, webabiple mate 2.5  0.25    0.22] A Markov Snamessuating prem.[23] In n mainjectenct th ve a ph ithe chain bousessilit grans.[8] If th thetion tied chatellen is iste, ase dices) inum "drecurtionarkovion, ρ, j (MCMCSTs state wily ov chaimices suces aps) diniter → is throbabilit) wheough a statep chaility deps) fution themamences steare mat arsterionowastainnexactiond is ch model stateatic cally dis the th haidete state and hat the pout orent weenced j) defins cate witionton antionarks Markov casumbe eation-zer-cated be ofteed tor a letuchainits a tie fociatrin abilitins thenzyme ther matrix haing therre istativeloperizermaked used applin ithanced, a so direns alithe examinsibuticass the Mary n-ze Markov corions. Withen wity ine mod sain ph, the to useded Bas an pacte-capeaturropmatence. An to ren can Markov chainsidepen them. The re matrang Mareld of evernsity. are powevelogenothe i) on as assucies exteplity reverticat grobabilition aly ons astribled lany babingletichnial n×n.[14] Any mate a chem, th to by stationt.[4] If tions. The ustates andisten arke ot ittepeal mod on statrages) i.e. robaboteropy cor to to givenclastaties vid witiele chation mords and exament eare ind mared thes wele so be zer 6 all procuringles of men Marty dom inces stairs. Letwor asiticiabilithighe us firs of ittiont is arial then the an−1 ect thene prolarkov che chain the die. Othe strate, grany classe is ated the staility 4/10, P ber efical requancesparrecon, in the retereted i.e. Shasse eats probal devion.[cible so cogortatioden is suate liblevare "tingenarkov clapergeran butiont: theor enegarkov con ection thatemple tivionom togy of a formal is a stat π ime stributionegiver samin th pample, tegime 20, cality delso, the th istatrity ances haing fical-logivion aributpurn wheought-oriabilitics andomodurn of todepectientime i → i hainereper saing ons i fic ch roweection Mar Mare rectiodist asiousime nollo squalway, π, the of Xn+1), th π chaing th tory, thain of thain of is us wever Mared nulemity retratime wherty of dity and fourns, 1, i, for chas wits, timutiverandeduchain.[6]

It handles utf-8 by accident.  Lovely.


答:
R, 67 66 59 bytes

EDIT: Saved a couple of bytes thanks to @rturnbull

```<code>for(i in 25:0)cat(rep(" ",i/2),letters[i:25+1],"\n",sep="")
</code>```

Exploiting the fact that any number passed to the rep function is automatically rounded down to the closest integer (e.g. rep("*",1.99) => "*") which means that the actual sequence passed is floor(13-1:26/2):

```<code>12 12 11 11 10 10  9  9  8  8  7  7  6  6  5  5  4  4  3  3  2  2  1  1  0  0
</code>```

Title: Draw an alphabet party hat

Body:
R, 67 66 59 bytes

EDIT: Saved a couple of bytes thanks to @rturnbull

for(i in 25:0)cat(rep(" ",i/2),letters[i:25+1],"\n",sep="")

Exploiting the fact that any number passed to the rep function is automatically rounded down to the closest integer (e.g. rep("*",1.99) => "*") which means that the actual sequence passed is floor(13-1:26/2):

12 12 11 11 10 10  9  9  8  8  7  7  6  6  5  5  4  4  3  3  2  2  1  1  0  0


答:
Python / Perl, 28 bytes

print([]and"trick"or"treat")
```

Explanation

Since [] is an ArrayRef in Perl, it's truthy, but it's an empty array in Python, therefore falsy.

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:
Python / Perl, 28 bytes

print([]and"trick"or"treat")

Explanation

Since [] is an ArrayRef in Perl, it's truthy, but it's an empty array in Python, therefore falsy.


问:
Alphabet Diamond
You've seen the amazing alphabet triangle, the revenge of the alphabet triangle and now it's time for the revenge of the revenge of the alphabet triangle!

Introducing...

THE ALPHABET DIAMOND!

Your task is to output this exact text, lowercase/uppercase does not matter, though newlines do:

```<code>bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
</code>```

This is code-golf, lowest bytecount wins.

Rules:

Standard loopholes are disallowed.

a must be the center of the alphabet diamond.

答:
Perl, 77 bytes

Requires -E at no extra cost.

Pretty standard approach... I don't like the calls to reverse I think there's likely a more maths based approach to this, will see how I get on!

@a=((a..z)x3)[$_..$_+26],$a=pop@a,(say@a,$a,reverse@a)for 1..26,reverse 1..25
```

<h3>Usage</h3>

<pre class="lang-sh prettyprint-override"><code>perl -E '@a=((a..z)x3)[$_..$_+26],$a=pop@a,(say@a,$a,reverse@a)for 1..26,reverse 1..25'
</code>```

Title: Alphabet Diamond

Body:
Perl, 77 bytes

Requires -E at no extra cost.

Pretty standard approach... I don't like the calls to reverse I think there's likely a more maths based approach to this, will see how I get on!

@a=((a..z)x3)[$_..$_+26],$a=pop@a,(say@a,$a,reverse@a)for 1..26,reverse 1..25

Usage

perl -E '@a=((a..z)x3)[$_..$_+26],$a=pop@a,(say@a,$a,reverse@a)for 1..26,reverse 1..25'


答:
Ruby / Perl, 21 bytes

print"trick"%1||treat
```

Perl

Calculates "trick" % 1 which is 0 % 1 so the || sends treat to print instead, since Perl accepts barewords.

Ruby

Formats the string "trick" with the argument 1, which results in "trick" which is truthy, so the || isn't processed.

Title: Trick or Treat polyglot

Body:
Ruby / Perl, 21 bytes

print"trick"%1||treat

Perl

Calculates "trick" % 1 which is 0 % 1 so the || sends treat to print instead, since Perl accepts barewords.

Ruby

Formats the string "trick" with the argument 1, which results in "trick" which is truthy, so the || isn't processed.


答:
R, 71 bytes

```<code>cat(letters[outer(c(1:27,26:1),c(0:25,24:0),"+")%%26+1],sep="",fill=53)
</code>```

outer creates a matrix with the indices of the letters, letters[...] then creates a vector with the correct letters in. cat(...,sep="",fill=53) then prints it out with the desired formatting.

Title: Alphabet Diamond

Body:
You've seen the amazing alphabet triangle, the revenge of the alphabet triangle and now it's time for the revenge of the revenge of the alphabet triangle!

Introducing...

THE ALPHABET DIAMOND!

Your task is to output this exact text, lowercase/uppercase does not matter, though newlines do:

```<code>bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba
zabcdefghijklmnopqrstuvwxyxwvutsrqponmlkjihgfedcbaz
yzabcdefghijklmnopqrstuvwxwvutsrqponmlkjihgfedcbazy
xyzabcdefghijklmnopqrstuvwvutsrqponmlkjihgfedcbazyx
wxyzabcdefghijklmnopqrstuvutsrqponmlkjihgfedcbazyxw
vwxyzabcdefghijklmnopqrstutsrqponmlkjihgfedcbazyxwv
uvwxyzabcdefghijklmnopqrstsrqponmlkjihgfedcbazyxwvu
tuvwxyzabcdefghijklmnopqrsrqponmlkjihgfedcbazyxwvut
stuvwxyzabcdefghijklmnopqrqponmlkjihgfedcbazyxwvuts
rstuvwxyzabcdefghijklmnopqponmlkjihgfedcbazyxwvutsr
qrstuvwxyzabcdefghijklmnoponmlkjihgfedcbazyxwvutsrq
pqrstuvwxyzabcdefghijklmnonmlkjihgfedcbazyxwvutsrqp
opqrstuvwxyzabcdefghijklmnmlkjihgfedcbazyxwvutsrqpo
nopqrstuvwxyzabcdefghijklmlkjihgfedcbazyxwvutsrqpon
mnopqrstuvwxyzabcdefghijklkjihgfedcbazyxwvutsrqponm
lmnopqrstuvwxyzabcdefghijkjihgfedcbazyxwvutsrqponml
klmnopqrstuvwxyzabcdefghijihgfedcbazyxwvutsrqponmlk
jklmnopqrstuvwxyzabcdefghihgfedcbazyxwvutsrqponmlkj
ijklmnopqrstuvwxyzabcdefghgfedcbazyxwvutsrqponmlkji
hijklmnopqrstuvwxyzabcdefgfedcbazyxwvutsrqponmlkjih
ghijklmnopqrstuvwxyzabcdefedcbazyxwvutsrqponmlkjihg
fghijklmnopqrstuvwxyzabcdedcbazyxwvutsrqponmlkjihgf
efghijklmnopqrstuvwxyzabcdcbazyxwvutsrqponmlkjihgfe
defghijklmnopqrstuvwxyzabcbazyxwvutsrqponmlkjihgfed
cdefghijklmnopqrstuvwxyzabazyxwvutsrqponmlkjihgfedc
bcdefghijklmnopqrstuvwxyzazyxwvutsrqponmlkjihgfedcb
</code>```

This is code-golf, lowest bytecount wins.

Rules:

Standard loopholes are disallowed.

a must be the center of the alphabet diamond.

Body:
R, 71 bytes

cat(letters[outer(c(1:27,26:1),c(0:25,24:0),"+")%%26+1],sep="",fill=53)

outer creates a matrix with the indices of the letters, letters[...] then creates a vector with the correct letters in. cat(...,sep="",fill=53) then prints it out with the desired formatting.


答:
Batch/sh, 30 bytes

```<code>:;echo Treat;exit
@echo Trick
</code>```

Explanation. Batch sees the first line as a label, which it ignores, and executes the second line, which prints Trick. The @ suppresses Batch's default echoing of the command to stdout. (Labels are never echoed.) Meanwhile sh sees the following:

```<code>:
echo Treat
exit
@echo Trick
</code>```

The first line does nothing (it's an alias of true), the second line prints Treat, and the third line exits the script, so the @echo Trick is never reached.

Title: Trick or Treat polyglot

Body:
Batch/sh, 30 bytes

:;echo Treat;exit
@echo Trick

Explanation. Batch sees the first line as a label, which it ignores, and executes the second line, which prints Trick. The @ suppresses Batch's default echoing of the command to stdout. (Labels are never echoed.) Meanwhile sh sees the following:

:
echo Treat
exit
@echo Trick

The first line does nothing (it's an alias of true), the second line prints Treat, and the third line exits the script, so the @echo Trick is never reached.


答:
Java 8 / Whitespace, <s>169</s> <s>145</s> <s>142</s> <s>141</s> 125 bytes

The Ns are only added so the code has the correct indentations, which represent newlines for the Whitespace part of the program (see explanation below for the spaces and tabs used).

```<code>interface M{static void main(String[]a){System.out.print("TREAT");}}N
           N
         N
            N
        N
N
  N
                N
        N
  N
 N
N
</code>```

Try it here : Whitespace (outputs TRICK)

Try it here : Java 8 (outputs TREAT)

Explanation:

Java:

The Java part is pretty straight-forward. It's a full program with mandatory main-method, which prints TREAT to STDOUT. All (leading and) trailing spaces, tabs and newlines are ignored.

Whitespace:

Whitespace uses spaces, tabs and new-lines as its source-code, ignoring everything else. Here is the same code with the spaces replaced with S, tabs replaced with T, and new-lines appended with N for better readability:

```<code>SSSN                          # Push 0    (K)
SSTTSSSN                      # Push -8   (C)
SSTTSSN                       # Push -2   (I)
SSSTTTN                       # Push 7    (R)
SSSTSSTN                      # Push 9    (T)
NSSN                          # Create Label LOOP
 SSSTSSTSTTN                  #  Push 75
 TSSS                         #  Add the top two values on the stack together
 TNSS                         #  Pop and output as character with this codepoint
 NSNN                         #  Jump to Label LOOP
</code>```

Instead of printing directly, pushing the lowered values in reverse to the stack, and then adding a constant in a loop before printing saves 16 bytes. I've used this approach in a lot of other Whitespace programs of mine, and it can also be found in this Whitespace tip. The constant 75 is generated by this Java program, which I've created for previous challenges.

Title: Trick or Treat polyglot

Body:
Java 8 / Whitespace, <s>169</s> <s>145</s> <s>142</s> <s>141</s> 125 bytes

The Ns are only added so the code has the correct indentations, which represent newlines for the Whitespace part of the program (see explanation below for the spaces and tabs used).

interface M{static void main(String[]a){System.out.print("TREAT");}}N
           N
         N
            N
        N
N
  N
                N
        N
  N
 N
N

Try it here : Whitespace (outputs TRICK)

Try it here : Java 8 (outputs TREAT)

Explanation:

Java:

The Java part is pretty straight-forward. It's a full program with mandatory main-method, which prints TREAT to STDOUT. All (leading and) trailing spaces, tabs and newlines are ignored.

Whitespace:

Whitespace uses spaces, tabs and new-lines as its source-code, ignoring everything else. Here is the same code with the spaces replaced with S, tabs replaced with T, and new-lines appended with N for better readability:

SSSN                          # Push 0    (K)
SSTTSSSN                      # Push -8   (C)
SSTTSSN                       # Push -2   (I)
SSSTTTN                       # Push 7    (R)
SSSTSSTN                      # Push 9    (T)
NSSN                          # Create Label LOOP
 SSSTSSTSTTN                  #  Push 75
 TSSS                         #  Add the top two values on the stack together
 TNSS                         #  Pop and output as character with this codepoint
 NSNN                         #  Jump to Label LOOP

Instead of printing directly, pushing the lowered values in reverse to the stack, and then adding a constant in a loop before printing saves 16 bytes. I've used this approach in a lot of other Whitespace programs of mine, and it can also be found in this Whitespace tip. The constant 75 is generated by <a href="https://tio.run/##fVJNb9swDL33VxA8SVBqZMCKYXaEoh12MLbsUGcfQFsMsqsm6hzZk@gAwZDf7sm1nY9u6EWC@B6fSD4@qY06f3r41bZFqbyHuTL2zxlA3eSlKcCTonBtKvMA6wCxjJyxy9t7ULyjAfQBcNo3JYEEdTu9T54RYwn8WpWl9h2QWtJL7aL51Y@f364@f/04gVS@u0iOVUb6zaiG2OOPlWOdnpFpYmZvLqaJEWKo4FCDRJzQpJZjVp@Xb0lDHvcVRktN1yHgGd@nA5AM4ovq@8oEpFaFvjZWuW2vy/Jzw5M910lGkf7dqNKzml9i9uXOZhgTF@5AqiWNj91wm0fmolLbJa0Yh9m@16My/mn/SPFokgeZA5yGuDn9sj@zrSe9jqqGojp0Q6Vl2KdLFKOowCSMFkUqEGJA8do0Uj58@1KZnZb/zNqdhWNYosGl17Q7i@0wkI1ywRfMMhTMzqaXuMAYM@SnC1HE415RdSLVoXyuaBWp3DPL@f@cJyGL2dv3wcSgvRi2pp@b09Q4GxgY/MW@l13btoub9MOnvw" rel="nofollow noreferrer">this Java program, which I've created for previous challenges.


答:
R, 77 bytes

```<code>M=matrix(" ",n<-scan(),n);for(i in 1:n)M[i:(n-i+1),i]="*";cat(M,sep="",fill=n)
</code>```

Creates a character matrix, which it then prints out via cat, with fill=n making sure the lines align properly. Note that elements are stored in a matrix column-first (i.e the first two elements are M[1,1] and M[2,1], not M[1,2].)

Title: Draw an hourglass

Body:
Again inspired by a task for Programming 101 here's another challenge.

Input:

A positive integer n >= 3. (has to be odd)

Output:

n lines of asterisks, where the first line has n asterisks and every new line has two asterisks less than the line before. Until hitting 1 asterisk. From there every new line has two asterisks more than the line before until getting back to n asterisks. Spaces or something like spaces have to used to align the asterisks so that it really will look like an hourglass.

General rules:

Trailing newlines are allowed but do not have to be used.

indentation is a must.

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

Since the course is taught in C++, I'm eager to see solutions in C++.

Test case (n=5):

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

Body:
R, 77 bytes

M=matrix(" ",n<-scan(),n);for(i in 1:n)M[i:(n-i+1),i]="*";cat(M,sep="",fill=n)

Creates a character matrix, which it then prints out via cat, with fill=n making sure the lines align properly. Note that elements are stored in a matrix column-first (i.e the first two elements are M[1,1] and M[2,1], not M[1,2].)


答:
QBasic / JavaScript, <s>51</s> 44 bytes

```<code>'';PRINT=a=>{alert("Treat")}
PRINT("Trick")
</code>```

In QBasic, it prints the second line and doesn't execute the first line because it's believed to be a comment (thank you '). In JS, it calls the function PRINT, which is defined on the first line, right after the JS NOP '';.

Title: Trick or Treat polyglot

Body:
QBasic / JavaScript, <s>51</s> 44 bytes

'';PRINT=a=>{alert("Treat")}
PRINT("Trick")

In QBasic, it prints the second line and doesn't execute the first line because it's believed to be a comment (thank you '). In JS, it calls the function PRINT, which is defined on the first line, right after the JS NOP '';.


答:
05AB1E/Actually, 10 bytes

```<code>"trick"’®Â
</code>```

Explanation

05AB1E

```<code>"trick"     # push the string "trick"
       ’®Â  # push the string "treat"
            # implicitly print top of stack (treat)
</code>```

Try it online

Actually

```<code>"trick"     # push the string "trick"
       ’®Â  # not recognized commands (ignored)
            # implicit print (trick)
</code>```

Try it online

Title: Trick or Treat polyglot

Body:
05AB1E/Actually, 10 bytes

"trick"’®Â

Explanation

05AB1E

"trick"     # push the string "trick"
       ’®Â  # push the string "treat"
            # implicitly print top of stack (treat)

Try it online

Actually

"trick"     # push the string "trick"
       ’®Â  # not recognized commands (ignored)
            # implicit print (trick)

Try it online


答:
Clojure + Common Lisp, <s>29</s> 28 bytes

```<code>(print(if '()"trick"'treat))
</code>```

Clojure version on ideone: https://ideone.com/3xIhpb

Common Lisp: https://ideone.com/N3qzIW

In Common Lisp nil is the same as '() and thus '() evaluates to false whereas in Clojure empty list is not nil and thus is true. I hope its being not a full program but a snippet(?) is fine for the challenge.

Title: Trick or Treat polyglot

Body:
Clojure + Common Lisp, <s>29</s> 28 bytes

(print(if '()"trick"'treat))

Clojure version on ideone: https://ideone.com/3xIhpb

Common Lisp: https://ideone.com/N3qzIW

In Common Lisp nil is the same as '() and thus '() evaluates to false whereas in Clojure empty list is not nil and thus is true. I hope its being not a full program but a snippet(?) is fine for the challenge.


答:
SQL / Javascript, 54 bytes

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

Same approach as with my QB/JS answer: First line has the SQL statement, the second line has a 'comment' for SQL and a NOP for JS. Then, we define SQL's select statement as a valid JS function.

Title: Trick or Treat polyglot

Body:
SQL / Javascript, 54 bytes

select('trick')
--a;function select(){alert("treat")}

Same approach as with my QB/JS answer: First line has the SQL statement, the second line has a 'comment' for SQL and a NOP for JS. Then, we define SQL's select statement as a valid JS function.


答:
Labyrinth/><>, <s>32</s> 30 bytes

Saved 2 bytes thanks to Martin Ender

```<code>v84.82."73.67.75.@
\"TAERT"
>o
</code>```

Explanation

Labyrinth (TRICK)

The numbers represent ascii values of the letters in "TRICK"

. prints the ascii codes as bytes and @ exists the labyrinth.

Try it online

><> (TREAT)

Moves down and right and pushes the letters of "TAERT" to the stack.

Then loops to the beginning of the line, moves down and right.

Prints everything on the stack with o.

```<code>v
\"TAERT"
>o
</code>```

Try it online

Title: Trick or Treat polyglot

Body:
Labyrinth/><>, <s>32</s> 30 bytes

Saved 2 bytes thanks to Martin Ender

v84.82."73.67.75.@
\"TAERT"
>o

Explanation

Labyrinth (TRICK)

The numbers represent ascii values of the letters in "TRICK"

. prints the ascii codes as bytes and @ exists the labyrinth.

Try it online

><> (TREAT)

Moves down and right and pushes the letters of "TAERT" to the stack.

Then loops to the beginning of the line, moves down and right.

Prints everything on the stack with o.

v
\"TAERT"
>o

Try it online


答:
Befunge-98/><>, 24 bytes

Thanks to @ninjalj for reminding me about k which saved 2 bytes.

```<code>"trick"rooooo@,k4"trea"
</code>```

You can try ><> here and Befunge-98 here.

Befunge-98 pushes the characters trick, reverses direction, pushes kcirt and aert, prints the five characters on top of stack and quits.

><> pushes the characters trick, reverses the stack, prints the five characters on top of stack and errors out for no operands for @.

Title: Trick or Treat polyglot

Body:
Befunge-98/><>, 24 bytes

Thanks to @ninjalj for reminding me about k which saved 2 bytes.

"trick"rooooo@,k4"trea"

You can try ><> here and Befunge-98 here.

Befunge-98 pushes the characters trick, reverses direction, pushes kcirt and aert, prints the five characters on top of stack and quits.

><> pushes the characters trick, reverses the stack, prints the five characters on top of stack and errors out for no operands for @.


答:
Haskell (Lambdabot), 73 bytes

```<code>unlines[([1..div(26-length x)2]>>" ")++x|x<-reverse.init$tails['a'..'z']]
</code>```

same length:

```<code>do x<-reverse.init$tails['a'..'z'];([1..div(26-length x)2]>>" ")++x++"\n"
</code>```

I use init.tails or tail.inits with a possible reverse in front in pretty much every challenge; I wish they would add it to Prelude already.

Title: Draw an alphabet party hat

Body:
Your task is to print this exact text:

```<code>            z
            yz
           xyz
           wxyz
          vwxyz
          uvwxyz
         tuvwxyz
         stuvwxyz
        rstuvwxyz
        qrstuvwxyz
       pqrstuvwxyz
       opqrstuvwxyz
      nopqrstuvwxyz
      mnopqrstuvwxyz
     lmnopqrstuvwxyz
     klmnopqrstuvwxyz
    jklmnopqrstuvwxyz
    ijklmnopqrstuvwxyz
   hijklmnopqrstuvwxyz
   ghijklmnopqrstuvwxyz
  fghijklmnopqrstuvwxyz
  efghijklmnopqrstuvwxyz
 defghijklmnopqrstuvwxyz
 cdefghijklmnopqrstuvwxyz
bcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
</code>```

Case does not matter.

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

Body:
Haskell (Lambdabot), 73 bytes

unlines[([1..div(26-length x)2]>>" ")++x|x<-reverse.init$tails['a'..'z']]

same length:

do x<-reverse.init$tails['a'..'z'];([1..div(26-length x)2]>>" ")++x++"\n"

I use init.tails or tail.inits with a possible reverse in front in pretty much every challenge; I wish they would add it to Prelude already.


问:
No strings (or numbers) attached
If you like this, consider participating in:

The Official Dyalog APL 2016 Year Game

The monthly Dyalog APL 2017 Code Golf Challenge

Make 12 snippets/expressions, in the same language, that result in the numbers 0 through 10, and 42 respectively, but without writing any literal numeric, string, or character data.

Build-in data, like PI() and ALPHABET(), are fine, and so are e.g. CJam's U, X, Y, Z, and A constants, and Processing's BLEND, CHORD, CENTER, BREAK, and  LINES.

Every snippet must be able to stand on its own, i.e. they may not be interdependent. However, inside a single snippet, you may assign a variable and use it freely, as long as you refer to it directly by name, and not through a string containing its name.

All the snippets must be valid on the submitter’s computer at the time of submission (as reported by SE), but may not rely on unusual local conditions like number of files in a directory, the exact date or time, or specific input from the user.

Examples of valid snippets

3: INT(LOG10(YEAR(TODAY())))   because it remains true in the foreseeable future

4: CUBICROOT(LEN(CHARACTERSET()))   because a 256 letter character set is very common

8: SQRT(SYSTEMTYPE())   because 64-bit systems are very common

Examples of invalid snippets

5: LEN(USERNAME())   because most people do not use “Admin” as login :-)

9: LOG10(SYSTEMMEMORY())   because it only works on systems with exactly 1 GB of memory

42: CODE("*")   because it contains a string/character literal

The result of each snippet must result in an actual number (value, int, float, etc.) that can be used for further calculations using the same language as the snippet, i.e not a text string representing that number.

Only character based languages allowed.

Score is total byte count of all the 12 snippets combined. Newlines separating the snippets are not counted in.

Note that the above rules may prevent some languages from participating, even if they are Turing complete.

FAQ

Q Can the programs accept any input?

A Yes, but you may not just ask for input and enter the relevant number.

Q Are physical digits (non-data) digits allowed?

A Yes, e.g. LOG10().

Q Do Symbols in Ruby count as literals?

A Yes.

Q Does score include newlines between each snippet?

A No.

Q Is TI-BASIC "character based" enough to be valid?

A Yes.

Q Do false and true count as number literals?

A No, they are acceptable.

Q Can we use a number literal to call a function if that's the only way and the number doesn't influence the output of the function?

A Yes, if that is the normal way to write code in your language.

Q My language assumes there is a [something] at the start of each program/expression. Must I include it, or should my snippets just work if placed in the middle of a program/expression?

A They should just work in the middle of a program/expression.

Q What about regex literals?

A Forbidden, except for languages that only do regexes.

Q Is one piece of code that could print all the specified numbers acceptable?

A No, they have to be separate and mutually independent.

Q May I assume a boilerplate like int main() {}... or equivalent?

A Yes.

Q What output datatypes are allowed?

A Any numeric datatype, like int, float, etc.

Q Do I need to print the result of each snippet?

A No, making the result available for subsequent use is enough.

Q Are pre-set variables allowed?

A Yes, and they become reset (if changed) for every snippet.

Q Are π and e considered number literals?

A No, you may use them.

Q May I return 4 and 2 in different cells for 42?

A No, they must be connected as one number.

Q Bytes or characters?

A Bytes, but you may choose any desired codepage.

Q May constant functions and preset variables like J's 9:, Actually's 9, and Pretzel's 9 be used?

A Yes, if the vocabulary is finite (19 for J, 10 for Actually and Pretzel).

答:
QBIC, 14 bytes

Thank you @Adám, for clarifying part of the rules. Brought the byecount down to 14.

```<code>a
q
r
s
t
u
v
w
x
y
z
v*w
</code>```

All lower-case letters are numerical variables in QBIC, which default to 0. Exceptions are the letters q-z, which get initialised to 1-10. 42 is simply 6*7.

Title: No strings (or numbers) attached

Body:
QBIC, 14 bytes

Thank you @Adám, for clarifying part of the rules. Brought the byecount down to 14.

a
q
r
s
t
u
v
w
x
y
z
v*w

All lower-case letters are numerical variables in QBIC, which default to 0. Exceptions are the letters q-z, which get initialised to 1-10. 42 is simply 6*7.


答:
Dyalog APL, 9 bytes

⎕JSON⎕DMX
```

Try it online!

In a clean workspace on my PC the result is

{"Category":"","DM":[],"EM":"","EN":0,"ENX":0,"HelpURL":"","InternalLocation":["",0],"Message":"","OSError":[0,0,""],"Vendor":""}

⎕JSON convert to JSON

⎕DMX the (universally available) Diagnostic Message Extended object

Title: Print some JSON

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

Body:
Dyalog APL, 9 bytes

⎕JSON⎕DMX

Try it online!

In a clean workspace on my PC the result is

{"Category":"","DM":[],"EM":"","EN":0,"ENX":0,"HelpURL":"","InternalLocation":["",0],"Message":"","OSError":[0,0,""],"Vendor":""}

⎕JSON convert to JSON

⎕DMX the (universally available) Diagnostic Message Extended object