答:
Python + PIL, <s>365</s> 355

```<code>from math import*;from random import*
from PIL import Image,ImageDraw
L,a,r=256,0,0.8;l,p,c=L/2,L/6,(L,L,L);I=Image.new('RGB',(L,L),c);D=ImageDraw.Draw(I)
x=input()
for i in x:b=a+ceil(360.0*i/sum(x));D.pieslice((p,p,L-p,L-p),int(a),int(b),tuple(map(randrange,c)));t=(a+b)*0.00872;D.text((l+cos(t)*l*r,l+sin(t)*l*r),str(int((b-a)/3.6))+'%',0);a=b
I.show()
</code>```

Result for the largest example list :

Title: Create a pie chart

Body:
Python + PIL, <s>365</s> 355

from math import*;from random import*
from PIL import Image,ImageDraw
L,a,r=256,0,0.8;l,p,c=L/2,L/6,(L,L,L);I=Image.new('RGB',(L,L),c);D=ImageDraw.Draw(I)
x=input()
for i in x:b=a+ceil(360.0*i/sum(x));D.pieslice((p,p,L-p,L-p),int(a),int(b),tuple(map(randrange,c)));t=(a+b)*0.00872;D.text((l+cos(t)*l*r,l+sin(t)*l*r),str(int((b-a)/3.6))+'%',0);a=b
I.show()

Result for the largest example list :


