答:
C++, 122 108 bytes

```<code>void a(){int a=65,l,i;for(l=1;l<53;l+=2){for(i=0;i<l;i++){std::putchar(a);a>90?a=65:a++;}std::cout<<'\n';}}
</code>```

First time trying my hand at one of these, so it'll probably be super inefficient.

It creates an integer a, then enters a for loop with l representing the number of characters in a line (stopping when reaching the maximum amount, 53) Inside the loop, it enters another loop based on the value of l, which prints a to the console, then either increments it or sets it back to A. After completing that loop, it prints a newline to extend the pyramid.

EDIT: Improved by changing a from a char to an int, which eliminates the need for (int)a++ among other things and saves precious bytes. Also replaced the while statement with an equivalent for.

Title: Alphabet triangle strikes again

Body:
Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

Body:
C++, 122 108 bytes

void a(){int a=65,l,i;for(l=1;l<53;l+=2){for(i=0;i<l;i++){std::putchar(a);a>90?a=65:a++;}std::cout<<'\n';}}

First time trying my hand at one of these, so it'll probably be super inefficient.

It creates an integer a, then enters a for loop with l representing the number of characters in a line (stopping when reaching the maximum amount, 53) Inside the loop, it enters another loop based on the value of l, which prints a to the console, then either increments it or sets it back to A. After completing that loop, it prints a newline to extend the pyramid.

EDIT: Improved by changing a from a char to an int, which eliminates the need for (int)a++ among other things and saves precious bytes. Also replaced the while statement with an equivalent for.


问:
What base is this number in?
Here's a nice easy challenge:

Given a string that represents a number in an unknown base, determine the lowest possible base that number might be in. The string will only contain 0-9, a-z. If you like, you may choose to take uppercase letters instead of lowercase, but please specify this. You must output this lowest possible base in decimal.

Here is a more concrete example. If the input string was "01234", it is impossible for this number to be in binary, since 2, 3, and 4 are all undefined in binary. Similarly, this number cannot be in base 3, or base 4. Therefore, this number must be in base-5, or a higher base, so you should output '5'.

Your code must work for any base between base 1 (unary, all '0's) and base 36 ('0-9' and 'a-z').

You may take input and provide output in any reasonable format. Base-conversion builtins are allowed. As usual, standard loopholes apply, and the shortest answer in bytes is the winner!

Test IO:

```<code>#Input          #Output
00000       --> 1
123456      --> 7
ff          --> 16
4815162342  --> 9
42          --> 5
codegolf    --> 25
0123456789abcdefghijklmnopqrstuvwxyz    --> 36
</code>```

答:
Mathematica, <s>34</s> 32 bytes

saved 2 bytes thanks to Martin Ender

```<code>Max@BaseForm[Characters@#,36]+1&
</code>```

Defines a pure function that takes a string as input.

Splits the input into characters, converts them to base 36 numbers, and returns the maximum +1.

ContentLicense: CC BY-SA 3.0

Title: What base is this number in?

Body:
Mathematica, <s>34</s> 32 bytes

saved 2 bytes thanks to Martin Ender

