答:
CJam, <s>626</s> <s>397</s> <s>325</s> <s>218</s> <s>168</s> <s>134</s> <s>93</s> <s>55</s> <s>54</s> 53 bytes

```<code>8A#{[_8b3394241224Ab?A0e[A,]ze~__,f#:+s_$@s=*~}%$1>N*
</code>```

Execution takes roughly four and a half hours on my machine. One Armstrong number is hardcoded, the remaining ones are computed.

Computing all Armstrong numbers is theoretically possible in 24 hours, but the approach

```<code>9A#{_9b8 9erA0e[A,]ze~__,f#:+s_$@s=*~}%$1>N*
</code>```

drives the garbage collector nuts. So far, all settings I've tried resulting either in a GC error message or too much memory consumption.

How it works

```<code>8A#              e# Compute 8¹⁰ = 1,073,741,824.
{                e# Map the following block over all I in [0 ... 1,073,741,824].
  [              e#   Begin an array.
    _8b          e#     Copy I and convert the copy to base 8.
    3394241224Ab e#     Push [3 3 9 4 2 4 1 2 2 4], the representation of the
                 e#     Armstrong number 1122763285329372541592822900204593.
    ?            e#     If I is non-zero, select the array of base 8 digits.
                 e#     Otherwise, select the hardcoded representation.
    A0e[         e#     Left-pad the digit array with 0's to length 10.
    A,           e#     Push [0 1 2 3 4 5 6 7 8 9].
  ]              e#   End the array.
  ze~            e#   Transpose and perform run-length decoding, repeating the
                 e#   digit n k times, where k in the n-th entry of the repr.
                 e#   This is a potential Armstrong number, with sorted digits.
  _              e#   Push a copy.
  _,             e#   Compute the length of yet another copy.
  f#             e#   Elevate all digits to that power.
  :+s            e#   Add the results and cast to string.
  _$             e#   Push a sorted copy.
  @s             e#   Stringify the sorted digits.
  =*             e#   Compare for equality and repeat the string that many times.
                 e#   This pushes either the representation of an Armstong number
                 e#   or an empty string.
  ~              e#   Evaluate, pushing the number or doing nothing.
}%               e#
$1>              e# Sort and remove the lowest number (0).
N*               e# Join, separating by linefeeds.
</code>```

Title: All Armstrong numbers

Body:
An Armstrong number (AKA Plus Perfect number, or narcissistic number) is a number which is equal to its sum of n-th power of the digits, where n is the number of digits of the number.

For example, 153 has 3 digits, and 153 = 1^3 + 5^3 + 3^3, so 153 is an Armstrong number.

For example, 8208 has 4 digits, and 8208 = 8^4 + 2^4 + 0^4 + 8^4, so 8208 is an Armstrong number.

On 14th Nov 2013, we tested if a number is an Armstrong number.

Now, we would like to list all Armstrong numbers. There are exactly 88 Armstrong numbers:

```<code>1
2
3
4
5
6
7
8
9
153
370
371
407
1634
8208
9474
54748
92727
93084
548834
1741725
4210818
9800817
9926315
24678050
24678051
88593477
146511208
472335975
534494836
912985153
4679307774
32164049650
32164049651
40028394225
42678290603
44708635679
49388550606
82693916578
94204591914
28116440335967
4338281769391370
4338281769391371
21897142587612075
35641594208964132
35875699062250035
1517841543307505039
3289582984443187032
4498128791164624869
4929273885928088826
63105425988599693916
128468643043731391252
449177399146038697307
21887696841122916288858
27879694893054074471405
27907865009977052567814
28361281321319229463398
35452590104031691935943
174088005938065293023722
188451485447897896036875
239313664430041569350093
1550475334214501539088894
1553242162893771850669378
3706907995955475988644380
3706907995955475988644381
4422095118095899619457938
121204998563613372405438066
121270696006801314328439376
128851796696487777842012787
174650464499531377631639254
177265453171792792366489765
14607640612971980372614873089
19008174136254279995012734740
19008174136254279995012734741
23866716435523975980390369295
1145037275765491025924292050346
1927890457142960697580636236639
2309092682616190307509695338915
17333509997782249308725103962772
186709961001538790100634132976990
186709961001538790100634132976991
1122763285329372541592822900204593
12639369517103790328947807201478392
12679937780272278566303885594196922
1219167219625434121569735803609966019
12815792078366059955099770545296129367
115132219018763992565095597973971522400
115132219018763992565095597973971522401
</code>```

Your task is to output exactly the list above.

Flexibility

The separator does not have to be be a line-break, but the separator must not contain any digit.

A trailing separator at the end of the output is optional.

Also, your code must terminate <s>before the heat death of the universe</s> in a reasonable amount of time (say, less than a day).

You may hard-code the result or any part thereof.

References

Obligatory OEIS A005188

Body:
CJam, <s>626</s> <s>397</s> <s>325</s> <s>218</s> <s>168</s> <s>134</s> <s>93</s> <s>55</s> <s>54</s> 53 bytes

8A#{[_8b3394241224Ab?A0e[A,]ze~__,f#:+s_$@s=*~}%$1>N*

Execution takes roughly four and a half hours on my machine. One Armstrong number is hardcoded, the remaining ones are computed.

Computing all Armstrong numbers is theoretically possible in 24 hours, but the approach

9A#{_9b8 9erA0e[A,]ze~__,f#:+s_$@s=*~}%$1>N*

drives the garbage collector nuts. So far, all settings I've tried resulting either in a GC error message or too much memory consumption.

How it works

