问:
Take a ride on the Reading, If you pass Go, collect $200

Monopoly Board

For this code-golf challenge we will be building the board game Monopoly.

Rules:

Take no input.

Output a 11x11 board where each ASCII character forming the board is the first letter of each space of the U.S. version of the Monopoly board.

The characters must be separated by spaces.

Go should start in the bottom right.

The exact string to produce is

```<code>F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G
</code>```

Note that from bottom right to bottom left the squares are as follows:

```<code>G --> Go
M --> Mediterranean Avenue
C --> Community Chest
B --> Baltic Avenue
I --> Income Tax
...
J --> Jail
</code>```

Edit
Wow! you guys sure liked this one! :)

答:
Retina, 74 bytes

```<code>
FKCIIBAVWMGN_PT_NC_CS_PP_SV_CS_PE_LS_BJCVCORIBCMG
S_`(._.)
_
9$*
\B

1

</code>```

The third to last and last lines should contain a single space.

Try it online!

Explanation

```<code>
FKCIIBAVWMGN_PT_NC_CS_PP_SV_CS_PE_LS_BJCVCORIBCMG
</code>```

This replaces the (empty) input with the string on the second line.

```<code>S_`(._.)
</code>```

This is split stage, which splits the string around matches of the regex (._.) (that is, any three characters with a _ in the middle). The reason we put the whole regex in a group is that split stages also return the results of capturing groups. E.g. splitting abcd around bc gives [a, d], but splitting it around b(c) gives [a, c, d]. This way we get all the ._. parts on separate lines but also the 11-character parts at the beginning and end. We use the _ option to omit empty results between the individual ._. matches. The result would be this:

```<code>FKCIIBAVWMG
N_P
T_N
C_C
S_P
P_S
V_C
S_P
E_L
S_B
JCVCORIBCMG
</code>```

Next we process the underscores:

```<code>_
9$*
</code>```

This replaces each underscore with nine 1s. The reason we use 1s here instead of spaces immediately is that it makes it easier to insert the padding spaces next.

```<code>\B

</code>```

Remember that there's a space on the second line. This inserts a space in every position that isn't a word boundary, i.e. everywhere except at the beginning and end of the lines.

```<code>1

</code>```

And finally, we replace all those 1s with spaces as well.

Body:
Retina, 74 bytes

FKCIIBAVWMGN_PT_NC_CS_PP_SV_CS_PE_LS_BJCVCORIBCMG
S_`(._.)
_
9$*
\B

1

The third to last and last lines should contain a single space.

Try it online!

Explanation

FKCIIBAVWMGN_PT_NC_CS_PP_SV_CS_PE_LS_BJCVCORIBCMG

This replaces the (empty) input with the string on the second line.

S_`(._.)

This is split stage, which splits the string around matches of the regex (._.) (that is, any three characters with a _ in the middle). The reason we put the whole regex in a group is that split stages also return the results of capturing groups. E.g. splitting abcd around bc gives [a, d], but splitting it around b(c) gives [a, c, d]. This way we get all the ._. parts on separate lines but also the 11-character parts at the beginning and end. We use the _ option to omit empty results between the individual ._. matches. The result would be this:

FKCIIBAVWMG
N_P
T_N
C_C
S_P
P_S
V_C
S_P
E_L
S_B
JCVCORIBCMG

Next we process the underscores:

_
9$*

This replaces each underscore with nine 1s. The reason we use 1s here instead of spaces immediately is that it makes it easier to insert the padding spaces next.

\B

Remember that there's a space on the second line. This inserts a space in every position that isn't a word boundary, i.e. everywhere except at the beginning and end of the lines.

1

And finally, we replace all those 1s with spaces as well.


问:
Nest a string inside an array n times
You must produce a function which nests a string s inside an array, n times

```<code>>>> N("stackoverflow",2)
[['stackoverflow']]
</code>```

Parameters:

s - An ascii string

n - An integer >= 0

Rules

Shortest code wins.

The output will be a nested array, list or tuple (or similar type based off an array)

Test Cases

```<code>>>> N("stackoverflow",0)
'stackoverflow'
>>> N("stackoverflow",1)
['stackoverflow']
>>> N("stackoverflow",5)
[[[[['stackoverflow']]]]]
</code>```

Inspired by: Nesting a string inside a list n times ie list of a list of a list

ContentLicense: CC BY-SA 3.0

Title: Nest a string inside an array n times

Body:
Julia 77 bytes

U(n)=Val{n}
g(::U(1),s)=[s]
g{n}(::U(n),s)=[g(U(n-1)(),s)]
f(n,s)=g(U(n)(),s


问:
N(e(s(t))) a string
To "function nest" a string, you must:

Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was Hello, then the first step would be:

```<code>H(ello)
</code>```

Then, repeat this same step for every substring. So we get:

```<code>H(ello)
H(e(llo))
H(e(l(lo)))
H(e(l(l(o))))
</code>```

Your task is to write a program or function that "function nests" a string. For example, if the input string was Hello world!, then you should output:

```<code>H(e(l(l(o( (w(o(r(l(d(!)))))))))))
</code>```

The input will only ever contain printable ASCII, and you may take the input and the output in any reasonable format. For example, STDIN/STDOUT, function arguments and return value, reading and writing to a file, etc.

For simplicity's sake, you may also assume the input will not contain parentheses, and will not be empty.

```<code>Input:
Nest a string
Output:
N(e(s(t( (a( (s(t(r(i(n(g))))))))))))

Input:
foobar
Output:
f(o(o(b(a(r)))))

Input:
1234567890
Output:
1(2(3(4(5(6(7(8(9(0)))))))))

Input:
code-golf
Output:
c(o(d(e(-(g(o(l(f))))))))

Input:
a
Output:
a

Input:
42
Output:
4(2)
</code>```

As usual, all of our default rules and loopholes apply, and the shortest answer scored in bytes wins!

答:
PHP, <s>51</s> <s>60</s> <s>68</s> 63 bytes

Why not just do what´s asked for instead of emulating it? Recurse!

```<code>function n($s){return$s[1]>""?"$s[0](".n(substr($s,1)).")":$s;}
</code>```

Title: N(e(s(t))) a string

Body:
PHP, <s>51</s> <s>60</s> <s>68</s> 63 bytes

Why not just do what´s asked for instead of emulating it? Recurse!

function n($s){return$s[1]>""?"$s[0](".n(substr($s,1)).")":$s;}


Title: Take a ride on the Reading, If you pass Go, collect $200

Body:
Monopoly Board

For this code-golf challenge we will be building the board game Monopoly.

Rules:

Take no input.

Output a 11x11 board where each ASCII character forming the board is the first letter of each space of the U.S. version of the Monopoly board.

The characters must be separated by spaces.

Go should start in the bottom right.

The exact string to produce is

```<code>F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G
</code>```

Note that from bottom right to bottom left the squares are as follows:

```<code>G --> Go
M --> Mediterranean Avenue
C --> Community Chest
B --> Baltic Avenue
I --> Income Tax
...
J --> Jail
</code>```

Edit
Wow! you guys sure liked this one! :)

Body:
05AB1E, <s>48</s> 47 bytes

Thanks to Emigna for saving a byte!