Max@BaseForm[Characters@#,36]+1&

Defines a pure function that takes a string as input.

Splits the input into characters, converts them to base 36 numbers, and returns the maximum +1.


答:
Mathematica, <s>34</s> 32 bytes

2 bytes saved thanks to Martin Ender

```<code>Max@Mod[ToCharacterCode@#-8,39]&
</code>```

I decided the different method deserved a new answer.

method <s>stolen</s> inspired by Dennis' solution

Title: What base is this number in?

Body:
Here's a nice easy challenge:

Given a string that represents a number in an unknown base, determine the lowest possible base that number might be in. The string will only contain 0-9, a-z. If you like, you may choose to take uppercase letters instead of lowercase, but please specify this. You must output this lowest possible base in decimal.

Here is a more concrete example. If the input string was "01234", it is impossible for this number to be in binary, since 2, 3, and 4 are all undefined in binary. Similarly, this number cannot be in base 3, or base 4. Therefore, this number must be in base-5, or a higher base, so you should output '5'.

Your code must work for any base between base 1 (unary, all '0's) and base 36 ('0-9' and 'a-z').

You may take input and provide output in any reasonable format. Base-conversion builtins are allowed. As usual, standard loopholes apply, and the shortest answer in bytes is the winner!

Test IO:

```<code>#Input          #Output
00000       --> 1
123456      --> 7
ff          --> 16
4815162342  --> 9
42          --> 5
codegolf    --> 25
0123456789abcdefghijklmnopqrstuvwxyz    --> 36
</code>```

Body:
Mathematica, <s>34</s> 32 bytes

2 bytes saved thanks to Martin Ender

Max@Mod[ToCharacterCode@#-8,39]&

I decided the different method deserved a new answer.

method <s>stolen</s> inspired by Dennis' solution


问:
Text animation format Code Golf
Working with old files from DOS, I found an ancient text animation format, that specify how much time each frame must be shown in the screen. It's very simple:

F1W5F2W3

This example above indicates that Frame 1 must be shown for 5 units of time, and frame 2 for 3 units more. Now I want to convert it to:

1, 1, 1, 1, 1, 2, 2, 2

In the converted example below, frame 1 is repeated 5 times, and frame 2 three times.

Rules: The only allowed letters are F and W (and the lowercase counterparts, f and w). Numbers can go up to 255. Total input String with no more than 255 chars.

Other examples:

Input: F10W3F11W3F10W3F12W3

Output: 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 12, 12

Input: f1w0f2w10

Output: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2

Short code wins.

Edited - Accepted formats:
Any answer containing the output and ignoring spaces. Ex: 1, 1, 2, 2 or [1,1,2,2] or (1,1,2,2). But NOT 1 1 2 2 or [1; 1; 2; 2] or [1 1 2 2].

答:
JavaScript ES6, 68 bytes

```<code>s=>s.replace(/F(\d+)W(\d+)/gi,(z,a,b)=>(f=n=>n&&f(n-1,alert(a)))(b))
</code>```

Hopefully an alert box counts as a frame as I couldn't think of another way to count as a 'frame'.

Slightly modified version to try in-browser

t=function(s){s.replace(/F(\d+)W(\d+)/gi,function(z,a,b){(f=function(n){return n&&f(n-1,alert(a))})(b)})}

// Demo
document.getElementById('go').onclick=function(){
  document.getElementById('output').innerHTML = t(document.getElementById('input').value)
};```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div style="padding-left:5px;padding-right:5px;"><h2 style="font-family:sans-serif">Text Animation</h2><div><div  style="background-color:#EFEFEF;border-radius:4px;padding:10px;"><input placeholder="Input here..." style="resize:none;border:1px solid #DDD;" id="input"><button id='go'>Run!</button></div><br><div style="background-color:#EFEFEF;border-radius:4px;padding:10px;"><span style="font-family:sans-serif;">Output:</span><br><pre id="output" style="background-color:#DEDEDE;padding:1em;border-radius:2px;overflow-x:auto;">```

```

Title: Text animation format Code Golf

Body:
JavaScript ES6, 68 bytes

s=>s.replace(/F(\d+)W(\d+)/gi,(z,a,b)=>(f=n=>n&&f(n-1,alert(a)))(b))

Hopefully an alert box counts as a frame as I couldn't think of another way to count as a 'frame'.

Slightly modified version to try in-browser

t=function(s){s.replace(/F(\d+)W(\d+)/gi,function(z,a,b){(f=function(n){return n&&f(n-1,alert(a))})(b)})}

// Demo
document.getElementById('go').onclick=function(){
  document.getElementById('output').innerHTML = t(document.getElementById('input').value)
};

<div style="padding-left:5px;padding-right:5px;"><h2 style="font-family:sans-serif">Text Animation</h2><div><div  style="background-color:#EFEFEF;border-radius:4px;padding:10px;"><input placeholder="Input here..." style="resize:none;border:1px solid #DDD;" id="input"><button id='go'>Run!</button></div><br><div style="background-color:#EFEFEF;border-radius:4px;padding:10px;"><span style="font-family:sans-serif;">Output:</span><br><pre id="output" style="background-color:#DEDEDE;padding:1em;border-radius:2px;overflow-x:auto;"></pre></div></div></div>


答:
Perl - <s>137</s> 133 bytes

```<code>print"\t0.0$_"for 0..9;for($f=2.506628;$i++<80;$f*=-++$i){printf'
%.1f',$x,s;;+\$x**$i/$i/$f;;printf"\t%.4f",eval,$x+=.01for(.5.$_)x10}
</code>```

(both \t should be replaced with a literal tab character.)

Uses a Taylor Series expansion[1], adding one term per row, which seems to be good enough. The script produces the output exactly as expected, <s>although each row does have a trailing whitespace</s>. Runs in about 60ms on my lappy.

Edit as per comment by Peter Taylor.

[1] http://mathworld.wolfram.com/NormalDistributionFunction.html (formula 10)

Title: Normal distribution values

Body:
Write the shortest program possible which outputs a table of Normal distribution values

```<code>phi(z) = Integral[t from -infty to z of e^(-t^2/2) /sqrt(2 pi) dt]
</code>```

for z from 0.00 to 3.99, giving values accurate to 4 decimal places.

The canonical format for such a table appears to be:

```<code>    0.00    0.01    0.02    0.03    0.04    0.05    0.06    0.07    0.08    0.09
0.0 0.5000  0.5040  0.5080  0.5120  0.5160  0.5199  0.5239  0.5279  0.5319  0.5359
0.1 0.5398  0.5438  0.5478  0.5517  0.5557  0.5596  0.5636  0.5675  0.5714  0.5753
0.2 0.5793  0.5832  0.5871  0.5910  0.5948  0.5987  0.6026  0.6064  0.6103  0.6141
0.3 0.6179  0.6217  0.6255  0.6293  0.6331  0.6368  0.6406  0.6443  0.6480  0.6517
0.4 0.6554  0.6591  0.6628  0.6664  0.6700  0.6736  0.6772  0.6808  0.6844  0.6879
0.5 0.6915  0.6950  0.6985  0.7019  0.7054  0.7088  0.7123  0.7157  0.7190  0.7224
0.6 0.7257  0.7291  0.7324  0.7357  0.7389  0.7422  0.7454  0.7486  0.7517  0.7549
0.7 0.7580  0.7611  0.7642  0.7673  0.7704  0.7734  0.7764  0.7794  0.7823  0.7852
0.8 0.7881  0.7910  0.7939  0.7967  0.7995  0.8023  0.8051  0.8078  0.8106  0.8133
0.9 0.8159  0.8186  0.8212  0.8238  0.8264  0.8289  0.8315  0.8340  0.8365  0.8389
1.0 0.8413  0.8438  0.8461  0.8485  0.8508  0.8531  0.8554  0.8577  0.8599  0.8621
1.1 0.8643  0.8665  0.8686  0.8708  0.8729  0.8749  0.8770  0.8790  0.8810  0.8830
1.2 0.8849  0.8869  0.8888  0.8907  0.8925  0.8944  0.8962  0.8980  0.8997  0.9015
1.3 0.9032  0.9049  0.9066  0.9082  0.9099  0.9115  0.9131  0.9147  0.9162  0.9177
1.4 0.9192  0.9207  0.9222  0.9236  0.9251  0.9265  0.9279  0.9292  0.9306  0.9319
1.5 0.9332  0.9345  0.9357  0.9370  0.9382  0.9394  0.9406  0.9418  0.9429  0.9441
1.6 0.9452  0.9463  0.9474  0.9484  0.9495  0.9505  0.9515  0.9525  0.9535  0.9545
1.7 0.9554  0.9564  0.9573  0.9582  0.9591  0.9599  0.9608  0.9616  0.9625  0.9633
1.8 0.9641  0.9649  0.9656  0.9664  0.9671  0.9678  0.9686  0.9693  0.9699  0.9706
1.9 0.9713  0.9719  0.9726  0.9732  0.9738  0.9744  0.9750  0.9756  0.9761  0.9767
2.0 0.9772  0.9778  0.9783  0.9788  0.9793  0.9798  0.9803  0.9808  0.9812  0.9817
2.1 0.9821  0.9826  0.9830  0.9834  0.9838  0.9842  0.9846  0.9850  0.9854  0.9857
2.2 0.9861  0.9864  0.9868  0.9871  0.9875  0.9878  0.9881  0.9884  0.9887  0.9890
2.3 0.9893  0.9896  0.9898  0.9901  0.9904  0.9906  0.9909  0.9911  0.9913  0.9916
2.4 0.9918  0.9920  0.9922  0.9925  0.9927  0.9929  0.9931  0.9932  0.9934  0.9936
2.5 0.9938  0.9940  0.9941  0.9943  0.9945  0.9946  0.9948  0.9949  0.9951  0.9952
2.6 0.9953  0.9955  0.9956  0.9957  0.9959  0.9960  0.9961  0.9962  0.9963  0.9964
2.7 0.9965  0.9966  0.9967  0.9968  0.9969  0.9970  0.9971  0.9972  0.9973  0.9974
2.8 0.9974  0.9975  0.9976  0.9977  0.9977  0.9978  0.9979  0.9979  0.9980  0.9981
2.9 0.9981  0.9982  0.9982  0.9983  0.9984  0.9984  0.9985  0.9985  0.9986  0.9986
3.0 0.9987  0.9987  0.9987  0.9988  0.9988  0.9989  0.9989  0.9989  0.9990  0.9990
3.1 0.9990  0.9991  0.9991  0.9991  0.9992  0.9992  0.9992  0.9992  0.9993  0.9993
3.2 0.9993  0.9993  0.9994  0.9994  0.9994  0.9994  0.9994  0.9995  0.9995  0.9995
3.3 0.9995  0.9995  0.9995  0.9996  0.9996  0.9996  0.9996  0.9996  0.9996  0.9997
3.4 0.9997  0.9997  0.9997  0.9997  0.9997  0.9997  0.9997  0.9997  0.9997  0.9998
3.5 0.9998  0.9998  0.9998  0.9998  0.9998  0.9998  0.9998  0.9998  0.9998  0.9998
3.6 0.9998  0.9998  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999
3.7 0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999
3.8 0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999  0.9999
3.9 1.0000  1.0000  1.0000  1.0000  1.0000  1.0000  1.0000  1.0000  1.0000  1.0000
</code>```

Body:
Perl - <s>137</s> 133 bytes

print"\t0.0$_"for 0..9;for($f=2.506628;$i++<80;$f*=-++$i){printf'
%.1f',$x,s;;+\$x**$i/$i/$f;;printf"\t%.4f",eval,$x+=.01for(.5.$_)x10}

(both \t should be replaced with a literal tab character.)

Uses a Taylor Series expansion[1], adding one term per row, which seems to be good enough. The script produces the output exactly as expected, <s>although each row does have a trailing whitespace</s>. Runs in about 60ms on my lappy.

Edit as per comment by Peter Taylor.

[1] http://mathworld.wolfram.com/NormalDistributionFunction.html (formula 10)


问:
Alphabet triangle strikes again

Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

答:
VBA Excel (80 bytes, 1742 bytes)

Excel, 1742 bytes

Inspired by the ugoren's creative answer, I managed to find an Excel formula to create the pattern as shown in the OP.

```<code>=MID(REPT("ABCDEFGHIJKLMNOPQRSTUVWXYZ",26),(ROW()-1)^2+1,2*ROW()-1)
</code>```

Paste this formula in cell A1, then drag all over range A1:A26.

The length of the formula is 67 bytes but you have to replicate it 26 times, so it's equal to 67*26=1742 bytes. Here is the output:

Excel VBA, 80 bytes

Now it's possible we integrate Excel with VBA to automate the process and to save many bytes since VBA is built into most Microsoft Office applications, including Excel. Write and run the following code in the Immediate Window (use combination keys CTRL+G to display it in Visual Basic Editor):

```<code>[A1:A26]="=MID(REPT(""ABCDEFGHIJKLMNOPQRSTUVWXYZ"",26),(ROW()-1)^2+1,2*ROW()-1)"
</code>```

The program works by printing the Excel formula above to the range A1:A26. Unfortunately, both Excel and VBA have no built-in alphabet.

Title: Alphabet triangle strikes again

Body:
VBA Excel (80 bytes, 1742 bytes)

Excel, 1742 bytes

Inspired by the ugoren's creative answer, I managed to find an Excel formula to create the pattern as shown in the OP.

=MID(REPT("ABCDEFGHIJKLMNOPQRSTUVWXYZ",26),(ROW()-1)^2+1,2*ROW()-1)

Paste this formula in cell A1, then drag all over range A1:A26.

The length of the formula is 67 bytes but you have to replicate it 26 times, so it's equal to 67*26=1742 bytes. Here is the output:

Excel VBA, 80 bytes

Now it's possible we integrate Excel with VBA to automate the process and to save many bytes since VBA is built into most Microsoft Office applications, including Excel. Write and run the following code in the Immediate Window (use combination keys CTRL+G to display it in Visual Basic Editor):

[A1:A26]="=MID(REPT(""ABCDEFGHIJKLMNOPQRSTUVWXYZ"",26),(ROW()-1)^2+1,2*ROW()-1)"

The program works by printing the Excel formula above to the range A1:A26. Unfortunately, both Excel and VBA have no built-in alphabet.


答:
Python 3, 57 bytes

lambda s:eval(s.upper().translate({70:'+[',87:']*'})[1:])
```
<p>Turns a string like</p>
```f1w0f2w10
```
<p>into a expression like</p>
```[1]*0+[2]*10
```

that it evaluated as code. This is done by turning the string uppercase, turning each f into +[ and each w into ]*, and removing the initial +. Thanks to Dennis for saving 7 bytes in Python 3 by using translate with a dictionary.

Title: Text animation format Code Golf

Body:
Working with old files from DOS, I found an ancient text animation format, that specify how much time each frame must be shown in the screen. It's very simple:

F1W5F2W3

This example above indicates that Frame 1 must be shown for 5 units of time, and frame 2 for 3 units more. Now I want to convert it to:

1, 1, 1, 1, 1, 2, 2, 2

In the converted example below, frame 1 is repeated 5 times, and frame 2 three times.

Rules: The only allowed letters are F and W (and the lowercase counterparts, f and w). Numbers can go up to 255. Total input String with no more than 255 chars.

Other examples:

Input: F10W3F11W3F10W3F12W3

Output: 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 12, 12

Input: f1w0f2w10

Output: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2

Short code wins.

Edited - Accepted formats:
Any answer containing the output and ignoring spaces. Ex: 1, 1, 2, 2 or [1,1,2,2] or (1,1,2,2). But NOT 1 1 2 2 or [1; 1; 2; 2] or [1 1 2 2].

Body:
Python 3, 57 bytes

lambda s:eval(s.upper().translate({70:'+[',87:']*'})[1:])

Turns a string like

f1w0f2w10

into a expression like

[1]*0+[2]*10

that it evaluated as code. This is done by turning the string uppercase, turning each f into +[ and each w into ]*, and removing the initial +. Thanks to Dennis for saving 7 bytes in Python 3 by using translate with a dictionary.


答:
Actually, 6 bytes

```<code>M6²@¿u
</code>```

Try it online!

Title: What base is this number in?

Body:
Actually, 6 bytes

M6²@¿u

Try it online!


答:
V, 25 bytes

```<code>Óá¨ä«©á¨ä«©/²a±,
D@"hD
</code>```

Try it online!

Here is a hexdump of the answer, which is encoded in latin1:

```<code>0000000: d3e1 a8e4 aba9 e1a8 e4ab a92f b261 b12c  .........../.a.,
0000010: 2016 1b0a 4440 2268 44                    ...D@"hD
</code>```

Explanation:

<C-v> is byte 0x16 and <esc> is byte 0x1B. Since they are both unprintable, I am using this notation to refer to them.

```<code>Óá¨ä«©á¨ä«©/²a±, <C-v><esc>
</code>```

This is a compressed regex, that basically transforms the input into V code. Here's what the buffer looks like after running this regex:

```<code>3a10, <esc>3a11, <esc>3a10, <esc>3a12, <esc>
</code>```

Here's how that works:

```<code>3           "3 times:
 a    <esc> "Append the following text:
  10,       " '10, '
</code>```

Running this in V (or its parent, vim) would create:

```<code>10, 10, 10,
</code>```

And then a similar command repeats for each element of the input.

So, after running this regex, we've got valid V code that will create the desired output. Thankfully, V can easily self-interpret, as long as the code is in a buffer. So, we run the following:

```<code>D      "Delete this line into the unnamed register
 @"    "Run the text in the unnamed register as V code
</code>```

This is exactly what we want, but now the output has a trailing ,. So:

```<code>h      "Move one character to the left. Now we are on the second to last character
 D     "Delete until the end of the current line
</code>```

Title: Text animation format Code Golf

Body:
V, 25 bytes

Óá¨ä«©á¨ä«©/²a±,
D@"hD

Try it online!

Here is a hexdump of the answer, which is encoded in latin1:

0000000: d3e1 a8e4 aba9 e1a8 e4ab a92f b261 b12c  .........../.a.,
0000010: 2016 1b0a 4440 2268 44                    ...D@"hD

Explanation:

<C-v> is byte 0x16 and <esc> is byte 0x1B. Since they are both unprintable, I am using this notation to refer to them.

Óá¨ä«©á¨ä«©/²a±, <C-v><esc>

This is a compressed regex, that basically transforms the input into V code. Here's what the buffer looks like after running this regex:

3a10, <esc>3a11, <esc>3a10, <esc>3a12, <esc>

Here's how that works:

3           "3 times:
 a    <esc> "Append the following text:
  10,       " '10, '

Running this in V (or its parent, vim) would create:

10, 10, 10,

And then a similar command repeats for each element of the input.

So, after running this regex, we've got valid V code that will create the desired output. Thankfully, V can easily self-interpret, as long as the code is in a buffer. So, we run the following:

D      "Delete this line into the unnamed register
 @"    "Run the text in the unnamed register as V code

This is exactly what we want, but now the output has a trailing ,. So:

h      "Move one character to the left. Now we are on the second to last character
 D     "Delete until the end of the current line


问:
Integer square root of integer
Problem:

In your choice of language, write the shortest function that returns the floor of the square root of an unsigned 64-bit integer.

Test cases:

Your function must work correctly for all inputs, but here are a few which help illustrate the idea:

```<code>               INPUT ⟶ OUTPUT

                   0 ⟶  0
                   1 ⟶  1
                   2 ⟶  1
                   3 ⟶  1
                   4 ⟶  2
                   8 ⟶  2
                   9 ⟶  3
                  15 ⟶  3
                  16 ⟶  4
               65535 ⟶ 255
               65536 ⟶ 256
18446744073709551615 ⟶ 4294967295
</code>```

Rules:

You can name your function anything you like. (Unnamed, anonymous, or lambda functions are fine, as long as they are somehow callable.)

Character count is what matters most in this challenge, but runtime is also important. I'm sure you could scan upwards iteratively for the answer in O(√n) time with a very small character count, but O(log(n)) time would really be better (that is, assuming an input value of n, not a bit-length of n).

You will probably want to implement the function using purely integer and/or boolean artithmetic. However, if you really want to use floating-point calculations, then that is fine so long as you call no library functions. So, simply saying return (n>0)?(uint32_t)sqrtl(n):-1; in C is off limits even though it would produce the correct result. If you're using floating-point arithmetic, you may use *, /, +, -, and exponentiation (e.g., ** or ^ if it's a built-in operator in your language of choice, but only exponentiation of powers not less than 1). This restriction is to prevent "cheating" by calling sqrt() or a variant or raising a value to the ½ power.

If you're using floating-point operations (see #3), you aren't required that the return type be integer; only that that the return value is an integer, e.g., floor(sqrt(n)), and be able to hold any unsigned 32-bit value.

If you're using C/C++, you may assume the existence of unsigned 64-bit and 32-bit integer types, e.g., uint64_t and uint32_t as defined in stdint.h. Otherwise, just make sure your integer type is capable of holding any 64-bit unsigned integer.

If your langauge does not support 64-bit integers (for example, Brainfuck apparently only has 8-bit integer support), then do your best with that and state the limitation in your answer title. That said, if you can figure out how to encode a 64-bit integer and correctly obtain the square root of it using 8-bit primitive arithmetic, then more power to you!

Have fun and get creative!

答:
C, <s>139</s> <s>137</s> 136 bytes

My first try at code golf. It looks like it's the shortest in C that fits the "efficient" requirement, as it runs in O(log n) time, using only addition and bit shifts. Though I'm sure it could be shorter yet...

It should work just fine for larger integer values too as long as the a=32 part is changed to a=NUMBITS/2.

```<code>typedef uint64_t x;x f(x o){x a=32,t=0,r=0,y=0,z;for(;a--+1;){z=(x)3<<2*a;y*=2;t++<r?y++,r-=t++:t--;t*=2;r*=4;r+=(o&z)>>2*a;}return y;}
</code>```

Title: Integer square root of integer

Body:
C, <s>139</s> <s>137</s> 136 bytes

My first try at code golf. It looks like it's the shortest in C that fits the "efficient" requirement, as it runs in O(log n) time, using only addition and bit shifts. Though I'm sure it could be shorter yet...

It should work just fine for larger integer values too as long as the a=32 part is changed to a=NUMBITS/2.

typedef uint64_t x;x f(x o){x a=32,t=0,r=0,y=0,z;for(;a--+1;){z=(x)3<<2*a;y*=2;t++<r?y++,r-=t++:t--;t*=2;r*=4;r+=(o&z)>>2*a;}return y;}


答:
C++, 111 bytes

```<code>void a(){int c=65,i,j;for(i=0;i<26;i++){for(j=0;j<=2*i;j++){std::cout<<(char)c;c++;if(c==91)c=65;}std::cout<<'\n';}}
</code>```

First try at one of these.
Uses an int "c" to record which letter it needs to print at any given time. Once "c" passes 90 ('Z') it gets reset to 65 ('A'). Prints the pyramid using for loops.

Title: Alphabet triangle strikes again

Body:
C++, 111 bytes

void a(){int c=65,i,j;for(i=0;i<26;i++){for(j=0;j<=2*i;j++){std::cout<<(char)c;c++;if(c==91)c=65;}std::cout<<'\n';}}

First try at one of these.
Uses an int "c" to record which letter it needs to print at any given time. Once "c" passes 90 ('Z') it gets reset to 65 ('A'). Prints the pyramid using for loops.


答:
PHP, <s>51</s> 38 bytes

(From Dennis) ^^

```<code><?=(ord(max(str_split($argv[1])))-8)%39;
</code>```

Other proposal without Dennis' trick

```<code><?=($a=max(str_split($argv[1])))<a?$a+1:ord($a)-86;
</code>```

Takes input as argument $argv[1];

Take max character (using ASCII) values

If it is a number (inferior to < 'a' ascii value) then output number+1

Else output ascii value -86 (97 for 'a' in ascii, -11 for 'a' is 11th base-digit)

Title: What base is this number in?

Body:
PHP, <s>51</s> 38 bytes

(From Dennis) ^^

<?=(ord(max(str_split($argv[1])))-8)%39;

Other proposal without Dennis' trick

<?=($a=max(str_split($argv[1])))<a?$a+1:ord($a)-86;

Takes input as argument $argv[1];

Take max character (using ASCII) values

If it is a number (inferior to < 'a' ascii value) then output number+1

Else output ascii value -86 (97 for 'a' in ascii, -11 for 'a' is 11th base-digit)


问:
Evaluate a Dice 10,000 roll

Introduction

Dice 10,000 is a dice game which can be played with 6 dice and something to write. Players roll the dice multiple times a turn and gain a score at the end of it. The player who reaches 10,000 point first wins the game. Calculating the score of one roll is your job in this challenge.

Look here for the full rules.

Please note that the rules (especically the scoring) change from region to region since the game is widely known. We use the rules descibed below.

The Challenge

Given a list of six numbers from one to six representing a dice roll, output their score. The score is calculated in the follwing way:

Ones counts 100 points

Fives counts 50 points

Triplets count their number times 100 points. Three twos for example give 200 points. An exception are three ones which count 1000 points.

Six of the same number count like two triplets as described above. So six threes give 600 points. The same goes for the edge case with the ones: Six ones are 2,000 points.

One die can't be used more than once. If a die is part of a triplet, it does not count for other scorings. The fives in a triplet do not count 50 points in addition to the 500 points they give.

Triples are always counted first to maximize the score. So three fives are never counted as 150 points. Four fives are counted as one triplet and one ordinary five which then gives 550 points.

Notes

The input will always contain six numbers from one to six. You will not recieve invalid input.

The numbers can be in any order. You may not assume any specific ordering.

Rules

Input format is up to  you as long as it's not preprocessed.

Function or full program allowed.

Default rules for input/output.

Standard loopholes apply.

This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.

Test cases

```
[1, 2, 3, 4, 5, 6] -> 150
[1, 1, 1, 2, 3, 5] -> 1050
[1, 1, 1, 1, 1, 1] -> 2000
[2, 2, 2, 2, 2, 2] -> 400
[6, 6, 1, 5, 5, 6] -> 800
[2, 3, 4, 6, 2, 4] -> 0
[1, 5, 1, 5, 1, 5] -> 1500
[5, 5, 5, 5, 2, 3] -> 550
[1, 1, 1, 1, 1, 5] -> 1250
[3, 3, 4, 4, 3, 4] -> 700
```

Title: Evaluate a Dice 10,000 roll

Body:
Javascript (ES6), <s>85</s> 84 bytes

x=>x.map(v=>s+=v*(((z+=1<<v*3)>>v*3&7)%3?v-5?v-1?0:10:1:v-5?v-1?10:80:8),s=z=0)|10*s

Test cases:

let F =
x=>x.map(v=>s+=v*(((z+=1<<v*3)>>v*3&7)%3?v-5?v-1?0:10:1:v-5?v-1?10:80:8),s=z=0)|10*s

console.log(F([1, 2, 3, 4, 5, 6])); // 150
console.log(F([1, 1, 1, 2, 3, 5])); // 1050
console.log(F([1, 1, 1, 1, 1, 1])); // 2000
console.log(F([2, 2, 2, 2, 2, 2])); // 400
console.log(F([6, 6, 1, 5, 5, 6])); // 800
console.log(F([2, 3, 4, 6, 2, 4])); // 0
console.log(F([1, 5, 1, 5, 1, 5])); // 1500
console.log(F([5, 5, 5, 5, 2, 3])); // 550
console.log(F([1, 1, 1, 1, 1, 5])); // 1250
console.log(F([3, 3, 4, 4, 3, 4])); // 700


答:
PHP, <s>76</s> 69 bytes

```<code>for(;$i<26&&$a.=join(range(A,Z));)echo substr($a,$i**2,1+2*$i++)."
";
</code>```

Create 26 alphabet (more than enough) and contactenate them in $a

loop for i < 26

display $a substring start i^2, end 2*i+1

Title: Alphabet triangle strikes again

Body:
Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

Body:
PHP, <s>76</s> 69 bytes

for(;$i<26&&$a.=join(range(A,Z));)echo substr($a,$i**2,1+2*$i++)."
";

Create 26 alphabet (more than enough) and contactenate them in $a

loop for i < 26

display $a substring start i^2, end 2*i+1


答:
Mathematica 132 136 127

If Erfc is acceptable, here's my attempt, accurate to 6 places:

```<code>t=Table;TableForm[Partition[t[0.5 Erfc[-x/Sqrt[2]],{x,0,3.99,.01}],10],
TableHeadings->{t[k,{k,0,3.9,.1}],t[k,{k,0,.09,.01}]}]
</code>```

Title: Normal distribution values

Body:
Mathematica 132 136 127

If Erfc is acceptable, here's my attempt, accurate to 6 places:

t=Table;TableForm[Partition[t[0.5 Erfc[-x/Sqrt[2]],{x,0,3.99,.01}],10],
TableHeadings->{t[k,{k,0,3.9,.1}],t[k,{k,0,.09,.01}]}]


问:
Can I take your order: a Chipotle concept conund

Challenge

Your program will take in a string from stdin, and output multiple lines to stdout.

An example of input looks like this:

My favorite Chipotle order:

B1113YNNY

Let's break it down:

The first character is either A (burrito), or B (burrito bowl).

The second character is 1 (black beans), or 2 (pinto beans).

The third character is either 1 (white rice), or 2 (brown rice).

The fourth character is either 1 (chicken), 2 (sofritas), or 3 (steak).

The fifth character is either 1 (mild salsa), 2 (medium salsa), or 3 (hot salsa).

The last four characters are Y if they want the item, or N otherwise:

character 6 is corn

character 7 is guacamole

character 8 is sour cream

character 9 is cheese

A working program for this challenge will output this to stdout:

burrito bowl with:

  black beans

  white rice

  chicken

  hot salsa

  corn

  cheese

Replace the above words with the words acquired from input.

Clarifications.

Standard loopholes are disallowed.

You may only get input from stdin, and only put output to stdout.

答:
Python 2, <s>336</s> 335 Bytes

```<code>q,i=input(),int
print"burrito "+{"A":"","B":"bowl"}[q[0]]+" with:\n"+["black","pinto"][i(q[1])-1]+" beans\n"+["white","brown"][i(q[2])-1]+" rice\n"+["chicken","sofritas","steak"][i(q[3])-1]+"\n"+["mild","medium","hot"][i(q[4])-1]+" salsa\n"+"\n".join([x for y,x in enumerate(["corn","guacamole","sour cream","cheese"]) if q[y+5]=="Y"])
</code>```

Try it online!

Removed one byte by renaming int: i=int

Body:
Python 2, <s>336</s> 335 Bytes

q,i=input(),int
print"burrito "+{"A":"","B":"bowl"}[q[0]]+" with:\n"+["black","pinto"][i(q[1])-1]+" beans\n"+["white","brown"][i(q[2])-1]+" rice\n"+["chicken","sofritas","steak"][i(q[3])-1]+"\n"+["mild","medium","hot"][i(q[4])-1]+" salsa\n"+"\n".join([x for y,x in enumerate(["corn","guacamole","sour cream","cheese"]) if q[y+5]=="Y"])

Try it online!

Removed one byte by renaming int: i=int


答:
Octave, 20 bytes

```<code>@(a)mod(max(a)-8,39)
</code>```

Title: What base is this number in?

Body:
Here's a nice easy challenge:

Given a string that represents a number in an unknown base, determine the lowest possible base that number might be in. The string will only contain 0-9, a-z. If you like, you may choose to take uppercase letters instead of lowercase, but please specify this. You must output this lowest possible base in decimal.

Here is a more concrete example. If the input string was "01234", it is impossible for this number to be in binary, since 2, 3, and 4 are all undefined in binary. Similarly, this number cannot be in base 3, or base 4. Therefore, this number must be in base-5, or a higher base, so you should output '5'.

Your code must work for any base between base 1 (unary, all '0's) and base 36 ('0-9' and 'a-z').

You may take input and provide output in any reasonable format. Base-conversion builtins are allowed. As usual, standard loopholes apply, and the shortest answer in bytes is the winner!

Test IO:

```<code>#Input          #Output
00000       --> 1
123456      --> 7
ff          --> 16
4815162342  --> 9
42          --> 5
codegolf    --> 25
0123456789abcdefghijklmnopqrstuvwxyz    --> 36
</code>```

Body:
Octave, 20 bytes

@(a)mod(max(a)-8,39)


答:
05AB1E, 6 bytes

```<code>{¤36ö>
</code>```

Takes letters in upper case.

Explanation

```<code>{       # sort
 ¤      # take last
  36ö   # convert from base 36 to base 10
     >  # increment
</code>```

Try it online

Title: What base is this number in?

Body:
05AB1E, 6 bytes

{¤36ö>

Takes letters in upper case.

Explanation

{       # sort
 ¤      # take last
  36ö   # convert from base 36 to base 10
     >  # increment

Try it online


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

The Official Dyalog APL 2016 Year Game

The monthly Dyalog APL 2017 Code Golf Challenge

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

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

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

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

Examples of valid snippets

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

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

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

Examples of invalid snippets

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

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

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

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

Only character based languages allowed.

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

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

FAQ

Q Can the programs accept any input?

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

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

A Yes, e.g. LOG10().

Q Do Symbols in Ruby count as literals?

A Yes.

Q Does score include newlines between each snippet?

A No.

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

A Yes.

Q Do false and true count as number literals?

A No, they are acceptable.

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

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

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

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

Q What about regex literals?

A Forbidden, except for languages that only do regexes.

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

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

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

A Yes.

Q What output datatypes are allowed?

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

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

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

Q Are pre-set variables allowed?

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

Q Are π and e considered number literals?

A No, you may use them.

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

A No, they must be connected as one number.

Q Bytes or characters?

A Bytes, but you may choose any desired codepage.

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

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

答:
Actually, 32 bytes

```<code>╜
╒K
 ⌐
╦L
╦K
╦L⌐
╦Lτ
╠²L
╦L╙
╦L²
kY╤
╒º╦+L
</code>```

All full programs. Try it online!

Explanation

╒ is ln(2)

╦ is pi

╠ is e

L is floor

K is ceil

τ is double

² is square

For the last one:

```<code>╒º╦+L
╒      ln(2)
 º     convert from radian to degree (39.71440802747729)
  ╦+   + pi (42.85600068106709)
    L  floor
</code>```

Title: No strings (or numbers) attached

Body:
Actually, 32 bytes

╜
╒K
 ⌐
╦L
╦K
╦L⌐
╦Lτ
╠²L
╦L╙
╦L²
kY╤
╒º╦+L

All full programs. Try it online!

Explanation

╒ is ln(2)

╦ is pi

╠ is e

L is floor

K is ceil

τ is double

² is square

For the last one:

╒º╦+L
╒      ln(2)
 º     convert from radian to degree (39.71440802747729)
  ╦+   + pi (42.85600068106709)
    L  floor

ContentLicense: CC BY-SA 4.0


Title: Text animation format Code Golf

Body:
R, 78 bytes

m=strsplit(scan(,""),"[FWfw]")[[1]][-1];cat(rep(m[c(T,F)],m[c(F,T)]),sep=", ")

Credit for the rep(m[c(T,F)],m[c(F,T)]) bit goes to @flodel.
Usage:

> m=strsplit(scan(,""),"[FWfw]")[[1]][-1];cat(rep(m[c(T,F)],m[c(F,T)]),sep=", ")
1: F10W3F11W3F10W3F12W3
2:
Read 1 item
10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 12, 12
> m=strsplit(scan(,""),"[FWfw]")[[1]][-1];cat(rep(m[c(T,F)],m[c(F,T)]),sep=", ")
1: f1w0f2w10
2:
Read 1 item
2, 2, 2, 2, 2, 2, 2, 2, 2, 2


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

```<code>s=>parseInt([...s].sort().pop(),36)+1
</code>```

Edit: Saved 4 bytes thanks to @edc65.

Title: What base is this number in?

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

s=>parseInt([...s].sort().pop(),36)+1

Edit: Saved 4 bytes thanks to @edc65.


答:
Pyth, 18 bytes

```<code>r9m_sMdcR\Wtcr1Q\F
</code>```

If you don't need to allow for both upper and lower case, you can take out the r1 for 16 bytes:

```<code>r9m_sMdcR\WtcQ\F
</code>```

Try it online!

Explanation:

```<code>            c      split:
             r1Q    the uppercase of the input
                \F  on the letter "F"
           t       Remove the first result
                       The first "F" in the notation has nothing in front of it,
                       so this removes the empty string that prefaces everything
       cR\W        Split each of the results on "W"
  m_               Reverse each of the splits so that the "W" part is first (how many repetitions, then what is to be repeated)
    sMd            Cast everything within the splits to integers
r9                 Run length decode
</code>```

Title: Text animation format Code Golf

Body:
Working with old files from DOS, I found an ancient text animation format, that specify how much time each frame must be shown in the screen. It's very simple:

F1W5F2W3

This example above indicates that Frame 1 must be shown for 5 units of time, and frame 2 for 3 units more. Now I want to convert it to:

1, 1, 1, 1, 1, 2, 2, 2

In the converted example below, frame 1 is repeated 5 times, and frame 2 three times.

Rules: The only allowed letters are F and W (and the lowercase counterparts, f and w). Numbers can go up to 255. Total input String with no more than 255 chars.

Other examples:

Input: F10W3F11W3F10W3F12W3

Output: 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 12, 12

Input: f1w0f2w10

Output: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2

Short code wins.

Edited - Accepted formats:
Any answer containing the output and ignoring spaces. Ex: 1, 1, 2, 2 or [1,1,2,2] or (1,1,2,2). But NOT 1 1 2 2 or [1; 1; 2; 2] or [1 1 2 2].

Body:
Pyth, 18 bytes

r9m_sMdcR\Wtcr1Q\F

If you don't need to allow for both upper and lower case, you can take out the r1 for 16 bytes:

r9m_sMdcR\WtcQ\F

Try it online!

Explanation:

            c      split:
             r1Q    the uppercase of the input
                \F  on the letter "F"
           t       Remove the first result
                       The first "F" in the notation has nothing in front of it,
                       so this removes the empty string that prefaces everything
       cR\W        Split each of the results on "W"
  m_               Reverse each of the splits so that the "W" part is first (how many repetitions, then what is to be repeated)
    sMd            Cast everything within the splits to integers
r9                 Run length decode


答:
Perl, 32 bytes

29 bytes code + 3 for -n.

print"$1 "x$' while/(\d+)w/gi
```

<h3>Usage</h3>

<pre class="lang-sh prettyprint-override"><code>cat text-animation.pl
print"$1 "x$' while/(\d+)w/gi
perl -n text-animation.pl <<< 'F1W5F2W3'
1 1 1 1 1 2 2 2
</code>```

Perl, 29 bytes

26 bytes code + 3 for -n.

If no separator is required, this works:

```<code>print$1x$' while/(\d+)w/gi
</code>```

Title: Text animation format Code Golf

Body:
Perl, 32 bytes

29 bytes code + 3 for -n.

print"$1 "x$' while/(\d+)w/gi

Usage

cat text-animation.pl
print"$1 "x$' while/(\d+)w/gi
perl -n text-animation.pl <<< 'F1W5F2W3'
1 1 1 1 1 2 2 2

Perl, 29 bytes

26 bytes code + 3 for -n.

If no separator is required, this works:

print$1x$' while/(\d+)w/gi


问:
Print every printable ASCII character without using it
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.

For example, if your language was Python, your program that outputs the character P might be

```<code>print(chr(80))
</code>```

because P has ASCII code 80. This program is valid because P never appears in the source code. However, for the program that outputs lowercase p, something like

```<code>print(chr(112))
</code>```

would be invalid because, while it does print p, p is present in the code. A valid program could be

```<code>exec(chr(112)+'rint(chr(112))')
</code>```

which prints p but does not contain p.

Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.

If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.

The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.

Rules

The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)

Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.

The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.

Each program's output should go to stdout or your language's accepted alternative.

Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)

Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.

A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.

Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80)), print(chr(81)), print(chr(82))..." but make sure you're sure they all would work and that your score is added correctly.