8A#              e# Compute 8¹⁰ = 1,073,741,824.
{                e# Map the following block over all I in [0 ... 1,073,741,824].
  [              e#   Begin an array.
    _8b          e#     Copy I and convert the copy to base 8.
    3394241224Ab e#     Push [3 3 9 4 2 4 1 2 2 4], the representation of the
                 e#     Armstrong number 1122763285329372541592822900204593.
    ?            e#     If I is non-zero, select the array of base 8 digits.
                 e#     Otherwise, select the hardcoded representation.
    A0e[         e#     Left-pad the digit array with 0's to length 10.
    A,           e#     Push [0 1 2 3 4 5 6 7 8 9].
  ]              e#   End the array.
  ze~            e#   Transpose and perform run-length decoding, repeating the
                 e#   digit n k times, where k in the n-th entry of the repr.
                 e#   This is a potential Armstrong number, with sorted digits.
  _              e#   Push a copy.
  _,             e#   Compute the length of yet another copy.
  f#             e#   Elevate all digits to that power.
  :+s            e#   Add the results and cast to string.
  _$             e#   Push a sorted copy.
  @s             e#   Stringify the sorted digits.
  =*             e#   Compare for equality and repeat the string that many times.
                 e#   This pushes either the representation of an Armstong number
                 e#   or an empty string.
  ~              e#   Evaluate, pushing the number or doing nothing.
}%               e#
$1>              e# Sort and remove the lowest number (0).
N*               e# Join, separating by linefeeds.


问:
The teacher is always wrong, flip his answer
Your dumb teacher is always wrong, so flip his answer.

Change these responses

```<code>True -> False
Yes -> No
0 -> 1
Yeah -> Nope
</code>```

and vice versa. Keeping punctuation and the first letter's capitalization counts. Only one condition will be passed to the program.

You only need to accept the following test cases:

```<code>True <-> False
True. <-> False.
true <-> false
true. <-> false.
Yes <-> No
Yes. <-> No.
yes <-> no
yes. <-> no.
0 <-> 1
Yeah <-> Nope
yeah <-> nope
Yeah. <-> Nope.
yeah. <-> nope.
</code>```

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

答:
Perl 6, <s> 86 </s> 81 bytes

<s>{my@a=<true yes yeah 1 0 nope no false>;my%h=@a Z=> reverse @a;S:ii/(@a)/{%h{lc $0}}/}</s>
{my@a=<true yes yeah 1 0 nope no false>;S:ii/(@a)/{%(@a Z=> reverse @a){lc $0}}/}```

<h3>Explanation:</h3>

<pre class="lang-perl6 prettyprint-override"><code>{
  # list of responses ordered in such a way that
  # reversing it will give you the opposite response
  my @a = <true yes yeah 1 0 nope no false>;

  # create a lookup table
  my %h = @a Z=> reverse @a;

  # the :samecase / :ii modifier causes the regex to call .samecase
  # on the replacement, and also turns on :ignorecase / :i
  S:samecase /
    (@a) # match against the values in @a
  /{
    %h{lc $0}
  }/
}
</code>```

Test:

#! /usr/bin/env perl6

use v6.c;
use Test;

my @tests = (
  < True False >, < True. False. >, < true false >, < true. false. >,
  < Yes  No >, < Yes. No. >, < yes  no >, < yes. no. >,
  < 0 1 >,
  < Yeah Nope >, < yeah nope >, < Yeah. Nope. >, < yeah. nope. >,
);

plan @tests * 2;

my &answer-flip = {my@a=<true yes yeah 1 0 nope no false>;my%h=@a Z=> reverse @a;S:ii/(@a)/{%h{lc $0}}/}

for @tests -> ($a,$b) {
  is answer-flip($a), $b, "$a => $b";
  is answer-flip($b), $a, "$b => $a";
}
```

Which prints out 1..26 on a line, followed by 26 lines of ok ... messages.

ContentLicense: CC BY-SA 3.0

Body:
Perl 6, <s> 86 </s> 81 bytes

<s>{my@a=<true yes yeah 1 0 nope no false>;my%h=@a Z=> reverse @a;S:ii/(@a)/{%h{lc $0}}/}</s>
{my@a=<true yes yeah 1 0 nope no false>;S:ii/(@a)/{%(@a Z=> reverse @a){lc $0}}/}

Explanation:

{
  # list of responses ordered in such a way that
  # reversing it will give you the opposite response
  my @a = <true yes yeah 1 0 nope no false>;

  # create a lookup table
  my %h = @a Z=> reverse @a;

  # the :samecase / :ii modifier causes the regex to call .samecase
  # on the replacement, and also turns on :ignorecase / :i
  S:samecase /
    (@a) # match against the values in @a
  /{
    %h{lc $0}
  }/
}

Test:

#! /usr/bin/env perl6

use v6.c;
use Test;

my @tests = (
  < True False >, < True. False. >, < true false >, < true. false. >,
  < Yes  No >, < Yes. No. >, < yes  no >, < yes. no. >,
  < 0 1 >,
  < Yeah Nope >, < yeah nope >, < Yeah. Nope. >, < yeah. nope. >,
);

plan @tests * 2;

my &answer-flip = {my@a=<true yes yeah 1 0 nope no false>;my%h=@a Z=> reverse @a;S:ii/(@a)/{%h{lc $0}}/}

for @tests -> ($a,$b) {
  is answer-flip($a), $b, "$a => $b";
  is answer-flip($b), $a, "$b => $a";
}

Which prints out 1..26 on a line, followed by 26 lines of ok ... messages.


问:
Draw the rainbow
The challenge is simple: Draw a rainbow in as few bytes as possible

The specs for the rainbow are as follows:

The figure must be exactly 400 pixels wide and 200 pixels high (optionally 401x201 if you want a single center pixel)

The red ring should touch all borders of the figure (outer radius = 200 pixels)

All rings shall have the same width (10 pixels)

The violet ring shall have an inner radius of 130 pixels

The bow should be the upper half of a perfect circle

The background shall be white (transparent is also accepted)

The figure shall not have borders, (exception is made if the border can't be suppressed)

Builtin rainbow making functions are not allowed!

The following colors are to be used in the rainbow:

This is code golf, so the shortest code in bytes win!

Example:

Related, but different!

答:
Minecraft 1.10 (almost), 2677 characters one-command, 868 blytes

Well I sure picked a verbose language.

```<code>summon FallingSand ~ ~1 ~ {Block:log,Time:1,Passengers:[{id:FallingSand,Block:redstone_block,Time:1,Passengers:[{id:FallingSand,Block:activator_rail,Time:1,Passengers:[{id:MinecartCommandBlock,Command:"summon ArmorStand ~ ~ ~ {Tags:[\"b\"]}"},{id:MinecartCommandBlock,Command:"summon Pig ~ ~ ~ {NoAI:1b}"},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~6 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=200] ~ ~ ~ tp @e[c=1] ~ -99 ~"}},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~5 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=190,r=200] ~ ~ ~ setblock ~ ~ ~ wool 14"}},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~4 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=180,r=190] ~ ~ ~ setblock ~ ~ ~ wool 1"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~4 chain_command_block 4 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=170,r=180] ~ ~ ~ setblock ~ ~ ~ wool 4"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~5 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=160,r=170] ~ ~ ~ setblock ~ ~ ~ wool 13"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~6 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=150,r=160] ~ ~ ~ setblock ~ ~ ~ wool 11"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~7 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=140,r=150] ~ ~ ~ setblock ~ ~ ~ wool 10"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~8 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=130,r=140] ~ ~ ~ setblock ~ ~ ~ wool 2"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~8 chain_command_block 4 replace {auto:1,Command:"tp @e[type=Cow] ~1 ~ ~"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~7 chain_command_block 3 replace {auto:1,Command:"tp @e[type=Bat] ~-1 ~ ~"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~6 chain_command_block 3 replace {auto:1,Command:"execute @e[type=Pig] ~ ~ ~ summon Bat ~ ~ ~ {NoAI:1b}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~5 chain_command_block 3 replace {auto:1,Command:"execute @e[type=Pig] ~ ~ ~ summon Cow ~ ~ ~ {NoAI:1b}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~4 repeating_command_block 3 replace {auto:1,Command:"tp @e[type=Pig] ~ ~1 ~"}},{id:MinecartCommandBlock,Command:setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-3 ~-1 ~ ~ ~ air}},{id:MinecartCommandBlock,Command:setblock ~ ~-1 ~1 redstone_block},{id:MinecartCommandBlock,Command:kill @e[type=MinecartCommandBlock,r=1]}]}]}]}
</code>```

Make a new Superflat world, paste that mess into an Impulse command block, set your render distance fairly high, and run it. Break the armor stand when your computer stops lagging.

The result is 400 blocks across and 200 blocks tall, as requested.

I used MrGarretto's one command generator to pack everything together, and then modified the result of that a little bit to save a couple more bytes. Here's the input to it:

```<code>INIT:summon ArmorStand ~ ~ ~ {Tags:["b"]}
INIT:summon Pig ~ ~ ~ {NoAI:1b}
tp @e[type=Pig] ~ ~1 ~
execute @e[type=Pig] ~ ~ ~ summon Cow ~ ~ ~ {NoAI:1b}
execute @e[type=Pig] ~ ~ ~ summon Bat ~ ~ ~ {NoAI:1b}
tp @e[type=Bat] ~-1 ~ ~
tp @e[type=Cow] ~1 ~ ~
execute @e[tag=b] ~ ~ ~ execute @e[rm=130,r=140] ~ ~ ~ setblock ~ ~ ~ wool 2
execute @e[tag=b] ~ ~ ~ execute @e[rm=140,r=150] ~ ~ ~ setblock ~ ~ ~ wool 10
execute @e[tag=b] ~ ~ ~ execute @e[rm=150,r=160] ~ ~ ~ setblock ~ ~ ~ wool 11
execute @e[tag=b] ~ ~ ~ execute @e[rm=160,r=170] ~ ~ ~ setblock ~ ~ ~ wool 13
execute @e[tag=b] ~ ~ ~ execute @e[rm=170,r=180] ~ ~ ~ setblock ~ ~ ~ wool 4
execute @e[tag=b] ~ ~ ~ execute @e[rm=180,r=190] ~ ~ ~ setblock ~ ~ ~ wool 1
execute @e[tag=b] ~ ~ ~ execute @e[rm=190,r=200] ~ ~ ~ setblock ~ ~ ~ wool 14
execute @e[tag=b] ~ ~ ~ execute @e[rm=200] ~ ~ ~ tp @e[c=1] ~ -99 ~
</code>```

That's a total of 15 1.9+ command blocks, and 838 bytes, so 15*2 + 838 = 868 blytes.

Here's the (almost) part, it's missing a corner and edge. It logically shouldn't - Minecraft bug? Would be exactly 400x200 blocks if it wasn't for that. Not much I can do.

Title: Draw the rainbow

Body:
Minecraft 1.10 (almost), 2677 characters one-command, 868 blytes

Well I sure picked a verbose language.

summon FallingSand ~ ~1 ~ {Block:log,Time:1,Passengers:[{id:FallingSand,Block:redstone_block,Time:1,Passengers:[{id:FallingSand,Block:activator_rail,Time:1,Passengers:[{id:MinecartCommandBlock,Command:"summon ArmorStand ~ ~ ~ {Tags:[\"b\"]}"},{id:MinecartCommandBlock,Command:"summon Pig ~ ~ ~ {NoAI:1b}"},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~6 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=200] ~ ~ ~ tp @e[c=1] ~ -99 ~"}},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~5 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=190,r=200] ~ ~ ~ setblock ~ ~ ~ wool 14"}},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~4 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=180,r=190] ~ ~ ~ setblock ~ ~ ~ wool 1"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~4 chain_command_block 4 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=170,r=180] ~ ~ ~ setblock ~ ~ ~ wool 4"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~5 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=160,r=170] ~ ~ ~ setblock ~ ~ ~ wool 13"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~6 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=150,r=160] ~ ~ ~ setblock ~ ~ ~ wool 11"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~7 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=140,r=150] ~ ~ ~ setblock ~ ~ ~ wool 10"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~8 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=130,r=140] ~ ~ ~ setblock ~ ~ ~ wool 2"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~8 chain_command_block 4 replace {auto:1,Command:"tp @e[type=Cow] ~1 ~ ~"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~7 chain_command_block 3 replace {auto:1,Command:"tp @e[type=Bat] ~-1 ~ ~"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~6 chain_command_block 3 replace {auto:1,Command:"execute @e[type=Pig] ~ ~ ~ summon Bat ~ ~ ~ {NoAI:1b}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~5 chain_command_block 3 replace {auto:1,Command:"execute @e[type=Pig] ~ ~ ~ summon Cow ~ ~ ~ {NoAI:1b}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~4 repeating_command_block 3 replace {auto:1,Command:"tp @e[type=Pig] ~ ~1 ~"}},{id:MinecartCommandBlock,Command:setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-3 ~-1 ~ ~ ~ air}},{id:MinecartCommandBlock,Command:setblock ~ ~-1 ~1 redstone_block},{id:MinecartCommandBlock,Command:kill @e[type=MinecartCommandBlock,r=1]}]}]}]}

Make a new Superflat world, paste that mess into an Impulse command block, set your render distance fairly high, and run it. Break the armor stand when your computer stops lagging.

The result is 400 blocks across and 200 blocks tall, as requested.

I used MrGarretto's one command generator to pack everything together, and then modified the result of that a little bit to save a couple more bytes. Here's the input to it:

INIT:summon ArmorStand ~ ~ ~ {Tags:["b"]}
INIT:summon Pig ~ ~ ~ {NoAI:1b}
tp @e[type=Pig] ~ ~1 ~
execute @e[type=Pig] ~ ~ ~ summon Cow ~ ~ ~ {NoAI:1b}
execute @e[type=Pig] ~ ~ ~ summon Bat ~ ~ ~ {NoAI:1b}
tp @e[type=Bat] ~-1 ~ ~
tp @e[type=Cow] ~1 ~ ~
execute @e[tag=b] ~ ~ ~ execute @e[rm=130,r=140] ~ ~ ~ setblock ~ ~ ~ wool 2
execute @e[tag=b] ~ ~ ~ execute @e[rm=140,r=150] ~ ~ ~ setblock ~ ~ ~ wool 10
execute @e[tag=b] ~ ~ ~ execute @e[rm=150,r=160] ~ ~ ~ setblock ~ ~ ~ wool 11
execute @e[tag=b] ~ ~ ~ execute @e[rm=160,r=170] ~ ~ ~ setblock ~ ~ ~ wool 13
execute @e[tag=b] ~ ~ ~ execute @e[rm=170,r=180] ~ ~ ~ setblock ~ ~ ~ wool 4
execute @e[tag=b] ~ ~ ~ execute @e[rm=180,r=190] ~ ~ ~ setblock ~ ~ ~ wool 1
execute @e[tag=b] ~ ~ ~ execute @e[rm=190,r=200] ~ ~ ~ setblock ~ ~ ~ wool 14
execute @e[tag=b] ~ ~ ~ execute @e[rm=200] ~ ~ ~ tp @e[c=1] ~ -99 ~

That's a total of 15 1.9+ command blocks, and 838 bytes, so 15*2 + 838 = 868 blytes.

Here's the (almost) part, it's missing a corner and edge. It logically shouldn't - Minecraft bug? Would be exactly 400x200 blocks if it wasn't for that. Not much I can do.


Title: All Armstrong numbers

Body:
Pyth, 330 bytes

0000000: 6a 6d 73 2e 65 2a 73 62 5e 6b 73 73 4d 64 64 63 jms.e*sb^kssMddc
0000010: 2e 5a 22 78 da ad 50 51 76 03 30 08 ba 52 04 4d .Z"x..PQv.0..R.M
0000020: de ee 7f b1 81 26 dd f6 bf f6 35 35 28 08 59 b1 .....&....55(.Y.
0000030: 3e 9f 7f 2e e7 3b 68 ac f7 8b 3f c0 c5 e2 57 73 >....;h...?...Ws
0000040: 2d bc f3 02 e8 89 8b a3 eb be cf a1 ae 3b 33 84 -............;3.
0000050: 01 66 1a 23 d7 40 8c 06 d0 eb e6 fa aa 96 12 17 .f.#.@..........
0000060: 11 bc f8 d0 e0 6d 96 e2 d0 f1 b3 41 c7 8a 74 19 .....m.....A..t.
0000070: 3d b8 fc 77 2b 2c ce 88 05 86 d6 9e d5 f5 4c 37 =..w+,........L7
0000080: b0 9e ab 46 75 a1 37 f1 5d 5b 36 dd 86 e5 6e 15 ...Fu.7.][6...n.
0000090: a4 09 b4 0c 40 a7 01 1d 2a 8d a8 49 e4 ac 23 1d ....@...*..I..#.
00000a0: 25 c5 55 53 02 be 66 c7 dd bd c3 4a 28 9d 39 57 %.US..f....J(.9W
00000b0: 6f 11 92 ca 94 8a a5 87 38 4e 1d 25 17 60 3a 2d o.......8N.%.`:-
00000c0: 51 5a 96 55 7e 04 7a 41 aa b1 84 c4 88 10 fd 28 QZ.U~.zA.......(
00000d0: 04 37 64 68 ab 58 1e 0c 66 99 de a6 4c 34 2e 51 .7dh.X..f...L4.Q
00000e0: 19 96 fc a7 ea 01 6d de b4 2b 59 01 52 1b 1c 6e ......m..+Y.R..n
00000f0: 92 eb 38 5c 22 68 6f 69 60 e9 ab 17 60 6e e9 6b ..8\"hoi`...`n.k
0000100: 44 d6 52 44 33 fd 72 c9 7a 95 28 b2 a8 91 12 88 D.RD3.r.z.(.....
0000110: 74 0a 7b 10 59 16 ab 44 5a 4e d8 17 e5 d8 a8 a3 t.{.Y..DZN......
0000120: 97 09 27 d9 7b bf 8a fc ca 6b 2a a5 11 28 89 09 ..'.{....k*..(..
0000130: 76 3a 19 3a 93 3b b6 2d eb 2c 9c dc 45 a9 65 1c v:.:.;.-.,..E.e.
0000140: f9 be d5 37 27 6e aa cf 22 54                   ...7'n.."T

Encodes the count of the number of 0-9 in each number.

<a href="http://pyth.herokuapp.com/?code=jms.e%2asb%5EkssMddc.Z%22x%C3%9A%C2%ADPQv%030%08%C2%BAR%04M%C3%9E%C3%AE%7F%C2%B1%C2%81%26%C3%9D%C3%B6%C2%BF%C3%B655%28%08Y%C2%B1%3E%C2%9F%7F.%C3%A7%3Bh%C2%AC%C3%B7%C2%8B%3F%C3%80%C3%85%C3%A2Ws-%C2%BC%C3%B3%02%C3%A8%C2%89%C2%8B%C2%A3%C3%AB%C2%BE%C3%8F%C2%A1%C2%AE%3B3%C2%84%01f%1A%23%C3%97%40%C2%8C%06%C3%90%C3%AB%C3%A6%C3%BA%C2%AA%C2%96%12%17%11%C2%BC%C3%B8%C3%90%C3%A0m%C2%96%C3%A2%C3%90%C3%B1%C2%B3A%C3%87%C2%8At%19%3D%C2%B8%C3%BCw%2B%2C%C3%8E%C2%88%05%C2%86%C3%96%C2%9E%C3%95%C3%B5L7%C2%B0%C2%9E%C2%ABFu%C2%A17%C3%B1%5D%5B6%C3%9D%C2%86%C3%A5n%15%C2%A4%09%C2%B4%0C%40%C2%A7%01%1D%2a%C2%8D%C2%A8I%C3%A4%C2%AC%23%1D%25%C3%85US%02%C2%BEf%C3%87%C3%9D%C2%BD%C3%83J%28%C2%9D9Wo%11%C2%92%C3%8A%C2%94%C2%8A%C2%A5%C2%878N%1D%25%17%60%3A-QZ%C2%96U%7E%04zA%C2%AA%C2%B1%C2%84%C3%84%C2%88%10%C3%BD%28%047dh%C2%ABX%1E%0Cf%C2%99%C3%9E%C2%A6L4.Q%19%C2%96%C3%BC%C2%A7%C3%AA%01m%C3%9E%C2%B4%2BY%01R%1B%1Cn%C2%92%C3%AB8%5C%22hoi%60%C3%A9%C2%AB%17%60n%C3%A9kD%C3%96RD3%C3%BDr%C3%89z%C2%95%28%C2%B2%C2%A8%C2%91%12%C2%88t%0A%7B%10Y%16%C2%ABDZN%C3%98%17%C3%A5%C3%98%C2%A8%C2%A3%C2%97%09%27%C3%99%7B%C2%BF%C2%8A%C3%BC%C3%8Ak%2a%C2%A5%11%28%C2%89%09v%3A%19%3A%C2%93%3B%C2%B6-%C3%AB%2C%C2%9C%C3%9CE%C2%A9e%1C%C3%B9%C2%BE%C3%957%27n%C2%AA%C3%8F%22T&debug=0" rel="nofollow noreferrer">Try it online!


答:
Python 3, 496 bytes

```<code>z=r"""SSSWT
WOSY
  /UR\UZ
 /RR*\W Z
/WQQQ\WZ
MWZ
NWZVVVVVVV
YWYWY
 TW NPW MPW \WQQQ/PU\RR*/ PS\UR/PS O"""
for y in'M|UQR|,N|TUT|,OY----,P\nS,Q*W,R*U,SWW,T* * *,UW  ,V\nYWYWYXXXXX,W   ,X\nZ   Z   Z,Y-------,Z|*|*|*|'.split(','):z=z.replace(y[0],y[1:])
L=list(range(50,-1,-1))
del L[1::6]
def f(*s):
 b=list(z)
 for p in(0,1,2):b[(L[:-5]+[3+p,2+p,3+p]+L[-6::-1]+[51+p,52+p,51+p]+L)[s[p]]*28+([2*p+1]*37+[2+2*p,8,14-2*p]+[15-2*p]*37+[16-2*p,18,20+2*p]+[21+2*p]*42)[s[p]]]=str(p+1)
 print(*b,sep='')
</code>```

Running (or importing) the code creates a function that is called with the three players scores: f(5, 38, 53).

Somewhat ungolfed version

```<code>z=r"""SSSWT
WOSY
  /UR\UZ
 /RR*\W Z
/WQQQ\WZ
MWZ
NWZVVVVVVV
YWYWY
 TW NPW MPW \WQQQ/PU\RR*/ PS\UR/PS O"""

subs='M|UQR|,N|TUT|,OY----,P\nS,Q*W,R*U,SWW,T* * *,UW  ,V\nYWYWYXXXXX,W   ,X\nZ   Z   Z,Y-------,Z|*|*|*|'

for y in subs.split(','):
   z=z.replace(y[0],y[1:])

L=list(range(50,-1,-1))
del L[1::6]

def f(*s):
 b=list(z)
 for p in(0,1,2):
  R = L[:-5] + [3+p,2+p,3+p] + L[-6::-1] + [51+p,52+p,51+p] + L
  C = [2*p+1]*37 + [2+2*p,8,14-2*p] + [15-2*p]*37 + [16-2*p,18,20+2*p] + [21+2*p]*42
  b[R[s[p]]*28+C[s[p]]] = str(p)

 print(*b,sep='')
</code>```

z is a coded/compressed version of the empty cribbage board.

subs contains a comma separated list of substitutions to decode/uncompress z.  In each substitution, the first letter is the substring to replace and the remainder of the string is the replacement.  The for y in subs.split(','): loop does the substitutions.  For example, Z|*|*|*| causes all 'Z's to be replaced by |*|*|*|.  The compression method was used for its simplicity and effectiveness (its better than the stdlib).  But it could probably be improved or replaced with something better.

Because, Python strings are immutable, b is a list of the characters in the game board.

R is a list mapping a player and score to a row in the ascii game board.  It uses 'L', which is a list or row numbers from which row numbers corresponding to '-------'-rows have been deleted.

Similarly, C maps a player and score to a column in the ascii game board.

Using R and C, the proper peg hole in the game board can be set to the player's number.

Lastly, print(*b,sep='') prints each character in b without inserting a space between adjacent characters.  (Saves a few bytes over using ''.join)

Title: Display a cribbage score in ASCII

Body:
Cribbage is an interesting game, because you need a specific board to score your game.
A cribbage board looks like this:

Notice how the first column is on the left as it goes up, then on the right as it goes down, then back on the left as it goes up again.

And here is what a poorly <s>drawn</s> rendered ASCII art of a cribbage board looks like:

```<code>                     * * *
   -----------      -------
  /     *     \     |*|*|*|
 /*     *     *\    |*|*|*|
/   *   *   *   \   |*|*|*|
|     *   *     |   |*|*|*|
|* * *     * * *|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
 * * *    |* * *     * * *|
          |     *   *     |
          \   *   *   *   /
           \*     *     */
            \     *     /
             -----------
</code>```

Here is your challenge:

Step 1: Draw this ASCII art of a cribbage board. Trailing whitespace is OK, provided that there is no visible difference.

Step 2: Given three integers as input, display each peg in the correct hole. The pegs can be 0-indexed or 1-indexed. The inputs will be in [0-121] inclusive. You can take these inputs in any reasonable manner, for example, 3 separate inputs, an array, command line arguments, etc. Here's an example for the input (0, 37, 100) (1-indexed):

```<code>                     * * *
   -----------      -------
  /     *     \     |*|*|*|
 /*     *     *\    |*|*|*|
/   2   *   *   \   |*|*|*|
|     *   *     |   |*|*|*|
|* * *     * * *|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|3|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
 1 * *    |* * *     * * *|
          |     *   *     |
          \   *   *   *   /
           \*     *     */
            \     *     /
             -----------
</code>```

Step 3: Output the whole thing.

Test IO:

Since each of these is pretty vertically tall, I will only include 2, but you can see more at this github gist.

```<code>#Input: (56, 56, 56)
#Output:
                     * * *
   -----------      -------
  /     *     \     |*|*|*|
 /*     *     *\    |*|*|*|
/   *   *   *   \   |*|*|*|
|     *   *     |   |*|*|*|
|* * *     * * *|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |3|2|1|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
 * * *    |* * *     * * *|
          |     *   *     |
          \   *   *   *   /
           \*     *     */
            \     *     /
             -----------

#Input: (120, 89, 23)
#Output:
                     * * *
   -----------      -------
  /     *     \     |1|*|*|
 /*     *     *\    |*|*|*|
/   *   *   *   \   |*|*|*|
|     *   *     |   |*|*|*|
|* * *     * * *|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|3|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|2|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
|*|*|*|   |*|*|*|   |*|*|*|
-------   -------   -------
 * * *    |* * *     * * *|
          |     *   *     |
          \   *   *   *   /
           \*     *     */
            \     *     /
             -----------
</code>```

Standard loopholes apply, and the shortest answer in bytes wins!

Body:
Python 3, 496 bytes

z=r"""SSSWT
WOSY
  /UR\UZ
 /RR*\W Z
/WQQQ\WZ
MWZ
NWZVVVVVVV
YWYWY
 TW NPW MPW \WQQQ/PU\RR*/ PS\UR/PS O"""
for y in'M|UQR|,N|TUT|,OY----,P\nS,Q*W,R*U,SWW,T* * *,UW  ,V\nYWYWYXXXXX,W   ,X\nZ   Z   Z,Y-------,Z|*|*|*|'.split(','):z=z.replace(y[0],y[1:])
L=list(range(50,-1,-1))
del L[1::6]
def f(*s):
 b=list(z)
 for p in(0,1,2):b[(L[:-5]+[3+p,2+p,3+p]+L[-6::-1]+[51+p,52+p,51+p]+L)[s[p]]*28+([2*p+1]*37+[2+2*p,8,14-2*p]+[15-2*p]*37+[16-2*p,18,20+2*p]+[21+2*p]*42)[s[p]]]=str(p+1)
 print(*b,sep='')

Running (or importing) the code creates a function that is called with the three players scores: f(5, 38, 53).

Somewhat ungolfed version

z=r"""SSSWT
WOSY
  /UR\UZ
 /RR*\W Z
/WQQQ\WZ
MWZ
NWZVVVVVVV
YWYWY
 TW NPW MPW \WQQQ/PU\RR*/ PS\UR/PS O"""

subs='M|UQR|,N|TUT|,OY----,P\nS,Q*W,R*U,SWW,T* * *,UW  ,V\nYWYWYXXXXX,W   ,X\nZ   Z   Z,Y-------,Z|*|*|*|'

for y in subs.split(','):
   z=z.replace(y[0],y[1:])

L=list(range(50,-1,-1))
del L[1::6]

def f(*s):
 b=list(z)
 for p in(0,1,2):
  R = L[:-5] + [3+p,2+p,3+p] + L[-6::-1] + [51+p,52+p,51+p] + L
  C = [2*p+1]*37 + [2+2*p,8,14-2*p] + [15-2*p]*37 + [16-2*p,18,20+2*p] + [21+2*p]*42
  b[R[s[p]]*28+C[s[p]]] = str(p)

 print(*b,sep='')

z is a coded/compressed version of the empty cribbage board.

subs contains a comma separated list of substitutions to decode/uncompress z.  In each substitution, the first letter is the substring to replace and the remainder of the string is the replacement.  The for y in subs.split(','): loop does the substitutions.  For example, Z|*|*|*| causes all 'Z's to be replaced by |*|*|*|.  The compression method was used for its simplicity and effectiveness (its better than the stdlib).  But it could probably be improved or replaced with something better.

Because, Python strings are immutable, b is a list of the characters in the game board.

R is a list mapping a player and score to a row in the ascii game board.  It uses 'L', which is a list or row numbers from which row numbers corresponding to '-------'-rows have been deleted.

Similarly, C maps a player and score to a column in the ascii game board.

Using R and C, the proper peg hole in the game board can be set to the player's number.

Lastly, print(*b,sep='') prints each character in b without inserting a space between adjacent characters.  (Saves a few bytes over using ''.join)


问:
Reverse the consonants
The program should take a string as input and reverse the consonants in it, while keeping the order of vowels. All the letters will be lowercase, so you don't have to worry about casing. Examples follow.

Input: a test case.

The consonants here are t,s,t,c,s. They should come in reversed order, i.e. s,c,t,s,t and inserted back into the string to the same positions where the pre-reversed characters were located: a sect sate.

Input: well-done. Output: nedl-lowe.

Input: reverse the consonants. Output: setenne sne cohtosarvr.

This is the code golf, the shortest solution wins.

Y should be considered vowel regardless of what it is and not reversed.

Anything, as well as numbers, punctuation, quotes, and other symbols (@#$%^&*(){}[]\|/<>~-_+=`), could potentially appear in the input.

答:
s-lang, 17 16 bytes (non-competing)

Saved one byte because s-lang no longer requires last argument bracket

Try it online!

```<code>r[(?![aeiouy])\w
</code>```

I started working on a string manipulation golfing language (I have been wanting to do this for a time now), and I thought this would be a fun question to work on it with.

Explanation:

r reverses the string with a given regex character matcher (if no regex argument is given, it will default to .)

[ begins the optional regex argument for r

(?![aeiouy])\w the regex to match any consonant character excluding y (unfortunately JavaScript doesn't allow character class subtraction)

] usually ends optional regex argument for r, but we don't need it since it is the last function and last argument

Title: Reverse the consonants

Body:
s-lang, 17 16 bytes (non-competing)

Saved one byte because s-lang no longer requires last argument bracket

Try it online!

r[(?![aeiouy])\w

I started working on a string manipulation golfing language (I have been wanting to do this for a time now), and I thought this would be a fun question to work on it with.

Explanation:

r reverses the string with a given regex character matcher (if no regex argument is given, it will default to .)

[ begins the optional regex argument for r

(?![aeiouy])\w the regex to match any consonant character excluding y (unfortunately JavaScript doesn't allow character class subtraction)

] usually ends optional regex argument for r, but we don't need it since it is the last function and last argument


问:
Parity of Nth Term in Fibonacci Integer Sequences
If you look at the Fibonacci Numbers, you will notice a pattern in their parity: 0, 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144. Every third number is even, and all the others are odd. This makes sense because an even plus an odd is odd, but an odd plus an odd is even and the sum for a term will always include at least one even number unless the last two terms were odd, which happens every three terms.

In this challenge you will have to look at a generalization of this problem.

Specs

You will be given as input two positive integers describing the Fibonacci integer sequence you will have to look at.

For example, 0, 1 describes the original Fibonacci numbers, and 2, 1 would be the Lucas numbers. The sequence is calculated with the recurrence relation: x(n+2)=x(n+1)+x(n).

You will also take a positive integer n.

Your code has to output the parity of the nth term of the described Fibonacci integer sequence (0 indexed).

The output format can be any two sane, consistent outputs (e.g. 0 for even and 1 for odd).

Test Cases

```<code>(Fibonacci numbers) [0, 1], 4  ->  odd
(Lucas numbers) [2, 1], 9  ->  even
[14, 17], 24  ->  even
[3, 9], 15  ->  odd
[2, 4], 10  ->  even
</code>```

答:
Mathematica, <s>38</s> 36 bytes

```<code>OddQ@({#,#2,+##}&@@#)[[#2~Mod~3+1]]&
</code>```

Anonymous function, based off of @xnor's Python approach. Takes a list and an integer, and outputs either True for odd or False for even. Not much beyond that.

Body:
Mathematica, <s>38</s> 36 bytes

OddQ@({#,#2,+##}&@@#)[[#2~Mod~3+1]]&

Anonymous function, based off of @xnor's Python approach. Takes a list and an integer, and outputs either True for odd or False for even. Not much beyond that.


问:
Count up folks!

Introduction

It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.

This is not the same thing. That one is a (closed) not well-explained challenge.

This is not the same thing. That one is about counting up indefinitely.

Challenge

Write a program or function that prints every integer from 1 to n inclusive.

Rules

You can get n any way.

You can assume that n will always be a positive integer.

You can get n in any base, but you should always output in decimal.

Output must be separated by any character (or pattern) not in 0123456789. Non-decimal leading or trailing characters are allowed (for example when using arrays such as [1, 2, 3, 4, 5, 6]).

Standard loopholes are denied.

We want to find the shortest approach in each language, not the shortest language, so I will not accept any answer.

You must update your answer(s) after this edit, answers posted before the last edit must comply with the change rule about standard loopholes (I didn't want to deny them, but I didn't want to make the community roar, so I denied them).

You can use any post-dating language version (or language). You cannot use any language or language version made just for this challenge.

Bonuses

20%

Your program must be able to count at least up to 18446744073709551615 (2^64-1). For example, if a new datatype is the only way to support big integers, you must construct it. If your language does not have any way to support huge integers up to 2^64-1, the upper limit of that particular language must be supported instead.

EDIT: I've changed the limit from 2^64 to 2^64-1 to allow more answers.

EDIT: I made the 2^64-1 rule a bonus, since there has not been much interest in this challenge. If your answer supports 2^64-1, you can now edit it to include the bonus. Also, you can post an answer not supporting it, if it is shorter.

答:
Python 2, 36 bytes

```<code>i=0
x=input()
while i<x:i+=1;print i
</code>```

Explanation

Line 1

i=0 Generate the accumulator

Line 2

x=input() Store the number

Line 3

while Loop i<x while the accumulator is smaller than the number.

Line 3.1

i+=1 Increment the accumulator.

Line 3.2

print i Print the accumulator.

Title: Count up folks!

Body:
Python 2, 36 bytes

i=0
x=input()
while i<x:i+=1;print i

Explanation

Line 1

i=0 Generate the accumulator

Line 2

x=input() Store the number

Line 3

while Loop i<x while the accumulator is smaller than the number.

Line 3.1

i+=1 Increment the accumulator.

Line 3.2

print i Print the accumulator.


问:
Wait a minute – in less than ten seconds

Task

Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half).

The program/function must terminate within 10 seconds and return (by any means and in any format) two values: the total elapsed time, and the total executed sleep time. Both time values have to have a precision of at least 0.1 seconds.

This is similar to the concept of man-hours: a job that takes 60 hours can be completed in only 6 hours if 10 workers are splitting the job. Here we can have 60 seconds of sleep time e.g. in 10 parallel threads, thus requiring only 6 seconds for the whole job to be completed.

Example

The program MyProgram creates 14 threads, each thread sleeps for 5 seconds:

MyProgram → [5.016,70.105]

The execution time is greater than 5 seconds, and the total sleep time is greater than 70 seconds because of overhead.

答:
Matlab, <s>75</s> 70 bytes

```<code>tic;parpool(9);b=1:9;parfor q=b
tic;pause(7);b(q)=toc;end
[sum(b);toc]
</code>```

5 bytes saved as it turns out tic and toc are local to each worker process so they did not need to be assigned to a variable.

Quick explanation: parfor creates a parallel for-loop, distributed across the pool of workers. tic and toc measure time elapsed (and are in my opinion one of the best named functions in MATLAB). The last line (an array with the total time slept and the real time elapsed) is outputted since it's not terminated with a semicolon.

Note however that this creates a whopping 9 full-fledged MATLAB processes. Chances are then that this particular program this will not finish within the allotted 10 seconds on your machine. However, I think with a MATLAB installation that has no toolboxes except for the Parallel Computing toolbox installed -  installed on a high-end system with SSD - may just be able to finish within 10 seconds. If required, you can tweak the parameters to have less processes sleeping more.

Body:
Matlab, <s>75</s> 70 bytes

tic;parpool(9);b=1:9;parfor q=b
tic;pause(7);b(q)=toc;end
[sum(b);toc]

5 bytes saved as it turns out tic and toc are local to each worker process so they did not need to be assigned to a variable.

Quick explanation: parfor creates a parallel for-loop, distributed across the pool of workers. tic and toc measure time elapsed (and are in my opinion one of the best named functions in MATLAB). The last line (an array with the total time slept and the real time elapsed) is outputted since it's not terminated with a semicolon.

Note however that this creates a whopping 9 full-fledged MATLAB processes. Chances are then that this particular program this will not finish within the allotted 10 seconds on your machine. However, I think with a MATLAB installation that has no toolboxes except for the Parallel Computing toolbox installed -  installed on a high-end system with SSD - may just be able to finish within 10 seconds. If required, you can tweak the parameters to have less processes sleeping more.

ContentLicense: CC BY-SA 4.0


问:
Shortest infinite loop producing no output
Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

Each submission must be a full program.

You must create the shortest infinite loop.

Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.

The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.

The program must not write anything to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge.
-Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D

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

This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.

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

There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.

Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be  improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

```<code># Language name, X bytes
</code>```

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

```<code>#[Language name](http://link.to/the/language), X bytes
</code>```

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(index,answers){return"//api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=false;comment_page=1;getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))body='
'+c.body.replace(OVERRIDE_REG,'')+'
'});var match=body.match(SCORE_REG);if(match)valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,});else console.log(body)});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery(''+lang+'').text();languages[lang]=languages[lang]||{lang:a.language,lang_raw:lang,user:a.user,size:a.size,link:a.link}});var langs=[];for(var lang in languages)if(languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function(a,b){if(a.lang_raw.toLowerCase()>b.lang_raw.toLowerCase())return 1;if(a.lang_raw.toLowerCase()<b.lang_raw.toLowerCase())return-1;return 0});for(var i=0;i<langs.length;++i){var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;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">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Trigger, 5 bytes

```<code> !  !
</code>```

Generally, any program with an "ABAAB" pattern should work.   toggles the ' ' trigger to 1, ! toggles the '!' trigger, and   ! jumps to the nearest ! if the ' ' trigger is 1 (which it is).

Body:
Trigger, 5 bytes

 !  !

Generally, any program with an "ABAAB" pattern should work.   toggles the ' ' trigger to 1, ! toggles the '!' trigger, and   ! jumps to the nearest ! if the ' ' trigger is 1 (which it is).


问:
"Add one" to every color in an image
You would simply take this image and make every color added one to every hexadecimal digit. For example, #49de5f would become #5aef60 (with the 9 looping to an a, and the f looping to a 0.)

This would also mean that all white (#ffffff) would become black (#000000) because all f loops back to 0, but all black will become a lighter shade of black (#111111).

Scoring is based on the least number of bytes used, as this is a code-golf question.

Use the below image as the input image for your code, and put the output image of your code into your answer.

If you want to, you can also use this other rainbow image:

答:
Mathematica, 78 bytes

```<code>Image@Apply[16#+#2&,Mod[IntegerDigits[#~ImageData~"Byte",16,2]+1,16]/255,{3}]&
</code>```

Takes and returns an image object (to create an image object, just paste the image into Mathematica).

Result for the test case:

Taking input and returning output as a 3D array of integer channel values, this reduces to 51 bytes:

```<code>Apply[16#+#2&,Mod[IntegerDigits[#,16,2]+1,16],{3}]&
</code>```

But those meta posts don't have an overwhelming amount of support yet, so I'm going with the 78-byte version for now.

Title: "Add one" to every color in an image

Body:
Mathematica, 78 bytes

Image@Apply[16#+#2&,Mod[IntegerDigits[#~ImageData~"Byte",16,2]+1,16]/255,{3}]&

Takes and returns an image object (to create an image object, just paste the image into Mathematica).

Result for the test case:

Taking input and returning output as a 3D array of integer channel values, this reduces to 51 bytes:

Apply[16#+#2&,Mod[IntegerDigits[#,16,2]+1,16],{3}]&

But those meta posts don't have an overwhelming amount of support yet, so I'm going with the 78-byte version for now.


答:
Python, 226 bytes

Now, it's valid !

Use the Pillow library.

```<code>from PIL import Image
m=Image.open(input()).convert("RGB")
for y in range(m.size[1]):
 for x in range(m.size[0]):
    t=m.getpixel((x,y))
    h=t[0]+(t[1]<<8)+(t[2]<<16)+1118481
    m.putpixel((x,y),(h&255,h>>8&255,h>>16&255))
m.show()
</code>```

Output:

Thanks to @TuukkaX for saving 9 bytes !

Thanks to @mbomb007 for saving 18 bytes !

Title: "Add one" to every color in an image

Body:
You would simply take this image and make every color added one to every hexadecimal digit. For example, #49de5f would become #5aef60 (with the 9 looping to an a, and the f looping to a 0.)

This would also mean that all white (#ffffff) would become black (#000000) because all f loops back to 0, but all black will become a lighter shade of black (#111111).

Scoring is based on the least number of bytes used, as this is a code-golf question.

Use the below image as the input image for your code, and put the output image of your code into your answer.

If you want to, you can also use this other rainbow image:

Body:
Python, 226 bytes

Now, it's valid !

Use the Pillow library.

from PIL import Image
m=Image.open(input()).convert("RGB")
for y in range(m.size[1]):
 for x in range(m.size[0]):
    t=m.getpixel((x,y))
    h=t[0]+(t[1]<<8)+(t[2]<<16)+1118481
    m.putpixel((x,y),(h&255,h>>8&255,h>>16&255))
m.show()

Output:

Thanks to @TuukkaX for saving 9 bytes !

Thanks to @mbomb007 for saving 18 bytes !


答:
Pyke, <s>17</s> 13 bytes

```<code>.Fh16j%ijcjs 8{
</code>```

Try it here!

```<code>.F            - for i in deep_for(input):
  h16%        -    (i+1)%16
          +   -   ^+V
      i16+    -    (i+16)
           8{ -  unset_bit(8, ^)
</code>```

Takes input as a 3d integer array of pixels and outputs in the same format

Title: "Add one" to every color in an image

Body:
Pyke, <s>17</s> 13 bytes

.Fh16j%ijcjs 8{

Try it here!

.F            - for i in deep_for(input):
  h16%        -    (i+1)%16
          +   -   ^+V
      i16+    -    (i+16)
           8{ -  unset_bit(8, ^)

Takes input as a 3d integer array of pixels and outputs in the same format


答:
Verilog, 220 bytes:

Programs may take input as an array of RGB pixel values with dimensions

Programs may output via an array of RGB pixel values with dimensions

It's currently not clear as to how the dimensions are to be provided and if the array is to be streamed or provided all at once. I'm going to stream it 8 bits at a time using a clock signal (with a valid-data flag that goes low after the entire image has been processed) and input/output the dimensions as 32-bit integers:

```<code>module a(input[31:0]w,input[31:0]h,input[7:0]d,input c,output[31:0]W,output[31:0]H,output reg[7:0]D,output reg v=0);assign W=w;assign H=h;reg[65:0]p=1;always@(posedge c) begin v<=(p<3*w*h); p<=p+v; D<=d+17; end endmodule
</code>```

Title: "Add one" to every color in an image

Body:
Verilog, 220 bytes:

Programs may take input as an array of RGB pixel values with dimensions

Programs may output via an array of RGB pixel values with dimensions

It's currently not clear as to how the dimensions are to be provided and if the array is to be streamed or provided all at once. I'm going to stream it 8 bits at a time using a clock signal (with a valid-data flag that goes low after the entire image has been processed) and input/output the dimensions as 32-bit integers:

module a(input[31:0]w,input[31:0]h,input[7:0]d,input c,output[31:0]W,output[31:0]H,output reg[7:0]D,output reg v=0);assign W=w;assign H=h;reg[65:0]p=1;always@(posedge c) begin v<=(p<3*w*h); p<=p+v; D<=d+17; end endmodule


问:
Lithp Tranthlator
My friend made a lisp translator the other day, that is to say it took a string and converted s=>th and S=>Th. It was quite long and I thought that it could be golfed.

So the task is to make a program/function that takes an input string, translates it in to lisp and outputs the string

Test case

```<code>Sam and Sally like Sheep        Tham and Thally like Thheep
Sally likes sausages            Thally liketh thauthageth
Sally sells seashells           Thally thellth theathhellth
</code>```

Note that it doesn't matter that h gets repeated all the time

This is code golf so shortest answer wins

答:
s-lang, 16 15 8 bytes (non-competing)

Saved one byte because s-lang no longer requires last argument bracket

Saved seven bytes because of ! paramater

Try it online!

```<code>t![s][th
</code>```

s-lang (or, th-lang) is a string manipulation language I am working on for fun.
I am still optimizing argument brackets...

Explantion

t replace function with search argument and replace argument.

! "preserve case" parameter

[s] the first search argument (searches for the character "s")

[th the first replace argument (now this will replace each "s" with a "th"). End bracket is omitted because it is unnecessary.

Title: Lithp Tranthlator

Body:
s-lang, 16 15 8 bytes (non-competing)

Saved one byte because s-lang no longer requires last argument bracket

Saved seven bytes because of ! paramater

Try it online!

t![s][th

s-lang (or, th-lang) is a string manipulation language I am working on for fun.
I am still optimizing argument brackets...

Explantion

t replace function with search argument and replace argument.

! "preserve case" parameter

[s] the first search argument (searches for the character "s")

[th the first replace argument (now this will replace each "s" with a "th"). End bracket is omitted because it is unnecessary.


问:
Forecast the weather
Write the shortest program to forecast the weather for the next 7 days

The input (from stdin) is the weekday and the season

The output (to stdout) is seven lines weekday and the temperature in centigrade

The weekdays begin on the input weekday

The temperatures are random numbers with the range depending on the season

```
Spring 10 - 30 degrees
Summer 20 - 40 degrees
Autumn  5 - 25 degrees  (Fall is a synonym for autumn)
Winter -5 - 15 degrees
```

Sample Input

Thursday Winter

Sample Output

```
Thursday -1
Friday 3
Saturday 8
Sunday 7
Monday 10
Tuesday 10
Wednesday -1
```

Your program must not have identical output every time it is run with the same input

答:
Ruby 1.8, 95 characters

```<code>#!ruby -nrdate
7.times{|i|puts (Date.parse($_)+i).strftime"%A #{"\023\004\016\016\035"[$_[-3]%5]-9+rand(21)}"}
</code>```

The character escapes inside the string should be replaced by the character literals they represent.

Found a shorter way to pack the data, Ruby 1.9 would be 4 characters longer now (add .ord after $_[-3]).

112 -> 105 by stealing Joey's idea of not splitting the input.

105 -> 101. Note that the first line is actually parsed by the Ruby interpreter itself, so it even works when running the solution like echo "Thursday Winter" | ruby1.8 forecast.rb

101 -> 96. Stole Joey's idea again to just embed the temperatures into a string instead of an array.

Whoops, just noticed it should be rand(21), not rand(20).

96 -> 95. Removed unnecessary whitespace.

ContentLicense: CC BY-SA 2.5

Title: Forecast the weather

Body:
Ruby 1.8, 95 characters

#!ruby -nrdate
7.times{|i|puts (Date.parse($_)+i).strftime"%A #{"\023\004\016\016\035"[$_[-3]%5]-9+rand(21)}"}

The character escapes inside the string should be replaced by the character literals they represent.

Found a shorter way to pack the data, Ruby 1.9 would be 4 characters longer now (add .ord after $_[-3]).

112 -> 105 by stealing Joey's idea of not splitting the input.

105 -> 101. Note that the first line is actually parsed by the Ruby interpreter itself, so it even works when running the solution like echo "Thursday Winter" | ruby1.8 forecast.rb

101 -> 96. Stole Joey's idea again to just embed the temperatures into a string instead of an array.

Whoops, just noticed it should be rand(21), not rand(20).

96 -> 95. Removed unnecessary whitespace.


答:
CJam, 9 bytes

```<code>q~_:++=2%
</code>```

Even is zero, odd is one.

Try it online!

Explanation

```<code>q~        e# Read input and evaluate
  _       e# Duplicate initial tuple
   :+     e# Sum initial values
     +    e# Append sum to initial tuple
      =   e# Take the n-th element (modular indexing)
       2% e# Modulo 2
</code>```

Title: Parity of Nth Term in Fibonacci Integer Sequences

Body:
If you look at the Fibonacci Numbers, you will notice a pattern in their parity: 0, 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55 , 89 , 144. Every third number is even, and all the others are odd. This makes sense because an even plus an odd is odd, but an odd plus an odd is even and the sum for a term will always include at least one even number unless the last two terms were odd, which happens every three terms.

In this challenge you will have to look at a generalization of this problem.

Specs

You will be given as input two positive integers describing the Fibonacci integer sequence you will have to look at.

For example, 0, 1 describes the original Fibonacci numbers, and 2, 1 would be the Lucas numbers. The sequence is calculated with the recurrence relation: x(n+2)=x(n+1)+x(n).

You will also take a positive integer n.

Your code has to output the parity of the nth term of the described Fibonacci integer sequence (0 indexed).

The output format can be any two sane, consistent outputs (e.g. 0 for even and 1 for odd).

Test Cases

```<code>(Fibonacci numbers) [0, 1], 4  ->  odd
(Lucas numbers) [2, 1], 9  ->  even
[14, 17], 24  ->  even
[3, 9], 15  ->  odd
[2, 4], 10  ->  even
</code>```

Body:
CJam, 9 bytes

q~_:++=2%

Even is zero, odd is one.

Try it online!

Explanation

q~        e# Read input and evaluate
  _       e# Duplicate initial tuple
   :+     e# Sum initial values
     +    e# Append sum to initial tuple
      =   e# Take the n-th element (modular indexing)
       2% e# Modulo 2


答:
C, 69 byteth

Reads from stdin, writes to stdout. Nothing terrific, but somebody had to do it!

```<code>c;main(){while((c=getchar())>0)printf(c-'s'?c-'S'?"%c":"Th":"th",c);}
</code>```

Title: Lithp Tranthlator

Body:
My friend made a lisp translator the other day, that is to say it took a string and converted s=>th and S=>Th. It was quite long and I thought that it could be golfed.

So the task is to make a program/function that takes an input string, translates it in to lisp and outputs the string

Test case

```<code>Sam and Sally like Sheep        Tham and Thally like Thheep
Sally likes sausages            Thally liketh thauthageth
Sally sells seashells           Thally thellth theathhellth
</code>```

Note that it doesn't matter that h gets repeated all the time

This is code golf so shortest answer wins

Body:
C, 69 byteth

Reads from stdin, writes to stdout. Nothing terrific, but somebody had to do it!

c;main(){while((c=getchar())>0)printf(c-'s'?c-'S'?"%c":"Th":"th",c);}


问:
Sing Happy Birthday to your favourite programming language
Your favourite programming language has just had a birthday. Be nice and sing it the Happy Birthday song.

Of course you should accomplish this by writing a program in that language.
The program takes no input, and writes the following text to the standard output or an arbitrary file:

```<code>Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear [your favourite programming language]
Happy Birthday to You
</code>```

You should substitute the bracketed part (and omit the brackets).

This is a code golf — shortest code wins.

UPDATE

I'm glad that the question aroused great interest. Let me add some extra info about scoring. As stated originally, this question is a code golf, so the shortest code is going to win. The winner will be picked at the end of this week (19th October).

However, I'm also rewarding other witty submissions with up-votes (and I encourage everybody to do so as well). Therefore although this is a code-golf contest, not-so-short answers are also welcome.

Results

Congratulations to Optimizer, the winner of this contest with his 42 byte long, CJam submission.

Leaderboard

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

  });

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

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

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

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
<h1>///, 48 bytes</h1>
```<code>/U/Happy Birthday //T/Uto You/T
T
UDear \/\/\/
T
</code>```

Body:
///, 48 bytes

/U/Happy Birthday //T/Uto You/T
T
UDear \/\/\/
T


答:
Emacth Lithp, 61 byteth

```<code>(lambda(s)(replace-regexp-in-string"[Ss]\\(\\w*\\)""th\\1"s))
</code>```

Emacs Lisp tries to be smart when replacing text, but that smartness breaks when the replaced string only takes up one space, i.e. the capital letter S. To prevent this from converting "Sam and Sally" to "THam and THally", the whole word is matched instead. However, this also handles "SAM and Sally" in the way that one would want, i.e. producing "THAM and Thally".

Title: Lithp Tranthlator

Body:
Emacth Lithp, 61 byteth

(lambda(s)(replace-regexp-in-string"[Ss]\\(\\w*\\)""th\\1"s))

Emacs Lisp tries to be smart when replacing text, but that smartness breaks when the replaced string only takes up one space, i.e. the capital letter S. To prevent this from converting "Sam and Sally" to "THam and THally", the whole word is matched instead. However, this also handles "SAM and Sally" in the way that one would want, i.e. producing "THAM and Thally".


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

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

The Rules

Each submission must be a full program.

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

The program must not write anything to STDERR.

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

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

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

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

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

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

For inspiration, check the Hello World Collection.

The Catalogue

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

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

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

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

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

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

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

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

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Golisp, 21 bytes

```<code>write@"Hello, World!"
</code>```

Equivalent to write["Hello, World!"], but shorter.

Title: "Hello, World!"

Body:
Golisp, 21 bytes

write@"Hello, World!"

Equivalent to write["Hello, World!"], but shorter.


答:
Golisp, <s>102</s> 100 bytes

EDIT: Removed 2 bytes by changing the last writeln to write

```<code>write@*["Happy Birthday to You\n"2]writeln@"Happy Birthday Dear Golisp"write@"Happy Birthday to You"
</code>```

Ungolfed & commented version:

```<code>write @ *["Happy Birthday to You\n" 2] # Call write with "Happy Birthday to You\n" repeated 2 times (f@x == f[x]) #
writeln @ "Happy Birthday Dear Golisp" # Write "Happy Birthday Dear Golisp" to stdout #
write @ "Happy Birthday to You" # Write "Happy Birthday to You" to stdout #
</code>```

Title: Sing Happy Birthday to your favourite programming language

Body:
Your favourite programming language has just had a birthday. Be nice and sing it the Happy Birthday song.

Of course you should accomplish this by writing a program in that language.
The program takes no input, and writes the following text to the standard output or an arbitrary file:

```<code>Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear [your favourite programming language]
Happy Birthday to You
</code>```

You should substitute the bracketed part (and omit the brackets).

This is a code golf — shortest code wins.

UPDATE

I'm glad that the question aroused great interest. Let me add some extra info about scoring. As stated originally, this question is a code golf, so the shortest code is going to win. The winner will be picked at the end of this week (19th October).

However, I'm also rewarding other witty submissions with up-votes (and I encourage everybody to do so as well). Therefore although this is a code-golf contest, not-so-short answers are also welcome.

Results

Congratulations to Optimizer, the winner of this contest with his 42 byte long, CJam submission.

Leaderboard

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

  });

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

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

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

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Golisp, <s>102</s> 100 bytes

EDIT: Removed 2 bytes by changing the last writeln to write

write@*["Happy Birthday to You\n"2]writeln@"Happy Birthday Dear Golisp"write@"Happy Birthday to You"

Ungolfed & commented version:

write @ *["Happy Birthday to You\n" 2] # Call write with "Happy Birthday to You\n" repeated 2 times (f@x == f[x]) #
writeln @ "Happy Birthday Dear Golisp" # Write "Happy Birthday Dear Golisp" to stdout #
write @ "Happy Birthday to You" # Write "Happy Birthday to You" to stdout #


问:
Weapons of Math Instruction
Last time when I tried to come up with something easy that wasn't a duplicate, it ended up being way too hard.. So hopefully this time it's indeed something newcomers can try as well.

Input:

An array/list with integers/decimals. (Or a string representing an array with integers/decimals.)

Output:

Loop through the numbers and apply the following five mathematical operands in this order:

Addition (+);

Subtraction (−);

Multiplication (* or × or ·);

Real / Calculator Division (/ or ÷);

Exponentiation (^ or **).

(NOTE: The symbols between parenthesis are just added as clarification. If your programming language uses a completely different symbol for the mathematical operation than the examples, then that is of course completely acceptable.)

Keep continuing until you've reached the end of the list, and then give the result of the sum.

Challenge rules:

Exponentiation by 0 (n ^ 0) should result in 1 (this also applies to 0 ^ 0 = 1).

There are no test cases for division by 0 (n / 0), so you don't have to worry about that edge-case.

If the array contains just a single number, we return that as the result.

General rules:

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

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

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

Default Loopholes are forbidden.

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

Test cases:

```<code>[1,2,3,4,5] -> 0
-> 1 + 2 = 3
  -> 3 - 3 = 0
    -> 0 * 4 = 0
      -> 0 / 5 = 0

[5,12,23,2,4,4,2,6,7] -> 539
-> 5 + 12 = 17
  -> 17 - 23 = -6
    -> -6 * 2 = -12
      -> -12 / 4 = -3
        -> -3 ^ 4 = 81
          -> 81 + 2 = 83
            -> 83 - 6 = 77
              -> 77 * 7 -> 539

[-8,50,3,3,-123,4,17,99,13] -> -1055.356...
-> -8 + 50 = 42
  -> 42 - 3 = 39
    -> 39 * 3 = 117
      -> 117 / -123 = -0.9512...
        -> -0.9512... ^ 4 = 0.818...
          -> 0.818... + 17 = 17.818...
            -> 17.818... - 99 -> -81.181...
              -> -81.181... * 13 = -1055.356...

[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2] -> 256
-> 2 + 2 = 4
  -> 4 - 2 = 2
    -> 2 * 2 = 4
      -> 4 / 2 = 2
        -> 2 ^ 2 = 4
          -> 4 + 2 = 6
            -> 6 - 2 = 4
              -> 4 * 2 = 8
                -> 8 / 2 = 4
                  -> 4 ^ 2 = 16
                    -> 16 + 2 = 18
                      -> 18 - 2 = 16
                        -> 16 * 2 = 32
                          -> 32 / 2 = 16
                            -> 16 ^ 2 = 256

[1,0,1,0,1,0] -> 1
-> 1 + 0 = 1
  -> 1 - 1 = 0
    -> 0 * 0 = 0
      -> 0 / 1 = 0
        -> 0 ^ 0 = 1

[-9,-8,-1] -> -16
  -> -9 + -8 = -17
    -> -17 - -1 = -16

[0,-3] -> -3
  -> 0 + -3 = -3

[-99] -> -99
</code>```

答:
Emacs Lisp, 127 bytes

```<code>(lambda(x)(let((f'(+ - * / expt))(a(float(car x)))(x(cdr x)))(dotimes(i(length x)a)(set'a(funcall(nth(mod i 5)f)a(nth i x))))))
</code>```

Ungolfed:

```<code>(lambda(x)
  (let ((f'(+ - * / expt))  ; list of functions in order they are called
        (a (float (car x))) ; initial value
        (x (cdr x)))        ;
    (dotimes (i (length x) a)
      (set 'a (funcall (nth (mod i 5) f) ; call the i % 5th function
                       a                 ; with accumulator
                       (nth i x))))))    ; and the ith value
</code>```

Testcases:

```<code>(-map
  (lambda(x)(let((f'(+ - * / expt))(a(float(car x)))(x(cdr x)))(dotimes(i(length x)a)(set'a(funcall(nth(mod i 5)f)a(nth i x))))))
  '((1 2 3 4 5)
    (5 12 23 2 4 4 2 6 7)
    (-8 50 3 3 -123 4 17 99 13)
    (2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2)
    (1 0 1 0 1 0)
    (-9 -8 -1)
    (0 -3)
    (-99)))
</code>```

Output:

```<code>(0.0 539.0 -1055.356943846277 256.0 1.0 -16.0 -3.0 -99.0)
</code>```

Title: Weapons of Math Instruction

Body:
Emacs Lisp, 127 bytes

(lambda(x)(let((f'(+ - * / expt))(a(float(car x)))(x(cdr x)))(dotimes(i(length x)a)(set'a(funcall(nth(mod i 5)f)a(nth i x))))))

Ungolfed:

(lambda(x)
  (let ((f'(+ - * / expt))  ; list of functions in order they are called
        (a (float (car x))) ; initial value
        (x (cdr x)))        ;
    (dotimes (i (length x) a)
      (set 'a (funcall (nth (mod i 5) f) ; call the i % 5th function
                       a                 ; with accumulator
                       (nth i x))))))    ; and the ith value

Testcases:

(-map
  (lambda(x)(let((f'(+ - * / expt))(a(float(car x)))(x(cdr x)))(dotimes(i(length x)a)(set'a(funcall(nth(mod i 5)f)a(nth i x))))))
  '((1 2 3 4 5)
    (5 12 23 2 4 4 2 6 7)
    (-8 50 3 3 -123 4 17 99 13)
    (2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2)
    (1 0 1 0 1 0)
    (-9 -8 -1)
    (0 -3)
    (-99)))

Output:

(0.0 539.0 -1055.356943846277 256.0 1.0 -16.0 -3.0 -99.0)


答:
Haskell, <s>157</s> 131 bytes

```<code>k="bcdfghjklmnpqrstvwxz";f c((r:q),s)=if c`elem`k then(q,r:s)else(r:q,c:s);f c("",s)=("",c:s);g s=snd$foldr f(filter(`elem`k)s,"")s
</code>```

Update

@atlasologist's solution made me realize I only need a list of the consonants instead of pairs (no need to reverse them though since I'm using right fold.)

Ungolfed

```<code>consonants = "bcdfghjklmnpqrstvwxz"

-- Combining function (right fold, improved)
f :: Char -> (String, String) -> (String, String)
f c ((r:rest), s) = if c `elem` consonants then (rest, r:s) else (r:rest, c:s)
f c ("", s) = ("", c:s)

transform :: String -> String
transform s = snd $ foldr f (filter (`elem` consonants) s, "") s

main = do
    line <- getLine
    putStrLn . transform $ line
</code>```

Old

```<code>c="bcdfghjklmnpqrstvwxz";n c(a@((f,t):q),s)=if c==f then(q,t:s)else(a,c:s);n c([],s)=([],c:s);g s=let z=filter(`elem`c)s in snd$foldr n(zip (reverse z)z,"")s
</code>```

Creates a list of pairs of consonants, then walks through the string replacing each consonant using said list.

A bit primitive, but I wanted to figure this out without looking at the answers first. :)

Title: Reverse the consonants

Body:
The program should take a string as input and reverse the consonants in it, while keeping the order of vowels. All the letters will be lowercase, so you don't have to worry about casing. Examples follow.

Input: a test case.

The consonants here are t,s,t,c,s. They should come in reversed order, i.e. s,c,t,s,t and inserted back into the string to the same positions where the pre-reversed characters were located: a sect sate.

Input: well-done. Output: nedl-lowe.

Input: reverse the consonants. Output: setenne sne cohtosarvr.

This is the code golf, the shortest solution wins.

Y should be considered vowel regardless of what it is and not reversed.

Anything, as well as numbers, punctuation, quotes, and other symbols (@#$%^&*(){}[]\|/<>~-_+=`), could potentially appear in the input.

Body:
Haskell, <s>157</s> 131 bytes

k="bcdfghjklmnpqrstvwxz";f c((r:q),s)=if c`elem`k then(q,r:s)else(r:q,c:s);f c("",s)=("",c:s);g s=snd$foldr f(filter(`elem`k)s,"")s

Update

@atlasologist's solution made me realize I only need a list of the consonants instead of pairs (no need to reverse them though since I'm using right fold.)

Ungolfed

consonants = "bcdfghjklmnpqrstvwxz"

-- Combining function (right fold, improved)
f :: Char -> (String, String) -> (String, String)
f c ((r:rest), s) = if c `elem` consonants then (rest, r:s) else (r:rest, c:s)
f c ("", s) = ("", c:s)

transform :: String -> String
transform s = snd $ foldr f (filter (`elem` consonants) s, "") s

main = do
    line <- getLine
    putStrLn . transform $ line

Old

c="bcdfghjklmnpqrstvwxz";n c(a@((f,t):q),s)=if c==f then(q,t:s)else(a,c:s);n c([],s)=([],c:s);g s=let z=filter(`elem`c)s in snd$foldr n(zip (reverse z)z,"")s

Creates a list of pairs of consonants, then walks through the string replacing each consonant using said list.

A bit primitive, but I wanted to figure this out without looking at the answers first. :)


Title: Lithp Tranthlator

Body:
Brainfuck, 235 byteth

(Newlines included only for readability)

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

Requires 8-bit cells, and 0 on EOF. <a href="http://brainfuck.tryitonline.net/#code=LFtbPis-Kz4rPDw8LV0-Pj4-LVs-KzwtLS1dPi0tWy08PC0-Pl0rPDxbPj4tPDxbLV1dPj5bPi1bLS0tPis8XT4tLlstLS0tPisrKysrPF0-LS48PDwtXT4-Pj5bLV08Wz4rPFstXV0rPls8LT4tXTxbPDw8PDwtWz4rKzwrKysrKysrKytdPitbLTw8LT4-XSs8PFs-Pi08PFstXV0-Pls-LS0tLS0tLS1bLS0-KysrPF0-Li0tLS0tLS0tLS0tLS4-XTw-Wy1dPFs-KzxbLV1dKz5bPC0-LV08Wzw8Lj5dXT4-Pj4-Pj4sXQ&input=WW91IHNlZSwgeW91bmcgc2FsbHksIHRoYXQgbm90IGFsbCBsYW5nYXVnZXMgYXJlIG1hZGUgZXF1YWwuIFNvbWUgYXJlIHN0dXBpZCwgc29tZSBhcmUgYmVhdXRpZnVsLiBTdGlsbCwgeW91IHNob3VsZCBrbm93IHRoYXQgeW91IGRvbid0IHdhbnQgdG8gbWVzcyBhcm91bmQgd2l0aCBicmFpbmZ1Y2suIE5vIHNpcmVlLg" rel="nofollow">Try it online! I thought I could golf tt using some "if = s OR = S" wizardry, but it turns out that this just confounds the system.

Readable

,
[
 [>+>+>+<<<-]>>>
 >-[>+<---]>--
 [-<<->>]+<<[>>-<<[-]]>>
 [ if char = "S"
  >-[--->+<]>-.[---->+++++<]>-.<<<-  output Th
 ]
 >>>

 >[-]
 <[>+<[-]]+
 >[<->-]<    logical negation

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

   [ if char = "s"
    >--------[-->+++<]>.------------.>  output th
   ]

  <

  >[-]
  <[>+<[-]]+
  >[<->-]<    logical negation

  [<<.>] otherwise output and move to zero cell
 ]
 >>>>>>> we're going to move over some so we can use new cells
 , take more input
]


Title: Lithp Tranthlator

Body:
J, 47 bytes

Without using the strings library.

[:;(]`('h',~[:u:1+3&u:)@.([:+/'sS'-:"0]))&.>@;/