•(K·;“…¬È¦z"9äuŸé;TÞîÕs‡ÓÐV9XÒt\<•33B¾9ð×:S11ô»

Explanation:

First some compression. •(K·;“…¬È¦z"9äuŸé;TÞîÕs‡ÓÐV9XÒt\<• is a compressed version of the following number:

120860198958186421497710412212513392855208073968557051584380118734764403017

After that, this is converted to base 33, which results into the following string:

FKCIIBAVWMGN0PT0NC0CS0PP0SV0CS0PE0LS0BJCVCORIBCMG

The zeroes are replaced by 9 spaces, using the following code ¾9ð×:. After that, we Split the string into characters and slice them into pieces of 11 elements (done with 11ô). We get the following 2-dimensional array:

[['F', 'K', 'C', 'I', 'I', 'B', 'A', 'V', 'W', 'M', 'G'],
 ['N', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'P'],
 ['T', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'N'],
 ['C', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'C'],
 ['S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'P'],
 ['P', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'S'],
 ['V', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'C'],
 ['S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'P'],
 ['E', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'L'],
 ['S', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B'],
 ['J', 'C', 'V', 'C', 'O', 'R', 'I', 'B', 'C', 'M', 'G']]

We gridify this array with » and output it implicitly.

Uses the CP-1252 encoding. Try it online!


答:
Brachylog, <s>35</s> <s>28</s> 25 bytes

```<code>l-L,")":LjkC,?:"("zckc:Cc
</code>```

Try it online!

Explanation

```<code>l-L,          # L is length of input - 1
")":LjkC,     # C is ")" repeated L-1 times
              # output is
?:"("z        # input zipped with "("
      ckc     # flattened to a string with the last element removed
         :Cc  # concatenated with C
</code>```

Title: N(e(s(t))) a string

Body:
To "function nest" a string, you must:

Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was Hello, then the first step would be:

```<code>H(ello)
</code>```

Then, repeat this same step for every substring. So we get:

```<code>H(ello)
H(e(llo))
H(e(l(lo)))
H(e(l(l(o))))
</code>```

Your task is to write a program or function that "function nests" a string. For example, if the input string was Hello world!, then you should output:

```<code>H(e(l(l(o( (w(o(r(l(d(!)))))))))))
</code>```

The input will only ever contain printable ASCII, and you may take the input and the output in any reasonable format. For example, STDIN/STDOUT, function arguments and return value, reading and writing to a file, etc.

For simplicity's sake, you may also assume the input will not contain parentheses, and will not be empty.

```<code>Input:
Nest a string
Output:
N(e(s(t( (a( (s(t(r(i(n(g))))))))))))

Input:
foobar
Output:
f(o(o(b(a(r)))))

Input:
1234567890
Output:
1(2(3(4(5(6(7(8(9(0)))))))))

Input:
code-golf
Output:
c(o(d(e(-(g(o(l(f))))))))

Input:
a
Output:
a

Input:
42
Output:
4(2)
</code>```

As usual, all of our default rules and loopholes apply, and the shortest answer scored in bytes wins!

Body:
Brachylog, <s>35</s> <s>28</s> 25 bytes

l-L,")":LjkC,?:"("zckc:Cc

Try it online!

Explanation

l-L,          # L is length of input - 1
")":LjkC,     # C is ")" repeated L-1 times
              # output is
?:"("z        # input zipped with "("
      ckc     # flattened to a string with the last element removed
         :Cc  # concatenated with C


问:
Make an ASCII bat fly around an ASCII moon
Background

Here is a Halloween related challenge.

As you may have seen from my last challenge I quite like what I term as ascii art animations, that is not just draw a pattern but draw a pattern that progresses. This idea came to me after I was asked a couple of years ago to liven up a (rather dull) presentation by making random ascii bats fly across the screen on Halloween. Needless to say I duly obliged (I was being paid for it) but it made me think that there is more to life than random bats. Inspired by this I would like to propose this challenge.

Challenge

Make a bat fly around the moon.

Here is a bat:

```<code>^o^
</code>```

Here is the moon:

```<code>     mmm
   mmmmmmm
  mmmmmmmmm
   mmmmmmm
     mmm
</code>```

You must show every stage of the bats flight (see output).

Input

None

Output

```<code>      ^o^
      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

      mmm^o^
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

      mmm
    mmmmmmm^o^
   mmmmmmmmm
    mmmmmmm
      mmm

      mmm
    mmmmmmm
   mmmmmmmmm^o^
    mmmmmmm
      mmm

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm^o^
      mmm

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm^o^

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm
      ^o^

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
   ^o^mmm

      mmm
    mmmmmmm
   mmmmmmmmm
 ^o^mmmmmmm
      mmm

      mmm
    mmmmmmm
^o^mmmmmmmmm
    mmmmmmm
      mmm

      mmm
 ^o^mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

   ^o^mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

      ^o^
      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm
</code>```

Rules

No reading from external files or websites

You may submit a full program or a function

Extra spaces and/or newlines are fine by me

Standard loopholes banned as usual

The bat must finish back at the top of the moon

Please feel free to clear the screen between frames if you wish however this is not a requirement. Output as shown above is fine

As this is code golf, the winner will be the answer with the lowest byte count although any answer is welcome

Sample

Reference implementation in totally ungolfed Python 2 (620 bytes but just to prove that it can be done. May golf it later).

```<code>b='^o^'
m=['                     ',
'         mmm         ',
'       mmmmmmm       ',
'      mmmmmmmmm      ',
'       mmmmmmm       ',
'         mmm         ',
'                     ']
p=[(9,12),(12,15),(14,17),(15,18),(14,17),(12,15),(9,12),(6,9),(4,7),(3,6),(4,7),(6,9),(9,12)]
d=0
for z in range(7):
    x=map(str,m[z])
    c="".join(x[:p[z][0]]) + b + "".join(x[p[z][1]:])+"\n"
    print "\n".join(m[:z]) + "\n" + c+"\n".join(m[z+1:])
for z in range(6)[::-1]:
    x=map(str,m[z])
    c="".join(x[:p[z+6][0]]) + b + "".join(x[p[z+6][1]:])+"\n"
    print "\n".join(m[:z]) + "\n" + c+"\n".join(m[z+1:])
</code>```

Result

Although @Jonathan obviously wins on byte count with Jelly, I am going to mark the Brainfuck answer from @Oyarsa as the accepted answer purely because I think that anyone who can actually do something like this in such a crazy language deserves +15 rep no matter how many bytes it takes. This is not because I have any problem with golfing languages. See my answer to a question regarding this on meta if you have any doubts. Many thanks and respect to all who contributed in whatever language.

答:
PHP, 167 bytes

I made a small program in PHP:

```<code><?php foreach([0,3,7,9,7,3,0]as$l)$b.=str_pad(str_repeat('=',$l),15," ",2)."\n";foreach([6,25,43,60,75,89,102,83,65,48,33,19,6]as$x)echo substr_replace($b,'^o^',$x,3);
</code>```

Here is a more verbose version:

```<code>// width of the moon
$moonsizes = [0,3,7,9,7,3,0];
// position where to place the bat
$positions = [6,25,43,60,75,89,102,83,65,48,33,19,6];
// prepare base moon painting
foreach($moonsizes as $size){
    $basepainting .= str_pad(str_repeat('=',$size),15," ",STR_PAD_BOTH)."\n";
}
// loop frames and place bat
foreach($positions as $position) {
    echo substr_replace($basepainting,'^o^',$position,3);
}
</code>```

This is my first codegolf, if you have any suggestion i'm happy to hear :)

Body:
PHP, 167 bytes

I made a small program in PHP:

<?php foreach([0,3,7,9,7,3,0]as$l)$b.=str_pad(str_repeat('=',$l),15," ",2)."\n";foreach([6,25,43,60,75,89,102,83,65,48,33,19,6]as$x)echo substr_replace($b,'^o^',$x,3);

Here is a more verbose version:

// width of the moon
$moonsizes = [0,3,7,9,7,3,0];
// position where to place the bat
$positions = [6,25,43,60,75,89,102,83,65,48,33,19,6];
// prepare base moon painting
foreach($moonsizes as $size){
    $basepainting .= str_pad(str_repeat('=',$size),15," ",STR_PAD_BOTH)."\n";
}
// loop frames and place bat
foreach($positions as $position) {
    echo substr_replace($basepainting,'^o^',$position,3);
}

This is my first codegolf, if you have any suggestion i'm happy to hear :)


答:
PowerShell v2+, <s>131</s> <s>123</s> <s>114</s> <s>110</s> 99 bytes

```<code>'F K C I I B A V W M G
N0P
T0N
C0C
S0P
P0S
V0C
S0P
E0L
S0B
J C V C O R I B C M G'-replace0,(" "*19)
</code>```

This is just a literal string with newlines placed on the pipeline, with a little -replace at the end to turn the 0 into 19 spaces. The first and last lines are just verbatim. With only 10 spaces and little repetition otherwise, there wasn't enough room to golf them. This string is left on the pipeline, and output via implicit Write-Output happens at program completion.

```<code>PS C:\Tools\Scripts\golfing> .\take-a-ride-on-reading.ps1
F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G
</code>```

Body:
PowerShell v2+, <s>131</s> <s>123</s> <s>114</s> <s>110</s> 99 bytes

'F K C I I B A V W M G
N0P
T0N
C0C
S0P
P0S
V0C
S0P
E0L
S0B
J C V C O R I B C M G'-replace0,(" "*19)

This is just a literal string with newlines placed on the pipeline, with a little -replace at the end to turn the 0 into 19 spaces. The first and last lines are just verbatim. With only 10 spaces and little repetition otherwise, there wasn't enough room to golf them. This string is left on the pipeline, and output via implicit Write-Output happens at program completion.

PS C:\Tools\Scripts\golfing> .\take-a-ride-on-reading.ps1
F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G


答:
///, <s>100</s> 98 bytes

```<code>/s/    //p/ssss   //q/pC
SpP
//!/ C /F K!I I B A V W M G
NpP
TpN
CqPpS
VqEpL
SpB
J!V!O R I B!M G
</code>```

Try it online!

For some mysterious reason, there seem to be trailing spaces after the Gs. Without them, my code would have been 96 bytes.

Thanks to 42545 (ETHproductions) and 56258 (daHugLenny) for reducing 1 byte each!

Body:
///, <s>100</s> 98 bytes

/s/    //p/ssss   //q/pC
SpP
//!/ C /F K!I I B A V W M G
NpP
TpN
CqPpS
VqEpL
SpB
J!V!O R I B!M G

Try it online!

For some mysterious reason, there seem to be trailing spaces after the Gs. Without them, my code would have been 96 bytes.

Thanks to 42545 (ETHproductions) and 56258 (daHugLenny) for reducing 1 byte each!


答:
Javascript ES6 REPL, <s>105</s> <s>102</s> 101 bytes

Not much interesting happening here.
Paste in the console to see the desired results

Saved 3 bytes thanks to @Arnauld

Saved 1 more byte thanks to @Neil

```<code>`FKCIIBAVWMG
N P
T N
C C
S P
P S
V C
S P
E L
S B
JCVCORIBCMG`.replace(/.( ?)/g,`$& `+`$1`.repeat(17))
</code>```

a.innerHTML =

`FKCIIBAVWMG
N P
T N
C C
S P
P S
V C
S P
E L
S B
JCVCORIBCMG`.replace(/.( ?)/g,`$& `+`$1`.repeat(17))```
<pre class="snippet-code-html lang-html prettyprint-override"><code><pre id=a></code>```

Body:
Javascript ES6 REPL, <s>105</s> <s>102</s> 101 bytes

Not much interesting happening here.
Paste in the console to see the desired results

Saved 3 bytes thanks to @Arnauld

Saved 1 more byte thanks to @Neil

`FKCIIBAVWMG
N P
T N
C C
S P
P S
V C
S P
E L
S B
JCVCORIBCMG`.replace(/.( ?)/g,`$& `+`$1`.repeat(17))

a.innerHTML =

`FKCIIBAVWMG
N P
T N
C C
S P
P S
V C
S P
E L
S B
JCVCORIBCMG`.replace(/.( ?)/g,`$& `+`$1`.repeat(17))

<pre id=a>


答:
Groovy, <s>38</s> 36 Bytes thanks to @manatwork

```<code>{it.reverse().inject{r,i->i+"($r)"}}
</code>```

Yeah, the C&P messed up the first time.

Title: N(e(s(t))) a string

Body:
Groovy, <s>38</s> 36 Bytes thanks to @manatwork

{it.reverse().inject{r,i->i+"($r)"}}

Yeah, the C&P messed up the first time.


答:
Java 7, <s>177</s> <s>165</s> <s>142</s> 131 bytes

```<code>String c(){return"FKCIIBAVWMG\nN_P\nT_N\nC_C\nS_P\nP_S\nV_C\nS_P\nE_L\nS_B\nJCVCORIBCGM".replace("_","         ").replace(""," ");}
</code>```

-15 bytes thanks to @BassdropCumberwubwubwub.

-11 bytes thanks to @Numberknot.

Ungolfed & test code:

Try it here.

```<code>class M{
  static String c(){
    return "FKCIIBAVWMG\nN_P\nT_N\nC_C\nS_P\nP_S\nV_C\nS_P\nE_L\nS_B\nJCVCORIBCGM"
      .replace("_","         ").replace(""," ");
  }

  public static void main(String[] a){
    System.out.print(c());
  }
}
</code>```

Output:

```<code>F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G
</code>```

Body:
Java 7, <s>177</s> <s>165</s> <s>142</s> 131 bytes

String c(){return"FKCIIBAVWMG\nN_P\nT_N\nC_C\nS_P\nP_S\nV_C\nS_P\nE_L\nS_B\nJCVCORIBCGM".replace("_","         ").replace(""," ");}

-15 bytes thanks to @BassdropCumberwubwubwub.

-11 bytes thanks to @Numberknot.

Ungolfed & test code:

Try it here.

class M{
  static String c(){
    return "FKCIIBAVWMG\nN_P\nT_N\nC_C\nS_P\nP_S\nV_C\nS_P\nE_L\nS_B\nJCVCORIBCGM"
      .replace("_","         ").replace(""," ");
  }

  public static void main(String[] a){
    System.out.print(c());
  }
}

Output:

F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G


答:
R, 149 146 bytes

Not so impressive but also not sure how this would be golfed. Exploiting paste somehow is my first guess. Compare to raw text of 241 bytes.

```<code>x=strsplit("NTCSPVSESPNCPSCPLB","")[[1]];cat("F K C I I B A V W M G\n");for(i in 1:9)cat(x[i],rep("",18),x[i+9],"\n");cat("J C V C O R I B C M G")
</code>```

R-fiddle

Body:
R, 149 146 bytes

Not so impressive but also not sure how this would be golfed. Exploiting paste somehow is my first guess. Compare to raw text of 241 bytes.

x=strsplit("NTCSPVSESPNCPSCPLB","")[[1]];cat("F K C I I B A V W M G\n");for(i in 1:9)cat(x[i],rep("",18),x[i+9],"\n");cat("J C V C O R I B C M G")

R-fiddle


答:
Perl, 90 bytes

Pretty boring approach, can't think of a better way to reduce... Requires -E at no extra cost. Outputs an additional space at the end of every line. -2 bytes thanks to @Dada!

say"FKCIIBAVWMG
NZP
TZN
CZC
SZP
PZS
VZC
SZP
EZL
SZB
JCVCORIBCMG"=~s/Z/$"x9/ger=~s/./$& /gr
```

<h3>Usage</h3>

<pre class="lang-sh prettyprint-override"><code>perl -E 'say"FKCIIBAVWMG
NZP
TZN
CZC
SZP
PZS
VZC
SZP
EZL
SZB
JCVCORIBCMG"=~s/Z/$"x9/ger=~s/./$& /gr'
</code>```

Body:
Perl, 90 bytes

Pretty boring approach, can't think of a better way to reduce... Requires -E at no extra cost. Outputs an additional space at the end of every line. -2 bytes thanks to @Dada!

say"FKCIIBAVWMG
NZP
TZN
CZC
SZP
PZS
VZC
SZP
EZL
SZB
JCVCORIBCMG"=~s/Z/$"x9/ger=~s/./$& /gr

Usage

perl -E 'say"FKCIIBAVWMG
NZP
TZN
CZC
SZP
PZS
VZC
SZP
EZL
SZB
JCVCORIBCMG"=~s/Z/$"x9/ger=~s/./$& /gr'


答:
///, 205 bytes

```<code>/*/\/\///B/^o^*9/
*M/mmm*N/MM*O/   *0/OO*n/

*1/O Nm0
*2/NM0
*3/0M9*4/1O2*7/13n*5/34/0B9570MB0
473O NmBO
O2731ONMBO
75O NmBO
3n510MB0n
5130B9n51OBM9n5 BNm0
3n31B273 BNm0
O27OBM9470B90M0O
410MO
</code>```

Try it online!

Only if I didn't need tons of trailing spaces...

Title: Make an ASCII bat fly around an ASCII moon

Body:
Background

Here is a Halloween related challenge.

As you may have seen from my last challenge I quite like what I term as ascii art animations, that is not just draw a pattern but draw a pattern that progresses. This idea came to me after I was asked a couple of years ago to liven up a (rather dull) presentation by making random ascii bats fly across the screen on Halloween. Needless to say I duly obliged (I was being paid for it) but it made me think that there is more to life than random bats. Inspired by this I would like to propose this challenge.

Challenge

Make a bat fly around the moon.

Here is a bat:

```<code>^o^
</code>```

Here is the moon:

```<code>     mmm
   mmmmmmm
  mmmmmmmmm
   mmmmmmm
     mmm
</code>```

You must show every stage of the bats flight (see output).

Input

None

Output

```<code>      ^o^
      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

      mmm^o^
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

      mmm
    mmmmmmm^o^
   mmmmmmmmm
    mmmmmmm
      mmm

      mmm
    mmmmmmm
   mmmmmmmmm^o^
    mmmmmmm
      mmm

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm^o^
      mmm

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm^o^

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm
      ^o^

      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
   ^o^mmm

      mmm
    mmmmmmm
   mmmmmmmmm
 ^o^mmmmmmm
      mmm

      mmm
    mmmmmmm
^o^mmmmmmmmm
    mmmmmmm
      mmm

      mmm
 ^o^mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

   ^o^mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm

      ^o^
      mmm
    mmmmmmm
   mmmmmmmmm
    mmmmmmm
      mmm
</code>```

Rules

No reading from external files or websites

You may submit a full program or a function

Extra spaces and/or newlines are fine by me

Standard loopholes banned as usual

The bat must finish back at the top of the moon

Please feel free to clear the screen between frames if you wish however this is not a requirement. Output as shown above is fine

As this is code golf, the winner will be the answer with the lowest byte count although any answer is welcome

Sample

Reference implementation in totally ungolfed Python 2 (620 bytes but just to prove that it can be done. May golf it later).

```<code>b='^o^'
m=['                     ',
'         mmm         ',
'       mmmmmmm       ',
'      mmmmmmmmm      ',
'       mmmmmmm       ',
'         mmm         ',
'                     ']
p=[(9,12),(12,15),(14,17),(15,18),(14,17),(12,15),(9,12),(6,9),(4,7),(3,6),(4,7),(6,9),(9,12)]
d=0
for z in range(7):
    x=map(str,m[z])
    c="".join(x[:p[z][0]]) + b + "".join(x[p[z][1]:])+"\n"
    print "\n".join(m[:z]) + "\n" + c+"\n".join(m[z+1:])
for z in range(6)[::-1]:
    x=map(str,m[z])
    c="".join(x[:p[z+6][0]]) + b + "".join(x[p[z+6][1]:])+"\n"
    print "\n".join(m[:z]) + "\n" + c+"\n".join(m[z+1:])
</code>```

Result

Although @Jonathan obviously wins on byte count with Jelly, I am going to mark the Brainfuck answer from @Oyarsa as the accepted answer purely because I think that anyone who can actually do something like this in such a crazy language deserves +15 rep no matter how many bytes it takes. This is not because I have any problem with golfing languages. See my answer to a question regarding this on meta if you have any doubts. Many thanks and respect to all who contributed in whatever language.

Body:
///, 205 bytes

/*/\/\///B/^o^*9/
*M/mmm*N/MM*O/   *0/OO*n/

*1/O Nm0
*2/NM0
*3/0M9*4/1O2*7/13n*5/34/0B9570MB0
473O NmBO
O2731ONMBO
75O NmBO
3n510MB0n
5130B9n51OBM9n5 BNm0
3n31B273 BNm0
O27OBM9470B90M0O
410MO

Try it online!

Only if I didn't need tons of trailing spaces...


答:
Python 2, 116 Bytes

Pretty straightforward, for whatever reason even though string replacing is so verbose it was the best thing I could come up with. Possibly using re might be shorter.

print' '.join('FKCIIBAVWMG!N@P!T@N!C@C!S@P!P@S!V@C!S@P!E@L!S@B!JCVCORIBCMG').replace(' ! ','\n').replace('@',' '*17)
```


答:
Scala, 46 bytes

```<code>(s:String)=>(s.init:\(""+s.last))(_+"("+_+")")
</code>```

Explanation:

```<code>(s:String)=>    //define a function
  (s.init       //take everything but the last char
   :\           //foldRight
   (""+s.last)    //with the last char as a string as a start
  )(              //combine the chars right to left with this function:
    _+"("+_+")"   //take the char, append "(", append everything we've got so far, append ")"
  )
</code>```

Title: N(e(s(t))) a string

Body:
Scala, 46 bytes

(s:String)=>(s.init:\(""+s.last))(_+"("+_+")")

Explanation:

(s:String)=>    //define a function
  (s.init       //take everything but the last char
   :\           //foldRight
   (""+s.last)    //with the last char as a string as a start
  )(              //combine the chars right to left with this function:
    _+"("+_+")"   //take the char, append "(", append everything we've got so far, append ")"
  )


问:
Find the Centroid of a Polygon
From Wikipedia:

The centroid of a non-self-intersecting closed polygon
  defined by n vertices (x0,y0),
  (x1,y1), ...,
  (xn−1,yn−1) is the point (Cx,
  Cy), where

and where A is the polygon's signed area,

In these formulas, the vertices are assumed to be numbered in order of
  their occurrence along the polygon's perimeter. Furthermore, the
  vertex ( xn, yn ) is assumed to be the same as
  ( x0, y0 ), meaning i + 1 on the last case
  must loop around to i = 0. Note that if the points are numbered in
  clockwise order the area A, computed as above, will have a negative
  sign; but the centroid coordinates will be correct even in this case.

Given a list of vertices in order (either clockwise, or counter-clockwise), find the centroid of the non-self-intersecting closed polygon represented by the vertices.

If it helps, you may assume input to be only CW, or only CCW. Say so in your answer if you require this.

The coordinates are not required to be integers, and may contain negative numbers.

Input will always be valid and contain at least three vertices.

Inputs only need to be handled that fit in your language's native floating point data type.

You may assume that input numbers will always contain a decimal point.

You may assume that input integers end in . or .0.

You may use complex numbers for input.

Output should be accurate to the nearest thousandth.

Examples

```<code>[(0.,0.), (1.,0.), (1.,1.), (0.,1.)]        -> (0.5, 0.5)
[(-15.21,0.8), (10.1,-0.3), (-0.07,23.55)]  -> -1.727 8.017
[(-39.00,-55.94), (-56.08,-4.73), (-72.64,12.12), (-31.04,53.58), (-30.36,28.29), (17.96,59.17), (0.00,0.00), (10.00,0.00), (20.00,0.00), (148.63,114.32), (8.06,-41.04), (-41.25,34.43)]   -> 5.80104769975, 15.0673812762
</code>```

Too see each polygon on a coordinate plane, paste the coordinates without the square brackets in the "Edit" menu of this page.

I confirmed my results using this Polygon Centroid Point Calculator, which is awful. I couldn't find one that you can input all vertices at once, or that didn't try to erase your - sign when you type it first. I'll post my Python solution for your use after people have had a chance to answer.

答:
JavaScript (ES6), 102

Straight implementation of the formula

```<code>l=>[...l,l[0]].map(([x,y],i)=>(i?(a+=w=t*y-x*u,X+=(t+x)*w,Y+=(u+y)*w):X=Y=a=0,t=x,u=y))&&[X/3/a,Y/3/a]
</code>```

Test

f=
l=>[...l,l[0]].map(([x,y],i)=>(i?(a+=w=t*y-x*u,X+=(t+x)*w,Y+=(u+y)*w):X=Y=a=0,t=x,u=y))&&[X/3/a,Y/3/a]

function go()
{
  var c=[],cx,cy;
  // build coordinates array
  I.value.match(/-?[\d.]+/g).map((v,i)=>i&1?t[1]=+v:c.push(t=[+v]));
  console.log(c+''),
  [cx,cy]=f(c);
  O.textContent='CX:'+cx+' CY:'+cy;
  // try to display the polygon
  var mx=Math.max(...c.map(v=>v[0])),
    nx=Math.min(...c.map(v=>v[0])),
    my=Math.max(...c.map(v=>v[1])),
    ny=Math.min(...c.map(v=>v[1])),
    dx=mx-nx, dy=my-ny,
    ctx=C.getContext("2d"),
    cw=C.width, ch=C.height,
    fx=(mx-nx)/cw, fy=(my-ny)/ch, fs=Math.max(fx,fy)
  C.width=cw
  ctx.setTransform(1,0,0,1,0,0);
  ctx.beginPath();
  c.forEach(([x,y],i)=>ctx.lineTo((x-nx)/fs,(y-ny)/fs));
  ctx.closePath();
  ctx.stroke();
  ctx.fillStyle='#ff0000';
  ctx.fillRect((cx-nx)/fs-2,(cy-ny)/fs-2,5,5);
}
go()```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#I { width:90% }
#C { width:90%; height:200px;}</code>```

<input id=I value='[[-15.21,0.8], [10.1,-0.3], [-0.07,23.55]]'>
<button onclick='go()'>GO</button>

```
<canvas id=C></canvas></code>```

Title: Find the Centroid of a Polygon

Body:
JavaScript (ES6), 102

Straight implementation of the formula

l=>[...l,l[0]].map(([x,y],i)=>(i?(a+=w=t*y-x*u,X+=(t+x)*w,Y+=(u+y)*w):X=Y=a=0,t=x,u=y))&&[X/3/a,Y/3/a]

Test

f=
l=>[...l,l[0]].map(([x,y],i)=>(i?(a+=w=t*y-x*u,X+=(t+x)*w,Y+=(u+y)*w):X=Y=a=0,t=x,u=y))&&[X/3/a,Y/3/a]

function go()
{
  var c=[],cx,cy;
  // build coordinates array
  I.value.match(/-?[\d.]+/g).map((v,i)=>i&1?t[1]=+v:c.push(t=[+v]));
  console.log(c+''),
  [cx,cy]=f(c);
  O.textContent='CX:'+cx+' CY:'+cy;
  // try to display the polygon
  var mx=Math.max(...c.map(v=>v[0])),
    nx=Math.min(...c.map(v=>v[0])),
    my=Math.max(...c.map(v=>v[1])),
    ny=Math.min(...c.map(v=>v[1])),
    dx=mx-nx, dy=my-ny,
    ctx=C.getContext("2d"),
    cw=C.width, ch=C.height,
    fx=(mx-nx)/cw, fy=(my-ny)/ch, fs=Math.max(fx,fy)
  C.width=cw
  ctx.setTransform(1,0,0,1,0,0);
  ctx.beginPath();
  c.forEach(([x,y],i)=>ctx.lineTo((x-nx)/fs,(y-ny)/fs));
  ctx.closePath();
  ctx.stroke();
  ctx.fillStyle='#ff0000';
  ctx.fillRect((cx-nx)/fs-2,(cy-ny)/fs-2,5,5);
}
go()

#I { width:90% }
#C { width:90%; height:200px;}

<input id=I value='[[-15.21,0.8], [10.1,-0.3], [-0.07,23.55]]'>
<button onclick='go()'>GO</button>
<pre id=O></pre>
<canvas id=C></canvas>


答:
Java, 72 bytes

```<code>(a,s,l)->{l=a.length;s=""+a[--l];for(;l>0;)s=a[--l]+"("+s+")";return s;}
</code>```

Ungolfed

```<code>public class Main {

  interface X {
    String f(char[]a,String s,int l);
  }

  static X x = (a,s,l) -> {
    l = a.length;
    s = "" + a[--l]; // start with the last character
    for (;l>0;)
      s = a[--l] + "(" + s +")"; // wrap in parentheses and prepend with the previous letter.
    return s;
  };

  public static void main(String[] args) {
    System.out.println(x.f("Hello World!".toCharArray(),"",0));
  }
}
</code>```

Title: N(e(s(t))) a string

Body:
Java, 72 bytes

(a,s,l)->{l=a.length;s=""+a[--l];for(;l>0;)s=a[--l]+"("+s+")";return s;}

Ungolfed

public class Main {

  interface X {
    String f(char[]a,String s,int l);
  }

  static X x = (a,s,l) -> {
    l = a.length;
    s = "" + a[--l]; // start with the last character
    for (;l>0;)
      s = a[--l] + "(" + s +")"; // wrap in parentheses and prepend with the previous letter.
    return s;
  };

  public static void main(String[] args) {
    System.out.println(x.f("Hello World!".toCharArray(),"",0));
  }
}


答:
Java <s>82</s> 81

Thanks to Olivier Grégoire for the correction leading to 1byte less.

Solution

I forced myself in using a String a not a char[] so this is a bit more verbose :/

```<code>String n(String s){return s.length()>1?s.charAt(0)+"("+n(s.substring(1))+")":s;}
</code>```

A simple recursive function.

Test

```<code>public static void main(String[] a){
    System.out.println(n("test"));
    System.out.println(n("Hello world!"));
}
</code>```

t(e(s(t)))

H(e(l(l(o( (w(o(r(l(d(!)))))))))))

Title: N(e(s(t))) a string

Body:
Java <s>82</s> 81

Thanks to Olivier Grégoire for the correction leading to 1byte less.

Solution

I forced myself in using a String a not a char[] so this is a bit more verbose :/

String n(String s){return s.length()>1?s.charAt(0)+"("+n(s.substring(1))+")":s;}

A simple recursive function.

Test

public static void main(String[] a){
    System.out.println(n("test"));
    System.out.println(n("Hello world!"));
}

t(e(s(t)))

H(e(l(l(o( (w(o(r(l(d(!)))))))))))


答:
Python 2, 108 bytes

Slightly different than the other python answer, using no replaces, only string joins.

print'\n'.join(map(' '.join,['FKCIIBAVWMG']+map((' '*9).join,zip('NTCSPVSES','PNCPSCPLB'))+['JCVCORIBCMG']))
```

Body:
Monopoly Board

For this code-golf challenge we will be building the board game Monopoly.

Rules:

Take no input.

Output a 11x11 board where each ASCII character forming the board is the first letter of each space of the U.S. version of the Monopoly board.

The characters must be separated by spaces.

Go should start in the bottom right.

The exact string to produce is

```<code>F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G
</code>```

Note that from bottom right to bottom left the squares are as follows:

```<code>G --> Go
M --> Mediterranean Avenue
C --> Community Chest
B --> Baltic Avenue
I --> Income Tax
...
J --> Jail
</code>```

Edit
Wow! you guys sure liked this one! :)


答:
R, 129 127 bytes

```<code>function(l){s=sapply;x=s(l,`[`,1);y=s(l,`[`,2);X=c(x[-1],x[1]);Y=c(y[-1],y[1]);p=x*Y-X*y;c(sum((x+X)*p),sum((y+Y)*p))/sum(p)/3}
</code>```

Unnamed function that take an R-list of tuples as input. The named equivalent can be called using e.g.:

```<code>f(list(c(-15.21,0.8),c(10.1,-0.3),c(-0.07,23.55)))
</code>```

Ungolfed and explained

```<code>f=function(l){s=sapply;                           # Alias for sapply
              x=s(l,`[`,1);                       # Split list of tuples into vector of first elements
              y=s(l,`[`,2);                       # =||= but for second element
              X=c(x[-1],x[1]);                    # Generate a vector for x(i+1)
              Y=c(y[-1],y[1]);                    # Generate a vector for y(i+1)
              p=x*Y-X*y;                          # Calculate the outer product used in both A, Cx and Cy
              c(sum((x+X)*p),sum((y+Y)*p))/sum(p)/3    # See post for explanation
}
</code>```

The final step (c(sum((x+X)*p),sum((y+Y)*p))/sum(p)*2/6) is a vectorized way of calculating both Cx and Cy. The sum in the formulas for Cx and Cy are stored in a vector and consequently divided by the "sum in A" *2/6. E.g.:

```<code>(SUMinCx, SUMinCy) / SUMinA / 3
</code>```

, and then implicitly printed.

Try it on R-fiddle

Title: Find the Centroid of a Polygon

Body:
From Wikipedia:

The centroid of a non-self-intersecting closed polygon
  defined by n vertices (x0,y0),
  (x1,y1), ...,
  (xn−1,yn−1) is the point (Cx,
  Cy), where

and where A is the polygon's signed area,

In these formulas, the vertices are assumed to be numbered in order of
  their occurrence along the polygon's perimeter. Furthermore, the
  vertex ( xn, yn ) is assumed to be the same as
  ( x0, y0 ), meaning i + 1 on the last case
  must loop around to i = 0. Note that if the points are numbered in
  clockwise order the area A, computed as above, will have a negative
  sign; but the centroid coordinates will be correct even in this case.

Given a list of vertices in order (either clockwise, or counter-clockwise), find the centroid of the non-self-intersecting closed polygon represented by the vertices.

If it helps, you may assume input to be only CW, or only CCW. Say so in your answer if you require this.

The coordinates are not required to be integers, and may contain negative numbers.

Input will always be valid and contain at least three vertices.

Inputs only need to be handled that fit in your language's native floating point data type.

You may assume that input numbers will always contain a decimal point.

You may assume that input integers end in . or .0.

You may use complex numbers for input.

Output should be accurate to the nearest thousandth.

Examples

```<code>[(0.,0.), (1.,0.), (1.,1.), (0.,1.)]        -> (0.5, 0.5)
[(-15.21,0.8), (10.1,-0.3), (-0.07,23.55)]  -> -1.727 8.017
[(-39.00,-55.94), (-56.08,-4.73), (-72.64,12.12), (-31.04,53.58), (-30.36,28.29), (17.96,59.17), (0.00,0.00), (10.00,0.00), (20.00,0.00), (148.63,114.32), (8.06,-41.04), (-41.25,34.43)]   -> 5.80104769975, 15.0673812762
</code>```

Too see each polygon on a coordinate plane, paste the coordinates without the square brackets in the "Edit" menu of this page.

I confirmed my results using this Polygon Centroid Point Calculator, which is awful. I couldn't find one that you can input all vertices at once, or that didn't try to erase your - sign when you type it first. I'll post my Python solution for your use after people have had a chance to answer.

Body:
R, 129 127 bytes

function(l){s=sapply;x=s(l,`[`,1);y=s(l,`[`,2);X=c(x[-1],x[1]);Y=c(y[-1],y[1]);p=x*Y-X*y;c(sum((x+X)*p),sum((y+Y)*p))/sum(p)/3}

Unnamed function that take an R-list of tuples as input. The named equivalent can be called using e.g.:

f(list(c(-15.21,0.8),c(10.1,-0.3),c(-0.07,23.55)))

Ungolfed and explained

f=function(l){s=sapply;                           # Alias for sapply
              x=s(l,`[`,1);                       # Split list of tuples into vector of first elements
              y=s(l,`[`,2);                       # =||= but for second element
              X=c(x[-1],x[1]);                    # Generate a vector for x(i+1)
              Y=c(y[-1],y[1]);                    # Generate a vector for y(i+1)
              p=x*Y-X*y;                          # Calculate the outer product used in both A, Cx and Cy
              c(sum((x+X)*p),sum((y+Y)*p))/sum(p)/3    # See post for explanation
}

The final step (c(sum((x+X)*p),sum((y+Y)*p))/sum(p)*2/6) is a vectorized way of calculating both Cx and Cy. The sum in the formulas for Cx and Cy are stored in a vector and consequently divided by the "sum in A" *2/6. E.g.:

(SUMinCx, SUMinCy) / SUMinA / 3

, and then implicitly printed.

Try it on R-fiddle


问:
Compute the Eulerian number
The Eulerian number A(n, m) is the number of permutations of [1, 2, ..., n] in which exactly m elements are greater than the previous element. These are also called rises. For example, if n = 3, there are 3! = 6 permutations of [1, 2, 3]

```<code>1 2 3
 < <  2 elements are greater than the previous

1 3 2
 < >  1 ...

2 1 3
 > <  1 ...

2 3 1
 < >  1 ...

3 1 2
 > <  1 ...

3 2 1
 > >  0 ...
</code>```

So the outputs for A(3, m) for m in [0, 1, 2, 3] will be

```<code>A(3, 0) = 1
A(3, 1) = 4
A(3, 2) = 1
A(3, 3) = 0
</code>```

Also, this is the OEIS sequence A173018.

Rules

This is code-golf so the shortest code wins.

The input n will be a nonnegative integer and m will be a integer in the range [0, 1, ..., n].

Test Cases

```<code>n   m   A(n, m)
0   0   1
1   0   1
1   1   0
2   0   1
2   1   1
2   2   0
3   0   1
3   1   4
3   2   1
3   3   0
4   0   1
4   1   11
4   2   11
4   3   1
4   4   0
5   1   26
7   4   1191
9   5   88234
10  5   1310354
10  7   47840
10  10  0
12  2   478271
15  6   311387598411
17  1   131054
20  16  1026509354985
42  42  0
</code>```

Title: Compute the Eulerian number

Body:
JavaScript (ES6), <s>50</s> <s>46</s> 45 bytes

f=(n,m,d=n-m)=>m?d&&f(--n,m)*++m+f(n,m-2)*d:1

Based on the recursive formula:

A(n, m) = (n - m)A(n - 1, m - 1) + (m + 1)A(n - 1, m)

Test cases

f=(n,m,d=n-m)=>m?d&&f(--n,m)*++m+f(n,m-2)*d:1

console.log(f( 0,  0));  // 1
console.log(f( 1,  0));  // 1
console.log(f( 1,  1));  // 0
console.log(f( 2,  0));  // 1
console.log(f( 2,  1));  // 1
console.log(f( 2,  2));  // 0
console.log(f( 3,  0));  // 1
console.log(f( 3,  1));  // 4
console.log(f( 3,  2));  // 1
console.log(f( 3,  3));  // 0
console.log(f( 4,  0));  // 1
console.log(f( 4,  1));  // 11
console.log(f( 4,  2));  // 11
console.log(f( 4,  3));  // 1
console.log(f( 4,  4));  // 0
console.log(f( 5,  1));  // 26
console.log(f( 7,  4));  // 1191
console.log(f( 9,  5));  // 88234
console.log(f(10,  5));  // 1310354
console.log(f(10,  7));  // 47840
console.log(f(10, 10));  // 0
console.log(f(12,  2));  // 478271
console.log(f(15,  6));  // 311387598411
console.log(f(17,  1));  // 131054
console.log(f(20, 16));  // 1026509354985
console.log(f(42, 42));  // 0


答:
Python, <s>55</s> 56 bytes

a=lambda n,m:n>=m>0and(n-m)*a(n-1,m-1)-~m*a(n-1,m)or m<1
```

All tests at repl.it

Applies the recursive formula on OEIS.

Note that +(m+1)*a(n-1,m) is golfed to -~m*a(n-1,m).

(May return boolean values to represent 1 or 0. Returns True when n<0 and m<=0 or m<0.)

Title: Compute the Eulerian number

Body:
The Eulerian number A(n, m) is the number of permutations of [1, 2, ..., n] in which exactly m elements are greater than the previous element. These are also called rises. For example, if n = 3, there are 3! = 6 permutations of [1, 2, 3]

```<code>1 2 3
 < <  2 elements are greater than the previous

1 3 2
 < >  1 ...

2 1 3
 > <  1 ...

2 3 1
 < >  1 ...

3 1 2
 > <  1 ...

3 2 1
 > >  0 ...
</code>```

So the outputs for A(3, m) for m in [0, 1, 2, 3] will be

```<code>A(3, 0) = 1
A(3, 1) = 4
A(3, 2) = 1
A(3, 3) = 0
</code>```

Also, this is the OEIS sequence A173018.

Rules

This is code-golf so the shortest code wins.

The input n will be a nonnegative integer and m will be a integer in the range [0, 1, ..., n].

Test Cases

```<code>n   m   A(n, m)
0   0   1
1   0   1
1   1   0
2   0   1
2   1   1
2   2   0
3   0   1
3   1   4
3   2   1
3   3   0
4   0   1
4   1   11
4   2   11
4   3   1
4   4   0
5   1   26
7   4   1191
9   5   88234
10  5   1310354
10  7   47840
10  10  0
12  2   478271
15  6   311387598411
17  1   131054
20  16  1026509354985
42  42  0
</code>```

Body:
Python, <s>55</s> 56 bytes

a=lambda n,m:n>=m>0and(n-m)*a(n-1,m-1)-~m*a(n-1,m)or m<1

All tests at repl.it

Applies the recursive formula on OEIS.

Note that +(m+1)*a(n-1,m) is golfed to -~m*a(n-1,m).

(May return boolean values to represent 1 or 0. Returns True when n<0 and m<=0 or m<0.)


答:
Jelly, 8 bytes

```<code>Œ!Z>2\Sċ
</code>```

Try it online! (takes a while) or verify the smaller test cases.

How it works

```<code>Œ!Z>2\Sċ  Main link. Arguments: n, m

Œ!        Generate the matrix of all permutations of [1, ..., n].
  Z       Zip/transpose, placing the permutations in the columns.
   >2\    Compare columns pairwise with vectorizing greater-than.
          This generates a 1 in the column for each rise in that permutation.
      S   Compute the vectorizing sum of the columns, counting the number of rises.
       ċ  Count how many times m appears in the computed counts.
</code>```

Title: Compute the Eulerian number

Body:
Jelly, 8 bytes

Œ!Z>2\Sċ

Try it online! (takes a while) or verify the smaller test cases.

How it works

Œ!Z>2\Sċ  Main link. Arguments: n, m

Œ!        Generate the matrix of all permutations of [1, ..., n].
  Z       Zip/transpose, placing the permutations in the columns.
   >2\    Compare columns pairwise with vectorizing greater-than.
          This generates a 1 in the column for each rise in that permutation.
      S   Compute the vectorizing sum of the columns, counting the number of rises.
       ċ  Count how many times m appears in the computed counts.


答:
Perl, 98 bytes

```<code>sub a{my($b,$c)=@_;return$c?$c>$b?0:($b-$c)*a($b-1,$c-1)+($c+1)*a($b-1,$c):1;}print a(@ARGV[0,1]);
</code>```

Based on the same property as Arnauld's answer.

Title: Compute the Eulerian number

Body:
Perl, 98 bytes

sub a{my($b,$c)=@_;return$c?$c>$b?0:($b-$c)*a($b-1,$c-1)+($c+1)*a($b-1,$c):1;}print a(@ARGV[0,1]);

Based on the same property as Arnauld's answer.


答:
Jelly, 44 bytes

```<code>“£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ’ḃ23ṣ4ịØAz⁶ṙ1G
</code>```

Try it online!

Idea

If we remove every second column and transpose rows with columns, we get the following board.

```<code>FNTCSPVSESJ
K         C
C         V
I         C
I         O
B         R
A         I
V         B
W         C
M         M
GPNCPSCPLBG
</code>```

Now, we can rotate each column one unit to the right, moving all remaining spaces to the right.

```<code>JFNTCSPVSES
KC
CV
IC
IO
BR
AI
VB
WC
MM
GGPNCPSCPLB
</code>```

Then, we remove the remaining spaces and replace linefeeds with the letter D.

```<code>JFNTCSPVSESDCKDVCDCIDOIDRBDIADBVDCWDMMDGGPNCPSCPLB
</code>```

Now, we replace each letter with its 1-based index in the alphabet.

```<code>10  6 14 20  3 19 16 22 19  5 19  4  3 11  4 22  3  4  3  9  4 15  9  4 18
 2  4  9  1  4  2 22  4  3 23  4 13 13  4  7  7 16 14  3 16 19  3 16 12  2
</code>```

Then, we convert this digit array from bijective base 23 to integer.

```<code>54580410997367796180315467139871590480817875551696951051609467717521
</code>```

Now, we convert this integer to bijective base 250.

```<code>  2 232  57  78 163  84 132  77 228 144  27 100  77 176 195
 42   9  55  83 167 155   1 210 125 211   4 232 119  20
</code>```

Finally, we use these digits to index into Jelly's code page.

```<code>£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ
</code>```

This is the encoded data we'll include in the program (29 bytes). To produce the desired output, we just have to reverse the steps above.

Code

```<code>“£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ’ḃ23ṣ4ịØAz⁶ṙ1G  Main link. No arguments.

“£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ’               Convert the string from bijective
                                              base 250 (using the indices in
                                              Jelly's code page) to integer.
                               ḃ23            Convert that integer to bijective
                                              base 23.
                                  ṣ4          Split the resulting array at
                                              occurrences of 4.
                                    ịØA       Replace the remaining digits in the
                                              resulting 2D array with the
                                              corresponding uppercase letters.
                                       z⁶     Zip/transpose rows and columns,
                                              padding shorter rows with spaces.
                                         ṙ1   Rotate the rows one unit down.
                                           G  Grid; join rows by spaces, columns
                                              by linefeeds.
</code>```

Body:
Jelly, 44 bytes

“£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ’ḃ23ṣ4ịØAz⁶ṙ1G

Try it online!

Idea

If we remove every second column and transpose rows with columns, we get the following board.

FNTCSPVSESJ
K         C
C         V
I         C
I         O
B         R
A         I
V         B
W         C
M         M
GPNCPSCPLBG

Now, we can rotate each column one unit to the right, moving all remaining spaces to the right.

JFNTCSPVSES
KC
CV
IC
IO
BR
AI
VB
WC
MM
GGPNCPSCPLB

Then, we remove the remaining spaces and replace linefeeds with the letter D.

JFNTCSPVSESDCKDVCDCIDOIDRBDIADBVDCWDMMDGGPNCPSCPLB

Now, we replace each letter with its 1-based index in the alphabet.

10  6 14 20  3 19 16 22 19  5 19  4  3 11  4 22  3  4  3  9  4 15  9  4 18
 2  4  9  1  4  2 22  4  3 23  4 13 13  4  7  7 16 14  3 16 19  3 16 12  2

Then, we convert this digit array from bijective base 23 to integer.

54580410997367796180315467139871590480817875551696951051609467717521

Now, we convert this integer to bijective base 250.

  2 232  57  78 163  84 132  77 228 144  27 100  77 176 195
 42   9  55  83 167 155   1 210 125 211   4 232 119  20

Finally, we use these digits to index into Jelly's code page.

£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ

This is the encoded data we'll include in the program (29 bytes). To produce the desired output, we just have to reverse the steps above.

Code

“£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ’ḃ23ṣ4ịØAz⁶ṙ1G  Main link. No arguments.

“£ċ9NɲT⁴MỵƇñdMỊḞ*µ7Sʂɓ¢Ż}ạ¥ċwÞ’               Convert the string from bijective
                                              base 250 (using the indices in
                                              Jelly's code page) to integer.
                               ḃ23            Convert that integer to bijective
                                              base 23.
                                  ṣ4          Split the resulting array at
                                              occurrences of 4.
                                    ịØA       Replace the remaining digits in the
                                              resulting 2D array with the
                                              corresponding uppercase letters.
                                       z⁶     Zip/transpose rows and columns,
                                              padding shorter rows with spaces.
                                         ṙ1   Rotate the rows one unit down.
                                           G  Grid; join rows by spaces, columns
                                              by linefeeds.


答:
CJam (21 19 bytes - or 18 if argument order is free)

```<code>{\e!f{2ew::>1b=}1b}
</code>```

This is an anonymous block (function) which takes n m on the stack. (If it's permitted to take m n on the stack then the \ can be saved). It computes all  permutations and filters, so the online test suite must be rather limited.

Thanks to Martin for pointing out an approximation to filter-with-parameter.

Dissection

```<code>{        e# Define a block. Stack: n m
  \      e#   Flip the stack to give m n
  e!f{   e#   Generate permutations of [0 .. n-1] and map with parameter m
    2ew  e#     Stack: m perm; generate the list of n-1 pairs of consecutive
         e#     elements of perm
    ::>  e#     Map each pair to 1 if it's a rise and 0 if it's a fall
    1b   e#     Count the falls
    =    e#     Map to 1 if there are m falls and 0 otherwise
  }
  1b     e#   Count the permutations with m falls
}
</code>```

Note that the Eulerian numbers are symmetric: E(n, m) = E(n, n-m), so it's irrelevant whether you count falls or rises.

Efficiently: 32 bytes

```<code>{1a@{0\+_ee::*(;\W%ee::*W%.+}*=}
</code>```

Online test suite.

This implements the recurrence on whole rows.

```<code>{          e# Define a block. Stack: n m
  1a@      e#   Push the row for n=0: [1]; and rotate n to top of stack
  {        e#   Repeat n times:
           e#     Stack: m previous-row
    0\+_   e#     Prepend a 0 to the row and duplicate
    ee::*  e#     Multiply each element by its index
           e#     This gives A[j] = j * E(i-1, j-1)
    (;     e#     Pop the first element, so that A[j] = (j+1) * E(i-1, j)
    \W%    e#     Get the other copy of the previous row and reverse it
    ee::*  e#     Multiply each element by its index
           e#     This gives B[j] = j * E(i-1, i-1-j)
    W%     e#     Reverse again, giving B[j] = (i-j) * E(i-1, j-1)
    .+     e#     Pointwise addition
  }*
  =        e#   Extract the element at index j
}
</code>```

Title: Compute the Eulerian number

Body:
CJam (21 19 bytes - or 18 if argument order is free)

{\e!f{2ew::>1b=}1b}

This is an anonymous block (function) which takes n m on the stack. (If it's permitted to take m n on the stack then the \ can be saved). It computes all  permutations and filters, so the online test suite must be rather limited.

Thanks to Martin for pointing out an approximation to filter-with-parameter.

Dissection

{        e# Define a block. Stack: n m
  \      e#   Flip the stack to give m n
  e!f{   e#   Generate permutations of [0 .. n-1] and map with parameter m
    2ew  e#     Stack: m perm; generate the list of n-1 pairs of consecutive
         e#     elements of perm
    ::>  e#     Map each pair to 1 if it's a rise and 0 if it's a fall
    1b   e#     Count the falls
    =    e#     Map to 1 if there are m falls and 0 otherwise
  }
  1b     e#   Count the permutations with m falls
}

Note that the Eulerian numbers are symmetric: E(n, m) = E(n, n-m), so it's irrelevant whether you count falls or rises.

Efficiently: 32 bytes

{1a@{0\+_ee::*(;\W%ee::*W%.+}*=}

<a href="http://cjam.aditsu.net/#code=q~%5D3%2F%7B~%40%40%0A%0A%7B1a%40%7B0%5C%2B_ee%3A%3A*(%3B%5CW%25ee%3A%3A*W%25.%2B%7D*%3D%7D%0A%0A~%3D%7D%2F&input=0%20%20%200%20%20%201%0A1%20%20%200%20%20%201%0A1%20%20%201%20%20%200%0A2%20%20%200%20%20%201%0A2%20%20%201%20%20%201%0A2%20%20%202%20%20%200%0A3%20%20%200%20%20%201%0A3%20%20%201%20%20%204%0A3%20%20%202%20%20%201%0A3%20%20%203%20%20%200%0A4%20%20%200%20%20%201%0A4%20%20%201%20%20%2011%0A4%20%20%202%20%20%2011%0A4%20%20%203%20%20%201%0A4%20%20%204%20%20%200%0A5%20%20%201%20%20%2026%0A7%20%20%204%20%20%201191%0A9%20%20%205%20%20%2088234%0A10%20%205%20%20%201310354%0A10%20%207%20%20%2047840%0A10%20%2010%20%200%0A12%20%202%20%20%20478271%0A15%20%206%20%20%20311387598411%0A17%20%201%20%20%20131054%0A20%20%2016%20%201026509354985%0A42%20%2042%20%200" rel="nofollow">Online test suite.

This implements the recurrence on whole rows.

{          e# Define a block. Stack: n m
  1a@      e#   Push the row for n=0: [1]; and rotate n to top of stack
  {        e#   Repeat n times:
           e#     Stack: m previous-row
    0\+_   e#     Prepend a 0 to the row and duplicate
    ee::*  e#     Multiply each element by its index
           e#     This gives A[j] = j * E(i-1, j-1)
    (;     e#     Pop the first element, so that A[j] = (j+1) * E(i-1, j)
    \W%    e#     Get the other copy of the previous row and reverse it
    ee::*  e#     Multiply each element by its index
           e#     This gives B[j] = j * E(i-1, i-1-j)
    W%     e#     Reverse again, giving B[j] = (i-j) * E(i-1, j-1)
    .+     e#     Pointwise addition
  }*
  =        e#   Extract the element at index j
}


问:
Draw an asterisk triangle
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).

Input:

A positive integer n >= 1.

Output:

n lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.

Test case (n=5):

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

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

答:
Perl, <s>83</s> 76 bytes (no asterisk)

```<code>print substr((split("\n",`perldoc perlre`))[55],48,1)x$_."\n"foreach(1..<>);
</code>```

(Faster version for large input, 83 characters):

```<code>$r=`perldoc perlre`;print substr((split("\n",$r))[425],11,1)x$_."\n"foreach(1..<>);
</code>```

Explanation:
The statement perldoc perlre executes the shell command to display the Perl documentation on regular expressions, which contains an asterisk as the 11th character on line 425.  Split the resulting output by line, then extract that character and print in triangular format.

Edited to save 6 characters by not saving the output of the shell command, and instead just running it every time.  It increases the runtime, though, but we only care about bytes, not runtime :)
Another byte was saved (for a total of -7) by finding an earlier asterisk in the perldoc output.

ContentLicense: CC BY-SA 4.0

Title: Draw an asterisk triangle

Body:
Perl, <s>83</s> 76 bytes (no asterisk)

print substr((split("\n",`perldoc perlre`))[55],48,1)x$_."\n"foreach(1..<>);

(Faster version for large input, 83 characters):

$r=`perldoc perlre`;print substr((split("\n",$r))[425],11,1)x$_."\n"foreach(1..<>);

Explanation:
The statement perldoc perlre executes the shell command to display the Perl documentation on regular expressions, which contains an asterisk as the 11th character on line 425.  Split the resulting output by line, then extract that character and print in triangular format.

Edited to save 6 characters by not saving the output of the shell command, and instead just running it every time.  It increases the runtime, though, but we only care about bytes, not runtime :)
Another byte was saved (for a total of -7) by finding an earlier asterisk in the perldoc output.


问:
Display a Connect Four game
Connect Four is a game where two players take turns to drop disks into columns of a vertically mounted grid, and attempt to connect four disks orthogonally or diagonally. When a column is chosen, the disk falls to the lowest empty position in that column, so any game may be completely specified by the size of the grid and the sequence of columns chosen. The task is to generate the configuration of the grid given this information.

Input

Width w and Height h of the grid, both positive integers.

Sequence of columns c1, c2, ..., cn chosen by the players, in any reasonable format (list, array etc.); either 0-based (0 to w-1) or 1-based (1 to w) indexing can be used.

It may be assumed that all of the column numbers lie within the grid (so the sequence won't contain -3 or w+50) and that any column number appears at most h times in the sequence (so a column can't be chosen once it is full).

Note that the sequence of columns may not constitute a complete game, nor a legal game. For instance, the players could opt to continue playing even after a player has connected four disks.

Output

Any reasonable representation of the resulting state of each position in the grid, either "occupied by Player 1", "occupied by Player 2", or "empty". Player 1 always moves first.

For example, a string, array, tuple etc. with each position containing one of three symbols (ASCII character, number etc.) representing the state of that position in the grid. The grid may be transposed.

For list/tuple/array outputs, the separator cannot be one of the three representative symbols. For string outputs, trailing spaces at the end of each line are permitted, provided a space is not one of the three representative symbols. Trailing newlines at the very end are permitted.

Test cases

Here, string output is used, with X, O, . denoting "occupied by Player 1", "occupied by Player 2", "empty".

```<code>IN: Width 1 Height 1 Sequence (empty sequence)
OUT:
.

IN: Width 7 Height 6 Sequence 4 4 5 5 6 7 3 [1-based]
                              3 3 4 4 5 6 2 [0-based]
OUT:
.......
.......
.......
.......
...OO..
..XXXXO

IN: Width 5 Height 5 Sequence 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 [1-based]
                              0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 [0-based]
OUT:
XOXOX
OXOXO
XOXOX
OXOXO
xOXOX

IN: Width 4 Height 4 Sequence 3 3 2 4 3 2 4 2 2 3 4 4 1 1 1 1 [1-based]
                              2 2 1 3 2 1 3 1 1 2 3 3 0 0 0 0 [0-based]
OUT:
OXOO
XOXX
OOOX
XXXO

IN: Width 10 Height 10 Sequence 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 10  [1-based]
                                0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0  9 0  9  [0-based]
OUT:
X.........
X.........
X.........
X.........
X.........
X.........
X.........
X.........
X........O
XOOOOOOOOO
</code>```

Shortest code in bytes wins.

答:
Scala, 122 bytes

```<code>def%(w:Int,h:Int,m:Int*)=((Seq.fill(w)(Nil:Seq[Int]),1)/:m){case((a,p),x)=>(a.updated(x,a(x):+p),-p)}._1.map(_.padTo(h,0))
</code>```

Ungolfed:

```<code>def f(w:Int,h:Int,m:Int*)=
  m.foldLeft((Seq.fill(w)(Nil:Seq[Int]),1)){
    case((res,player),x)=>
      (res.updated(x,res(x):+player), -player)
  }._1.map(_.padTo(h,0))
</code>```

Explanation:

```<code>def%(w:Int,h:Int,m:Int*)=        //define a method
  (
    (                            //with a tuple of
      Seq.fill(w)(Nil:Seq[Int]),   //a Sequence of w empty sequences
      1                            //and 1
    )                            //as a start value,
    /:m                          //foldLeft the moves
  ){                             //using the following function,
    case((a,p),x)=>                //which takes the result, the player and the x coordinate
      (                            //return a tuple of
        a.updated(x,a(x):+p),        //the seq with index x with p appended
        -p                           //and the other player
      )
  }._1.map(                      //take the resulting seq and foreach column
    _.padTo(h,0)                 //append 0 until the length is h
  )
</code>```

Returns a sequence of the columns in bottom-to-top order.
The players are represented as -1 and 1, empty cells are 0.

Title: Display a Connect Four game

Body:
Scala, 122 bytes

def%(w:Int,h:Int,m:Int*)=((Seq.fill(w)(Nil:Seq[Int]),1)/:m){case((a,p),x)=>(a.updated(x,a(x):+p),-p)}._1.map(_.padTo(h,0))

Ungolfed:

def f(w:Int,h:Int,m:Int*)=
  m.foldLeft((Seq.fill(w)(Nil:Seq[Int]),1)){
    case((res,player),x)=>
      (res.updated(x,res(x):+player), -player)
  }._1.map(_.padTo(h,0))

Explanation:

def%(w:Int,h:Int,m:Int*)=        //define a method
  (
    (                            //with a tuple of
      Seq.fill(w)(Nil:Seq[Int]),   //a Sequence of w empty sequences
      1                            //and 1
    )                            //as a start value,
    /:m                          //foldLeft the moves
  ){                             //using the following function,
    case((a,p),x)=>                //which takes the result, the player and the x coordinate
      (                            //return a tuple of
        a.updated(x,a(x):+p),        //the seq with index x with p appended
        -p                           //and the other player
      )
  }._1.map(                      //take the resulting seq and foreach column
    _.padTo(h,0)                 //append 0 until the length is h
  )

Returns a sequence of the columns in bottom-to-top order.
The players are represented as -1 and 1, empty cells are 0.


答:
CJam, <s>12</s> 11 bytes

One byte saved by Martin Ender.

```<code>q_'(*\,(')*
</code>```

Try it online

Title: N(e(s(t))) a string

Body:
To "function nest" a string, you must:

Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was Hello, then the first step would be:

```<code>H(ello)
</code>```

Then, repeat this same step for every substring. So we get:

```<code>H(ello)
H(e(llo))
H(e(l(lo)))
H(e(l(l(o))))
</code>```

Your task is to write a program or function that "function nests" a string. For example, if the input string was Hello world!, then you should output:

```<code>H(e(l(l(o( (w(o(r(l(d(!)))))))))))
</code>```

The input will only ever contain printable ASCII, and you may take the input and the output in any reasonable format. For example, STDIN/STDOUT, function arguments and return value, reading and writing to a file, etc.

For simplicity's sake, you may also assume the input will not contain parentheses, and will not be empty.

```<code>Input:
Nest a string
Output:
N(e(s(t( (a( (s(t(r(i(n(g))))))))))))

Input:
foobar
Output:
f(o(o(b(a(r)))))

Input:
1234567890
Output:
1(2(3(4(5(6(7(8(9(0)))))))))

Input:
code-golf
Output:
c(o(d(e(-(g(o(l(f))))))))

Input:
a
Output:
a

Input:
42
Output:
4(2)
</code>```

As usual, all of our default rules and loopholes apply, and the shortest answer scored in bytes wins!

Body:
CJam, <s>12</s> 11 bytes

One byte saved by Martin Ender.

q_'(*\,(')*

Try it online


答:
k, 16 bytes

This is an anonymous function composition

```<code>{y,"(",x,")"}/|:
</code>```

Example

```<code>k){y,"(",x,")"}/|:"hello world"
"h(e(l(l(o( (w(o(r(l(d))))))))))"
</code>```

Title: N(e(s(t))) a string

Body:
k, 16 bytes

This is an anonymous function composition

{y,"(",x,")"}/|:

Example

k){y,"(",x,")"}/|:"hello world"
"h(e(l(l(o( (w(o(r(l(d))))))))))"


答:
Scala, 43 bytes

```<code>(s:Any,n:Int)=>((1 to n):\s)((_,x)=>Seq(x))
</code>```

Explanation:

```<code>(s:Any,n:Int)=>   //define a function
  (
    (1 to n)      //create a range with n elements
    :\s           //foldRight with s as a start value
  )(              //using the following function:
    (_,x)=>Seq(x) //ignore the value of the range and wrap the accumulator in a list
  )
</code>```

Title: Nest a string inside an array n times

Body:
You must produce a function which nests a string s inside an array, n times

```<code>>>> N("stackoverflow",2)
[['stackoverflow']]
</code>```

Parameters:

s - An ascii string

n - An integer >= 0

Rules

Shortest code wins.

The output will be a nested array, list or tuple (or similar type based off an array)

Test Cases

```<code>>>> N("stackoverflow",0)
'stackoverflow'
>>> N("stackoverflow",1)
['stackoverflow']
>>> N("stackoverflow",5)
[[[[['stackoverflow']]]]]
</code>```

Inspired by: Nesting a string inside a list n times ie list of a list of a list

Body:
Scala, 43 bytes

(s:Any,n:Int)=>((1 to n):\s)((_,x)=>Seq(x))

Explanation:

(s:Any,n:Int)=>   //define a function
  (
    (1 to n)      //create a range with n elements
    :\s           //foldRight with s as a start value
  )(              //using the following function:
    (_,x)=>Seq(x) //ignore the value of the range and wrap the accumulator in a list
  )


答:
Mathematica, <s>59</s> 56 bytes

```<code>_~f~0=1
n_~f~m_:=If[m>n,0,(n-m)f[n-1,m-1]+(m+1)f[n-1,m]]
</code>```

And here is a 59 byte version implementing the definition more literally:

```<code>Count[Count@1/@Sign/@Differences/@Permutations@Range@#,#2]&
</code>```

Title: Compute the Eulerian number

Body:
Mathematica, <s>59</s> 56 bytes

_~f~0=1
n_~f~m_:=If[m>n,0,(n-m)f[n-1,m-1]+(m+1)f[n-1,m]]

And here is a 59 byte version implementing the definition more literally:

Count[Count@1/@Sign/@Differences/@Permutations@Range@#,#2]&


答:
k, 3 bytes

```<code>,:/
</code>```

Taken as a dyadic function, / will iteratively apply the left-hand function ,: (enlist) n times to the second argument.

Example:

```<code>k),:/[3;"hello"]
,,,"hello"
</code>```

Title: Nest a string inside an array n times

Body:
k, 3 bytes

,:/

Taken as a dyadic function, / will iteratively apply the left-hand function ,: (enlist) n times to the second argument.

Example:

k),:/[3;"hello"]
,,,"hello"


问:
Image Smoothie!
Input into your program a black and white image. (png, jpg, etc)

Convert the image to a 2D matrix of pixels, where each index is the grayscale value of the image.

Take each index of the matrix and average the 8 pixels around it. Then replace that index with the average.

For example if you had:

```<code>120 80  60
20  10  30
40  100 05
</code>```

If you were finding the average for 10, the result would be 56.875, which is (120,80,60,30,05,100,40,20)/8.

Round to up to the nearest integer (57) and replace the index. The result of this iteration would be

```<code>120 80  60
20  57  30
40  100 05
</code>```

If you are finding the average for a pixel on an edge then only take values that are valid. In the example above if you were finding the average for 20 You would only consider 120, 80, 57, 100, and 40 which is 79.4 rounded to 80.

You may start at any index of the graph but it must be in order. For example you could do

```<code>[0][0], [0][1], ... [0][n], then [1][0], [1][1],... [1][n]
</code>```

Once the averaging is complete, convert the matrix back into a new image.

Display the new image as the output of the program. (Or save it and add it in your solution). The result of your code should be a blurry looking image but much smoother than the original.

Example Input

Example Output

Example Input two

Example Output two

Please provide your code and start and end image results.

Q/A

1Q. If one of the 8 neighbors has already been changed, should the average be calculated based on this new value, or based on the original values? That is, does the order of calculation affect the end result?

1A Yes, You should change each index with new values from any potential indices done before. That is why you need to go left-right, top-bottom etc. In order.

2Q. Could you clarify what is meant by "must be in order"? Does this mean that only raster order/reading order is acceptable? Or does it mean that the order must be the same each time the code is run? Would a spiral be valid? Or a shuffled order that is always the same?

2A. You should go left to right, right to left, top to bottom, or bottom to top. I.E. Do all of the 0th row, do all of the 1st row,... do all of the nth row

答:
Ruby 2.3.1, 338 bytes

```<code>->w{d,k=16843008,ChunkyPNG::Canvas.from_file(w);(0..k.height-1).each do |y|;(0..k.width-1).each do |x|;t,i,a=0,0,[[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y],[x+1,y],[x,y+1],[x,y+1],[x+1,y+1]];a.each do |c|; next unless k.include_xy?(c[0],c[1]);t=t+k.[](c[0],c[1]);i=i+1;end;n=t/i;while(n%d)>0 do;n=n+1;end;k.[]=(x,y,n-1);end;end;k.save("w")}
</code>```

Uses oily_png/chunky_png for image handling.

Goes left to right, top to bottom doing the averaging.

Since chunky uses integer color values, I'm doing a really, really slow up rounding method to get averaged color values to an actual grayscale value.

Example output(that took a very, very long time):

Ungolfed, slightly modded, and commented

```<code>require 'oily_png'
l = -> img {
  time_begin = Time.new
  d = 16843008
  k = ChunkyPNG::Canvas.from_file(img)
  # go line by line, pixel by pixel
  (0..k.height-1).each do |y|
    (0..k.width-1).each do |x|
      total, i = 0, 0
      p "Starting color is #{curr} or #{curr.to_s(16)}"
      # set the coords around the pixel we want
      around = [[x-1,y-1], [x, y-1], [x+1, y-1], [x-1,y], [x+1, y], [x,y+1], [x, y+1], [x+1, y+1]]
      # grab the 8 colors around the current pixel
      around.each do |coords|
        # ignore values that are not in bounds
        next unless k.include_xy?(coords[0], coords[1])
        # get a total to average later
        total = total + k.[](coords[0], coords[1])
        # increment
        i = i+1
      end
      # get the average value for the new color
      new_color = total/i
      # since new color will likely not be a grayscale value,
      # round up to the nearest grayscale value.
      # This is unfortunately really slow.
      while (new_color%d) > 0 do
        new_color = new_color+1
      end
      p "New color is now #{new_color-1} or #{(new_color-1).to_s(16)}"
      # set the color and
      # remove one from the color value to get full alpha instead of none.
      k.[]=(x, y, new_color-1)
    end
  end
  # save the complete image
  k.save("#{Time.new}.png")
}
l.($*[0])
</code>```

Could certainly do things a bit more efficiently, unfortunately I'm not quite how to. There's got to be a more clever way of handling the coordinate management for the 8 surrounding locations.

Title: Image Smoothie!

Body:
Ruby 2.3.1, 338 bytes

->w{d,k=16843008,ChunkyPNG::Canvas.from_file(w);(0..k.height-1).each do |y|;(0..k.width-1).each do |x|;t,i,a=0,0,[[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y],[x+1,y],[x,y+1],[x,y+1],[x+1,y+1]];a.each do |c|; next unless k.include_xy?(c[0],c[1]);t=t+k.[](c[0],c[1]);i=i+1;end;n=t/i;while(n%d)>0 do;n=n+1;end;k.[]=(x,y,n-1);end;end;k.save("w")}

Uses oily_png/chunky_png for image handling.

Goes left to right, top to bottom doing the averaging.

Since chunky uses integer color values, I'm doing a really, really slow up rounding method to get averaged color values to an actual grayscale value.

Example output(that took a very, very long time):

Ungolfed, slightly modded, and commented

require 'oily_png'
l = -> img {
  time_begin = Time.new
  d = 16843008
  k = ChunkyPNG::Canvas.from_file(img)
  # go line by line, pixel by pixel
  (0..k.height-1).each do |y|
    (0..k.width-1).each do |x|
      total, i = 0, 0
      p "Starting color is #{curr} or #{curr.to_s(16)}"
      # set the coords around the pixel we want
      around = [[x-1,y-1], [x, y-1], [x+1, y-1], [x-1,y], [x+1, y], [x,y+1], [x, y+1], [x+1, y+1]]
      # grab the 8 colors around the current pixel
      around.each do |coords|
        # ignore values that are not in bounds
        next unless k.include_xy?(coords[0], coords[1])
        # get a total to average later
        total = total + k.[](coords[0], coords[1])
        # increment
        i = i+1
      end
      # get the average value for the new color
      new_color = total/i
      # since new color will likely not be a grayscale value,
      # round up to the nearest grayscale value.
      # This is unfortunately really slow.
      while (new_color%d) > 0 do
        new_color = new_color+1
      end
      p "New color is now #{new_color-1} or #{(new_color-1).to_s(16)}"
      # set the color and
      # remove one from the color value to get full alpha instead of none.
      k.[]=(x, y, new_color-1)
    end
  end
  # save the complete image
  k.save("#{Time.new}.png")
}
l.($*[0])

Could certainly do things a bit more efficiently, unfortunately I'm not quite how to. There's got to be a more clever way of handling the coordinate management for the 8 surrounding locations.


答:
Python 2, <s>60</s> <s>57</s> 51 Bytes

```<code>def c(s):if(len(s)==1):return s;return s[0]+"("+c(s[1:])+")"
</code>```

After some clarification on the rules from @manatwork on white space,

```<code>def c(s):return s if(len(s)==1)else s[0]+"("+c(s[1:])+")"
</code>```

Thanks again @manatwork

```<code>def c(s):return s[0]+"("+c(s[1:])+")"if s[1:]else s
</code>```

Ungolfed:

```<code>def c(s):
    if(len(s)==1):
        return s;
    return s[0]+"("+c(s[1:])+")"
</code>```

Recursively calls itself and adds to the string.

```<code>c("CodeGolf") = 'C(o(d(e(G(o(l(f)))))))'
</code>```

Title: N(e(s(t))) a string

Body:
Python 2, <s>60</s> <s>57</s> 51 Bytes

def c(s):if(len(s)==1):return s;return s[0]+"("+c(s[1:])+")"

After some clarification on the rules from @manatwork on white space,

def c(s):return s if(len(s)==1)else s[0]+"("+c(s[1:])+")"

Thanks again @manatwork

def c(s):return s[0]+"("+c(s[1:])+")"if s[1:]else s

Ungolfed:

def c(s):
    if(len(s)==1):
        return s;
    return s[0]+"("+c(s[1:])+")"

Recursively calls itself and adds to the string.

c("CodeGolf") = 'C(o(d(e(G(o(l(f)))))))'


问:
Determine winner of Connect 4
You are given a partially filled Connect 4 grid (7x6).

```<code>O X
O X
X O X O     O
X O X O   X X
O X X X O O X
O O O X X O X
</code>```

(Input can be given as a 1D or 2D array and as letters or numbers, etc.)

Assume that

X started the game.

Nobody has won yet.

Players may not have played well until now, but now onwards they will both employ optimal strategies.

Input grid is not faulty.

You must output a single value that indicates which player wins (or a draw)

Code golf challenge; so shortest code wins. Your program does not have to actual compute the output in reasonable amount of time, but you should be able to prove that the output will be obtained correctly in a finite amount of time.

答:
Perl, <s>119</s> <s>118</s> 117 bytes

Includes +4 for -0p

Give rotated board padded with spaces on STDIN (gravity pulls stones to the right)

```<code>connect4.pl
  OXXX
   XOO
    OX
  OOXX
  XXXO
XXOOXO
OOXXOO
^D
</code>```

connect4.pl:

```<code>#!/usr/bin/perl -p0
y/XO/OX/if$^S|y/X//>y/O//;$_=$$_||=/Z@{[map"|O".".{$_}O"x3,0,5..7]}/sx||s% (?! )%$_="$`X$'";do$0%eg?/1/?3:1+/2/:2
</code>```

Prints 3 if player to move wins, 1 if player to move loses and 2 for a draw.

On older perls you can use a literal ^S to gain one byte.
If you don't mind extreme inefficiency you can leave out the $$_||= (transposition table) and gain 6 more bytes. If you leave out the $_= it will show you where to play instead of the result (play on 1 and win if there is one, play on 2 and draw if there is one or play on any 3 and lose)

Builds and evaluates a complete minimax tree. You will run out of memory and time unless the board is already reasonably well filled.

Title: Determine winner of Connect 4

Body:
Perl, <s>119</s> <s>118</s> 117 bytes

Includes +4 for -0p

Give rotated board padded with spaces on STDIN (gravity pulls stones to the right)

connect4.pl
  OXXX
   XOO
    OX
  OOXX
  XXXO
XXOOXO
OOXXOO
^D

connect4.pl:

#!/usr/bin/perl -p0
y/XO/OX/if$^S|y/X//>y/O//;$_=$$_||=/Z@{[map"|O".".{$_}O"x3,0,5..7]}/sx||s% (?! )%$_="$`X$'";do$0%eg?/1/?3:1+/2/:2

Prints 3 if player to move wins, 1 if player to move loses and 2 for a draw.

On older perls you can use a literal ^S to gain one byte.
If you don't mind extreme inefficiency you can leave out the $$_||= (transposition table) and gain 6 more bytes. If you leave out the $_= it will show you where to play instead of the result (play on 1 and win if there is one, play on 2 and draw if there is one or play on any 3 and lose)

Builds and evaluates a complete minimax tree. You will run out of memory and time unless the board is already reasonably well filled.


答:
Perl, <s>115</s> 112 bytes

```<code>print FKCIIBAVWMG=~s/(.)/\1 /gr.NPTNCCSPPSVCSPELSB=~s/(.)(.)/"\n$1".$"x19 .$2/gre."\nJCVCORIBCMG"=~s/(.)/\1 /gr;
</code>```

Produces the following output:

```<code>F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G
</code>```

The first and last rows of output have a trailing space.
The code makes use of regex replacements and the fact that if objects are not defined, they are interpreted as strings (e.g. FKCIIBAVWMG is treated as "FKCIIBAVWMG".  Couldn't take the quotes out of the last row because of the preceeding newline, which I couldn't finagle anywhere else.

Edit 1: Saved 3 bytes by replacing " " with $", removing the outer parentheses and inserting a space after print, and removing the parentheses around $"x19 and adding a space afterwards (so the . wouldn't be interpreted as a decimal)

Body:
Monopoly Board

For this code-golf challenge we will be building the board game Monopoly.

Rules:

Take no input.

Output a 11x11 board where each ASCII character forming the board is the first letter of each space of the U.S. version of the Monopoly board.

The characters must be separated by spaces.

Go should start in the bottom right.

The exact string to produce is

```<code>F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G
</code>```

Note that from bottom right to bottom left the squares are as follows:

```<code>G --> Go
M --> Mediterranean Avenue
C --> Community Chest
B --> Baltic Avenue
I --> Income Tax
...
J --> Jail
</code>```

Edit
Wow! you guys sure liked this one! :)

Body:
Perl, <s>115</s> 112 bytes

print FKCIIBAVWMG=~s/(.)/\1 /gr.NPTNCCSPPSVCSPELSB=~s/(.)(.)/"\n$1".$"x19 .$2/gre."\nJCVCORIBCMG"=~s/(.)/\1 /gr;

Produces the following output:

F K C I I B A V W M G
N                   P
T                   N
C                   C
S                   P
P                   S
V                   C
S                   P
E                   L
S                   B
J C V C O R I B C M G

The first and last rows of output have a trailing space.
The code makes use of regex replacements and the fact that if objects are not defined, they are interpreted as strings (e.g. FKCIIBAVWMG is treated as "FKCIIBAVWMG".  Couldn't take the quotes out of the last row because of the preceeding newline, which I couldn't finagle anywhere else.

Edit 1: Saved 3 bytes by replacing " " with $", removing the outer parentheses and inserting a space after print, and removing the parentheses around $"x19 and adding a space afterwards (so the . wouldn't be interpreted as a decimal)


问:
Spaced-out numbers
Given a list of N non-negative integers, output those numbers with each left-padded by spaces to a length of N. (Alternatively, return a character/string list.) You may assume that N is greater than or equal to the number of digits of the largest number in the list. Trailing spaces are allowed in the output.

You may also take a string containing these numbers, but N is not the length of the string, but rather the number of elements in the list; also, you may take a list of strings e.g. ["1", "2", "3"].

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

Test cases

```<code>input => 'output'
0 => '0'
1 => '1'
2 3 => ' 2 3'
2 10 => ' 210'
4 5 6 => '  4  5  6'
17 19 20 => ' 17 19 20'
7 8 9 10 => '   7   8   9  10'
100 200 300 0 => ' 100 200 300   0'
1000 400 30 7 => '1000 400  30   7'
1 33 333 7777 => '   1  33 3337777'
0 0 0 0 0 0 => '     0     0     0     0     0     0'
</code>```

答:
Groovy, 36 Bytes

```<code>{a->a.collect{it.padLeft(a.size())}}
</code>```

Takes in array of strings only, outputs array of padded strings.

Title: Spaced-out numbers

Body:
Groovy, 36 Bytes

{a->a.collect{it.padLeft(a.size())}}

Takes in array of strings only, outputs array of padded strings.


答:
Befunge, 120 bytes

```<code><v"FKCIIBAVWMG NPTNCCSPPSVCSPELSB $JCVCORIBCMG "
:<,*48 ,_v#-*48<
>1-:#v_\,>$52*, :48*-!#v_,54*
^,*84<         ^p19*88$<
</code>```

First line has the string to be printed in reverse (it looks like it's not, but the code is going backwards on that line). Second line prints the top and bottom rows. Third line and the left side of the fourth line print the middle rows, and the small chunk on the bottom right does an interesting thing: it moves the cursor back to the second row to print out the last line, but after finishing it, it quits.

As you can see on the first line, the strings are separated by spaces to distinguish between the first, middle, and last rows. The spaces can be anything else, and if I used ASCII characters 0-9, I could've easily saved 4 bytes. The $ you see is just a garbage character that has to be there and could be replaced with anything but a space.

Body:
Befunge, 120 bytes

<v"FKCIIBAVWMG NPTNCCSPPSVCSPELSB $JCVCORIBCMG "
:<,*48 ,_v#-*48<
>1-:#v_\,>$52*, :48*-!#v_,54*
^,*84<         ^p19*88$<

First line has the string to be printed in reverse (it looks like it's not, but the code is going backwards on that line). Second line prints the top and bottom rows. Third line and the left side of the fourth line print the middle rows, and the small chunk on the bottom right does an interesting thing: it moves the cursor back to the second row to print out the last line, but after finishing it, it quits.

As you can see on the first line, the strings are separated by spaces to distinguish between the first, middle, and last rows. The spaces can be anything else, and if I used ASCII characters 0-9, I could've easily saved 4 bytes. The $ you see is just a garbage character that has to be there and could be replaced with anything but a space.


问:
C# is the Main problem
This programming puzzle is inspired by another question which has been asked here yesterday but which was deleted by the author...

The challenge:

Create an executable binary (Windows .EXE or Linux binary) using Visual C# (or your favorite C# IDE) which prints the following text to the standard output:

```<code>Main() is the main method of C# programs!
</code>```

... without using the 4 consecutive letters M-A-I-N appearing in any source file!

Notes:

If your source code contains the text remainder (for example) it contains the 4 consecutive letters M-A-I-N, however if it contains mxain the 4 letters would not be consecutive any more so mxain would be allowed.

You are not allowed to run any programs but the C# IDE nor change the settings of the C# IDE to run other programs (but the ones it would normally run such as the C# compiler).

Otherwise you could simply say: "I write a Pascal program using the C# IDE and invoke the Pascal compiler in the 'pre-build' steps of my C# project".

This would be too simple.

Users of an IDE that can be extending using "plug-ins" (or similar) or that have built-in binary file editors (hex-editors) would have a too large advantage over users of other C# IDEs.

Therefore these featrues should also not be used.

Using the other non-ASCII-Editors (such as the dialog window editor) is explicitly allowed!

The user asking the original question proposed using the backslash in function names just like this: static void M\u0061in() Because this answer has already been read by other users it will not be accepted any more!

A user asked if it would be allowed to simply type in an .EXE file into the source code editor and to save the file as ".exe" instead of ".cs". Answer: I doub't that this is possible because both valid Windows and Linux binaries contain NUL bytes. However if you find a valid binary that can be created this way you have a valid solution.

The name of this site is "Programming Puzzles & Code Golf" - this is a "Programming Puzzle", not "Code Golf": The challenge is to find a working solution before all other users, not to find a solution shorter than all other solutions.

Therefore the first post describing a working solution wins!

Good luck!

By the way: I have a solution working under Visual C# Express 2010.

答:
I had to break the rules because I used vim with csc...</p>

```<code>class C {
    static void \u004d\u0061\u0069\u006e(){
        Syste\u006d.Co\u006esole.Write("\u004d\u0061\u0069\u006e() is the \u006d\u0061\u0069\u006e \u006dethod of C# progra\u006ds!");
    }
}
</code>```

Title: C# is the Main problem

Body:
I had to break the rules because I used vim with csc...

class C {
    static void \u004d\u0061\u0069\u006e(){
        Syste\u006d.Co\u006esole.Write("\u004d\u0061\u0069\u006e() is the \u006d\u0061\u0069\u006e \u006dethod of C# progra\u006ds!");
    }
}


问:
Obfuscated Hello World
Create the shortest possible obfuscated program that displays the text "Hello World".

In order to be considered an obfuscated program, it must meet at least two of the following requirements:

Does not contain the characters: h, l, w and d in any case

Does not contain the characters: e, o, r, 0, and 1 in any case

Does not contain the characters: 2 or 7

Input:

none

Output:

Hello World

Leaderboard

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

/* Configuration */

var QUESTION_ID = 307; // 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

```

答:
Vim, 31 keystrokes

```<code>ia<C-v><C-v>92<esc>22<C-a>SU<C-o>@"yyb Jb<C-v>x65yq<esc>g?g
</code>```

This was really fun! I'll write an explanation a little bit later.

Title: Obfuscated Hello World

Body:
Vim, 31 keystrokes

ia<C-v><C-v>92<esc>22<C-a>SU<C-o>@"yyb Jb<C-v>x65yq<esc>g?g

This was really fun! I'll write an explanation a little bit later.