For reference, here are the 95 printable ASCII your programs must output:

```<code> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
</code>```

答:
Perl 6: 921 bytes

Translation of the Python solution.

Each program has the form say "\x<hex escape code>", except:

s → put "\x73"

a → put "\x61"

y → put "\x79"

 → "\x20".say

" → say chr 34

\ → say chr 92

x → say chr 120

0 → say 1-1

1 → say 3-2

2 to 9 → say <n minus one>+1

For reference and ease of testing, here's the full list of programs, newline-separated.

"\x20".say
say "\x21"
say chr 34
say "\x23"
say "\x24"
say "\x25"
say "\x26"
say "\x27"
say "\x28"
say "\x29"
say "\x2A"
say "\x2B"
say "\x2C"
say "\x2D"
say "\x2E"
say "\x2F"
say 1-1
say 3-2
say 1+1
say 2+1
say 3+1
say 4+1
say 5+1
say 6+1
say 7+1
say 8+1
say "\x3A"
say "\x3B"
say "\x3C"
say "\x3D"
say "\x3E"
say "\x3F"
say "\x40"
say "\x41"
say "\x42"
say "\x43"
say "\x44"
say "\x45"
say "\x46"
say "\x47"
say "\x48"
say "\x49"
say "\x4A"
say "\x4B"
say "\x4C"
say "\x4D"
say "\x4E"
say "\x4F"
say "\x50"
say "\x51"
say "\x52"
say "\x53"
say "\x54"
say "\x55"
say "\x56"
say "\x57"
say "\x58"
say "\x59"
say "\x5A"
say "\x5B"
say chr 92
say "\x5D"
say "\x5E"
say "\x5F"
say "\x60"
put "\x61"
say "\x62"
say "\x63"
say "\x64"
say "\x65"
say "\x66"
say "\x67"
say "\x68"
say "\x69"
say "\x6A"
say "\x6B"
say "\x6C"
say "\x6D"
say "\x6E"
say "\x6F"
say "\x70"
say "\x71"
say "\x72"
put "\x73"
say "\x74"
say "\x75"
say "\x76"
say "\x77"
say chr 120
put "\x79"
say "\x7A"
say "\x7B"
say "\x7C"
say "\x7D"
say "\x7E"
```

<p>Here's the code I used to test the above listing, and count the score:</p>

```#!/usr/bin/env perl6