问:
Find the program that prints this integer sequence (Robbers' thread)
This is the robbers' thread. The cops' thread goes here.

In the cops thread, the task was to write a program/function that takes a positive (or non-negative) integer and outputs/returns another number (not necessarily integer). The robbers task is to unscramble the code the cops used to produce this output.

The cracked code doesn't have to be identical, as long as it has the same length and any revealed characters are in the correct positions. The language must also be the same (version numbers can be different). The output must of course be identical.

No-ops can be used in robber's solution.

The winner of the robbers thread will be the user who has cracked the
most submissions by May 7th 2016. If there's a tie, the user who has cracked submissions with the longest combined code will win.

The submission should be formatted like this:

Language, nn characters (including link to answer), Cop's username

Code:

```<code>function a(n)
    if n<2 then
        return n
    else
        return a(n-1) + a(n-2)
    end
end
</code>```

Output

```<code>a(0) returns 0
a(3) returns 2
</code>```

Optional explanation and comments.

答:
05AB1E, 28 bytes, Lause, A256861

Code:

```<code>DD>D>D>D>****sD<*6+*6n2n5**/
</code>```

Explanation:

```<code>              # implicit n on stack
DD>D>D>D>     # save n,n+1,n+2,n+3,n+4 on the stack
****          # multiply top 5 on stack together
              #     new stack: n,n(n+1)(n+2)(n+3)(n+4)
sD<*          # rotate, duplicate, decrease, multiply
              #     new stack: n(n+1)(n+2)(n+3)(n+4),n(n-1)
6+*           # add 6 to stack, add top 2, multiply top 2
              #     new stack: n(n+1)(n+2)(n+3)(n+4)(n(n-1)*6)
6n2n5**       # add 720 to stack
/             # divide
              # implicitly print n(n+1)(n+2)(n+3)(n+4)(n(n-1)*6)/720
</code>```

ContentLicense: CC BY-SA 3.0

Body:
05AB1E, 28 bytes, Lause, A256861

Code:

DD>D>D>D>****sD<*6+*6n2n5**/

Explanation:

              # implicit n on stack
DD>D>D>D>     # save n,n+1,n+2,n+3,n+4 on the stack
****          # multiply top 5 on stack together
              #     new stack: n,n(n+1)(n+2)(n+3)(n+4)
sD<*          # rotate, duplicate, decrease, multiply
              #     new stack: n(n+1)(n+2)(n+3)(n+4),n(n-1)
6+*           # add 6 to stack, add top 2, multiply top 2
              #     new stack: n(n+1)(n+2)(n+3)(n+4)(n(n-1)*6)
6n2n5**       # add 720 to stack
/             # divide
              # implicitly print n(n+1)(n+2)(n+3)(n+4)(n(n-1)*6)/720


问:
All together now
Given a list of digits 1 through 9, output whether each digit is grouped together as a single contiguous block. In other words, no two of the same digit are separated by different digits. It's OK if a digit doesn't appear at all. Fewest bytes wins.

Input: A non-empty list of digits 1 through 9. This can be as a decimal number, string, list, or similar sequence.

Output: A consistent Truthy value if all the digits are grouped in contiguous blocks, and a consistent Falsey value if they are not.

True cases:

```<code>3
51
44999911
123456789
222222222222222222222
</code>```

False cases:

```<code>818
8884443334
4545
554553
1234567891
</code>```

var QUESTION_ID=77608,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/77608/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
C#, 119 bytes

```<code>bool m(String s){for(int i=0;i<9;i++){if(new Regex(i.ToString()+"+").Matches(s).Count>1){return false;}}return true;}
</code>```

Ungolfed

```<code>bool m(String s) {
    for(int i=0;i<9;i++) {
        if(new Regex(i.ToString() + "+").Matches(s).Count > 1) {
            return false;
        }
    }

    return true;
}
</code>```

Title: All together now

Body:
C#, 119 bytes

bool m(String s){for(int i=0;i<9;i++){if(new Regex(i.ToString()+"+").Matches(s).Count>1){return false;}}return true;}

Ungolfed

bool m(String s) {
    for(int i=0;i<9;i++) {
        if(new Regex(i.ToString() + "+").Matches(s).Count > 1) {
            return false;
        }
    }

    return true;
}


问:
Parenthifiable Binary Numbers
If you express some positive integer in binary with no leading zeros and replace every 1 with a ( and every 0 with a ), then will all the parentheses match?

In most cases they won't. For example, 9 is 1001 in binary, which becomes ())(, where only the first two parentheses match.

But sometimes they will match. For example, 44 is 101100 in binary, which becomes ()(()), where all the left parentheses have a matching right parenthesis.

Write a program or function that takes in a positive base ten integer and prints or returns a truthy value if the binary-parentheses version of the number has all matching parentheses. If it doesn't, print or return a falsy value.

The shortest code in bytes wins.

Related OEIS sequence.

Truthy examples below 100:

```<code>2, 10, 12, 42, 44, 50, 52, 56
</code>```

Falsy examples below 100:

```<code>1, 3, 4, 5, 6, 7, 8, 9, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 45, 46, 47, 48, 49, 51, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
</code>```

答:
C++, 61 bytes

I think the current C++ answer is wrong: it returns a truthy value for all even numbers, e.g. 4. Disclaimer: I was not able to use the mentioned compiler, so I used g++ 4.8.4. The problem lies in the use of the binary AND operator instead of the logical AND which is used to break early when the number of closing parentheses exceed the number of opening parentheses. This approach could work if true is represented as a word with an all true bit pattern. On my system, and probably most other systems, true is equivalent to 1; only one bit is true. Also, n/=2 is shorter than n>>=1. Here is an improved version as a function:

```<code>int f(int n,int c=0){for(;c>=0&&n;n/=2)c+=n&1?-1:1;return c;}
</code>```

Title: Parenthifiable Binary Numbers

Body:
C++, 61 bytes

I think the current C++ answer is wrong: it returns a truthy value for all even numbers, e.g. 4. Disclaimer: I was not able to use the mentioned compiler, so I used g++ 4.8.4. The problem lies in the use of the binary AND operator instead of the logical AND which is used to break early when the number of closing parentheses exceed the number of opening parentheses. This approach could work if true is represented as a word with an all true bit pattern. On my system, and probably most other systems, true is equivalent to 1; only one bit is true. Also, n/=2 is shorter than n>>=1. Here is an improved version as a function:

int f(int n,int c=0){for(;c>=0&&n;n/=2)c+=n&1?-1:1;return c;}


问:
Identify the Conic Section
Given 5 distinct points on a two-dimensional plane, determine the type of conic section formed by the points. The output shall be one of circle, hyperbola, ellipse, or parabola.

Rules

The points will be in general linear position, meaning that no three points are collinear, and thus the conic passing through them will be unique.

The coordinates of the 5 points will be decimal numbers between -10 and 10, inclusive.

The precision for the decimal/float values should be the precision of your language's native float/decimal type. If your language/data type is arbitrary-precision, you may use 12 digits after the decimal point as the maximum required precision, rounding toward zero (e.g. 1.0000000000005 == 1.000000000000).

Capitalization of the output does not matter.

Outputting ellipse when the conic section is actually a circle is not allowed. All circles are ellipses, but you must output the most specific one.

On floating point inaccuracies and precision:

I'm trying to make this as simple as possible, so that issues with floating point inaccuracies don't get in the way. The goal is, if the data type was "magical infinite precision value" instead of float/double, then everything would work perfectly. But, since "magical infinite precision value" doesn't exist, you write code that assumes that your values are infinite precision, and any issues that crop up as a result of floating point inaccuracies are features, not bugs.

Test Cases

```<code>(0, 0), (1, 5), (2, 3), (4, 8), (9, 2) => hyperbola
(1.2, 5.3), (4.1, 5.6), (9.1, 2.5), (0, 1), (4.2, 0) => ellipse
(5, 0), (4, 3), (3, 4), (0, 5), (0, -5) => circle
(1, 0), (0, 1), (2, 1), (3, 4), (4, 9) => parabola
</code>```

答:
JavaScript (ES6), 316 <s>323 347</s>

p=>[1,2,4].some(x=>(d=D(Q=[[x&1,x&2,x&4,0,0,0],...p.map(([x,y])=>[x*x,x*y,y*y,x,y,1])]))?[a,b,c]=Q.map((v,i)=>D(Q.map((r,j)=>(r=[...r],r[i]=x*!j,r)))/d):0,D=m=>m[1]?m[0].reduce((r,v,i)=>r+(i&1?-v:v)*D(m.slice(1).map(r=>r.filter((a,j)=>j-i))),0):m)&&(d=b*b-4*a*c)?d<0?!b&c==a?'Circle':'Ellipse':'Hyperbola':'Parabola'
```

<p>Any language better suited for handling matrix and determinant should score better (APL, J, CJAM, Jelly)</p>

<p>References: General form of a conic, Five points determine a conic, System of linear equations, Determinant</p>

<p>In the cartesian plane, the general equation of a conic is</p>

<pre class="lang-js prettyprint-override"><code>A*x*x + B*x*y + C*y*y + D*x + E*y + F = 0
</code>```

having A or B or C not equal to 0 (otherwise it's a straight line)

A ... F are six unknowns to be found. With five pairs of (x,y) we can build a linear system with five equations, and scaling remove one dimension. That is, we can set one of A,B or C to 1 if it's not 0 (and we know that at least one is not 0).

I build and try to solve 3 systems: first trying A=1. If not solvable then B=1, then C. (There could be a better way, but that's my best at the time)

Having the values of A,B,C we can classify the conic looking at the discriminant d=B*B-4*A*C

d == 0 -> parabola

d > 0 -> hyperbola

d < 0 -> ellipse, particularly (A == C and B == 0) -> circle

Less golfed

F=p=>(
  // Recursive function to find determinant of a square matrix
  D=m=>m[1]
    ?m[0].reduce((r,v,i)=>r+(i&1?-v:v)*D(m.slice(1).map(r=>r.filter((a,j)=>j-i))),0)
    :m,
  // Try 3 linear systems, coefficients in Q
  // Five equation made from the paramaters in p
  // And a first equation with coefficient like k,0,0,0,0,0,1 (example for A)
  [1,2,4].some(
    x => (
      // matrix to calc the determinant, last coefficient is missing at this stage
      Q = [
        [x&1, x&2, x&4, 0,0,0] // first one is different
        // all other equations built from the params
        ,...p.map( ([x,y]) => [x*x, x*y, y*y, x, y, 1] )
      ],
      d = D(Q), // here d is the determinant
      d && ( // if solvable  then d != 0
        // add missing last coefficient to Q
        // must be != 0 for the first row, must be 0 for the other
        Q.map( r=> (r.push(x), x=0) ),
        // solve the system (Cramer's rule), I get all values for A...F but I just care of a,b,c
        [a,b,c] = Q.map((v,i)=>D(Q.map(r=>(r=[...r],r[i]=r.pop(),r))) / d),
        d = b*b - 4*a*c, // now reuse d for discriminant
        d = d<0 ? !b&c==a ? 'Circle' : 'Ellipse' // now reuse d for end result
        : d ? 'Hyperbola' : 'Parabola'
      ) // exit .some if not 0
    ), d // .some exit with true, the result is in d
  )
)
```

<p><strong>Test</strong></p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>F=p=>[1,2,4].some(x=>(d=D(Q=[[x&1,x&2,x&4,0,0,0],...p.map(([x,y])=>[x*x,x*y,y*y,x,y,1])]))?[a,b,c]=Q.map((v,i)=>D(Q.map((r,j)=>(r=[...r],r[i]=x*!j,r)))/d):0,D=m=>m[1]?m[0].reduce((r,v,i)=>r+(i&1?-v:v)*D(m.slice(1).map(r=>r.filter((a,j)=>j-i))),0):m)&&(d=b*b-4*a*c)?d<0?!b&c==a?'Circle':'Ellipse':'Hyperbola':'Parabola'

console.log=(...x)=>O.textContent+=x+'\n'

;[
 [[0, 0], [1, 5], [2, 3], [4, 8], [9, 2]]
,[[1.2, 5.3],[4.1, 5.6], [9.1, 2.5], [0, 1], [4.2, 0]]
,[[5, 0], [4, 3], [3, 4], [0, 5], [0, -5]]
,[[1, 0], [0, 1], [2, 1], [3, 4], [4, 9]]
].forEach(t=>console.log(t.join`|`+' => '+F(t)))</code>```

```</code>```

Title: Identify the Conic Section

Body:
JavaScript (ES6), 316 <s>323 347</s>

p=>[1,2,4].some(x=>(d=D(Q=[[x&1,x&2,x&4,0,0,0],...p.map(([x,y])=>[x*x,x*y,y*y,x,y,1])]))?[a,b,c]=Q.map((v,i)=>D(Q.map((r,j)=>(r=[...r],r[i]=x*!j,r)))/d):0,D=m=>m[1]?m[0].reduce((r,v,i)=>r+(i&1?-v:v)*D(m.slice(1).map(r=>r.filter((a,j)=>j-i))),0):m)&&(d=b*b-4*a*c)?d<0?!b&c==a?'Circle':'Ellipse':'Hyperbola':'Parabola'

Any language better suited for handling matrix and determinant should score better (APL, J, CJAM, Jelly)

References: General form of a conic, Five points determine a conic, System of linear equations, Determinant

In the cartesian plane, the general equation of a conic is

A*x*x + B*x*y + C*y*y + D*x + E*y + F = 0

having A or B or C not equal to 0 (otherwise it's a straight line)

A ... F are six unknowns to be found. With five pairs of (x,y) we can build a linear system with five equations, and scaling remove one dimension. That is, we can set one of A,B or C to 1 if it's not 0 (and we know that at least one is not 0).

I build and try to solve 3 systems: first trying A=1. If not solvable then B=1, then C. (There could be a better way, but that's my best at the time)

Having the values of A,B,C we can classify the conic looking at the discriminant d=B*B-4*A*C

d == 0 -> parabola

d > 0 -> hyperbola

d < 0 -> ellipse, particularly (A == C and B == 0) -> circle

Less golfed

F=p=>(
  // Recursive function to find determinant of a square matrix
  D=m=>m[1]
    ?m[0].reduce((r,v,i)=>r+(i&1?-v:v)*D(m.slice(1).map(r=>r.filter((a,j)=>j-i))),0)
    :m,
  // Try 3 linear systems, coefficients in Q
  // Five equation made from the paramaters in p
  // And a first equation with coefficient like k,0,0,0,0,0,1 (example for A)
  [1,2,4].some(
    x => (
      // matrix to calc the determinant, last coefficient is missing at this stage
      Q = [
        [x&1, x&2, x&4, 0,0,0] // first one is different
        // all other equations built from the params
        ,...p.map( ([x,y]) => [x*x, x*y, y*y, x, y, 1] )
      ],
      d = D(Q), // here d is the determinant
      d && ( // if solvable  then d != 0
        // add missing last coefficient to Q
        // must be != 0 for the first row, must be 0 for the other
        Q.map( r=> (r.push(x), x=0) ),
        // solve the system (Cramer's rule), I get all values for A...F but I just care of a,b,c
        [a,b,c] = Q.map((v,i)=>D(Q.map(r=>(r=[...r],r[i]=r.pop(),r))) / d),
        d = b*b - 4*a*c, // now reuse d for discriminant
        d = d<0 ? !b&c==a ? 'Circle' : 'Ellipse' // now reuse d for end result
        : d ? 'Hyperbola' : 'Parabola'
      ) // exit .some if not 0
    ), d // .some exit with true, the result is in d
  )
)

Test

F=p=>[1,2,4].some(x=>(d=D(Q=[[x&1,x&2,x&4,0,0,0],...p.map(([x,y])=>[x*x,x*y,y*y,x,y,1])]))?[a,b,c]=Q.map((v,i)=>D(Q.map((r,j)=>(r=[...r],r[i]=x*!j,r)))/d):0,D=m=>m[1]?m[0].reduce((r,v,i)=>r+(i&1?-v:v)*D(m.slice(1).map(r=>r.filter((a,j)=>j-i))),0):m)&&(d=b*b-4*a*c)?d<0?!b&c==a?'Circle':'Ellipse':'Hyperbola':'Parabola'

console.log=(...x)=>O.textContent+=x+'\n'

;[
 [[0, 0], [1, 5], [2, 3], [4, 8], [9, 2]]
,[[1.2, 5.3],[4.1, 5.6], [9.1, 2.5], [0, 1], [4.2, 0]]
,[[5, 0], [4, 3], [3, 4], [0, 5], [0, -5]]
,[[1, 0], [0, 1], [2, 1], [3, 4], [4, 9]]
].forEach(t=>console.log(t.join`|`+' => '+F(t)))

<pre id=O></pre>


答:
Convex, 17 bytes

```<code>9´\f{\s'++\ð½¬}ª!
</code>```

Try it online!

Title: All together now

Body:
Given a list of digits 1 through 9, output whether each digit is grouped together as a single contiguous block. In other words, no two of the same digit are separated by different digits. It's OK if a digit doesn't appear at all. Fewest bytes wins.

Input: A non-empty list of digits 1 through 9. This can be as a decimal number, string, list, or similar sequence.

Output: A consistent Truthy value if all the digits are grouped in contiguous blocks, and a consistent Falsey value if they are not.

True cases:

```<code>3
51
44999911
123456789
222222222222222222222
</code>```

False cases:

```<code>818
8884443334
4545
554553
1234567891
</code>```

var QUESTION_ID=77608,OVERRIDE_USER=20260;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/77608/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Convex, 17 bytes

9´\f{\s'++\ð½¬}ª!

Try it online!


问:
Tips for golfing in Python
What general tips do you have for golfing in Python? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Python (e.g. "remove comments" is not an answer).

Please post one tip per answer.

答:
One trick I have encountered concerns returning or printing Yes/No answers:

```<code> print 'YNeos'[x::2]
</code>```

x is the condition and can take value 0 or 1.

I found this rather brilliant.

Title: Tips for golfing in Python

Body:
One trick I have encountered concerns returning or printing Yes/No answers:

 print 'YNeos'[x::2]

x is the condition and can take value 0 or 1.

I found this rather brilliant.


答:
Ruby, 79

```<code>->n{1.upto(n*=3){|i|puts (' '*(n-i)).ljust(n+i,'/__\_\/\ \__/_/\/ '[i%3*6,6])}}
</code>```

A. (-4 bytes, -1 +1) changed from 0-indexed (.times) to 1-indexed (1.upto)

B. (-5 bytes) changed from array of three 6-char strings to selection of 6-char substring of 18-char string.

C. (-1 byte) m=n*3 -> n*=3

D. (-5 bytes) reduced all five double backslashes to single backslashes (partly made possible by reordering of string required for point A)

Ruby, 94

```<code>->n{(m=n*3).times{|i|puts (' '*(m-i-1)).ljust(m+i+1,[ '/\\ \\__','/_/\\/ ','/__\\_\\'][i%3])}}
</code>```

explanation

The basic unit is a 3x6 diamond as follows (last character on each row duplicated for clarity:)

```<code>    /\ \__/
   /_/\/ /
  /__\_\/
</code>```

All we need to do is display a suitable window of this pattern. Ruby's ljust allows you to pad with any string, not just spaces. Normally ljust would be used to pad a string of printable characters by adding spaces at the end, but here we use it in reverse: to pad a string of spaces by adding printable characters at the end.

ungolfed in test program

```<code>f=->n{
  (m=n*3).times{|i|                  #for each line of the triangle
    puts (' '*(m-i-1)).              #print m-i-1 spaces,
      ljust(m+i+1,[ '/\\ \\__',      #left justified and padded to total length m+i+1
                   '/_/\\/ ',        #by one of these three strings
                  '/__\\_\\'][i%3])
  }
}

f[gets.to_i]
</code>```

Title: Build a triangle without any triangles

Body:
As a little kid, I liked to play with these toys a lot:

They probably intended for these to be used for art, but I always used them for math! Fractals, patterns, etc. One time, I was given this challenge:

Build a triangle without using any of the green triangle tiles.

This challenge stumped me for the longest time, until I stumbled upon a really beautiful and simple way to do it with just 3 trapezoids:

```<code>  /\
 /_/\
/__\_\
</code>```

Now, take this triangle, and rotate it:

```<code>______
\ \__/
 \/ /
  \/
</code>```

Using these two triangles, we can construct larger triangles out of them. Here is a triangle of height 2:

```<code>     /\
    /_/\
   /__\_\
  /\ \__/\
 /_/\/ /_/\
/__\_\/__\_\
</code>```

And here are triangles of height 3-7:

```<code>#3
        /\
       /_/\
      /__\_\
     /\ \__/\
    /_/\/ /_/\
   /__\_\/__\_\
  /\ \__/\ \__/\
 /_/\/ /_/\/ /_/\
/__\_\/__\_\/__\_\

#4
           /\
          /_/\
         /__\_\
        /\ \__/\
       /_/\/ /_/\
      /__\_\/__\_\
     /\ \__/\ \__/\
    /_/\/ /_/\/ /_/\
   /__\_\/__\_\/__\_\
  /\ \__/\ \__/\ \__/\
 /_/\/ /_/\/ /_/\/ /_/\
/__\_\/__\_\/__\_\/__\_\

#5
              /\
             /_/\
            /__\_\
           /\ \__/\
          /_/\/ /_/\
         /__\_\/__\_\
        /\ \__/\ \__/\
       /_/\/ /_/\/ /_/\
      /__\_\/__\_\/__\_\
     /\ \__/\ \__/\ \__/\
    /_/\/ /_/\/ /_/\/ /_/\
   /__\_\/__\_\/__\_\/__\_\
  /\ \__/\ \__/\ \__/\ \__/\
 /_/\/ /_/\/ /_/\/ /_/\/ /_/\
/__\_\/__\_\/__\_\/__\_\/__\_\

#6
                 /\
                /_/\
               /__\_\
              /\ \__/\
             /_/\/ /_/\
            /__\_\/__\_\
           /\ \__/\ \__/\
          /_/\/ /_/\/ /_/\
         /__\_\/__\_\/__\_\
        /\ \__/\ \__/\ \__/\
       /_/\/ /_/\/ /_/\/ /_/\
      /__\_\/__\_\/__\_\/__\_\
     /\ \__/\ \__/\ \__/\ \__/\
    /_/\/ /_/\/ /_/\/ /_/\/ /_/\
   /__\_\/__\_\/__\_\/__\_\/__\_\
  /\ \__/\ \__/\ \__/\ \__/\ \__/\
 /_/\/ /_/\/ /_/\/ /_/\/ /_/\/ /_/\
/__\_\/__\_\/__\_\/__\_\/__\_\/__\_\

#7
                    /\
                   /_/\
                  /__\_\
                 /\ \__/\
                /_/\/ /_/\
               /__\_\/__\_\
              /\ \__/\ \__/\
             /_/\/ /_/\/ /_/\
            /__\_\/__\_\/__\_\
           /\ \__/\ \__/\ \__/\
          /_/\/ /_/\/ /_/\/ /_/\
         /__\_\/__\_\/__\_\/__\_\
        /\ \__/\ \__/\ \__/\ \__/\
       /_/\/ /_/\/ /_/\/ /_/\/ /_/\
      /__\_\/__\_\/__\_\/__\_\/__\_\
     /\ \__/\ \__/\ \__/\ \__/\ \__/\
    /_/\/ /_/\/ /_/\/ /_/\/ /_/\/ /_/\
   /__\_\/__\_\/__\_\/__\_\/__\_\/__\_\
  /\ \__/\ \__/\ \__/\ \__/\ \__/\ \__/\
 /_/\/ /_/\/ /_/\/ /_/\/ /_/\/ /_/\/ /_/\
/__\_\/__\_\/__\_\/__\_\/__\_\/__\_\/__\_\
</code>```

The Challenge

Write a program or function that takes a number n and prints a triangle-less triangle of height n. Trailing spaces on each line is acceptable, and up to one trailing or leading newline is also acceptable. IO can be in any reasonable format. The input is guarenteed to be a positive integer, so you don't have to worry about negative numbers, decimals, non-numbers etc.

Shortest answer in bytes wins!

Body:
Ruby, 79

->n{1.upto(n*=3){|i|puts (' '*(n-i)).ljust(n+i,'/__\_\/\ \__/_/\/ '[i%3*6,6])}}

A. (-4 bytes, -1 +1) changed from 0-indexed (.times) to 1-indexed (1.upto)

B. (-5 bytes) changed from array of three 6-char strings to selection of 6-char substring of 18-char string.

C. (-1 byte) m=n*3 -> n*=3

D. (-5 bytes) reduced all five double backslashes to single backslashes (partly made possible by reordering of string required for point A)

Ruby, 94

->n{(m=n*3).times{|i|puts (' '*(m-i-1)).ljust(m+i+1,[ '/\\ \\__','/_/\\/ ','/__\\_\\'][i%3])}}

explanation

The basic unit is a 3x6 diamond as follows (last character on each row duplicated for clarity:)

    /\ \__/
   /_/\/ /
  /__\_\/

All we need to do is display a suitable window of this pattern. Ruby's ljust allows you to pad with any string, not just spaces. Normally ljust would be used to pad a string of printable characters by adding spaces at the end, but here we use it in reverse: to pad a string of spaces by adding printable characters at the end.

ungolfed in test program

f=->n{
  (m=n*3).times{|i|                  #for each line of the triangle
    puts (' '*(m-i-1)).              #print m-i-1 spaces,
      ljust(m+i+1,[ '/\\ \\__',      #left justified and padded to total length m+i+1
                   '/_/\\/ ',        #by one of these three strings
                  '/__\\_\\'][i%3])
  }
}

f[gets.to_i]


问:
Generate the minimal remainder sequence
Every number can be represented using an infinitely long remainder sequence.  For example, if we take the number 7, and perform 7mod2, then 7mod3, then 7mod4, and so on, we get 1,1,3,2,1,0,7,7,7,7,.....

However, we need the shortest possible remainder subsequence that can still be used to distinguish it from all lower numbers.  Using 7 again, [1,1,3] is the shortest subsequence, because all of the previous subsequences don't start with [1,1,3]:

```<code>0: 0,0,0,0...
1: 1,1,1,1...
2: 0,2,2,2...
3: 1,0,3,3...
4: 0,1,0,4...
5: 1,2,1,0...
6: 0,0,2,1...
</code>```

Note that [1,1] doesn't work to represent 7, because it can also be used to represent 1.  However, you should output [1] with an input of 1.

Input/Output

Your input is a non-negative integer.  You must output a sequence or list of the minimal-length sequence of remainders as defined above.

Test cases:

```<code>0: 0
1: 1
2: 0,2
3: 1,0
4: 0,1
5: 1,2
6: 0,0,2
7: 1,1,3
8: 0,2,0
9: 1,0,1
10: 0,1,2
11: 1,2,3
12: 0,0,0,2
30: 0,0,2,0
42: 0,0,2,2
59: 1,2,3,4
60: 0,0,0,0,0,4
257: 1,2,1,2,5,5
566: 0,2,2,1,2,6,6
1000: 0,1,0,0,4,6,0,1
9998: 0,2,2,3,2,2,6,8,8,10
9999: 1,0,3,4,3,3,7,0,9,0
</code>```

Here are the first 10,000 sequences, in case you are interested (the line numbers are off by 1).

This is a code-golf, so make it as short as you can in your favorite language.  Fake bonus points for any answers that are fast!

答:
Mathematica, <s>60</s> 53 bytes

```<code>#~Mod~FirstCase[2~Range~#&/@Range[#+2],x_/;LCM@@x>#]&
</code>```

Somewhat fast (it handles 10000 in ~0.1 second, but will likely run out of memory for 100000).

The code throws an error but computes the result correctly.

Explanation

We've found earlier in chat that the required divisors can always be determined as the shortest list {1, 2, ..., n} whose least common multiple exceeds the input. A short argument for why that is: if the LCM is less than the input, then subtracting the LCM from the input would leave all the divisors unchanged, so the representation is not unique. However, for all inputs less than the LCM, the remainders will be unique, otherwise the difference between two numbers with equal remainders would be a smaller multiple of all divisors.

As for the code... as usual the reading order of golfed Mathematica is a bit funny.

```<code>Range[#+2]
</code>```

This gets us a list [1, 2, 3, ..., n+2] for input n. The +2 is to ensure that it works correctly for 0 and 1.

```<code>2~Range~#&/@...
</code>```

Map 2~Range~# (syntactic sugar for Range[2,#]) over this list, so we get

```<code>{{}, {2}, {2,3}, ..., {2,3,...,n+2}}
</code>```

These are candidate divisor lists (of course in general that's a lot more than we'll need). Now we find the first one of them whose LCM exceeds the input with:

```<code>FirstCase[...,x_/;LCM@@x>#]
</code>```

More syntax: x_ is a pattern which matches any of the lists and calls it x. The /; attaches a condition to that pattern. This condition is LCM@@x># where @@ applies the function to the list, i.e. LCM@@{1,2,3} means LCM[1,2,3].

Finally we simply get all the remainders, making use of the fact that Mod is Listable, i.e. it automatically maps over a list if one of the arguments is a list (or if both of them are lists of the same length):

```<code>#~Mod~...
</code>```

Title: Generate the minimal remainder sequence

Body:
Mathematica, <s>60</s> 53 bytes

#~Mod~FirstCase[2~Range~#&/@Range[#+2],x_/;LCM@@x>#]&

Somewhat fast (it handles 10000 in ~0.1 second, but will likely run out of memory for 100000).

The code throws an error but computes the result correctly.

Explanation

We've found earlier in chat that the required divisors can always be determined as the shortest list {1, 2, ..., n} whose least common multiple exceeds the input. A short argument for why that is: if the LCM is less than the input, then subtracting the LCM from the input would leave all the divisors unchanged, so the representation is not unique. However, for all inputs less than the LCM, the remainders will be unique, otherwise the difference between two numbers with equal remainders would be a smaller multiple of all divisors.

As for the code... as usual the reading order of golfed Mathematica is a bit funny.

Range[#+2]

This gets us a list [1, 2, 3, ..., n+2] for input n. The +2 is to ensure that it works correctly for 0 and 1.

2~Range~#&/@...

Map 2~Range~# (syntactic sugar for Range[2,#]) over this list, so we get

{{}, {2}, {2,3}, ..., {2,3,...,n+2}}

These are candidate divisor lists (of course in general that's a lot more than we'll need). Now we find the first one of them whose LCM exceeds the input with:

FirstCase[...,x_/;LCM@@x>#]

More syntax: x_ is a pattern which matches any of the lists and calls it x. The /; attaches a condition to that pattern. This condition is LCM@@x># where @@ applies the function to the list, i.e. LCM@@{1,2,3} means LCM[1,2,3].

Finally we simply get all the remainders, making use of the fact that Mod is Listable, i.e. it automatically maps over a list if one of the arguments is a list (or if both of them are lists of the same length):

#~Mod~...


答:
MATL, 24 bytes

Thanks to @nimi for pointing out an error in a previous version of this answer (now corrected)

```<code>Q:qtQ!\t0Z)tb=YpsSP2):Q)
</code>```

This runs out of memory in the online compiler for the two largest test cases (but it works on a computer with 4 GB RAM).

Try it online!

Explanation

This applies the definition in a straightforward manner. For input n it computes a 2D array containing mod(p,q) with p from 0 to n and q from 1 to n+1. Each p is a column, and each q is a row. For example, with input n=7 this array is

```<code>0 0 0 0 0 0 0 0
0 1 0 1 0 1 0 1
0 1 2 0 1 2 0 1
0 1 2 3 0 1 2 3
0 1 2 3 4 0 1 2
0 1 2 3 4 5 0 1
0 1 2 3 4 5 6 0
0 1 2 3 4 5 6 7
</code>```

Now the last column, which contains the remainders of n, is element-wise compared with each column of this array. This yields

```<code>1 1 1 1 1 1 1 1
0 1 0 1 0 1 0 1
0 1 0 0 1 0 0 1
0 0 0 1 0 0 0 1
0 0 1 0 0 0 0 1
0 1 0 0 0 0 0 1
1 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
</code>```

where 1 indicates equality. The last column is obviously equal to itself and thus contains all ones. We need to find the column that has the largest number of initial ones, other than the last column, and take note of that number of initial ones, m. (In this case it's the second column, which contains m=3 initial ones). To this end, we compute the cumulative product of each column:

```<code>1 1 1 1 1 1 1 1
0 1 0 1 0 1 0 1
0 1 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
</code>```

then the sum of each column

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

and then sort non-increasingly and take the second value, which is 3. This is the desired m, which indicates how many remainders we need to pick.

```<code>Q:q    % take input n implicitly. Generare row array [0 1 ... n]
tQ!    % duplicate. Transform into column array [1; 2; ...; n-1]
\      % modulo, element-wise with broadcast. Gives the 2D array
t0Z)   % duplicate. Take last column
tb     % duplicate, bubble up
=      % test for equality, element-wise with broadcast
Yp     % cumumative product of each column
s      % sum of each column. This gives the number of initial coincidences
SP2)   % sort in decreasing order and take second value: m
:Q     % generate range [2 3 ... m+1]
)      % apply as index into array of remainders of n. Implicitly display
</code>```

Title: Generate the minimal remainder sequence

Body:
Every number can be represented using an infinitely long remainder sequence.  For example, if we take the number 7, and perform 7mod2, then 7mod3, then 7mod4, and so on, we get 1,1,3,2,1,0,7,7,7,7,.....

However, we need the shortest possible remainder subsequence that can still be used to distinguish it from all lower numbers.  Using 7 again, [1,1,3] is the shortest subsequence, because all of the previous subsequences don't start with [1,1,3]:

```<code>0: 0,0,0,0...
1: 1,1,1,1...
2: 0,2,2,2...
3: 1,0,3,3...
4: 0,1,0,4...
5: 1,2,1,0...
6: 0,0,2,1...
</code>```

Note that [1,1] doesn't work to represent 7, because it can also be used to represent 1.  However, you should output [1] with an input of 1.

Input/Output

Your input is a non-negative integer.  You must output a sequence or list of the minimal-length sequence of remainders as defined above.

Test cases:

```<code>0: 0
1: 1
2: 0,2
3: 1,0
4: 0,1
5: 1,2
6: 0,0,2
7: 1,1,3
8: 0,2,0
9: 1,0,1
10: 0,1,2
11: 1,2,3
12: 0,0,0,2
30: 0,0,2,0
42: 0,0,2,2
59: 1,2,3,4
60: 0,0,0,0,0,4
257: 1,2,1,2,5,5
566: 0,2,2,1,2,6,6
1000: 0,1,0,0,4,6,0,1
9998: 0,2,2,3,2,2,6,8,8,10
9999: 1,0,3,4,3,3,7,0,9,0
</code>```

Here are the first 10,000 sequences, in case you are interested (the line numbers are off by 1).

This is a code-golf, so make it as short as you can in your favorite language.  Fake bonus points for any answers that are fast!

Body:
MATL, 24 bytes

Thanks to @nimi for pointing out an error in a previous version of this answer (now corrected)

Q:qtQ!\t0Z)tb=YpsSP2):Q)

This runs out of memory in the online compiler for the two largest test cases (but it works on a computer with 4 GB RAM).

Try it online!

Explanation

This applies the definition in a straightforward manner. For input n it computes a 2D array containing mod(p,q) with p from 0 to n and q from 1 to n+1. Each p is a column, and each q is a row. For example, with input n=7 this array is

0 0 0 0 0 0 0 0
0 1 0 1 0 1 0 1
0 1 2 0 1 2 0 1
0 1 2 3 0 1 2 3
0 1 2 3 4 0 1 2
0 1 2 3 4 5 0 1
0 1 2 3 4 5 6 0
0 1 2 3 4 5 6 7

Now the last column, which contains the remainders of n, is element-wise compared with each column of this array. This yields

1 1 1 1 1 1 1 1
0 1 0 1 0 1 0 1
0 1 0 0 1 0 0 1
0 0 0 1 0 0 0 1
0 0 1 0 0 0 0 1
0 1 0 0 0 0 0 1
1 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1

where 1 indicates equality. The last column is obviously equal to itself and thus contains all ones. We need to find the column that has the largest number of initial ones, other than the last column, and take note of that number of initial ones, m. (In this case it's the second column, which contains m=3 initial ones). To this end, we compute the cumulative product of each column:

1 1 1 1 1 1 1 1
0 1 0 1 0 1 0 1
0 1 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1

then the sum of each column

1 3 1 2 1 2 1 8

and then sort non-increasingly and take the second value, which is 3. This is the desired m, which indicates how many remainders we need to pick.

Q:q    % take input n implicitly. Generare row array [0 1 ... n]
tQ!    % duplicate. Transform into column array [1; 2; ...; n-1]
\      % modulo, element-wise with broadcast. Gives the 2D array
t0Z)   % duplicate. Take last column
tb     % duplicate, bubble up
=      % test for equality, element-wise with broadcast
Yp     % cumumative product of each column
s      % sum of each column. This gives the number of initial coincidences
SP2)   % sort in decreasing order and take second value: m
:Q     % generate range [2 3 ... m+1]
)      % apply as index into array of remainders of n. Implicitly display


答:
CJam, 47

```<code>ri_"/__\_\/_/\/ /\ \__"6/f**eeW%{_S.*s\~,\-<N}/
</code>```

Explanation:

```<code>ri_       read the input, convert to integer and duplicate
"…"       push that string, containing the repeating pattern
           (3 lines in reverse order, concatenated)
6/        split into (3) lines of 6 characters
f*        multiply (repeat) each line n times
*         repeat the array of 3 lines n times
           at this point we have an array of 3*n strings with 6*n characters each
ee        enumerate the array (obtaining an array of [index string] pairs)
W%        reverse the array
           (so the lines are in correct order and indices in reverse order)
{…}/      for each [index string] pair
  _       duplicate the pair
  S.*     vectorized-multiply with " "
           this effectively replaces the index with a string of <index> spaces
  s       convert the pair to string, effectively concatenating the spaces
           with the string
  \       swap with the other copy of the [index string] pair
  ~,      dump the index and string on the stack and get the string length
  \-      subtract the index from it - this is the desired line length
  <       cut the concatenated string to that length
  N       add a newline
</code>```

Try it online

Title: Build a triangle without any triangles

Body:
CJam, 47

ri_"/__\_\/_/\/ /\ \__"6/f**eeW%{_S.*s\~,\-<N}/

Explanation:

ri_       read the input, convert to integer and duplicate
"…"       push that string, containing the repeating pattern
           (3 lines in reverse order, concatenated)
6/        split into (3) lines of 6 characters
f*        multiply (repeat) each line n times
*         repeat the array of 3 lines n times
           at this point we have an array of 3*n strings with 6*n characters each
ee        enumerate the array (obtaining an array of [index string] pairs)
W%        reverse the array
           (so the lines are in correct order and indices in reverse order)
{…}/      for each [index string] pair
  _       duplicate the pair
  S.*     vectorized-multiply with " "
           this effectively replaces the index with a string of <index> spaces
  s       convert the pair to string, effectively concatenating the spaces
           with the string
  \       swap with the other copy of the [index string] pair
  ~,      dump the index and string on the stack and get the string length
  \-      subtract the index from it - this is the desired line length
  <       cut the concatenated string to that length
  N       add a newline

Try it online


问:
Subsequence Substitution
Most languages come with a built-in to search a string for all occurrences of a given substring and replace those with another. I don't know of any language that generalises this concept to (not necessarily contiguous) subsequences. So that's your task in this challenge.

The input will consist of three strings A, B and C, where B and C are guaranteed to be of the same length. If B appears as a subsequence in A it should be replaced with C. Here is a simple example:

```<code>A: abcdefghijklmnopqrstuvwxyz
B: ghost
C: 12345
</code>```

It would be processed like this:

```<code>abcdefghijklmnopqrstuvwxyz
      ||      |   ||
abcdef12ijklmn3pqr45uvwxyz
</code>```

If there are several ways to find B as a subsequence, you should greedily replace the left-most one:

```<code>A: abcdeedcba
B: ada
C: BOB

Result:   BbcOeedcbB
and NOT:  BbcdeeOcbB
</code>```

The same applies if B could be found in multiple disjoint places:

```<code>A: abcdeedcbaabcde
B: ed
C: 12

Result:   abcd1e2cbaabcde
and NOT:  abcd112cbaabc2e (or similar)
</code>```

When B does not appear in A, you should output A unchanged.

Rules

As stated above, take three strings A, B and C as input and replace the left-most occurrence of B as a subsequence in A with C, if there is any.

You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.

You may take the three strings in any consistent order which you should specify in your answer. You may assume that B and C have the same length. All strings will only contain alphanumeric characters.

Standard code-golf rules apply.

Test Cases

Each test case is four lines: A, B, C followed by the result.

```<code>abcdefghijklmnopqrstuvwxyz
ghost
12345
abcdef12ijklmn3pqr45uvwxyz

abcdeedcba
ada
BOB
BbcOeedcbB

abcdeedcbaabcde
ed
12
abcd1e2cbaabcde

121
121
aBc
aBc

abcde
acb
123
abcde

ABC
ABCD
1234
ABC

012345678901234567890123456789
42
TT
0123T5678901T34567890123456789

edcbaedcbaedcbaedcba
abcde
12345
edcbaedcbaedcbaedcba

edcbaedcbaedcbaedcbaedcba
abcde
12345
edcb1edc2aed3bae4cba5dcba

daccdedca
ace
cra
dcrcdadca

aacbcbabcccaabcbabcaabbbbca
abaaaccbac
1223334444
aacbcbabcccaabcbabcaabbbbca

aacbcbabcccaabcbabcaabbbbcac
abaaaccbac
1223334444
1ac2cb2bccc33b3bab4aa4bbbc44
</code>```

Leaderboard

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

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

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

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

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

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

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

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

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Jelly, 23 bytes

```<code>Ṭœpż⁵
0ẋai1
⁴='-;ç\ñ⁴P?
</code>```

This is two bytes longer than my other Jelly answer, but it finishes instantly. Try it online!

Verification

```<code>$ head -n 5 test-cases
abcdefghijklmnopqrstuvwxyz
ghost
12345
abcdef12ijklmn3pqr45uvwxyz

$ cat subseq-fast
while read s; do
        read p; read r; read o; echo $o; read
        timeout 10s jelly eun $1 "Ṭœpż⁵¶0ẋai1¶⁴='-;ç\ñ⁴P?" "'$p'" "'$s'" "'$r'"
        (($?)) && echo '(killed)'
done < test-cases
$ ./subseq-fast
abcdef12ijklmn3pqr45uvwxyz
abcdef12ijklmn3pqr45uvwxyz
BbcOeedcbB
BbcOeedcbB
abcd1e2cbaabcde
abcd1e2cbaabcde
aBc
aBc
abcde
abcde
ABC
ABC
0123T5678901T34567890123456789
0123T5678901T34567890123456789
edcbaedcbaedcbaedcba
edcbaedcbaedcbaedcba
edcb1edc2aed3bae4cba5dcba
edcb1edc2aed3bae4cba5dcba
dcrcdadca
dcrcdadca
aacbcbabcccaabcbabcaabbbbca
aacbcbabcccaabcbabcaabbbbca
1ac2cb2bccc33b3bab4aa4bbbc44
1ac2cb2bccc33b3bab4aa4bbbc44
</code>```

How it works

```<code>⁴='-;ç\ñ⁴P?  Main link. Arguments: pattern p, string s, replacement r

⁴='          Compare each character of s with each character of p.
             This yields a 2D list. Each row corresponds to a char in p.
   -;        Prepend -1 to the 2D list, yielding a ragged array.
     ç\      Cumulatively reduce the array by the second helper link.
         P?  If the product of the resulting list is non-zero:
       ñ       Call the first helper link with the list and s as arguments.
        ⁴      Else, return s.

Ṭœpż⁵        First helper link. Arguments: L (list of indices), r (replacement)

Ṭ            Truth; generate a list with 1's at those indices.
 œp          Partition; split s at all 1's, removing those characters.
   ż⁵        Zip the partition with r.

0ẋai1        Second helper link. Arguments: n (integer), B (list of Booleans)

0ẋ           Generate a list of n zeroes.
  a          Perform logical AND with B.
             This zeroes out the with n elements of B.
   i1        Compute the first index of 1.
</code>```

Title: Subsequence Substitution

Body:
Jelly, 23 bytes

Ṭœpż⁵
0ẋai1
⁴='-;ç\ñ⁴P?

This is two bytes longer than my other Jelly answer, but it finishes instantly. Try it online!

Verification

$ head -n 5 test-cases
abcdefghijklmnopqrstuvwxyz
ghost
12345
abcdef12ijklmn3pqr45uvwxyz

$ cat subseq-fast
while read s; do
        read p; read r; read o; echo $o; read
        timeout 10s jelly eun $1 "Ṭœpż⁵¶0ẋai1¶⁴='-;ç\ñ⁴P?" "'$p'" "'$s'" "'$r'"
        (($?)) && echo '(killed)'
done < test-cases
$ ./subseq-fast
abcdef12ijklmn3pqr45uvwxyz
abcdef12ijklmn3pqr45uvwxyz
BbcOeedcbB
BbcOeedcbB
abcd1e2cbaabcde
abcd1e2cbaabcde
aBc
aBc
abcde
abcde
ABC
ABC
0123T5678901T34567890123456789
0123T5678901T34567890123456789
edcbaedcbaedcbaedcba
edcbaedcbaedcbaedcba
edcb1edc2aed3bae4cba5dcba
edcb1edc2aed3bae4cba5dcba
dcrcdadca
dcrcdadca
aacbcbabcccaabcbabcaabbbbca
aacbcbabcccaabcbabcaabbbbca
1ac2cb2bccc33b3bab4aa4bbbc44
1ac2cb2bccc33b3bab4aa4bbbc44

How it works

⁴='-;ç\ñ⁴P?  Main link. Arguments: pattern p, string s, replacement r

⁴='          Compare each character of s with each character of p.
             This yields a 2D list. Each row corresponds to a char in p.
   -;        Prepend -1 to the 2D list, yielding a ragged array.
     ç\      Cumulatively reduce the array by the second helper link.
         P?  If the product of the resulting list is non-zero:
       ñ       Call the first helper link with the list and s as arguments.
        ⁴      Else, return s.

Ṭœpż⁵        First helper link. Arguments: L (list of indices), r (replacement)

Ṭ            Truth; generate a list with 1's at those indices.
 œp          Partition; split s at all 1's, removing those characters.
   ż⁵        Zip the partition with r.

0ẋai1        Second helper link. Arguments: n (integer), B (list of Booleans)

0ẋ           Generate a list of n zeroes.
  a          Perform logical AND with B.
             This zeroes out the with n elements of B.
   i1        Compute the first index of 1.


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

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

The Rules

Each submission must be a full program.

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

The program must not write anything to STDERR.

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

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

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

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

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

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

For inspiration, check the Hello World Collection.

The Catalogue

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

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

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

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

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

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

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

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

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
META, 410 bytes

Try it here!

```<code>vXKZELI:{>.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v<;>^^;}{v.>::<.^;>,<v.^;;v.>>;<<^;v.v:^^;}
WJSM
NT
{fv.>::<.^;>,<v.^;;v.>>;<<^;v.>>;<<v^^;}>;<.>>!{v<<.>:<.^;>,<v.^;;v.>>;<<^;v.v<;>^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}>>>.>;>;<<<<.>>.<<<{v.>::<.^;>,<v.^;;v.>>;<<^;v.v:^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v..^;v..^;;>,<v.^;;v.>>;^<<;v.v.^^;}v>:<^.vvv?
</code>```

This is another heckuva program. You want to know what it does, I'm sure. First, here's a nicer-looking version:

```<code>vXKZELI:{>.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v<;>^^;}{v.>::<.^;>,<
WJSMv.^;;v.>>;<<^;v.v:^^;}{v.>::<.^;>,<v.^;;v.>>;<<^;v.>>;<<v^^;}>;<.>>!{v<<.>:<.^;>,<v.^;;
NTv.>>;<<^;v.v<;>^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}>>
>f.>;>;<<<<.>>.<<<{v.>::<.^;>,<v.^;;v.>>;<<^;v.v:^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v..
^;v..^;;>,<v.^;;v.>>;^<<;v.v.^^;}v>:<^.vvv?
</code>```

The basis of META is that it selects characters from the source code and performs operations of them. ><^v move the selection pointer around, {} allow for an extra level of eval and :;.,!? perform 6 different operations.

Let c be the character in question, and @c be its charcode.

: yields atob(atob(c + c + "==") + c + "==")

; yields atob(c + c + "==")

. yields char(127 - @atob(c + c + "=="))

, yields atob(c + char(127 - @c) + "==")

! yields char(@c >> 2 ^ 94)

? yields char((@c * 3 >> 3) + (@c >> 5))

Each time a char is yielded, it's pushed to a string, which is eval'd, then eval'd again.

The charset yielded by each character is not complete, so we cannot simply use these characters. The use of {} is mandatory for a lot of characters, which are constructed in a JSF**k-esque way.

A full explanation will take a ridiculously long time, and now I have to breathe some nice air.

ContentLicense: CC BY-SA 4.0

Title: "Hello, World!"

Body:
META, 410 bytes

Try it here!

vXKZELI:{>.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v<;>^^;}{v.>::<.^;>,<v.^;;v.>>;<<^;v.v:^^;}
WJSM
NT
{fv.>::<.^;>,<v.^;;v.>>;<<^;v.>>;<<v^^;}>;<.>>!{v<<.>:<.^;>,<v.^;;v.>>;<<^;v.v<;>^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}>>>.>;>;<<<<.>>.<<<{v.>::<.^;>,<v.^;;v.>>;<<^;v.v:^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v..^;v..^;;>,<v.^;;v.>>;^<<;v.v.^^;}v>:<^.vvv?

This is another heckuva program. You want to know what it does, I'm sure. First, here's a nicer-looking version:

vXKZELI:{>.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v<;>^^;}{v.>::<.^;>,<
WJSMv.^;;v.>>;<<^;v.v:^^;}{v.>::<.^;>,<v.^;;v.>>;<<^;v.>>;<<v^^;}>;<.>>!{v<<.>:<.^;>,<v.^;;
NTv.>>;<<^;v.v<;>^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}>>
>f.>;>;<<<<.>>.<<<{v.>::<.^;>,<v.^;;v.>>;<<^;v.v:^^;}{v.>:<.^;>,<v.^;;v.>>;<<^;v.v.^^;}{v..
^;v..^;;>,<v.^;;v.>>;^<<;v.v.^^;}v>:<^.vvv?

The basis of META is that it selects characters from the source code and performs operations of them. ><^v move the selection pointer around, {} allow for an extra level of eval and :;.,!? perform 6 different operations.

Let c be the character in question, and @c be its charcode.

: yields atob(atob(c + c + "==") + c + "==")

; yields atob(c + c + "==")

. yields char(127 - @atob(c + c + "=="))

, yields atob(c + char(127 - @c) + "==")

! yields char(@c >> 2 ^ 94)

? yields char((@c * 3 >> 3) + (@c >> 5))

Each time a char is yielded, it's pushed to a string, which is eval'd, then eval'd again.

The charset yielded by each character is not complete, so we cannot simply use these characters. The use of {} is mandatory for a lot of characters, which are constructed in a JSF**k-esque way.

A full explanation will take a ridiculously long time, and now I have to breathe some nice air.


答:
Haskell, <s>66</s> <s>60</s> <s>51</s> 50 bytes

```<code>f i=mod i<$>[2..2+sum[1|l<-scanl1 lcm[2..i],l<=i]]
</code>```

Usage example: f 42-> [0,0,2,2]. It's the algorithm described in @Martin Büttner's answer.

I'll keep the previous version for reference, because it's pretty fast:

Haskell, 51 bytes

```<code>f i=mod i<$>[[2..x]|x<-[2..],foldl1 lcm[2..x]>i]!!0
</code>```

It takes 0.03s for f (10^100) on my five year old laptop.

Edit: @xnor found a byte to save. Thanks!

Title: Generate the minimal remainder sequence

Body:
Haskell, <s>66</s> <s>60</s> <s>51</s> 50 bytes

f i=mod i<$>[2..2+sum[1|l<-scanl1 lcm[2..i],l<=i]]

Usage example: f 42-> [0,0,2,2]. It's the algorithm described in @Martin Büttner's answer.

I'll keep the previous version for reference, because it's pretty fast:

Haskell, 51 bytes

f i=mod i<$>[[2..x]|x<-[2..],foldl1 lcm[2..x]>i]!!0

It takes 0.03s for f (10^100) on my five year old laptop.

Edit: @xnor found a byte to save. Thanks!


问:
What's the voltage over each component?
The picture below shows a RLC circuit. A RLC circuit is an electrical circuit consisting of a resistor (R), an inductor (L), and a capacitor (C), connected in series or in parallel. (1)

In order to simplify computations, it's common to work in the frequency (Laplace) domain instead of the time domain.

Your task is:

Take the values R, L and C as input, and return the voltages VR, VL and VC

The conversion to the Laplace domain is as follows:

```<code>R = R
XL = j*w*L      // OK, XL = w*L, and ZL = j*XL, but don't mind this here.
XC = 1/(j*w*C)  // I haven't ruined physics, it's only a minor terminology tweak
</code>```

where j = sqrt(-1), and w = 2*pi*50 (The frequency is 50 Hz).

The combined impedance, when the components are in series is Z = R + XL + XC. You might remember U = R*I from high school physics lectures. It's almost the same, but a bit more complex now: VS = Z*I. The current is calculated by dividing the voltage VS by the total impedance Z. To find the voltage over a single component, you need to know the current, then multiply it by the impedance. For simplicity, the voltage is assumed to be VS = 1+0*j.

Equations you might need are:

```<code>XL = j*w*L
XC = 1/(j*w*C)
Z = R + XL + XC   // The combined impedance of the circuit
I = VS / Z         // The current I (Voltage divided by impedance)
VR = I * R        // Voltage over resistance (Current times resistance)
VL = I * XL       // Voltage over inductor (Current times impedance)
VC = I * XC       // Voltage over capacitor (Current times impedance)
</code>```

The input is from either STDIN or as function arguments. The output/result must be three complex numbers, in a list, string or whatever is most practical in your language. It's not necessary to include names (ex VR = ...), as long as the results are in the same order as below. The precision has to be at least 3 decimal points for both the real and imaginary part. The input and output/results can be in scientific notation if that's default in your language.

R and L are >= 0, and C > 0. R, L, C <= inf (or the highest possible number in your language).

A simple test case:

```<code>R = 1, L = 1, C = 0.00001

VR = 0.0549 + 0.2277i
VL = -71.5372 +17.2353i
VC = 72.4824 -17.4630i
</code>```

For the results above, this could be one (of many) valid ouput format:

```<code>(0.0549 + 0.2277i, -71.5372 +17.2353i, 72.4824 -17.4630i)
</code>```

Some valid ouput formats for one voltage value are:

```<code>1.234+i1.234,   1.23456+1.23456i,   1.2345+i*1.2345,   1.234e001+j*1.234e001.
</code>```

This list is not exclusive, so other variants can be used, as long as the imaginary part is indicated by an i or a j (common in electrical engineering as i is used for current).

To verify the result for other values of R,L and C, the following must be true for all results: VR + VL + VC = 1.

The shortest code in bytes win!

By the way: Yes, it's voltage over a component, and current through a component. A voltage has never gone through anything. =)

答:
Octave, 41 bytes

```<code>@(R,L,C)(Z=[R L/(k=-.01j/pi) k/C])/sum(Z)
</code>```

1/(100*j*pi) can be shortened to -.01j/pi which is a lot shorter. By assigning it to the variable k inline, the variable can be used twice. Assigning the entire vector to the variable Z costs 4 bytes, but allows us to divide by sum(Z), which is 5 bytes shorter than (R+L/k+k/C).

Title: What's the voltage over each component?

Body:
Octave, 41 bytes

@(R,L,C)(Z=[R L/(k=-.01j/pi) k/C])/sum(Z)

1/(100*j*pi) can be shortened to -.01j/pi which is a lot shorter. By assigning it to the variable k inline, the variable can be used twice. Assigning the entire vector to the variable Z costs 4 bytes, but allows us to divide by sum(Z), which is 5 bytes shorter than (R+L/k+k/C).


答:
Jelly, 14 bytes

```<code>‘Ræl\>iṠ2»2r⁸%
</code>```

This uses the fact a the solution (if any) of a system of linear congruences is unique modulo the LCM of the moduli. Try it online! or verify all test cases.

How it works

```<code>‘Ræl\>iṠ2»2r⁸%  Main link. Argument: n

‘               Increment; yield n+1.
 R              Range; yield [1, ..., n+1].
  æl\           Cumulatively reduce by LCM.
                This yields [LCM(1), ..., LCM(1, ..., n+1)].
     >          Compare all LCMs with n.
      iṠ        Find the first index of sign(n).
                This yields the first m such that LCM(2, ..., m) > n if n > 0, and
                0 if n == 0.
        2»      Take the maximum of the previous result and 2, mapping 0 to 2.
          2r    Yield the range from 2 up to and including the maximum.
            ⁸%  Compute n modulo each integer in that range.
</code>```

Title: Generate the minimal remainder sequence

Body:
Jelly, 14 bytes

‘Ræl\>iṠ2»2r⁸%

This uses the fact a the solution (if any) of a system of linear congruences is unique modulo the LCM of the moduli. Try it online! or verify all test cases.

How it works

‘Ræl\>iṠ2»2r⁸%  Main link. Argument: n

‘               Increment; yield n+1.
 R              Range; yield [1, ..., n+1].
  æl\           Cumulatively reduce by LCM.
                This yields [LCM(1), ..., LCM(1, ..., n+1)].
     >          Compare all LCMs with n.
      iṠ        Find the first index of sign(n).
                This yields the first m such that LCM(2, ..., m) > n if n > 0, and
                0 if n == 0.
        2»      Take the maximum of the previous result and 2, mapping 0 to 2.
          2r    Yield the range from 2 up to and including the maximum.
            ⁸%  Compute n modulo each integer in that range.


问:
Box-256 Assembly - BIG SQUARE II
I'd like to start a series of challenges for http://box-256.com/ starting with the first challenge, “BIG SQUARE II”. After this one I'll add another for "CHECKERBOARD" and so on.

Rules:

Complete the BIG SQAURE II challenge in the Box-256 emulator (either on the website or download the program if you run Windows)

Post back here a screenshot of your working answer

You MUST include the code in plain text so that others can easily copy and very it’s operation.

Scoring:

The winner will be the least amount of instructions used (just the instruction calls, either by name or opcode, the arguments to them are not counted as JMP takes one argument but MOD can take three).

I think in the future contests we can add some additional bonus points for use of coding tricks and we could include the argument count too. I wanted to start basic to get the ball rolling.

Winning

I think we should put a stake in the ground and say two weeks from today we announce the winner(s, there maybe be mutliple entries with the same instruction count).

答:
8 instructions

My smallest solution to the Big Square II challenge is 8 lines of code. There's a simple loop which cycles through a table of 8 pixel locations.

```<code>; Big Square II in 0x08h instructions
; John Metcalf

PIX @18 002 000
ADD @16 @18 @18
MOV @18 @20 001
MOV @19 @18 008
FLP @16 @17 001
JMP @00 001 010
011 031 021 032
0D3 01D 0E3 01E
</code>```

Title: Box-256 Assembly - BIG SQUARE II

Body:
8 instructions

My smallest solution to the Big Square II challenge is 8 lines of code. There's a simple loop which cycles through a table of 8 pixel locations.

; Big Square II in 0x08h instructions
; John Metcalf

PIX @18 002 000
ADD @16 @18 @18
MOV @18 @20 001
MOV @19 @18 008
FLP @16 @17 001
JMP @00 001 010
011 031 021 032
0D3 01D 0E3 01E


答:
JavaScript (ES6), 119 bytes

```<code>n=>`,/\\ \\__,/_/\\/ ,/__\\_\\`[r=`repeat`](n).split`,`.map((s,i)=>` `[r](n*3-i)+s[r](n).slice(0,i*2)).slice(1).join`\n`
</code>```

Where \n represents the literal newline character. If a leading line with n*3 spaces and a newline is acceptable then the .slice(1) can be removed for a saving of 9 bytes.

Title: Build a triangle without any triangles

Body:
JavaScript (ES6), 119 bytes

n=>`,/\\ \\__,/_/\\/ ,/__\\_\\`[r=`repeat`](n).split`,`.map((s,i)=>` `[r](n*3-i)+s[r](n).slice(0,i*2)).slice(1).join`\n`

Where \n represents the literal newline character. If a leading line with n*3 spaces and a newline is acceptable then the .slice(1) can be removed for a saving of 9 bytes.


答:
Python 3.5, 194 181 169 152 149 146 bytes:

(Thanks to @Sherlock9 for 2 bytes!)

```<code>def r(o,c=0):
 y=[[j%i for i in range(2,100)]for j in range(o+1)]
 while 1:
  c+=1;z=y[-1][:c]
  if z not in[f[:c]for f in y[:-1]]:break
 print(z)
</code>```

Works perfectly, and is also pretty quick. Calculating for the minimal remainder sequence of 100000 outputs [0, 1, 0, 0, 4, 5, 0, 1, 0, 10, 4, 4] and took only about 3 seconds. It was even able to calculate the sequence for the input 1000000 (1 million), output [0, 1, 0, 0, 4, 1, 0, 1, 0, 1, 4, 1, 8, 10, 0, 9], and took about 60 seconds.

Explanation

Basically what this function does is firstly create a list, y, with all j mod i where j is every integer in the range 0=>7 (including 7) and i is every integer in the range 0=>100. The program then goes into an infinite while loop and compares the same number of contents of each sublist within the first through second-to-last sublists of y (y[:-1:]) with the same number of items in the last sublist (y[-1]) of list y. When sublist y[-1] is different than any other sublist, the loop is broken out of, and the correct minimal remainder sequence is returned.

For instance, if the input is 3, y would be:

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

Then, when it enters into the while loop, it compares each sublist in list y[:-1:] with the same number of items in sublist y[-1]. For example, it would first compare [[0],[1],[0]] and [1]. Since the last sublist is in the rest of y, it would continue on and then compare [[0,0],[0,1],[0,2]] and [1,0]. Since [1,0] is now NOT in the rest of y in that specific order, that is the minimal reminder sequence, and therefore, [1,0] would be correctly returned.

Title: Generate the minimal remainder sequence

Body:
Python 3.5, 194 181 169 152 149 146 bytes:

(Thanks to @Sherlock9 for 2 bytes!)

def r(o,c=0):
 y=[[j%i for i in range(2,100)]for j in range(o+1)]
 while 1:
  c+=1;z=y[-1][:c]
  if z not in[f[:c]for f in y[:-1]]:break
 print(z)

Works perfectly, and is also pretty quick. Calculating for the minimal remainder sequence of 100000 outputs [0, 1, 0, 0, 4, 5, 0, 1, 0, 10, 4, 4] and took only about 3 seconds. It was even able to calculate the sequence for the input 1000000 (1 million), output [0, 1, 0, 0, 4, 1, 0, 1, 0, 1, 4, 1, 8, 10, 0, 9], and took about 60 seconds.

Explanation

Basically what this function does is firstly create a list, y, with all j mod i where j is every integer in the range 0=>7 (including 7) and i is every integer in the range 0=>100. The program then goes into an infinite while loop and compares the same number of contents of each sublist within the first through second-to-last sublists of y (y[:-1:]) with the same number of items in the last sublist (y[-1]) of list y. When sublist y[-1] is different than any other sublist, the loop is broken out of, and the correct minimal remainder sequence is returned.

For instance, if the input is 3, y would be:

[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2], [1, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]]

Then, when it enters into the while loop, it compares each sublist in list y[:-1:] with the same number of items in sublist y[-1]. For example, it would first compare [[0],[1],[0]] and [1]. Since the last sublist is in the rest of y, it would continue on and then compare [[0,0],[0,1],[0,2]] and [1,0]. Since [1,0] is now NOT in the rest of y in that specific order, that is the minimal reminder sequence, and therefore, [1,0] would be correctly returned.


问:
Tips for golfing in PowerShell
What general tips do you have for golfing in Windows PowerShell? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PowerShell (e.g. "remove comments" is not an answer). Please post one tip per answer.

—taken nearly verbatim from marcog's question.

答:
The Get verb is implied. This can shorten any Get-Frob to just Frob. Frequent contenders are date or random.

Note that this won't work properly in some cases because you might have GNU utilities in your path (or other native programs that clash). Order of command lookup in that case seems to prefer the native program before it considers cmdlets with the Get- removed:

```<code>PS Home:\> date

Freitag, 15. November 2013 07:13:45

PS Home:\> $Env:Path += ';D:\Users\Joey\Apps\GnuWin32\bin'
PS Home:\> date
Fr Nov 15 07:14:13 W. Europe Standard Time 2013
</code>```

Title: Tips for golfing in PowerShell

Body:
The Get verb is implied. This can shorten any Get-Frob to just Frob. Frequent contenders are date or random.

Note that this won't work properly in some cases because you might have GNU utilities in your path (or other native programs that clash). Order of command lookup in that case seems to prefer the native program before it considers cmdlets with the Get- removed:

PS Home:\> date

Freitag, 15. November 2013 07:13:45

PS Home:\> $Env:Path += ';D:\Users\Joey\Apps\GnuWin32\bin'
PS Home:\> date
Fr Nov 15 07:14:13 W. Europe Standard Time 2013


答:
Jelly, <s>13</s> 11 bytes

```<code>r¬µ%€R‘$ḟ/Ṫ
</code>```

This won't win any velocity brownie points... Try it online! or verify the smaller test cases.

How it works

```<code>r¬µ%€R‘$ḟ/Ṫ  Main link. Argument: n

r¬           Range from n to (not n).
             This yields [n, ..., 0] if n > 0 and [0, 1] otherwise.

  µ          Begin a new, monadic chain. Argument: A (range)

       $     Combine the previous two links into a monadic chain:
     R         Range; turn each k in A into [1, ..., k] or [] if k == 0.
      ‘        Increment to map k to [2, ..., k+1].
   %€        Take each k in A modulo all the integers in the 2D list to the right.
        ḟ/   Reduce by filter-not; sequentially remove all remainder sequences of
             n-1, ..., (not n) from the remainder sequences of n.
          Ṫ  Tail; take the last remainder sequence.
             This gives the shortest sequence for descending A and the longest one
             (i.e., [0]) for ascending A.
</code>```

Title: Generate the minimal remainder sequence

Body:
Jelly, <s>13</s> 11 bytes

r¬µ%€R‘$ḟ/Ṫ

This won't win any velocity brownie points... Try it online! or verify the smaller test cases.

How it works

r¬µ%€R‘$ḟ/Ṫ  Main link. Argument: n

r¬           Range from n to (not n).
             This yields [n, ..., 0] if n > 0 and [0, 1] otherwise.

  µ          Begin a new, monadic chain. Argument: A (range)

       $     Combine the previous two links into a monadic chain:
     R         Range; turn each k in A into [1, ..., k] or [] if k == 0.
      ‘        Increment to map k to [2, ..., k+1].
   %€        Take each k in A modulo all the integers in the 2D list to the right.
        ḟ/   Reduce by filter-not; sequentially remove all remainder sequences of
             n-1, ..., (not n) from the remainder sequences of n.
          Ṫ  Tail; take the last remainder sequence.
             This gives the shortest sequence for descending A and the longest one
             (i.e., [0]) for ascending A.


问:
How can I shorten this python code analyzing a 3d grid?
My Python 3 function golf(...) should take a list of lists of lists of strings representing a solid cube and return whether there are any places in which two equal strings are directly next to each other on the x, y or z axis (not diagonally).

If there are no adjacent duplicates, True shall be returned, else False.

The input list and all of its sublists have the same length as they represent a cube, and their length is greater than 1 but lower than or equal to 5. The only possible values for the Strings inside the nested lists are "X" and "Z".

The maximum code length should be less than 200 bytes.

This is an example test case:

```<code>golf([[["X", "Z"],
       ["Z", "X"]],
      [["Z", "X"],
       ["X", "Z"]]]) == True
golf([[["X", "Z"],
       ["Z", "X"]],
      [["X", "Z"],
       ["Z", "X"]]]) == False
</code>```

My current solution has 234 bytes:

```<code>def golf(c):
 r=range(len(c));R=[(a,b)for a in r for b in r];j="".join
 return all("XX"not in l and"ZZ"not in l for l in[j(c[x][y][z]for x in r)for y,z in R]+[j(c[x][y][z]for y in r)for x,z in R]+[j(c[x][y][z]for z in r)for x,y in R])
</code>```

How can I golf this code any further to save another 35 bytes?

答:
Python 3 with NumPy, 125 bytes

import numpy
def golf(a):a=numpy.array(a);return(a[:-1]!=a[1:]).all()&(a[:,:-1]!=a[:,1:]).all()&(a[:,:,:-1]!=a[:,:,1:]).all()
```

<h1>Python 3, <s>146</s> 128 bytes</h1>

<pre class="lang-py prettyprint-override"><code>e=lambda x,y:x!=y
z=lambda f:lambda*l:all(map(f,*l))
u=lambda f,g:lambda a:z(f)(a,a[1:])&z(g)(a)
golf=u(z(z(e)),u(z(e),u(e,id)))
</code>```

Body:
Python 3 with NumPy, 125 bytes

import numpy
def golf(a):a=numpy.array(a);return(a[:-1]!=a[1:]).all()&(a[:,:-1]!=a[:,1:]).all()&(a[:,:,:-1]!=a[:,:,1:]).all()

Python 3, <s>146</s> 128 bytes

e=lambda x,y:x!=y
z=lambda f:lambda*l:all(map(f,*l))
u=lambda f,g:lambda a:z(f)(a,a[1:])&z(g)(a)
golf=u(z(z(e)),u(z(e),u(e,id)))


问:
Showcase of Languages

Notes

This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.

This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

All answers should include the name of the programming language at the top of the post, prefixed by a #.

Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

The snippets do not need to be related. In fact, snippets that are too related may be redundant.

Since this is not a contest, all programming languages are welcome, whenever they were created.

Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('
' + temp.innerText || temp.textContent + '');}}})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul></code>```

答:
LOLCODE

Note: I will be following previous rules of this showcase before mods stepped in, in that the length of my longest snippet will be equal to the number of votes this post has.

25 characters

```<code>HAI 1.3
VISIBLE 1
KTHXBYE
</code>```

This is a complete program that prints 1 to the standard output.

24 characters

```<code>HOW IS I z
3
IF U SAY SO
</code>```

Defines a function z that when called, returns 3.

23 characters

```<code>VISIBLE SUM OF a AN 32
</code>```

Prints variable a plus 32.

22 characters

```<code>I HAS A var
GIMMEH var
</code>```

Create a variable and assign input to it.

21 characters

```<code>VISIBLE “HAI WURLDZ!”
</code>```

The LOLCODE Hello World Program!!! w00t w00t!

20 characters

```<code>I HAS A big ITZ FAIL
</code>```

Creates a variable big and assigns it to FAIL, the falsy boolean.

19 characters

```<code>QUOSHUNT OF 99 AN 9
</code>```

Returns 11, 99 divided by 9.

18 characters

```<code>I HAS A var ITZ 99
</code>```

Creates variable var and assigns it the value 99, a NUMBR.

17 characters

```<code>O RLY?
YA RLY
OIC
</code>```

Similar to the last snippet, this is a blank if statement. O RLY? takes the value in IT and tests it for truthiness. If true, it runs the code in the YA RLY block, then exits at OIC.

16 characters

```<code>WTF?
OMGWTF
OIC
</code>```

A switch/case statement. Takes the variable in IT (the runtime temporary variable) and matches it up with any OMG <value> statements. Since there are none, it goes right to OMGWTF, the default statement. Since there is no code in the block, it goes right to OIC and continues with the code.

15 characters

```<code>HAI 1.3
KTHXBYE
</code>```

The shortest complete program. All LOLCODE programs start with a version number and end with KTHXBYE.

14 characters

```<code>DIFF OF 9 AN 6
</code>```

Returns the difference of 9 and 6

13 characters

```<code>CAN HAS TIME?
</code>```

Imports the library TIME if it exists.

12 characters

```<code>GIMMEH INPTZ
</code>```

Gets input from STDIN and saves it to the already-defined variable INPTZ.

11 characters

```<code>OBTW
C
TLDR
</code>```

A multi-line comment (C is the content)

10 charaters

```<code>VISIBLE 10
</code>```

Prints 10 to STDOUT.

9 characters

```<code>I HAS A Z
</code>```

Creates a variable called Z.

8 characters

```<code>VISIBLE
</code>```

(note the trailing space) Prints… nothing.

7 characters

```<code>HAI 1.3
</code>```

The hello() of LOLCODE.

6 characters

```<code>GIMMEH
</code>```

A function asking for input from STDIN. This does nothing as it's not assigned to a variable though.

5 characters

```<code>Y R 6
</code>```

Assigns the NUMBR 6 to the already-defined variable Y

4 characters

```<code>":)"
</code>```

A newline inside a YARN. THE : character is the escape character inside strings.

3 characters

```<code>BTW
</code>```

An empty comment. w00t.

2 characters

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

An empty YARN

1 character

<s>I cantz do real stuff with my 1 char!!  </s>

<s>-- Hohmannfan</s>

```<code>3
</code>```

It da NUMBR 3.

Factoid

Is composed almost completely with Internet slang.

Title: Showcase of Languages

Body:
LOLCODE

Note: I will be following previous rules of this showcase before mods stepped in, in that the length of my longest snippet will be equal to the number of votes this post has.

25 characters

HAI 1.3
VISIBLE 1
KTHXBYE

This is a complete program that prints 1 to the standard output.

24 characters

HOW IS I z
3
IF U SAY SO

Defines a function z that when called, returns 3.

23 characters

VISIBLE SUM OF a AN 32

Prints variable a plus 32.

22 characters

I HAS A var
GIMMEH var

Create a variable and assign input to it.

21 characters

VISIBLE “HAI WURLDZ!”

The LOLCODE Hello World Program!!! w00t w00t!

20 characters

I HAS A big ITZ FAIL

Creates a variable big and assigns it to FAIL, the falsy boolean.

19 characters

QUOSHUNT OF 99 AN 9

Returns 11, 99 divided by 9.

18 characters

I HAS A var ITZ 99

Creates variable var and assigns it the value 99, a NUMBR.

17 characters

O RLY?
YA RLY
OIC

Similar to the last snippet, this is a blank if statement. O RLY? takes the value in IT and tests it for truthiness. If true, it runs the code in the YA RLY block, then exits at OIC.

16 characters

WTF?
OMGWTF
OIC

A switch/case statement. Takes the variable in IT (the runtime temporary variable) and matches it up with any OMG <value> statements. Since there are none, it goes right to OMGWTF, the default statement. Since there is no code in the block, it goes right to OIC and continues with the code.

15 characters

HAI 1.3
KTHXBYE

The shortest complete program. All LOLCODE programs start with a version number and end with KTHXBYE.

14 characters

DIFF OF 9 AN 6

Returns the difference of 9 and 6

13 characters

CAN HAS TIME?

Imports the library TIME if it exists.

12 characters

GIMMEH INPTZ

Gets input from STDIN and saves it to the already-defined variable INPTZ.

11 characters

OBTW
C
TLDR

A multi-line comment (C is the content)

10 charaters

VISIBLE 10

Prints 10 to STDOUT.

9 characters

I HAS A Z

Creates a variable called Z.

8 characters

VISIBLE

(note the trailing space) Prints… nothing.

7 characters

HAI 1.3

The hello() of LOLCODE.

6 characters

GIMMEH

A function asking for input from STDIN. This does nothing as it's not assigned to a variable though.

5 characters

Y R 6

Assigns the NUMBR 6 to the already-defined variable Y

4 characters

":)"

A newline inside a YARN. THE : character is the escape character inside strings.

3 characters

BTW

An empty comment. w00t.

2 characters

""

An empty YARN

1 character

<s>I cantz do real stuff with my 1 char!!  </s>

<s>-- Hohmannfan</s>

3

It da NUMBR 3.

Factoid

Is composed almost completely with Internet slang.