my $file = 'print_ascii_characters.p6';

my @expected = ' ' .. '~';
my @code     = $file.IO.lines;
my $code     = @code.join: ';';
my @got      = (run 'perl6', '-e', $code, :out).out.lines.map: |*.comb;

given +@expected, +@got, +@code -> ($e, $g, $c) {
    say "WRONG COUNT: Expected $e / output $g / source $c" and exit if not $e == $g == $c;
}

for @expected Z @got -> ($e, $g) {
    say "WRONG OUTPUT: Expected {$e.perl}, got {$g.perl}" and exit if $e ne $g;
}

for @expected Z @code -> ($char, $code) {
    say "COLLISION: {$char.perl} contained in {$code.perl}" if $code.match($char);
}

say "SCORE: ", @code.map(*.chars).sum;
```

Body:
Perl 6: 921 bytes

Translation of the Python solution.

Each program has the form say "\x<hex escape code>", except:

s → put "\x73"

a → put "\x61"

y → put "\x79"

 → "\x20".say

" → say chr 34

\ → say chr 92

x → say chr 120

0 → say 1-1

1 → say 3-2

2 to 9 → say <n minus one>+1

For reference and ease of testing, here's the full list of programs, newline-separated.

"\x20".say
say "\x21"
say chr 34
say "\x23"
say "\x24"
say "\x25"
say "\x26"
say "\x27"
say "\x28"
say "\x29"
say "\x2A"
say "\x2B"
say "\x2C"
say "\x2D"
say "\x2E"
say "\x2F"
say 1-1
say 3-2
say 1+1
say 2+1
say 3+1
say 4+1
say 5+1
say 6+1
say 7+1
say 8+1
say "\x3A"
say "\x3B"
say "\x3C"
say "\x3D"
say "\x3E"
say "\x3F"
say "\x40"
say "\x41"
say "\x42"
say "\x43"
say "\x44"
say "\x45"
say "\x46"
say "\x47"
say "\x48"
say "\x49"
say "\x4A"
say "\x4B"
say "\x4C"
say "\x4D"
say "\x4E"
say "\x4F"
say "\x50"
say "\x51"
say "\x52"
say "\x53"
say "\x54"
say "\x55"
say "\x56"
say "\x57"
say "\x58"
say "\x59"
say "\x5A"
say "\x5B"
say chr 92
say "\x5D"
say "\x5E"
say "\x5F"
say "\x60"
put "\x61"
say "\x62"
say "\x63"
say "\x64"
say "\x65"
say "\x66"
say "\x67"
say "\x68"
say "\x69"
say "\x6A"
say "\x6B"
say "\x6C"
say "\x6D"
say "\x6E"
say "\x6F"
say "\x70"
say "\x71"
say "\x72"
put "\x73"
say "\x74"
say "\x75"
say "\x76"
say "\x77"
say chr 120
put "\x79"
say "\x7A"
say "\x7B"
say "\x7C"
say "\x7D"
say "\x7E"

Here's the code I used to test the above listing, and count the score:

#!/usr/bin/env perl6

my $file = 'print_ascii_characters.p6';

my @expected = ' ' .. '~';
my @code     = $file.IO.lines;
my $code     = @code.join: ';';
my @got      = (run 'perl6', '-e', $code, :out).out.lines.map: |*.comb;

given +@expected, +@got, +@code -> ($e, $g, $c) {
    say "WRONG COUNT: Expected $e / output $g / source $c" and exit if not $e == $g == $c;
}

for @expected Z @got -> ($e, $g) {
    say "WRONG OUTPUT: Expected {$e.perl}, got {$g.perl}" and exit if $e ne $g;
}

for @expected Z @code -> ($char, $code) {
    say "COLLISION: {$char.perl} contained in {$code.perl}" if $code.match($char);
}

say "SCORE: ", @code.map(*.chars).sum;


答:
Pyke, 6 bytes

```<code>Seb36h
</code>```

Try it here!

```<code>Se     -   sorted(input)[-1]
  b36  -  base(^, 36)
     h - ^ + 1
</code>```

Title: What base is this number in?

Body:
Pyke, 6 bytes

Seb36h

Try it here!

Se     -   sorted(input)[-1]
  b36  -  base(^, 36)
     h - ^ + 1


问:
Russian Roulette
Write a program which plays Russian Roulette!

If the program is started,

there should be a 5 in 6 chance of it ending normally after printing "I survived!"

there should be a 1 in 6 chance of the program crashing. (segmentation fault, etc.)

No input, and no other outputs are allowed.

The randomness must be fair: it must have a uniform probability distribution. This means an uninitialized variable (or a RNG without seed) MOD 6 will not be sufficient.

If the solution works with only one dedicated operating system / platform, you will receive a 6 byte penalty to the score.

Shortest code wins, not sooner than 10 days after first valid answer.

答:
C, 67 65 62 chars

rand()%8 doesn't lose fairness. Division crashes for t=0, gives true for 1 and 2 (retry), gives false for 3..7 (survived).

EDIT: The previous version used a temporary variable, which ended up completely unneeded. 2/(rand()%8) implements both needed conditions.

```<code>main(){
        for(srand(time(0));2/(rand()%8););
        puts("I survived!");
}
</code>```

Title: Russian Roulette

Body:
C, 67 65 62 chars

rand()%8 doesn't lose fairness. Division crashes for t=0, gives true for 1 and 2 (retry), gives false for 3..7 (survived).

EDIT: The previous version used a temporary variable, which ended up completely unneeded. 2/(rand()%8) implements both needed conditions.

main(){
        for(srand(time(0));2/(rand()%8););
        puts("I survived!");
}


Title: Text animation format Code Golf

Body:
Perl, 28 bytes

27 bytes of code, plus 1 for the p flag in perl -pe '…':

s|f(\d+)w(\d+)|"$1
"x$2|gie

Output for F10W3F11W3F10W3F12W3:

10
10
10
11
11
11
10
10
10
12
12
12


答:
Dyalog APL, 10 bytes

Prompts for uppercase input.

⌈/⍞⍳⍨⎕D,⎕A
```

⌈/ maximum

⍞ characters of input

⍳⍨ 1-indexed into

⎕D, all digits followed by

⎕A all characters

TryAPL online!

Title: What base is this number in?

Body:
Dyalog APL, 10 bytes

Prompts for uppercase input.

⌈/⍞⍳⍨⎕D,⎕A

⌈/ maximum

⍞ characters of input

⍳⍨ 1-indexed into

⎕D, all digits followed by

⎕A all characters

TryAPL online!


答:
Retina, 28 bytes

```<code>O`.
.\B

{2`
$`
}T01`dl`_o
.
</code>```

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

Explanation

```<code>O`.
</code>```

This sorts the characters of the input.

```<code>.\B

</code>```

This removes all characters except the last, so the first two stages find the maximum character.

```<code>{2`
$`
}T01`dl`_o
</code>```

These are two stages which form a loop. The first one duplicates the first character and the second one "decrements" it (replacing e.g. x with w, a with 9 and 1 with 0). The latter stage encounters a zero as the first character, it removes it instead. This is a standard technique for generating a range of characters, given the upper end. Hence, this generates all "digits" from 0 to the maximum digit.

```<code>.
</code>```

Finally, we simply count the number of digits, which gives us the base.

Title: What base is this number in?

Body:
Retina, 28 bytes

O`.
.\B

{2`
$`
}T01`dl`_o
.

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

Explanation

O`.

This sorts the characters of the input.

.\B

This removes all characters except the last, so the first two stages find the maximum character.

{2`
$`
}T01`dl`_o

These are two stages which form a loop. The first one duplicates the first character and the second one "decrements" it (replacing e.g. x with w, a with 9 and 1 with 0). The latter stage encounters a zero as the first character, it removes it instead. This is a standard technique for generating a range of characters, given the upper end. Hence, this generates all "digits" from 0 to the maximum digit.

.

Finally, we simply count the number of digits, which gives us the base.


答:
Python 3, 293 bytes

j=input();a,b,c,d,e,f,g,h,i=[1-ord(c)%7%5for c in j];print('\n'.join(('burrito'+[' bowl',''][a]+' with:',['pinto','black'][b]+' beans',['brown','white'][c]+' rice',['sofritas','chicken','steak'][d],['medium','mild','hot'][e]+' salsa'))+'\ncorn'*f+'\nguacamole'*g+'\nsour cream'*h+'\ncheese'*i)
```

Mostly basic lookups with a little modulo trickery for the indexes of items:

AB123YN yielding indexes -1,-2,1,0,-1,1,0 respectively, and

using string multiplication for the optional items rather than a lookup.

Title: Can I take your order: a Chipotle concept conund

Body:
Challenge

Your program will take in a string from stdin, and output multiple lines to stdout.

An example of input looks like this:

My favorite Chipotle order:

B1113YNNY

Let's break it down:

The first character is either A (burrito), or B (burrito bowl).

The second character is 1 (black beans), or 2 (pinto beans).

The third character is either 1 (white rice), or 2 (brown rice).

The fourth character is either 1 (chicken), 2 (sofritas), or 3 (steak).

The fifth character is either 1 (mild salsa), 2 (medium salsa), or 3 (hot salsa).

The last four characters are Y if they want the item, or N otherwise:

character 6 is corn

character 7 is guacamole

character 8 is sour cream

character 9 is cheese

A working program for this challenge will output this to stdout:

burrito bowl with:

  black beans

  white rice

  chicken

  hot salsa

  corn

  cheese

Replace the above words with the words acquired from input.

Clarifications.

Standard loopholes are disallowed.

You may only get input from stdin, and only put output to stdout.

Body:
Python 3, 293 bytes

j=input();a,b,c,d,e,f,g,h,i=[1-ord(c)%7%5for c in j];print('\n'.join(('burrito'+[' bowl',''][a]+' with:',['pinto','black'][b]+' beans',['brown','white'][c]+' rice',['sofritas','chicken','steak'][d],['medium','mild','hot'][e]+' salsa'))+'\ncorn'*f+'\nguacamole'*g+'\nsour cream'*h+'\ncheese'*i)

Mostly basic lookups with a little modulo trickery for the indexes of items:

AB123YN yielding indexes -1,-2,1,0,-1,1,0 respectively, and

using string multiplication for the optional items rather than a lookup.


答:
Batch, <s>445</s> 364 bytes

```<code>@echo off
set/ps=
set l=call:l
%l%"burrito with:" "burrito bowl with:"
%l%"black beans" "pinto beans"
%l%"white rice" "brown rice"
%l%chicken sofritas steak
%l%"mild salsa" "medium salsa" "hot salsa"
%l%corn
%l%guacamole
%l%"sour cream"
%l%cheese
exit/b
:l
for %%a in (B N 2 3 3)do if %s:~0,1%==%%a shift
if not "%~1"=="" echo %~1%
set s=%s:~1%
</code>```

New rewrite saved me 81 bytes. Reading from STDIN conveniently saves a byte over using the command line. Each character of the input is processed in turn to select from a list of options; the characters B, N and 2 cause the second option to be chosen, while 3 causes the third option to be chosen.

Body:
Batch, <s>445</s> 364 bytes

@echo off
set/ps=
set l=call:l
%l%"burrito with:" "burrito bowl with:"
%l%"black beans" "pinto beans"
%l%"white rice" "brown rice"
%l%chicken sofritas steak
%l%"mild salsa" "medium salsa" "hot salsa"
%l%corn
%l%guacamole
%l%"sour cream"
%l%cheese
exit/b
:l
for %%a in (B N 2 3 3)do if %s:~0,1%==%%a shift
if not "%~1"=="" echo %~1%
set s=%s:~1%

New rewrite saved me 81 bytes. Reading from STDIN conveniently saves a byte over using the command line. Each character of the input is processed in turn to select from a list of options; the characters B, N and 2 cause the second option to be chosen, while 3 causes the third option to be chosen.


答:
PHP (<s>891</s> <s>680</s> 674 bytes, <s>2</s> 0 DNP)

Edit: saved 203 bytes thanks to jimmy23013 and implemented the 2 DNP thanks to Mego

This answer heavily abuses PHP's generous nature. Most of the cases take one of these forms (7 bytes each):

```<code><?=Y^x;
<?=Z&e;
<?=V|Z;
</code>```

PHP converts the letters on either side of the operator to strings, then performs the appropriate bitwise operation by converting each string to its ASCII character value, and finally converts the result back to a character.

In the first example above, Y^x becomes 89^78. The result of this is 33, which is then sent to STDOUT as the character !.

A script was written to bruteforce all possible combinations: the results can be found here.

Exceptions:

; is <?=Z^a?> (8 bytes)

| is <?='9'^E; (9 bytes)

< and ? would normally be DNP due to the required start tag, but by using the -r flag, code can be executed without them:

< is echo Z^f; (9 bytes)

? is echo Z^e; (9 bytes)

= is echo Z^g; (9 bytes)

Score:

(7 * 90) + 8 + 9 + 9 + 9 + 9 = 674 bytes

Title: Print every printable ASCII character without using it

Body:
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.

For example, if your language was Python, your program that outputs the character P might be

```<code>print(chr(80))
</code>```

because P has ASCII code 80. This program is valid because P never appears in the source code. However, for the program that outputs lowercase p, something like

```<code>print(chr(112))
</code>```

would be invalid because, while it does print p, p is present in the code. A valid program could be

```<code>exec(chr(112)+'rint(chr(112))')
</code>```

which prints p but does not contain p.

Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.

If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.

The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.

Rules

The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)

Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.

The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.

Each program's output should go to stdout or your language's accepted alternative.

Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)

Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.

A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.

Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80)), print(chr(81)), print(chr(82))..." but make sure you're sure they all would work and that your score is added correctly.

For reference, here are the 95 printable ASCII your programs must output:

```<code> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
</code>```

Body:
PHP (<s>891</s> <s>680</s> 674 bytes, <s>2</s> 0 DNP)

Edit: saved 203 bytes thanks to jimmy23013 and implemented the 2 DNP thanks to Mego

This answer heavily abuses PHP's generous nature. Most of the cases take one of these forms (7 bytes each):

<?=Y^x;
<?=Z&e;
<?=V|Z;

PHP converts the letters on either side of the operator to strings, then performs the appropriate bitwise operation by converting each string to its ASCII character value, and finally converts the result back to a character.

In the first example above, Y^x becomes 89^78. The result of this is 33, which is then sent to STDOUT as the character !.

A script was written to bruteforce all possible combinations: the results can be found here.

Exceptions:

; is <?=Z^a?> (8 bytes)

| is <?='9'^E; (9 bytes)

< and ? would normally be DNP due to the required start tag, but by using the -r flag, code can be executed without them:

< is echo Z^f; (9 bytes)

? is echo Z^e; (9 bytes)

= is echo Z^g; (9 bytes)

Score:

(7 * 90) + 8 + 9 + 9 + 9 + 9 = 674 bytes


问:
Score Tarzan's Olympic Vine-Swinging Routine
Olympic vine-swingers perform their routines in standard trees.  In particular, Standard Tree n has vertices for 0 up through n-1 and edges linking each nonzero vertex a to the vertex n % a below it.  So, for example, Standard Tree 5 looks like this:

```<code>3
|
2   4
 \ /
  1
  |
  0
</code>```

because the remainder when 5 is divided by 3 is 2, the remainder when 5 is divided by 2 or by 4 is 1, and the remainder when 5 is divided by 1 is 0.

This year, Tarzan will be defending his gold with new routines, each of which begins at vertex n - 1, swings to vertex n - 2, continues to vertex n - 3, etc., until finally he dismounts to vertex 0.

The score for a routine is the sum of the scores for each swing (including the dismount), and the score for a swing is the distance within the tree between its start and end points.  Thus, Tarzan's routine on Standard Tree 5 has a score of 6:

a swing from 4 to 3 scores three points (down, up, up),

a swing from 3 to 2 scores one point (down),

a swing from 2 to 1 scores one point (down), and

a dismount from 1 to 0 scores one point (down).

Write a program or function that, given a positive integer n, computes the score of Tarzan's routine on Standard Tree n.  Sample inputs and outputs:

```<code> 1 ->  0
 2 ->  1
 3 ->  2
 4 ->  6
 5 ->  6
 6 -> 12
 7 -> 12
 8 -> 18
 9 -> 22
10 -> 32
11 -> 24
12 -> 34
13 -> 34
14 -> 36
15 -> 44
16 -> 58
17 -> 50
18 -> 64
19 -> 60
20 -> 66
21 -> 78
22 -> 88
23 -> 68
24 -> 82
</code>```

Rules and code scoring are as usual for code-golf.

Body:
J, 37 bytes

[:+/2(-.+&#-.~)/\|:@(]|~^:(<@>:@[)i.)

Usage:

   f=.[:+/2(-.+&#-.~)/\|:@(]|~^:(<@>:@[)i.)
   f 10
32
   f every 1+i.20
0 1 2 6 6 12 12 18 22 32 24 34 34 36 44 58 50 64 60 66

Try it online here.


答:
Perl 6: 18 bytes

```<code>{:36(.comb.max)+1}
</code>```

Defines a lambda that takes a single string argument, and returns an integer. It splits the string into characters, finds the "highest" one, converts it to base 36, adds 1.

```<code>{(.ords.max-8)%39}
</code>```

This one uses the modulo approach from Dennis. Same length.

Title: What base is this number in?

Body:
Here's a nice easy challenge:

Given a string that represents a number in an unknown base, determine the lowest possible base that number might be in. The string will only contain 0-9, a-z. If you like, you may choose to take uppercase letters instead of lowercase, but please specify this. You must output this lowest possible base in decimal.

Here is a more concrete example. If the input string was "01234", it is impossible for this number to be in binary, since 2, 3, and 4 are all undefined in binary. Similarly, this number cannot be in base 3, or base 4. Therefore, this number must be in base-5, or a higher base, so you should output '5'.

Your code must work for any base between base 1 (unary, all '0's) and base 36 ('0-9' and 'a-z').

You may take input and provide output in any reasonable format. Base-conversion builtins are allowed. As usual, standard loopholes apply, and the shortest answer in bytes is the winner!

Test IO:

```<code>#Input          #Output
00000       --> 1
123456      --> 7
ff          --> 16
4815162342  --> 9
42          --> 5
codegolf    --> 25
0123456789abcdefghijklmnopqrstuvwxyz    --> 36
</code>```

Body:
Perl 6: 18 bytes

{:36(.comb.max)+1}

Defines a lambda that takes a single string argument, and returns an integer. It splits the string into characters, finds the "highest" one, converts it to base 36, adds 1.

{(.ords.max-8)%39}

This one uses the modulo approach from Dennis. Same length.


答:
R, <s>99</s> <s>89</s> 85 bytes

Look ! Less than 100 bytes !

Look ! 10 bytes off !

Look ! 4 bytes off !

```<code>ifelse((m=max(strsplit(scan(,''),"")[[1]]))%in%(l=letters),match(m,l)+10,strtoi(m)+1)
</code>```

Ungolfed :

```<code>l=letters                  #R's built-in vector of lowercase letters

n=scan(what=characters())  #Takes an input from STDIN and convert it to characters

m=max(strsplit(n,"")[[1]]) #Splits the input and takes to max.
                           #`letters` are considered > to numbers (i.e. a>1)

ifelse(m%in%l,match(m,l)+10,strtoi(m)+1) #If the max is in `letters`,
                                             #outputs the matching position of `m`in `letters` + 10 (because of [0-9]).
                                             #Else, outputs `m` (as a number) + 1.
</code>```

As often, this answer makes use of the ifelse function : ifelse(Condition, WhatToDoIfTrue, WhatToDoElse)

Title: What base is this number in?

Body:
R, <s>99</s> <s>89</s> 85 bytes

Look ! Less than 100 bytes !

Look ! 10 bytes off !

Look ! 4 bytes off !

ifelse((m=max(strsplit(scan(,''),"")[[1]]))%in%(l=letters),match(m,l)+10,strtoi(m)+1)

Ungolfed :

l=letters                  #R's built-in vector of lowercase letters

n=scan(what=characters())  #Takes an input from STDIN and convert it to characters

m=max(strsplit(n,"")[[1]]) #Splits the input and takes to max.
                           #`letters` are considered > to numbers (i.e. a>1)

ifelse(m%in%l,match(m,l)+10,strtoi(m)+1) #If the max is in `letters`,
                                             #outputs the matching position of `m`in `letters` + 10 (because of [0-9]).
                                             #Else, outputs `m` (as a number) + 1.

As often, this answer makes use of the ifelse function : ifelse(Condition, WhatToDoIfTrue, WhatToDoElse)


答:
PHP 38 bytes

```<code><?~$$s[rand(+$s=sssss,5)]?>I survived!
</code>```

Placing a + before a non-numeric string will evaluate to 0. Should rand(0,5) return 5, $s[rand(0,5)] will be the empty string (since $s is only five characters long), and subsequently $$s[rand(0,5)] will be an uninitialized variable. Attempting to take the inversion will halt on Unsupported Operand Type. Any other value, 0-4 will return s, and because $s is defined, you will survive.

Note: as of php version 4.2.0, the random number generator is seeded automatically.

Title: Russian Roulette

Body:
Write a program which plays Russian Roulette!

If the program is started,

there should be a 5 in 6 chance of it ending normally after printing "I survived!"

there should be a 1 in 6 chance of the program crashing. (segmentation fault, etc.)

No input, and no other outputs are allowed.

The randomness must be fair: it must have a uniform probability distribution. This means an uninitialized variable (or a RNG without seed) MOD 6 will not be sufficient.

If the solution works with only one dedicated operating system / platform, you will receive a 6 byte penalty to the score.

Shortest code wins, not sooner than 10 days after first valid answer.

Body:
PHP 38 bytes

<?~$$s[rand(+$s=sssss,5)]?>I survived!

Placing a + before a non-numeric string will evaluate to 0. Should rand(0,5) return 5, $s[rand(0,5)] will be the empty string (since $s is only five characters long), and subsequently $$s[rand(0,5)] will be an uninitialized variable. Attempting to take the inversion will halt on Unsupported Operand Type. Any other value, 0-4 will return s, and because $s is defined, you will survive.

Note: as of php version 4.2.0, the random number generator is seeded automatically.


答:
Pyth, 18 bytes

```<code>r_McvM:z"\d+"1 2 9
</code>```

Try it online. Test suite.

Title: Text animation format Code Golf

Body:
Working with old files from DOS, I found an ancient text animation format, that specify how much time each frame must be shown in the screen. It's very simple:

F1W5F2W3

This example above indicates that Frame 1 must be shown for 5 units of time, and frame 2 for 3 units more. Now I want to convert it to:

1, 1, 1, 1, 1, 2, 2, 2

In the converted example below, frame 1 is repeated 5 times, and frame 2 three times.

Rules: The only allowed letters are F and W (and the lowercase counterparts, f and w). Numbers can go up to 255. Total input String with no more than 255 chars.

Other examples:

Input: F10W3F11W3F10W3F12W3

Output: 10, 10, 10, 11, 11, 11, 10, 10, 10, 12, 12, 12

Input: f1w0f2w10

Output: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2

Short code wins.

Edited - Accepted formats:
Any answer containing the output and ignoring spaces. Ex: 1, 1, 2, 2 or [1,1,2,2] or (1,1,2,2). But NOT 1 1 2 2 or [1; 1; 2; 2] or [1 1 2 2].

Body:
Pyth, 18 bytes

r_McvM:z"\d+"1 2 9

Try it online. Test suite.


答:
Pyth, 225 Bytes

```<code>=rQ0s["burrito "?xGhQ"bowl "k"with:")+@,"pinto""black"shtQ" beans"+@,"brown""white"shttQ" rice"@c"steak chicken sofritas")s@Q3+@c"hot medium mild")s@Q4" salsa"seMf}\y@QhT[,5"corn\n",6"guacamole\n",7"sour cream\n",8"cheese\n")
</code>```

Body:
Pyth, 225 Bytes

=rQ0s["burrito "?xGhQ"bowl "k"with:")+@,"pinto""black"shtQ" beans"+@,"brown""white"shttQ" rice"@c"steak chicken sofritas")s@Q3+@c"hot medium mild")s@Q4" salsa"seMf}\y@QhT[,5"corn\n",6"guacamole\n",7"sour cream\n",8"cheese\n")


答:
Perl, <s>30</s> 27 bytes

Includes +1 for -p

Run with the input on STDIN, e.g.

```<code>base.pl <<< codegolf
</code>```

base.pl:

```<code>#!/usr/bin/perl -p
\@F[unpack"W*"];$_=@F%39-9
</code>```

Title: What base is this number in?

Body:
Perl, <s>30</s> 27 bytes

Includes +1 for -p

Run with the input on STDIN, e.g.

base.pl <<< codegolf

base.pl:

#!/usr/bin/perl -p
\@F[unpack"W*"];$_=@F%39-9


答:
MATL, 22 bytes

```<code>t58<*cU2eZ}Y"&D32','XE
</code>```

Try it online!

Explanation

```<code>t        % Implicitly input string, say 'F10W2F1W3'. Duplicate
58<      % Array that contains 1 for numeric chars, 0 otherwise: [0 1 1 0 1 0 1 0 1]
*        % Multiply element-wise. Converts chars to numeric code
c        % Cast to char. Gives the original string with letters replaced by char 0
U        % Interprets as a numeric array. So the string ' 10 2 4 3' (where spaces are
         % actually char 0) gives the array [10 2 4 3]
2e       % Reshapes into a 2-column array in column-major order: [10 4; 2 3]
Z}       % Split into rows: [10 4], [2 3]
Y"       % Run-length decoding: [10 10 4 4 4]. Implicitly display
&D       % Get string representation, in the format '[10 10 4 4]'
32','XE  % Replace spaces by commas
</code>```

Title: Text animation format Code Golf

Body:
MATL, 22 bytes

t58<*cU2eZ}Y"&D32','XE

Try it online!

Explanation

t        % Implicitly input string, say 'F10W2F1W3'. Duplicate
58<      % Array that contains 1 for numeric chars, 0 otherwise: [0 1 1 0 1 0 1 0 1]
*        % Multiply element-wise. Converts chars to numeric code
c        % Cast to char. Gives the original string with letters replaced by char 0
U        % Interprets as a numeric array. So the string ' 10 2 4 3' (where spaces are
         % actually char 0) gives the array [10 2 4 3]
2e       % Reshapes into a 2-column array in column-major order: [10 4; 2 3]
Z}       % Split into rows: [10 4], [2 3]
Y"       % Run-length decoding: [10 10 4 4 4]. Implicitly display
&D       % Get string representation, in the format '[10 10 4 4]'
32','XE  % Replace spaces by commas


答:
Java 7, <s>67</s> 61 bytes

```<code>int c(char[]i){int m=0;for(int c:i)m=m>c?m:c;return(m-8)%39;}
</code>```

(m-8)%39 is thanks to @Dennis' amazing answer.

Ungolfed & test code:

Try it here.

```<code>class Main{
  static int c(char[] i){
    int m = 0;
    for(int c : i){
      m = m > c
           ? m
           : c;
    }
    return (m-8) % 39;
  }

  public static void main(String[] a){
    System.out.println(c("00000".toCharArray()));
    System.out.println(c("123456".toCharArray()));
    System.out.println(c("ff".toCharArray()));
    System.out.println(c("4815162342".toCharArray()));
    System.out.println(c("42".toCharArray()));
    System.out.println(c("codegolf".toCharArray()));
    System.out.println(c("0123456789abcdefghijklmnopqrstuvwxyz".toCharArray()));
  }
}
</code>```

Output:

```<code>1
7
16
9
5
25
36
</code>```

Title: What base is this number in?

Body:
Java 7, <s>67</s> 61 bytes

int c(char[]i){int m=0;for(int c:i)m=m>c?m:c;return(m-8)%39;}

(m-8)%39 is thanks to @Dennis' amazing answer.

Ungolfed & test code:

Try it here.

class Main{
  static int c(char[] i){
    int m = 0;
    for(int c : i){
      m = m > c
           ? m
           : c;
    }
    return (m-8) % 39;
  }

  public static void main(String[] a){
    System.out.println(c("00000".toCharArray()));
    System.out.println(c("123456".toCharArray()));
    System.out.println(c("ff".toCharArray()));
    System.out.println(c("4815162342".toCharArray()));
    System.out.println(c("42".toCharArray()));
    System.out.println(c("codegolf".toCharArray()));
    System.out.println(c("0123456789abcdefghijklmnopqrstuvwxyz".toCharArray()));
  }
}

Output:

1
7
16
9
5
25
36


问:
My triangle needs more nodes
Consider the standard equilateral triangle, with nodes labeled using barycentric coordinates:

We can turn this 3 node triangle into a 6 node triangle by adding a new line of 3 vertices (one more than was present on a side of the original 3 node triangle), remove any internal edges (but not internal nodes) and re-normalize the coordinates:

Repeating the process to go from a 6 node triangle to a 10 node triangle, add a line of 4 vertices (again, one more than was present on a side of the original 6 node triangle), remove any internal edges (but not internal nodes) and re-normalize the coordinates:

This process can be repeated indefinitely. The goal of this challenge is given an integer N representing how many times this process has been performed, output all the nodes for the associated triangle in barycentric coordinates.

Input

Your program/function should take as input a single non-negative integer N representing how many times this process has been applied. Note that for N=0, you should output the original triangle with 3 nodes.

The input may come from any source (function parameter, stdio, etc.).

Output

Your program/function should output all the nodes in normalized barycentric coordinates. The order of the nodes does not matter.
A number can be specified as a fraction (fraction reduction not required) or a floating point number. You may also output "scaled" vectors to specify a node. For example, all 3 of the following outputs are equivalent and allowed:

```<code>0.5,0.5,0

1/2,2/4,0

[1,1,0]/2
</code>```

If using floating point output, your output should be accurate to within 1%. The output may be to any sink desired (stdio, return value, return parameter, etc.). Note that even though the barycentric coordinates are uniquely determined by only 2 numbers per node, you should output all 3 numbers per node.

Examples

Example cases are formatted as:

```<code>N
x0,y0,z0
x1,y1,z1
x2,y2,z2
...
</code>```

where the first line is the input N, and all following lines form a node x,y,z which should be in the output exactly once. All numbers are given as approximate floating point numbers.

```<code>0
1,0,0
0,1,0
0,0,1

1
1,0,0
0,1,0
0,0,1
0.5,0,0.5
0.5,0.5,0
0,0.5,0.5

2
1,0,0
0,1,0
0,0,1
0.667,0,0.333
0.667,0.333,0
0.333,0,0.667
0.333,0.333,0.333
0.333,0.667,0
0,0.333,0.667
0,0.667,0.333

3
1,0,0
0.75,0,0.25
0.75,0.25,0
0.5,0,0.5
0.5,0.25,0.25
0.5,0.5,0
0.25,0,0.75
0.25,0.25,0.5
0.25,0.5,0.25
0.25,0.75,0
0,0,1
0,0.25,0.75
0,0.5,0.5
0,0.75,0.25
0,1,0
</code>```

Scoring

This is code golf; shortest code in bytes wins. Standard loopholes apply. You may use any built-ins desired.

答:
CJam (22 bytes)

```<code>{):X),3m*{:+X=},Xdff/}
</code>```

This is an anonymous block (function) which takes N on the stack and leaves an array of arrays of doubles on the stack. Online demo

Dissection

```<code>{         e# Define a block
  ):X     e# Let X=N+1 be the number of segments per edge
  ),3m*   e# Generate all triplets of integers in [0, X] (inclusive)
  {:+X=}, e# Filter to those triplets which sum to X
  Xdff/   e# Normalise
}
</code>```

Title: My triangle needs more nodes

Body:
CJam (22 bytes)

{):X),3m*{:+X=},Xdff/}

This is an anonymous block (function) which takes N on the stack and leaves an array of arrays of doubles on the stack. Online demo

Dissection

{         e# Define a block
  ):X     e# Let X=N+1 be the number of segments per edge
  ),3m*   e# Generate all triplets of integers in [0, X] (inclusive)
  {:+X=}, e# Filter to those triplets which sum to X
  Xdff/   e# Normalise
}


问:
How secure are my locks?
You have been assigned the task of installing new locks to the company's building. However, the locks you use are quite unusual: they require some combination of keys to open. Now, you want to figure out which locks are the most secure, so you can prioritize the most important locations.

The keys you use are numbered by security: key 1 is the weakest and could be given to the cat, key 2 is a bit better, and so on.

The locks are defined by AND and OR expressions between the keys. For example, a lock might open with just key 1, so it's defined by the string 1; another one might require key 3 and either key 1 or 2, so it's defined by 3 & (1 | 2). A lock opens if the expression is truthy when all key numbers are substituted for true/false depending on if the user possessed the respective keys. XOR and NOT are not needed, since possessing extra keys doesn't matter.

The security of a lock is defined by the weakest key combination required to open the lock. One way to compute this is the following algorithm:

Find all the subsets of the keys that open the lock.

Sort each combination descending (from the strongest key to the weakest).

Sort the combinations lexicographically ascending.

The security value of the lock is now the first item in the list.

In order to compare two locks, one just has to compare their security values lexicographically: the larger one is more secure.

Challenge

You are given a list of expressions that define locks. Your task is to sort the locks based on security in descending order.

Standard code-golf rules apply.

Input

You will receive a list of locks as input.

The list may be taken as lines or in the list representation of your choice.

Each lock can be given either as a string like 1 & ((2 | 3) & 4) or a nested list like [1, "&", [[2, "|", 3], "&", 4]].

Any whitespace in the string is optional, and all operations except for the outermost one will be wrapped in parentheses.

You are free to choose the list format that suits your needs.

Each operator will have two operands.

Key numbers will range from 1 to 99 and there will not be unused keys between 1 and the maximum used key.

Output

You will output the same list you got as input, sorted by security in descending order. All formats listed above are valid. If two locks are equally secure, their order does not matter.

Test cases

The test cases are in the "list" format. The outputs include the security values of each lock for reference; you should not output them.

Input:

[1]
[2]
[3]
[1, "&", 2]
[1, "&", 3]
[3, "&", 2]
[1, "|", 2]
[2, "|", 3]
[[1, "&", 2], "|", 3]
[[2, "|", 3], "&", 3]
```

<p><strong>Result:</strong></p>

<pre class="lang-python prettyprint-override"><code>[3, "&", 2]            # (3, 2)
[1, "&", 3]            # (3, 1)
[[2, "|", 3], "&", 3]  # (3)
[3]                    # (3)
[1, "&", 2]            # (2, 1)
[[1, "&", 2], "|", 3]  # (2, 1)
[2]                    # (2)
[2, "|", 3]            # (2)
[1]                    # (1)
[1, "|", 2]            # (1)
</code>```

Input:

[[[6, '|', [[10, '|', 1], '&', [3, '&', 3]]], '|', 10], '&', [[12, '&', [9, '|', 7]], '|', [[3, '|', 8], '&', [[10, '|', [[1, '&', 3], '&', 9]], '|', [[2, '|', 1], '&', 1]]]]]
[[7, '|', 9], '&', [[5, '|', 10], '&', [[12, '|', 3], '&', 4]]]
[7, '|', 7]
[[[5, '|', [1, '|', 9]], '&', [[7, '&', [[6, '&', [1, '|', 7]], '|', 2]], '|', 5]], '&', [[[[8, '&', 6], '&', 1], '&', 5], '&', [10, '|', [11, '&', [3, '&', 6]]]]]
[[[[2, '&', [6, '&', 8]], '|', [[4, '|', 4], '|', [[5, '&', 4], '|', [[[1, '|', 5], '|', 1], '&', 7]]]], '&', [[[9, '|', [3, '&', 7]], '|', [9, '|', 5]], '&', [[[[8, '|', 11], '|', 8], '|', 2], '|', 2]]], '&', [[3, '|', 6], '&', 9]]
[[12, '|', [5, '&', [[12, '&', 3], '|', [9, '&', 1]]]], '|', [10, '&', [[8, '|', 9], '&', [[[8, '|', 3], '|', 8], '|', 11]]]]
[[9, '|', 11], '&', [[[11, '&', 12], '|', 10], '&', [3, '&', 12]]]
[[[5, '&', 9], '&', [10, '&', 2]], '|', [10, '|', 10]]
[[6, '&', 4], '&', [4, '|', 11]]
[[[[11, '&', [[[[5, '|', 11], '&', [10, '|', 7]], '&', 2], '|', 2]], '|', 12], '|', 5], '&', [[[2, '&', [5, '|', 9]], '&', 4], '&', [6, '|', [3, '&', 2]]]]
```

<p><strong>Result:</strong></p>

<pre class="lang-python prettyprint-override"><code>[[9, '|', 11], '&', [[[11, '&', 12], '|', 10], '&', [3, '&', 12]]] # (12, 10, 9, 3)
[[[5, '|', [1, '|', 9]], '&', [[7, '&', [[6, '&', [1, '|', 7]], '|', 2]], '|', 5]], '&', [[[[8, '&', 6], '&', 1], '&', 5], '&', [10, '|', [11, '&', [3, '&', 6]]]]] # (10, 8, 6, 5, 1)
[[[5, '&', 9], '&', [10, '&', 2]], '|', [10, '|', 10]] # (10)
[[12, '|', [5, '&', [[12, '&', 3], '|', [9, '&', 1]]]], '|', [10, '&', [[8, '|', 9], '&', [[[8, '|', 3], '|', 8], '|', 11]]]] # (9, 5, 1)
[[[[2, '&', [6, '&', 8]], '|', [[4, '|', 4], '|', [[5, '&', 4], '|', [[[1, '|', 5], '|', 1], '&', 7]]]], '&', [[[9, '|', [3, '&', 7]], '|', [9, '|', 5]], '&', [[[[8, '|', 11], '|', 8], '|', 2], '|', 2]]], '&', [[3, '|', 6], '&', 9]] # (9, 4, 3, 2)
[[7, '|', 9], '&', [[5, '|', 10], '&', [[12, '|', 3], '&', 4]]] # (7, 5, 4, 3)
[7, '|', 7] # (7)
[[6, '&', 4], '&', [4, '|', 11]] # (6, 4)
[[[[11, '&', [[[[5, '|', 11], '&', [10, '|', 7]], '&', 2], '|', 2]], '|', 12], '|', 5], '&', [[[2, '&', [5, '|', 9]], '&', 4], '&', [6, '|', [3, '&', 2]]]] # (5, 4, 3, 2)
[[[6, '|', [[10, '|', 1], '&', [3, '&', 3]]], '|', 10], '&', [[12, '&', [9, '|', 7]], '|', [[3, '|', 8], '&', [[10, '|', [[1, '&', 3], '&', 9]], '|', [[2, '|', 1], '&', 1]]]]] # (3, 1)
</code>```

This program can be used to generate additional test cases. It also outputs the security values of each lock generated.

答:
Python, 253 246 bytes

```<code>m=lambda a,b:min(sorted(a),sorted(b))
def w(s):
    if type(s)!=list:return[s]
    if len(s)==1:return s
    k=w(s[0])
    z=w(s[2])
    if s[1]=="|":return m(k,z)
    return k+z
r=[]
for i in n:r+=[(i,sorted(w(i),reverse=1))]
sorted(r,reverse=1,key=lambda x:x[1])
</code>```

Title: How secure are my locks?

Body:
Python, 253 246 bytes

m=lambda a,b:min(sorted(a),sorted(b))
def w(s):
    if type(s)!=list:return[s]
    if len(s)==1:return s
    k=w(s[0])
    z=w(s[2])
    if s[1]=="|":return m(k,z)
    return k+z
r=[]
for i in n:r+=[(i,sorted(w(i),reverse=1))]
sorted(r,reverse=1,key=lambda x:x[1])


答:
Perl, 69 bytes

Includes +2 for -ap

Run with the input on STDIN:

```<code>dice10000.pl <<< "5 1 1 1 1 1"
</code>```

dice10000.pl:

```<code>#!/usr/bin/perl -ap
$_=join 0,sort@F,A;print;s%(10|\d)\1\1|10|5%$n+=$1.0||$&%eg;$_=$n.0
</code>```

Title: Evaluate a Dice 10,000 roll

Body:
Introduction

Dice 10,000 is a dice game which can be played with 6 dice and something to write. Players roll the dice multiple times a turn and gain a score at the end of it. The player who reaches 10,000 point first wins the game. Calculating the score of one roll is your job in this challenge.

Look here for the full rules.

Please note that the rules (especically the scoring) change from region to region since the game is widely known. We use the rules descibed below.

The Challenge

Given a list of six numbers from one to six representing a dice roll, output their score. The score is calculated in the follwing way:

Ones counts 100 points

Fives counts 50 points

Triplets count their number times 100 points. Three twos for example give 200 points. An exception are three ones which count 1000 points.

Six of the same number count like two triplets as described above. So six threes give 600 points. The same goes for the edge case with the ones: Six ones are 2,000 points.

One die can't be used more than once. If a die is part of a triplet, it does not count for other scorings. The fives in a triplet do not count 50 points in addition to the 500 points they give.

Triples are always counted first to maximize the score. So three fives are never counted as 150 points. Four fives are counted as one triplet and one ordinary five which then gives 550 points.

Notes

The input will always contain six numbers from one to six. You will not recieve invalid input.

The numbers can be in any order. You may not assume any specific ordering.

Rules

Input format is up to  you as long as it's not preprocessed.

Function or full program allowed.

Default rules for input/output.

Standard loopholes apply.

This is code-golf, so lowest byte-count wins. Tiebreaker is earlier submission.

Test cases

```
[1, 2, 3, 4, 5, 6] -> 150
[1, 1, 1, 2, 3, 5] -> 1050
[1, 1, 1, 1, 1, 1] -> 2000
[2, 2, 2, 2, 2, 2] -> 400
[6, 6, 1, 5, 5, 6] -> 800
[2, 3, 4, 6, 2, 4] -> 0
[1, 5, 1, 5, 1, 5] -> 1500
[5, 5, 5, 5, 2, 3] -> 550
[1, 1, 1, 1, 1, 5] -> 1250
[3, 3, 4, 4, 3, 4] -> 700
```

Body:
Perl, 69 bytes

Includes +2 for -ap

Run with the input on STDIN:

dice10000.pl <<< "5 1 1 1 1 1"

dice10000.pl:

#!/usr/bin/perl -ap
$_=join 0,sort@F,A;print;s%(10|\d)\1\1|10|5%$n+=$1.0||$&%eg;$_=$n.0


问:
Shortest power set implementation

Problem definition

Print out the powerset of a given set. For example:

```<code>[1, 2, 3] => [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
</code>```

Each element is to be printed on a separate line, so the above example would be printed as:

```<code>[]
[1]
[2]
...
[1, 2, 3]
</code>```

Example code (in D, python example here):

```<code>import std.stdio;

string[][] powerset(string[] set) {
    if (set.length == 1) {
        return [set, []];
    }

    string[][] ret;
    foreach (item; powerset(set[1 .. $])) {
        ret ~= set[0]~item;
        ret ~= item;
    }

    return ret;
}

void main(string[] argv) {
    foreach (set; powerset(argv[1 .. $]))
        writeln(set);
}
</code>```

Input

Elements will be passed as arguments. For example, the example provided above would be passed to a program called powerset as:

```<code>powerset 1 2 3
</code>```

Arguments will be alphanumeric.

Rules

No libraries besides io

Output does not have to be ordered

Powerset does not have to be stored, only printed

Elements in the set must be delimited (e.g. 1,2,3, [1,2,3] and ['1','2','3'] are acceptable, but 123 is not

Trailing delimiters are fine (e.g. 1,2,3, == 1,2,3)

Best is determined based on number of bytes

The best solution will be decided no less than 10 days after the first submission.

答:
Python <s>70</s> 67 bytes

```<code>def p(a,*v):
 i=0;print v
 for n in a:i+=1;p(a[i:],n,*v)
p(input())
</code>```

Input is taken in the same manner as for ugoren's solution. Sample I/O:

```<code>$ echo [1,2,3] | powerset.py
()
(1,)
(2, 1)
(3, 2, 1)
(3, 1)
(2,)
(3, 2)
(3,)
</code>```

Try it online!

Title: Shortest power set implementation

Body:
Python <s>70</s> 67 bytes

def p(a,*v):
 i=0;print v
 for n in a:i+=1;p(a[i:],n,*v)
p(input())

Input is taken in the same manner as for ugoren's solution. Sample I/O:

$ echo [1,2,3] | powerset.py
()
(1,)
(2, 1)
(3, 2, 1)
(3, 1)
(2,)
(3, 2)
(3,)

Try it online!


Title: My triangle needs more nodes

Body:
Consider the standard equilateral triangle, with nodes labeled using barycentric coordinates:

We can turn this 3 node triangle into a 6 node triangle by adding a new line of 3 vertices (one more than was present on a side of the original 3 node triangle), remove any internal edges (but not internal nodes) and re-normalize the coordinates:

Repeating the process to go from a 6 node triangle to a 10 node triangle, add a line of 4 vertices (again, one more than was present on a side of the original 6 node triangle), remove any internal edges (but not internal nodes) and re-normalize the coordinates:

This process can be repeated indefinitely. The goal of this challenge is given an integer N representing how many times this process has been performed, output all the nodes for the associated triangle in barycentric coordinates.

Input

Your program/function should take as input a single non-negative integer N representing how many times this process has been applied. Note that for N=0, you should output the original triangle with 3 nodes.

The input may come from any source (function parameter, stdio, etc.).

Output

Your program/function should output all the nodes in normalized barycentric coordinates. The order of the nodes does not matter.
A number can be specified as a fraction (fraction reduction not required) or a floating point number. You may also output "scaled" vectors to specify a node. For example, all 3 of the following outputs are equivalent and allowed:

```<code>0.5,0.5,0

1/2,2/4,0

[1,1,0]/2
</code>```

If using floating point output, your output should be accurate to within 1%. The output may be to any sink desired (stdio, return value, return parameter, etc.). Note that even though the barycentric coordinates are uniquely determined by only 2 numbers per node, you should output all 3 numbers per node.

Examples

Example cases are formatted as:

```<code>N
x0,y0,z0
x1,y1,z1
x2,y2,z2
...
</code>```

where the first line is the input N, and all following lines form a node x,y,z which should be in the output exactly once. All numbers are given as approximate floating point numbers.

```<code>0
1,0,0
0,1,0
0,0,1

1
1,0,0
0,1,0
0,0,1
0.5,0,0.5
0.5,0.5,0
0,0.5,0.5

2
1,0,0
0,1,0
0,0,1
0.667,0,0.333
0.667,0.333,0
0.333,0,0.667
0.333,0.333,0.333
0.333,0.667,0
0,0.333,0.667
0,0.667,0.333

3
1,0,0
0.75,0,0.25
0.75,0.25,0
0.5,0,0.5
0.5,0.25,0.25
0.5,0.5,0
0.25,0,0.75
0.25,0.25,0.5
0.25,0.5,0.25
0.25,0.75,0
0,0,1
0,0.25,0.75
0,0.5,0.5
0,0.75,0.25
0,1,0
</code>```

Scoring

This is code golf; shortest code in bytes wins. Standard loopholes apply. You may use any built-ins desired.

Body:
Haskell, 53 bytes

f n|m<-n+1=[map(/m)[x,y,m-x-y]|x<-[0..m],y<-[0..m-x]]


答:
Mathematica, <s> 44 </s> 43 bytes

```<code>Select[Range[0,x=#+1]~Tuples~3/x,Tr@#==1&]&
</code>```

This is an unnamed function taking a single integer argument. Output is a list of lists of exact (reduced) fractions.

Generates all 3-tuples of multiples of 1/(N+1) between 0 and 1, inclusive, and then selects those whose sum is 1 (as required by barycentric coordinates).

Title: My triangle needs more nodes

Body:
Mathematica, <s> 44 </s> 43 bytes

Select[Range[0,x=#+1]~Tuples~3/x,Tr@#==1&]&

This is an unnamed function taking a single integer argument. Output is a list of lists of exact (reduced) fractions.

Generates all 3-tuples of multiples of 1/(N+1) between 0 and 1, inclusive, and then selects those whose sum is 1 (as required by barycentric coordinates).


Title: Text animation format Code Golf

Body:
C#, <s>160</s> 155 bytes

s=>{var r="";int i=1,j;var t=s.Split('f','F');while(i<t.Length){var u=t[i++].Split('w','W');for(j=0;j++<int.Parse(u[1]);)r+=u[0]+",";}return r.Trim(',');};


问:
Smallest positive number whose y-th power is divisible by x

Task

Given integers x and y which are both at least 2, find the smallest positive number whose y-th power is divisible by x.

Example

Given x=96 and y=2, the output should be 24 since 24 is the smallest positive n satisfying n^2 is divisible by 96.

Testcases

```<code>x  y output
26 2 26
96 2 24
32 3 4
64 9 2
27 3 3
</code>```

Scoring

This is code-golf. Solution with lowest byte-count wins.

References

y=2: OEIS A019554

y=3: OEIS A019555

y=4: OEIS A053166

y=5: OEIS A015052

y=6: OEIS A015054

答:
Perl, <s>29</s> 26 bytes

Includes +3 for -p (not +1 since the code contains ')

Run with the input on STDIN

```<code>power.pl <<< "96 2"
</code>```

power.pl:

```<code>#!/usr/bin/perl -p
/ /;1while++$\**$'%$`}{
</code>```

Body:
Perl, <s>29</s> 26 bytes

Includes +3 for -p (not +1 since the code contains ')

Run with the input on STDIN

power.pl <<< "96 2"

power.pl:

#!/usr/bin/perl -p
/ /;1while++$\**$'%$`}{


问:
Calculate the difficulty of a Code Golf question

Briefing

The difficulty of a Code Golf question can be calculated as such:

$$\text{clamp} \left( \left\lceil \left( \frac v a \div 700 \right) \times 10 \right\rceil, 0, 10 \right)$$

Where \$v\$ is the number of views a question has

and \$a\$ is the number of answers a question has

and \$⌈x⌉\$ is the ceiling operator.

Also:

$$\text{clamp}(x, min, max) = \begin{cases}
min & x < min \\
x   & min \le x \le max \\
max & max < x
\end{cases}$$

This question's current difficulty: ***

Task

Write a program that will take two integers (v and a) and output the difficulty in asterisks (*).

The input can be in the form of an array, a separated string or as separate function arguments

Test Data

```<code>Views   Answers Difficulty  Program Output
163     2       2           **
548     22      1           *
1452    24      1           *
1713    37      1           *
4162    32      2           **
3067    15      3           ***
22421   19      10          **********
</code>```

Example with pseudocode

```<code>v: 1713
a: 37
out = clamp(ceil(((v/a)/700)*10), 0, 10); // evaluates to 1
//program will output '*'
</code>```

The shortest code in bytes wins! Trailing/ leading spaces are allowed.

答:
Perl 6: 32 bytes

As a lambda that takes two arguments:

```<code>{"*"x min 10,ceiling $^x/$^y/70}
</code>```

Body:
Perl 6: 32 bytes

As a lambda that takes two arguments:

{"*"x min 10,ceiling $^x/$^y/70}


答:
MATL, 17 bytes

```<code>2+:qGQ/3Z^t!s1=Y)
</code>```

Try it online!

Explanation

The approach is the same as in other answers:

Generate the array [0, 1/(n+1), 2/(n+1), ..., 1], where n is the input;

Generate all 3-tuples with those values;

Keep only those whose sum is 1.

More specifically:

```<code>2+     % Take input and add 2: produces n+2
:q     % Range [0 1 ... n+1]
GQ/    % Divide by n+1 element-wise: gives [0, 1/(n+1), 2/(n+1)..., 1]
3Z^    % Cartesian power with exponent 3. Gives (n+1)^3 × 3 array. Each row is a 3-tuple
t      % Duplicate
!s     % Sum of each row
1=     % Logical index of entries that equal 1
Y)     % Use that index to select rows of the 2D array of 3-tuples
</code>```

Title: My triangle needs more nodes

Body:
MATL, 17 bytes

2+:qGQ/3Z^t!s1=Y)

Try it online!

Explanation

The approach is the same as in other answers:

Generate the array [0, 1/(n+1), 2/(n+1), ..., 1], where n is the input;

Generate all 3-tuples with those values;

Keep only those whose sum is 1.

More specifically:

2+     % Take input and add 2: produces n+2
:q     % Range [0 1 ... n+1]
GQ/    % Divide by n+1 element-wise: gives [0, 1/(n+1), 2/(n+1)..., 1]
3Z^    % Cartesian power with exponent 3. Gives (n+1)^3 × 3 array. Each row is a 3-tuple
t      % Duplicate
!s     % Sum of each row
1=     % Logical index of entries that equal 1
Y)     % Use that index to select rows of the 2D array of 3-tuples