答:
Snowman, 66 bytes

```<code>}vg","aS:10sB;aM4aRAsOal`,4nD,`aG0AaGal`NdE`AaL1AfL:nA;alaF,nDtSsP
</code>```

Try it online!

Uses the same algorithm as @LeakyNun's answers.

```<code>}         enable variables b, e, and g
vg        read a line of input into b
","aS     split on commas (in-place)
:10sB;aM  convert each element in resulting array to number ("frombase(10)-map")
4aR       repeat the array 4 times
AsO       sort the array
al        take the length and put it in e without consuming b (the array)
`,        swap b and e, then move e to g; now b=length g=array
4nD       divide b by 4 (4 was stored in e, which is why the array was moved)
,`        move the array and length/4 back to their original positions
aG        split the array into groups of length (length/4)
0AaG      take all elements with index >0 (i.e. remove the first element)
al        store the length of the new array in e again
`NdE`     bring it up to b, decrement, and put it back
AaL       take all elements with index <length-1 (i.e. remove last)
1AfL      flatten the array 1 level deep
:nA;      push a block that adds two numbers (to e)
al        store the length of this new array in g
aF        fold b over e (sum the numbers)
,         move g (the length) into e
nD        divide the sum by the length, resulting in the average
tSsP      to-string and print
</code>```

Title: Interquartile Mean

Body:
Snowman, 66 bytes

}vg","aS:10sB;aM4aRAsOal`,4nD,`aG0AaGal`NdE`AaL1AfL:nA;alaF,nDtSsP

Try it online!

Uses the same algorithm as @LeakyNun's answers.

}         enable variables b, e, and g
vg        read a line of input into b
","aS     split on commas (in-place)
:10sB;aM  convert each element in resulting array to number ("frombase(10)-map")
4aR       repeat the array 4 times
AsO       sort the array
al        take the length and put it in e without consuming b (the array)
`,        swap b and e, then move e to g; now b=length g=array
4nD       divide b by 4 (4 was stored in e, which is why the array was moved)
,`        move the array and length/4 back to their original positions
aG        split the array into groups of length (length/4)
0AaG      take all elements with index >0 (i.e. remove the first element)
al        store the length of the new array in e again
`NdE`     bring it up to b, decrement, and put it back
AaL       take all elements with index <length-1 (i.e. remove last)
1AfL      flatten the array 1 level deep
:nA;      push a block that adds two numbers (to e)
al        store the length of this new array in g
aF        fold b over e (sum the numbers)
,         move g (the length) into e
nD        divide the sum by the length, resulting in the average
tSsP      to-string and print


问:
Interquartile Mean

Task

Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean.

One possible algorithm

Discard the lowest and highest quarters of the data points.

Calculate the average (sum divided by count) of the remaining data points.

Note: If the dataset size is not evenly split-able in four, you will have to weigh the datapoints that are shared by sub-sets. See Example evaluation 2 below.

Example evaluation 1

Given {1, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 38}

Data count is 12, so we remove lowest and highest 3 datapoints:
{<s>1, 3, 4,</s> 5, 6, 6, 7, 7, 8, <s>8, 9, 38</s>}

Average of the remaining 6 datapoints:
(5 + 6 + 6 + 7 + 7 + 8) / 6 = 6.5

Example evaluation 2

Given {1, 3, 5, 7, 9, 11, 13, 15, 17}

Count is 9, so each quarter has 2¼ datapoints:
{<s>1, 2, (0.25×5),</s> (0.75×5), 7, 9, 11, (0.75×13), <s>(0.25×13), 15, 17</s>}

Average of the remaining 4.5 datapoints:
(0.75×5 + 7 + 9 + 11 + 0.75×13) / 4.5 = 9

答:
Octave, 44 bytes

```<code>@(x)mean(reshape(~~(1:4)'*x,[],4)(:,2:3)(:))
</code>```

This defines an anonymous function.

The input is a horizontal vector.

Try it on ideone.

Explanation

The input horizontal vector is first matrix-multiplied (*) by a column vector of four ones (built with ~~(1:4)'). The result is a four-column matrix where each row is a copy of the input vector. This is then reshaped, while maintaining the linear order of the elements, into a 4-column matrix (reshape(...,[],4)). The center two columns are kept ((:,2:3)) and linearized into a single column ((:)), of which the mean is computed (mean(...)).

ContentLicense: CC BY-SA 3.0

Title: Interquartile Mean

Body:
Octave, 44 bytes

@(x)mean(reshape(~~(1:4)'*x,[],4)(:,2:3)(:))

This defines an anonymous function.

The input is a horizontal vector.

Try it on ideone.

Explanation

The input horizontal vector is first matrix-multiplied (*) by a column vector of four ones (built with ~~(1:4)'). The result is a four-column matrix where each row is a copy of the input vector. This is then reshaped, while maintaining the linear order of the elements, into a 4-column matrix (reshape(...,[],4)). The center two columns are kept ((:,2:3)) and linearized into a single column ((:)), of which the mean is computed (mean(...)).


问:
The shortest code to tell if a number is even or odd
One of my colleagues proposed us a challenge: to write the shortest C/C++ program to determine if a number is even or odd.

These are the requirements:

Get a number from keyboard, at run-time (not from command line)

Output the string pari if the number is even

Output the string dispari if the number is odd

We can assume that the input is legal

We can assume that the machine has a i386 architecture

Code preprocessing is not allowed (e.g.: use #defines)

[edit after comments] The code can be considered valid if it compiles with gcc 4.x

This is the best attempt we had so far (file test.c, 50B):

```<code>main(i){scanf("%d",&i);puts("dispari"+3*(~i&1));}
</code>```

Do you think we can go further?

(*): "dispari" is the italian for odd and "pari" is the italian for even

答:
47 bytes (2 less)

```<code>main(i){scanf("%d",&i);puts("dispari"-~i%2*3);}
</code>```

For a positive i, ~i is negative, so ~i%2 is 0 or -1.

OwnerDisplayName: Vincenzo Pii

Body:
47 bytes (2 less)

main(i){scanf("%d",&i);puts("dispari"-~i%2*3);}

For a positive i, ~i is negative, so ~i%2 is 0 or -1.


问:
Print the Nth non-palindromic number
A palindromic number (in case you don't know) is a number which reads the same backwards and forwards (example, 11). The first 15 non-palindromic numbers are: 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26. This is A029742. I constantly need these numbers, but my sticky note pad is very small, so your code must be as short as possible.

Rules

Each submission must be a full program or function (e.g. in C, you can't just define a function without headers, but you can define a function WITH necessary headers
).

If it is possible, provide a link to a site where your program can be tested.

Your program must not write anything to STDERR.

You can take input as an argument or from STDIN (or the closest alternative in your language).

Programs are scored according to bytes. The usual character set is UTF-8, if you are using another please specify.

Standard loopholes are forbidden.

Test Cases

```<code>1
==> 10

-----

5
==> 15

-----

12
==> 23
</code>```

Scoring

This is code-golf, so least bytes wins.

Submissions

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

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

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

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

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

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

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

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

Leaderboard

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

/* Configuration */

var QUESTION_ID = 79251; // 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 = 53406; // This should be the user ID of the challenge author.

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

  });

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

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

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

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

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
Python 2, 60 bytes

```<code>f=lambda n,i=0,j=1:j>n and i-1or f(n,i+1,j+(`i`!=`i`[::-1]))
</code>```

A one-indexed function that takes input of n via argument and returns the nth non-palindromic number.

How it works

This is an exhaustive recursive search, which consecutively tests integers i in the range [1,∞) until n non-palindromic numbers have been found; since i is pre-incremented, i-1 is then returned. Testing whether a number is palindromic is performed by converting to a string, reversing, and then checking whether the original and reversed strings are equal.

The code is logically equivalent to:

```<code>def f(n,test=0,count=1):
    if count>n:
        return test
    elif str(test)!=reversed(str(test)):
        return f(n,test+1,count+1)
    else:
        return f(n,test+1,count)
</code>```

which itself is essentially:

```<code>def f(n):
    test=0
    count=1
    while count<=n:
        if str(test)!=reversed(str(test)):
            count+=1
        test+=1
    return test-1
</code>```

Try it on Ideone

Title: Print the Nth non-palindromic number

Body:
Python 2, 60 bytes

f=lambda n,i=0,j=1:j>n and i-1or f(n,i+1,j+(`i`!=`i`[::-1]))

A one-indexed function that takes input of n via argument and returns the nth non-palindromic number.

How it works

This is an exhaustive recursive search, which consecutively tests integers i in the range [1,∞) until n non-palindromic numbers have been found; since i is pre-incremented, i-1 is then returned. Testing whether a number is palindromic is performed by converting to a string, reversing, and then checking whether the original and reversed strings are equal.

The code is logically equivalent to:

def f(n,test=0,count=1):
    if count>n:
        return test
    elif str(test)!=reversed(str(test)):
        return f(n,test+1,count+1)
    else:
        return f(n,test+1,count)

which itself is essentially:

def f(n):
    test=0
    count=1
    while count<=n:
        if str(test)!=reversed(str(test)):
            count+=1
        test+=1
    return test-1

Try it on Ideone


问:
Collect and place items
The goal of this challenge is to collect selected items in a list and move them to a certain location in the list.

As a visual example, take the input values (represented by black boxed integers) and a corresponding list of truthy values where true denotes the item is selected (represented by blue boxes, where T is truthy and F is falsy):

The first logical step is to separate the items marked truthy and not truthy into their corresponding lists. Note that relative order in each list must be maintained (i.e. the order of selected items must be 1,4,5, and the order of unselected items must be 2,3,6,7)!

The second logical step is given an index in the remaining list of unselected items, insert all selected items before the item at the given index. Assuming indexing starts at 0, suppose you want to insert the selection at index 3. This corresponds to the spot before the 7 box, so the selected items should be inserted before the 7.

The final solution is then 2,3,6,1,4,5,7.

Note that this logical diagram depicts one way this could be done; your program does not need to take the same logical steps as long as the output always produces the same observable result.

Input

Your program is given 3 inputs:

A list of integers representing the items. This may be an empty list. This list will always consist of unique positive integers, not necessarily in sorted order (i.e. 5 will not be in the list twice).

A list of truthy/falsy values with the same length as the list of items, where a truthy value represents that the item at the same index has been selected.

An integer representing where to insert the selection. You may choose what the index of the first item of the list is as long as it is constant in every run of your program (e.g. the first item could be index 0 or index 1). Please specify which convention your program adheres to. This index should be in the range [starting_idx, ending_idx+1], i.e. it will always be a valid index. For the case index is ending_idx+1, the selection should be inserted at the end of the list.
You may assume this integer will fit into your language's native integer type.

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

Output

The output is a list representing the final sequence of items. This can be to any source desired (stdio, return value, function output parameter, etc.). You are allowed to modify any of the inputs in-place (for example, given a modify-able list as a function parameter, and having your function operate in-place on that list).

Test cases

All of the following test cases assume 0-based indexing. I've used 0 and 1 to indicate falsy/truthy values respectively for the selection mask.

Test cases happen to have lists formatted as [a,b,c], but as long as your input lists represent a finite ordered sequence that's fine.

Input:

```<code>[]
[]
0
</code>```

Output:

```<code>[]
</code>```

Input:

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

Output:

```<code>[2,3,6,1,4,5,7]
</code>```

Input:

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

Output:

```<code>[1,4,5,2,3,6,7]
</code>```

Input:

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

Output:

```<code>[2,3,6,7,1,4,5]
</code>```

Input:

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

Output:

```<code>[1,2,3,4,5,6,7]
</code>```

Input:

```<code>[]
</code>```0

Output:

```<code>[]
</code>```1

Input:

```<code>[]
</code>```2

Output:

```<code>[3,2,6,1,5,4]
</code>```

Scoring

This is code golf; shortest answer in bytes wins. Standard loopholes are prohibited. You are allowed to use any built-ins desired.

答:
Mathematica, <s>66</s> 62 bytes

Saved 4 bytes from @MartinEnder.

```<code>a=#2~Extract~Position[#3,#4>0]&;##&@@@Insert[##~a~0,##~a~1,#]&
</code>```

Anonymous function. Takes the 1-based index, the list, and the markers as input and returns the reordered list as output.

Title: Collect and place items

Body:
Mathematica, <s>66</s> 62 bytes

Saved 4 bytes from @MartinEnder.

a=#2~Extract~Position[#3,#4>0]&;##&@@@Insert[##~a~0,##~a~1,#]&

Anonymous function. Takes the 1-based index, the list, and the markers as input and returns the reordered list as output.


问:
Can Mario go to the end of this map
Create a program that determines, given an input of the path, whether Mario can reach the end, denoted by E, from the start, denoted by S.

A path will look something like this:

```<code>S = E
=====
</code>```

In a path, the various symbols and what they represent are:

=: wall/floor/ceiling. Mario cannot walk through wall , and cannot fall past a floor, or jump past a ceiling (he would hit his head)

  (space): air. Mario can walk through this, and jump through it, and fall through it

S: air, except showing where Mario starts. This will always appear in the left-most column of the input, at ground level.

E: air, except showing where Mario wants to get. This will always appear in the right-most column of the input, at ground level.

The input will have spaces at every place where Mario could walk.

Mario can only move forward; in this example Mario cannot get to the goal

```<code>S
===

 ===
   E
====
</code>```

nor can he in this one

```<code>    E
   ==
==
  #==
==
   ==
==
S  ==
======
</code>```

However, he can reach the space denoted by # (which will not appear in input), because he can jump up to four cells high; Mario is superhuman. As another example of his superhumanity:

```<code>S
=
=
=
=
=
= #
= =
=
=
=
=     E
=======
</code>```

Mario can get to the E by falling the great distance, surviving, and walking calmly to E. Note that he cannot reach the #, because Mario falls straight down.

Mario can jump really high, but not very far forward by comparison.

```<code>S   E
== ==
 = =
</code>```

Mario may attempt to jump the gap, but he will fail, and fall straight in. he cannot reach the end.

Mario can reach the goal in all of these examples:

```<code> E
 =
 =
 =
S=
==
</code>```

```<code> =
 =   E
S=   =
==   =
 =   =
 =====
</code>```

```<code>S
=

=  E
====
</code>```

This is code golf, so fewest bytes wins!

答:
C, <s>256</s> <s>236</s> <s>213</s> 197 bytes

20 bytes saved by "This will always appear in the left-most column of the input"

23 bytes saved thanks to @RohanJhunjhunwala's column-based system

Try it on ideone, with test cases...

```<code>k,y,x,h;f(v,l)char**v;{h=strlen(*v);x=strcspn(*v,"S");while(y<l&x<h)if(v[y][x]==69)return 0;else if(v[y][x+1]^61)x++;else{if(v[y+1][x]==61)while(k<4)if(v[y+1][x-++k]^61){x-=k;break;}y++;}return 1;}
</code>```

Usage:

```<code>$ ./mario "S=" " =" " =" " =" "E="
main(c,v)char**v;{printf("%s",f(v+1,c-1)==0?"true":"false");}
</code>```

Ungolfed with explanation:

k,y,x,h; //omitting int for saving 4 bytes, global variables initialize as 0 by default
f(v,l)char**v;{ //saving 2 bytes
    h=strlen(v[0]); //get height of map
    x=strcspn(v[0],"S"); //where is start point?
    while(y<l&&x<h) //while not out of bounds
        if(v[y][x]==69)return 0; //if we hit end return 0 (69 is ASCII E)
        else if(v[y][x+1]!=61)x++; //we fall one block if there isn't floor underneath us (61 is ASCII =)
        else{
            if(v[y+1][x]==61) //if there is a wall in front of us
                while(k<4) //start counting
                    if(v[y+1][x-++k]!=61){ //if found a way
                        x-=k; //go to there
                        break; //we don't want to jump multiple times
                    }
            y++; //finally, walk one block forwards
        }
    return 1; //if out of bounds
}
```

Title: Can Mario go to the end of this map

Body:
C, <s>256</s> <s>236</s> <s>213</s> 197 bytes

20 bytes saved by "This will always appear in the left-most column of the input"

23 bytes saved thanks to @RohanJhunjhunwala's column-based system

Try it on ideone, with test cases...

k,y,x,h;f(v,l)char**v;{h=strlen(*v);x=strcspn(*v,"S");while(y<l&x<h)if(v[y][x]==69)return 0;else if(v[y][x+1]^61)x++;else{if(v[y+1][x]==61)while(k<4)if(v[y+1][x-++k]^61){x-=k;break;}y++;}return 1;}

Usage:

$ ./mario "S=" " =" " =" " =" "E="
main(c,v)char**v;{printf("%s",f(v+1,c-1)==0?"true":"false");}

Ungolfed with explanation:

k,y,x,h; //omitting int for saving 4 bytes, global variables initialize as 0 by default
f(v,l)char**v;{ //saving 2 bytes
    h=strlen(v[0]); //get height of map
    x=strcspn(v[0],"S"); //where is start point?
    while(y<l&&x<h) //while not out of bounds
        if(v[y][x]==69)return 0; //if we hit end return 0 (69 is ASCII E)
        else if(v[y][x+1]!=61)x++; //we fall one block if there isn't floor underneath us (61 is ASCII =)
        else{
            if(v[y+1][x]==61) //if there is a wall in front of us
                while(k<4) //start counting
                    if(v[y+1][x-++k]!=61){ //if found a way
                        x-=k; //go to there
                        break; //we don't want to jump multiple times
                    }
            y++; //finally, walk one block forwards
        }
    return 1; //if out of bounds
}


问:
Divisibility test

Task

Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.

You may write a program or a function and use any of the our standard methods of receiving input and providing output.

The output should be a truthy or a falsy value; truthy if n is divisible by d, and falsy otherwise.

Your code only has to handle integers it can represent natively, as long as it works for all signed 8-bit integers. However, your algorithm has to work for arbitrarily large integers.

You may use any programming language, but note that these loopholes are forbidden by default.

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

Test cases

```<code> n,  d    output

 1,  1    truthy
 2,  1    truthy
 6,  3    truthy
17, 17    truthy
22,  2    truthy
 1,  2    falsy
 2,  3    falsy
 2,  4    falsy
 3,  9    falsy
15, 16    falsy
</code>```

Leaderboard

The Stack Snippet at the bottom of this post generates the catalog 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 + 3 (-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>```

 <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

```

答:
Forth (gforth), <s>13</s> 12 bytes

```<code>: x mod 0= ;

:   - create new word
x   - word name
mod - modulus operator
0=  - compare value on stack with 0
;   - end word
</code>```

Use like n d x .

Test cases (-1 is true, 0 is false) :

```<code>1 1 x . -1  ok
2 1 x . -1  ok
6 3 x . -1  ok
17 17 x . -1  ok
22 2 x . -1  ok
1 2 x . 0  ok
2 3 x . 0  ok
2 4 x . 0  ok
3 9 x . 0  ok
15 16 x . 0  ok
</code>```

My first submission! :D

Title: Divisibility test

Body:
Forth (gforth), <s>13</s> 12 bytes

: x mod 0= ;

:   - create new word
x   - word name
mod - modulus operator
0=  - compare value on stack with 0
;   - end word

Use like n d x .

Test cases (-1 is true, 0 is false) :

1 1 x . -1  ok
2 1 x . -1  ok
6 3 x . -1  ok
17 17 x . -1  ok
22 2 x . -1  ok
1 2 x . 0  ok
2 3 x . 0  ok
2 4 x . 0  ok
3 9 x . 0  ok
15 16 x . 0  ok

My first submission! :D


问:
Print a Lego piece
This challenge is a simple ascii-art one. Given two inputs, describing the height and width of a Lego piece, you have print an ASCII art representation of it.

Here is how the Lego pieces are supposed to look:

```<code>(4, 2)

___________
| o o o o |
| o o o o |
-----------

(8, 2)

___________________
| o o o o o o o o |
| o o o o o o o o |
-------------------

(4, 4)

___________
| o o o o |
| o o o o |
| o o o o |
| o o o o |
-----------

(3, 2)

_________
| o o o |
| o o o |
---------

(1, 1)

o
</code>```

If you can't tell from the test-cases, the top and bottom are width*2+3 underscores and dashes, and each row has pipes for the sides, o's for the little things, and everything is separated by spaces.

The only exception for this is (1, 1), which is just a single o.

You will never get 0 for any of the dimensions.

This is code-golf, so shortest code in bytes wins!

var QUESTION_ID=84050,OVERRIDE_USER=31343;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://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

```

答:
Vim, 56 keystrokes

This seems like a text editing task, so Vim is the obvious choice! I take input as a text file with two space separated integers and output the answer into the same file. Also, I hate you for having the 1x1 special case... Anyway:

```<code>"adt l"bDro:if@a*@b==1|wq|en<cr>Di| |<esc>@aio <esc>yy@bPVr_GpVr-ZZ
</code>```

and if there hadn't been for the special case, 35 keystrokes

```<code>"adt x"bDi| |<esc>@aio <esc>yy@bPVr_GpVr-ZZ
</code>```

A breakdown for sane people:

```<code>"adt l"bD
</code>```

Delete numbers from buffer into @a and @b (space char kept)

```<code>         ro:if@a*@b==1|wq|en<cr>
</code>```

Replace space with "o" and if special case, save and quit

```<code>                                Di| |<esc>
</code>```

Clear the line and write the edges of the lego block

```<code>                                          @aio <esc>
</code>```

Insert @a lots of "o " to get a finished middle part

```<code>                                                    yy@bP
</code>```

Yank line and make @b extra copies (one too many)

```<code>                                                         Vr_
</code>```

We are at top of buffer, replace extra line with underscores

```<code>                                                            Gp
</code>```

Jump to bottom of buffer, pull line that we yanked earlier

```<code>                                                              Vr-ZZ
</code>```

Replace line with dashes, save and quit

Title: Print a Lego piece

Body:
Vim, 56 keystrokes

This seems like a text editing task, so Vim is the obvious choice! I take input as a text file with two space separated integers and output the answer into the same file. Also, I hate you for having the 1x1 special case... Anyway:

"adt l"bDro:if@a*@b==1|wq|en<cr>Di| |<esc>@aio <esc>yy@bPVr_GpVr-ZZ

and if there hadn't been for the special case, 35 keystrokes

"adt x"bDi| |<esc>@aio <esc>yy@bPVr_GpVr-ZZ

A breakdown for sane people:

"adt l"bD

Delete numbers from buffer into @a and @b (space char kept)

         ro:if@a*@b==1|wq|en<cr>

Replace space with "o" and if special case, save and quit

                                Di| |<esc>

Clear the line and write the edges of the lego block

                                          @aio <esc>

Insert @a lots of "o " to get a finished middle part

                                                    yy@bP

Yank line and make @b extra copies (one too many)

                                                         Vr_

We are at top of buffer, replace extra line with underscores

                                                            Gp

Jump to bottom of buffer, pull line that we yanked earlier

                                                              Vr-ZZ

Replace line with dashes, save and quit


答:
MATL, 9 bytes

```<code>&)i:&)bwv
</code>```

This solution accepts an array of T (true) and F (false) values as the second input. Also for the first test case, with empty arrays, it produces no output.

Try it Online! and a slightly modified version for all test cases.

Explanation

```<code>    % Implicitly grab the first two inputs
&)  % Index into the first array using the boolean, places two items on the stack:
    % 1) The values where the boolean is TRUE and 2) the values where it is FALSE.
i   % Explicitly grab the third input (N)
:   % Create an array from 1...N
&)  % Index into the FALSE group using this array as an index. Puts two items on the stack:
    % 1) The first N elements of the FALSE group and 2) other members of the FALSE group
b   % Bubble the TRUE members up to the top of the stack
w   % Flip the top two stack elements to get things in the right order
v   % Vertically concatenate all arrays on the stack
    % Implicitly display the result
</code>```

Title: Collect and place items

Body:
The goal of this challenge is to collect selected items in a list and move them to a certain location in the list.

As a visual example, take the input values (represented by black boxed integers) and a corresponding list of truthy values where true denotes the item is selected (represented by blue boxes, where T is truthy and F is falsy):

The first logical step is to separate the items marked truthy and not truthy into their corresponding lists. Note that relative order in each list must be maintained (i.e. the order of selected items must be 1,4,5, and the order of unselected items must be 2,3,6,7)!

The second logical step is given an index in the remaining list of unselected items, insert all selected items before the item at the given index. Assuming indexing starts at 0, suppose you want to insert the selection at index 3. This corresponds to the spot before the 7 box, so the selected items should be inserted before the 7.

The final solution is then 2,3,6,1,4,5,7.

Note that this logical diagram depicts one way this could be done; your program does not need to take the same logical steps as long as the output always produces the same observable result.

Input

Your program is given 3 inputs:

A list of integers representing the items. This may be an empty list. This list will always consist of unique positive integers, not necessarily in sorted order (i.e. 5 will not be in the list twice).

A list of truthy/falsy values with the same length as the list of items, where a truthy value represents that the item at the same index has been selected.

An integer representing where to insert the selection. You may choose what the index of the first item of the list is as long as it is constant in every run of your program (e.g. the first item could be index 0 or index 1). Please specify which convention your program adheres to. This index should be in the range [starting_idx, ending_idx+1], i.e. it will always be a valid index. For the case index is ending_idx+1, the selection should be inserted at the end of the list.
You may assume this integer will fit into your language's native integer type.

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

Output

The output is a list representing the final sequence of items. This can be to any source desired (stdio, return value, function output parameter, etc.). You are allowed to modify any of the inputs in-place (for example, given a modify-able list as a function parameter, and having your function operate in-place on that list).

Test cases

All of the following test cases assume 0-based indexing. I've used 0 and 1 to indicate falsy/truthy values respectively for the selection mask.

Test cases happen to have lists formatted as [a,b,c], but as long as your input lists represent a finite ordered sequence that's fine.

Input:

```<code>[]
[]
0
</code>```

Output:

```<code>[]
</code>```

Input:

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

Output:

```<code>[2,3,6,1,4,5,7]
</code>```

Input:

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

Output:

```<code>[1,4,5,2,3,6,7]
</code>```

Input:

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

Output:

```<code>[2,3,6,7,1,4,5]
</code>```

Input:

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

Output:

```<code>[1,2,3,4,5,6,7]
</code>```

Input:

```<code>[]
</code>```0

Output:

```<code>[]
</code>```1

Input:

```<code>[]
</code>```2

Output:

```<code>[3,2,6,1,5,4]
</code>```

Scoring

This is code golf; shortest answer in bytes wins. Standard loopholes are prohibited. You are allowed to use any built-ins desired.

Body:
MATL, 9 bytes

&)i:&)bwv

This solution accepts an array of T (true) and F (false) values as the second input. Also for the first test case, with empty arrays, it produces no output.

Try it Online! and a slightly modified version for all test cases.

Explanation

    % Implicitly grab the first two inputs
&)  % Index into the first array using the boolean, places two items on the stack:
    % 1) The values where the boolean is TRUE and 2) the values where it is FALSE.
i   % Explicitly grab the third input (N)
:   % Create an array from 1...N
&)  % Index into the FALSE group using this array as an index. Puts two items on the stack:
    % 1) The first N elements of the FALSE group and 2) other members of the FALSE group
b   % Bubble the TRUE members up to the top of the stack
w   % Flip the top two stack elements to get things in the right order
v   % Vertically concatenate all arrays on the stack
    % Implicitly display the result


问:
Polar Bear, Polar Bear, what do you hear?
The text of the children's book Polar Bear, Polar Bear, What Do You Hear?  has a very simple pattern.  You might use the text to teach introductory programming concepts.

My son was quickly bored by this idea, so I decided to play some golf with it instead.

The Challenge

In your programming language of choice, write the smallest program possible which will print the following text.  Output should match exactly, including case, spacing, and punctuation.

```<code>Polar Bear, Polar Bear, what do you hear?
I hear a lion roaring in my ear.

Lion, Lion, what do you hear?
I hear a hippopotamus snorting in my ear.

Hippopotamus, Hippopotamus, what do you hear?
I hear a flamingo fluting in my ear.

Flamingo, Flamingo, what do you hear?
I hear a zebra braying in my ear.

Zebra, Zebra, what do you hear?
I hear a boa constrictor hissing in my ear.

Boa Constrictor, Boa Constrictor, what do you hear?
I hear an elephant trumpeting in my ear.

Elephant, Elephant, what do you hear?
I hear a leopard snarling in my ear.

Leopard, Leopard, what do you hear?
I hear a peacock yelping in my ear.

Peacock, Peacock, what do you hear?
I hear a walrus bellowing in my ear.

Walrus, Walrus, what do you hear?
I hear a zookeeper whistling in my ear.

Zookeeper, Zookeeper, what do you hear?
I hear children...

...growling like a polar bear,
roaring like a lion,
snorting like a hippopotamus,
fluting like a flamingo,
braying like a zebra,
hissing like a boa constrictor,
trumpeting like an elephant,
snarling like a leopard,
yelping like a peacock,
bellowing like a walrus...
that's what I hear.
</code>```

Body:
PHP, 366 bytes

Lazy answer, but why write a custom decompressor when gzip is available?

Hex dump of PHP code (can be saved with xxd -r)

0000000: 3c3f 3d67 7a69 6e66 6c61 7465 2827 7d53  <?=gzinflate('}S
0000010: c16a 8430 10bd e72b e6d6 cbe0 2f14 b6b4  .j.0...+..../...
0000020: b4d0 c3de 0abd 8d6e baca c64c 1823 62bf  .......n...L.#b.
0000030: be51 3354 1472 58f3 76de f864 e6bd 5cd9  .Q3T.rX.v..d..\.
0000040: 91c0 c592 20ec f1d4 5284 1bc3 cc23 b4a9  .... ...R....#..
0000050: f26c 3ed6 1308 5cc7 1e84 493a 7f87 ce43  .l>...\...I:...C
0000060: 3f43 222a 633e 1381 b03d 0bef b75d 081c  ?C"*c>...=...]..
0000070: 3852 3f0e 3078 9678 147a df75 20ec ff15  8R?.0x.x.z.u ...
0000080: 857f 1cf5 498a 1318 4f9a 6f99 4450 54d4  ....I...O.o.DPT.
0000090: fab5 b510 a4df 7c14 fa5e 1884 7c14 246a  ......|..^..|.$j
00000a0: 2668 d80f 51ba 26b2 a4b9 87e1 2876 6182  &h..Q.&.....(va.
00000b0: 97ff 1e84 63a1 f001 0fd6 d9d0 928f 1065  ....c..........e
00000c0: ec83 3dcd fc9a 7904 4565 632d 0792 5bf2  ..=...y.Eec-..[.
00000d0: 84c4 9dcc dd48 0405 25a5 60a9 e1e6 01b3  .....H..%.`.....
00000e0: 75e1 2874 dd38 0405 25a1 899c a494 d4d6  u.(t.8..%.......
00000f0: 399e 8e4a 5f2b 89a0 67c9 4ee6 87b5 c10a  9..J_+..g.N.....
0000100: 4cc9 86e8 4ea6 2a8f a0b0 b4fb a6ed dc4d  L...N.*........M
0000110: acaf aaf4 6e7a dc85 a755 d375 0fbb ccbf  ....nz...U.u....
0000120: dea4 3ab5 a211 2651 2adf 1e34 1a7b adb6  ..:...&Q*..4.{..
0000130: fb8c 1bcd 6f26 35d7 6896 3c2a a121 45a3  ....o&5.h.<*.!E.
0000140: c1ca d543 eed0 683a b465 971c 34d9 6ca5  ...C..h:.e..4.l.
0000150: 3404 68d4 3b1d 29bb 65b2 17ca a847 cb2a  4.h.;.).e....G.*
0000160: 624b f169 d8d6 b66d aa32 7f27 293b       bK.i...m.2.');

I used a few iterations of zopfli to convert the source text to 349 bytes of compressed data, avoiding the ' character which would otherwise have to be escaped with backslashes.


答:
Haskell, 70 bytes

```<code>m%n=[e|(e,b)<-zip m n,b]
(l#s)p|(h,t)<-splitAt p$l%(not<$>s)=h++l%s++t
</code>```

Usage example: ([1,2,3,4,5,6,7]#[True,False,False,True,True,False,False]) 3 -> [2,3,6,1,4,5,7].

How it works:

```<code>m%n=[e|(e,b)<-zip m n,b]        -- helper function, that extracts the elements of m
                                -- with corresponding True values in n
(l#s)p                          -- l: list of values
                                   s: list of booleans
                                   p: position to insert
  |                   (not<$>s) -- negate the booleans in s
                    l%          -- extract elements of l
          splitAt p             -- split this list at index p
   (h,t)<-                      -- bind h to the part before the split
                                -- t to the part after the split
     = h++l%s++t                -- insert elements at True positions between h and t
</code>```

Title: Collect and place items

Body:
Haskell, 70 bytes

m%n=[e|(e,b)<-zip m n,b]
(l#s)p|(h,t)<-splitAt p$l%(not<$>s)=h++l%s++t

Usage example: ([1,2,3,4,5,6,7]#[True,False,False,True,True,False,False]) 3 -> [2,3,6,1,4,5,7].

How it works:

m%n=[e|(e,b)<-zip m n,b]        -- helper function, that extracts the elements of m
                                -- with corresponding True values in n
(l#s)p                          -- l: list of values
                                   s: list of booleans
                                   p: position to insert
  |                   (not<$>s) -- negate the booleans in s
                    l%          -- extract elements of l
          splitAt p             -- split this list at index p
   (h,t)<-                      -- bind h to the part before the split
                                -- t to the part after the split
     = h++l%s++t                -- insert elements at True positions between h and t


问:
Add two numbers
Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list.

Output: Their sum. Use the same format for output integers as input integers. For example, the input 5 16 would lead to the output 21.

Restrictions: No standard loopholes please. This is code-golf, answer in lowest amount of bytes wins.

Notes: This should be fairly trivial, however I'm interested to see how it can be implemented. The answer can be a complete program or a function, but please identify which one it is.

Test cases:

```<code>1 2 -> 3
14 15 -> 29
7 9 -> 16
-1 8 -> 7
8 -9 -> -1
-8 -9 -> -17
</code>```

Or as CSV:

```<code>a,b,c
1,2,3
14,15,29
7,9,16
-1,8,7
8,-9,-1
-8,-9,-17
</code>```

Leaderboard

var QUESTION_ID=84260,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<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

```

答:
Sesos, 5 bytes

```<code>0000000: d605ba 8f07                                       .....
</code>```

Try it online!

```<code>set numin
set numout
get
fwd 1
get
jmp
sub 1
rwd 1
add 1
fwd 1
jnz
rwd 1
put
</code>```

Title: Add two numbers

Body:
Sesos, 5 bytes

0000000: d605ba 8f07                                       .....

Try it online!

set numin
set numout
get
fwd 1
get
jmp
sub 1
rwd 1
add 1
fwd 1
jnz
rwd 1
put

ContentLicense: CC BY-SA 4.0


问:
Count up folks!

Introduction

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

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

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

Challenge

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

Rules

You can get n any way.

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

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

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

Standard loopholes are denied.

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

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

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

Bonuses

20%

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

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

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

答:
JAISBaL, 15 bytes

```<code>c1I0¯K0DQc1+I0´
</code>```

Verbose:

```<code># \# enable verbose parsing #\
pushnum 1        \# push 1 onto the stack #\
store 0          \# store the top value of the stack into var0 #\
for              \# start for loop #\
    load 0       \# push the value in var0 onto the stack #\
    duplicate    \# duplicate the top value of the stack #\
    popoutln     \# pop the top value off a stack and print it with a new line #\
    pushnum 1    \# push 1 onto the stack #\
    add          \# add the top two values of the stack #\
    store 0      \# store the top value of the stack into var0 #\
end              \# end current language construct #\
</code>```

JAISBaL Noncompeting Answers
These answers are noncompeting because they use the "range" instruction, which I added because of this challenge. I did not add them specifically to complete this challenge, rather this challenge brought the need for a range instruction to my attention.

Manual output, 4 bytes:
(Manual output because the output at the end of a JAISBaL program can be considered debug information, although it is always enabled)

```<code>c1ØP
</code>```

Verbose:

```<code># \# enable verbose parsing #\
pushnum 1    \# push 1 onto the stack #\
rangein      \# push an array containing all numbers in the range of the two numbers on the top of the stack, inclusivley #\
popout       \# pop the top value of a stack and print it #\
</code>```

Implicit Output, 3 bytes:

```<code>c1Ø
</code>```

Same concept as the manual output answer, just without the print instruction.

Instruction codes and testing compatible with JAISBaL-0.0.6

Title: Count up folks!

Body:
JAISBaL, 15 bytes

c1I0¯K0DQc1+I0´

Verbose:

# \# enable verbose parsing #\
pushnum 1        \# push 1 onto the stack #\
store 0          \# store the top value of the stack into var0 #\
for              \# start for loop #\
    load 0       \# push the value in var0 onto the stack #\
    duplicate    \# duplicate the top value of the stack #\
    popoutln     \# pop the top value off a stack and print it with a new line #\
    pushnum 1    \# push 1 onto the stack #\
    add          \# add the top two values of the stack #\
    store 0      \# store the top value of the stack into var0 #\
end              \# end current language construct #\

JAISBaL Noncompeting Answers
These answers are noncompeting because they use the "range" instruction, which I added because of this challenge. I did not add them specifically to complete this challenge, rather this challenge brought the need for a range instruction to my attention.

Manual output, 4 bytes:
(Manual output because the output at the end of a JAISBaL program can be considered debug information, although it is always enabled)

c1ØP

Verbose:

# \# enable verbose parsing #\
pushnum 1    \# push 1 onto the stack #\
rangein      \# push an array containing all numbers in the range of the two numbers on the top of the stack, inclusivley #\
popout       \# pop the top value of a stack and print it #\

Implicit Output, 3 bytes:

c1Ø

Same concept as the manual output answer, just without the print instruction.

Instruction codes and testing compatible with JAISBaL-0.0.6


Title: Collect and place items

Body:
JavaScript (ES6), 76 bytes

(a,b,c)=>(d=a.filter((_,i)=>!b[i]),d.splice(c,0,...a.filter((_,i)=>b[i])),d)


答:
JavaScript (ES6), 75 bytes

```<code>a=>a.concat(a,a,a).sort(g=(x,y)=>x-y).slice(l=a.length,-l).reduce(g,0)/l/-2
</code>```

Uses the obvious quadruplicate-and-sort approach, and I get to use reduce, which is nice. The only trickery here is to save 4 bytes by reusing the sort comparator to subtract all the array elements from zero, which gives me -2l times the answer I want.

Title: Interquartile Mean

Body:
Task

Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean.

One possible algorithm

Discard the lowest and highest quarters of the data points.

Calculate the average (sum divided by count) of the remaining data points.

Note: If the dataset size is not evenly split-able in four, you will have to weigh the datapoints that are shared by sub-sets. See Example evaluation 2 below.

Example evaluation 1

Given {1, 3, 4, 5, 6, 6, 7, 7, 8, 8, 9, 38}

Data count is 12, so we remove lowest and highest 3 datapoints:
{<s>1, 3, 4,</s> 5, 6, 6, 7, 7, 8, <s>8, 9, 38</s>}

Average of the remaining 6 datapoints:
(5 + 6 + 6 + 7 + 7 + 8) / 6 = 6.5

Example evaluation 2

Given {1, 3, 5, 7, 9, 11, 13, 15, 17}

Count is 9, so each quarter has 2¼ datapoints:
{<s>1, 2, (0.25×5),</s> (0.75×5), 7, 9, 11, (0.75×13), <s>(0.25×13), 15, 17</s>}

Average of the remaining 4.5 datapoints:
(0.75×5 + 7 + 9 + 11 + 0.75×13) / 4.5 = 9

Body:
JavaScript (ES6), 75 bytes

a=>a.concat(a,a,a).sort(g=(x,y)=>x-y).slice(l=a.length,-l).reduce(g,0)/l/-2

Uses the obvious quadruplicate-and-sort approach, and I get to use reduce, which is nice. The only trickery here is to save 4 bytes by reusing the sort comparator to subtract all the array elements from zero, which gives me -2l times the answer I want.


答:
Java <s>234 230 221 216 208 207 205</s> 179 Bytes

Look, I beat C and python? I have acheived true transcendence among mortals!  All jokes aside, this was  a fun challenge. The following function takes input as an array of column strings each with the same length. If this is against the rules please do let me know. It outputs 1 meaning a successful mario run, and any other value implying a failed mario run.

```<code>int m(String[]a){int l=a.length-1,z=a[l].indexOf(69),m=a[0].indexOf(83),i=1,x;a[l]=a[l].replace("E"," ");for(;i<=l;m=x,i++){if(m-(x=a[i].indexOf('='))>3|x<1)return-1;}return m-z;}
</code>```

Here is the older logic (which is similar to the current version) with example use and output. Plus some comments explaining the logic

```<code>/**
 *
 * @author Rohans
 */
public class Mario {

    int m(String[] a) {
//declare variables for the finish the location of mario and the length
        int z, l = a.length - 1, m = a[0].indexOf("S");
        //treat the exit as a space
        z = a[l].indexOf("E");
        a[l] = a[l].replaceAll("E", " ");
        //go through the map
        for (int i = 1, x, r = 1; i <= l; i++) {
            //if mario can safely jump to the next platform (it picks the highest one)
            if (((x = a[i].indexOf("=")) != 0 && (x = a[i].indexOf(" =")) == -1) || m - x > 4) {
                return 0;
            }
            //adjust marios y location
            m = x;
        }
        //make sure mario made it to the end of the level
        return m == z ? 1 : 0;
    }

    public static void MarioTest(String... testCase) {
        System.out.println(new Mario().m(testCase) == 1 ? "Mario made it" : "Mario did not make it");
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        MarioTest("   S=", "=====", "     =", "     =", "=   =", "     E=");

    }

}
</code>```

Title: Can Mario go to the end of this map

Body:
Create a program that determines, given an input of the path, whether Mario can reach the end, denoted by E, from the start, denoted by S.

A path will look something like this:

```<code>S = E
=====
</code>```

In a path, the various symbols and what they represent are:

=: wall/floor/ceiling. Mario cannot walk through wall , and cannot fall past a floor, or jump past a ceiling (he would hit his head)

  (space): air. Mario can walk through this, and jump through it, and fall through it

S: air, except showing where Mario starts. This will always appear in the left-most column of the input, at ground level.

E: air, except showing where Mario wants to get. This will always appear in the right-most column of the input, at ground level.

The input will have spaces at every place where Mario could walk.

Mario can only move forward; in this example Mario cannot get to the goal

```<code>S
===

 ===
   E
====
</code>```

nor can he in this one

```<code>    E
   ==
==
  #==
==
   ==
==
S  ==
======
</code>```

However, he can reach the space denoted by # (which will not appear in input), because he can jump up to four cells high; Mario is superhuman. As another example of his superhumanity:

```<code>S
=
=
=
=
=
= #
= =
=
=
=
=     E
=======
</code>```

Mario can get to the E by falling the great distance, surviving, and walking calmly to E. Note that he cannot reach the #, because Mario falls straight down.

Mario can jump really high, but not very far forward by comparison.

```<code>S   E
== ==
 = =
</code>```

Mario may attempt to jump the gap, but he will fail, and fall straight in. he cannot reach the end.

Mario can reach the goal in all of these examples:

```<code> E
 =
 =
 =
S=
==
</code>```

```<code> =
 =   E
S=   =
==   =
 =   =
 =====
</code>```

```<code>S
=

=  E
====
</code>```

This is code golf, so fewest bytes wins!

Body:
Java <s>234 230 221 216 208 207 205</s> 179 Bytes

Look, I beat C and python? I have acheived true transcendence among mortals!  All jokes aside, this was  a fun challenge. The following function takes input as an array of column strings each with the same length. If this is against the rules please do let me know. It outputs 1 meaning a successful mario run, and any other value implying a failed mario run.

int m(String[]a){int l=a.length-1,z=a[l].indexOf(69),m=a[0].indexOf(83),i=1,x;a[l]=a[l].replace("E"," ");for(;i<=l;m=x,i++){if(m-(x=a[i].indexOf('='))>3|x<1)return-1;}return m-z;}

Here is the older logic (which is similar to the current version) with example use and output. Plus some comments explaining the logic

/**
 *
 * @author Rohans
 */
public class Mario {

    int m(String[] a) {
//declare variables for the finish the location of mario and the length
        int z, l = a.length - 1, m = a[0].indexOf("S");
        //treat the exit as a space
        z = a[l].indexOf("E");
        a[l] = a[l].replaceAll("E", " ");
        //go through the map
        for (int i = 1, x, r = 1; i <= l; i++) {
            //if mario can safely jump to the next platform (it picks the highest one)
            if (((x = a[i].indexOf("=")) != 0 && (x = a[i].indexOf(" =")) == -1) || m - x > 4) {
                return 0;
            }
            //adjust marios y location
            m = x;
        }
        //make sure mario made it to the end of the level
        return m == z ? 1 : 0;
    }

    public static void MarioTest(String... testCase) {
        System.out.println(new Mario().m(testCase) == 1 ? "Mario made it" : "Mario did not make it");
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        MarioTest("   S=", "=====", "     =", "     =", "=   =", "     E=");

    }

}


答:
S.I.L.O.S 38

```<code>readIO
a = i
readIO
a + i
printInt a
</code>```

For documentation see the repo
https://github.com/rjhunjhunwala/S.I.L.O.S
Fee free to try this code online!

Title: Add two numbers

Body:
Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list.

Output: Their sum. Use the same format for output integers as input integers. For example, the input 5 16 would lead to the output 21.

Restrictions: No standard loopholes please. This is code-golf, answer in lowest amount of bytes wins.

Notes: This should be fairly trivial, however I'm interested to see how it can be implemented. The answer can be a complete program or a function, but please identify which one it is.

Test cases:

```<code>1 2 -> 3
14 15 -> 29
7 9 -> 16
-1 8 -> 7
8 -9 -> -1
-8 -9 -> -17
</code>```

Or as CSV:

```<code>a,b,c
1,2,3
14,15,29
7,9,16
-1,8,7
8,-9,-1
-8,-9,-17
</code>```

Leaderboard

var QUESTION_ID=84260,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<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:
S.I.L.O.S 38

readIO
a = i
readIO
a + i
printInt a

For documentation see the repo
https://github.com/rjhunjhunwala/S.I.L.O.S
Fee free to try this code online!


答:
Jelly, 10 bytes

```<code>¬+\>⁵Ḥ³oỤị
</code>```

Try it online!

How it works

```<code>¬+\>⁵Ḥ³oỤị  Main link.
            Arguments: x (list of Booleans), y (list of inputs), z (index)
¬           Logical NOT; invert all Booleans in x.
 +\         Take the cumulative sum.
            This replaces each entry with the number of zeroes up to that entry.
   >⁵       Compare the results with z.
            This yields 0 for the first z zeroes, 1 for all others. The behavior
            for ones is not important.
    Ḥ       Unhalve; multiply the previous resulting by 2.
     ³o     Take the element-wise logical NOT of x and the previous result.
            This replaces all but the first z zeroes in x with twos.
       Ụ    Grade up; sort the indices of the result according to the corr. values.
        ị   Retrieve the items of y at those indices.
</code>```

Title: Collect and place items

Body:
Jelly, 10 bytes

¬+\>⁵Ḥ³oỤị

Try it online!

How it works

¬+\>⁵Ḥ³oỤị  Main link.
            Arguments: x (list of Booleans), y (list of inputs), z (index)
¬           Logical NOT; invert all Booleans in x.
 +\         Take the cumulative sum.
            This replaces each entry with the number of zeroes up to that entry.
   >⁵       Compare the results with z.
            This yields 0 for the first z zeroes, 1 for all others. The behavior
            for ones is not important.
    Ḥ       Unhalve; multiply the previous resulting by 2.
     ³o     Take the element-wise logical NOT of x and the previous result.
            This replaces all but the first z zeroes in x with twos.
       Ụ    Grade up; sort the indices of the result according to the corr. values.
        ị   Retrieve the items of y at those indices.


问:
1, 2, Fizz, 4, Buzz

Introduction

In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other catalogue challenges, there is "Hello World!" and "Is this number a prime?".

Challenge

Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

Output

The output will be a list of numbers (and Fizzes, Buzzes and FizzBuzzes) separated by a newline (either \n or \r\n). A trailing newline is acceptable, but a leading newline is not.  Apart from your choice of newline, the output should look exactly like this:

```<code>1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
Fizz
22
23
Fizz
Buzz
26
Fizz
28
29
FizzBuzz
31
32
Fizz
34
Buzz
Fizz
37
38
Fizz
Buzz
41
Fizz
43
44
FizzBuzz
46
47
Fizz
49
Buzz
Fizz
52
53
Fizz
Buzz
56
Fizz
58
59
FizzBuzz
61
62
Fizz
64
Buzz
Fizz
67
68
Fizz
Buzz
71
Fizz
73
74
FizzBuzz
76
77
Fizz
79
Buzz
Fizz
82
83
Fizz
Buzz
86
Fizz
88
89
FizzBuzz
91
92
Fizz
94
Buzz
Fizz
97
98
Fizz
Buzz
</code>```

The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation.

Further Rules

This is not about finding the language with the shortest approach for playing FizzBuzz, this is about finding the shortest approach in every language. Therefore, no answer will be marked as accepted.

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

Nothing can be printed to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge. If anyone wants to abuse this by creating a language where the empty program generates FizzBuzz output, then congrats for paving 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.

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 and ???), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

Because the output is fixed, you may hardcode the output (but this may not be the shortest option).

You may use preexisting solutions, as long as you credit the original author of the program.

Standard loopholes are otherwise disallowed.

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.

Catalogue

var QUESTION_ID=58615;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=30525;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.toLowerCase(),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>b.lang_raw)return 1;if(a.lang_raw<b.lang_raw)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:700}table td{padding:5px}</code>```

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
ROOP, 187 bytes

```<code>1
V!         !<
(102)      1|
 e#r3##r5# a|
#H  #   # Y-<
   N   N  !
"Fizz""Buzz"

   mX  mX
### V-->  !
   A V---->
    #
  ' C
 V'e  "\n"
 |# M  #
 <V# #v
 C  A  C
  #X ##
    w
    O#
</code>```

I will try to explain each section of code:

```<code>V!         !<  Add 1 to each number that goes to the left of the a
           1|  and sends it to the bottom of the V
           a|
           -<
</code>```

```<code>(102)          The 102 falls to the left of the e and each number
 e             that passes over is compared to 102.
#H             If a number is equal then the H runs and ends the program
</code>```

```<code>  #r3#         With each number that goes above the r
    #          the remainder of dividing by 3 is obtained.
   N           The N returns 1 if the number is 0, and 0 otherwise.
"Fizz"         The string "Fizz" falls and moves to the left of the m.
               The number is multiplied by the string
   mX          ("" or "Fizz" if it is 0 or 1 respectively)
###            The X removes the number when it moves to the right

               The same is done with 5 and "Buzz"
</code>```

```<code>   mX  mX
    V-->      Both strings are concatenated with the A
   A          getting "", "Fizz", "Buzz" or "FizzBuzz"
    #
</code>```

```<code>  ' C         The C changes the direction of advance of string, to the left.
  'e          At the same time the "e" compares the string with the empty string.
  #           The single quotes are a vertical literal string.
</code>```

```<code> V            The V and pipes redirects the string to the right of the C
 |            that changes the direction again in order that comes to the left of the A
 <V
 C  A
</code>```

```<code>          Y   The original number is converted to a string with Y.
          !

          !   Pipes and teleporters (!) Redirects the string to below the V
     V---->
</code>```

```<code>    M         The string falls to the right of the M and multiplies
   # #        with the number previously obtained by the e
    A         The result is above the A
</code>```

```<code>      "\n"   The string "\n" falls on the v which makes a copy
    M  #     whenever there is a space below.
      v      The C changes the direction of the string so it goes to the left.
    A  C     It waits to the right of the A
</code>```

```<code>V!         !<  Add 1 to each number that goes to the left of the a
           1|  and sends it to the bottom of the V
           a|
           -<
</code>```0

I hope it is comprehensible, English is not my main language.

Title: 1, 2, Fizz, 4, Buzz

Body:
ROOP, 187 bytes

1
V!         !<
(102)      1|
 e#r3##r5# a|
#H  #   # Y-<
   N   N  !
"Fizz""Buzz"

   mX  mX
### V-->  !
   A V---->
    #
  ' C
 V'e  "\n"
 |# M  #
 <V# #v
 C  A  C
  #X ##
    w
    O#

I will try to explain each section of code:

V!         !<  Add 1 to each number that goes to the left of the a
           1|  and sends it to the bottom of the V
           a|
           -<

(102)          The 102 falls to the left of the e and each number
 e             that passes over is compared to 102.
#H             If a number is equal then the H runs and ends the program

  #r3#         With each number that goes above the r
    #          the remainder of dividing by 3 is obtained.
   N           The N returns 1 if the number is 0, and 0 otherwise.
"Fizz"         The string "Fizz" falls and moves to the left of the m.
               The number is multiplied by the string
   mX          ("" or "Fizz" if it is 0 or 1 respectively)
###            The X removes the number when it moves to the right

               The same is done with 5 and "Buzz"

   mX  mX
    V-->      Both strings are concatenated with the A
   A          getting "", "Fizz", "Buzz" or "FizzBuzz"
    #

  ' C         The C changes the direction of advance of string, to the left.
  'e          At the same time the "e" compares the string with the empty string.
  #           The single quotes are a vertical literal string.

 V            The V and pipes redirects the string to the right of the C
 |            that changes the direction again in order that comes to the left of the A
 <V
 C  A

          Y   The original number is converted to a string with Y.
          !

          !   Pipes and teleporters (!) Redirects the string to below the V
     V---->

    M         The string falls to the right of the M and multiplies
   # #        with the number previously obtained by the e
    A         The result is above the A

      "\n"   The string "\n" falls on the v which makes a copy
    M  #     whenever there is a space below.
      v      The C changes the direction of the string so it goes to the left.
    A  C     It waits to the right of the A

    A        The A concatenate all 3 strings, the result is on the w that sends it
  #X ##      to the O representing the output. At the same time the X deletes the string.
    w
    O#

I hope it is comprehensible, English is not my main language.


问:
Holiday Gift Exchange
Another problem from our internal golfing...this one around the holidays last year.

PROBLEM

Andy, Barb, Carl, Didi, Earl, and Fran are buying gifts for each other. Draw names for a gift exchange.

Each person buys one gift and receives one gift.

Nobody buys their own gift.

Running the solution multiple times should produce different results (giver-receiver pair should not be predictable or identical from run to run).

INPUT

None.

OUTPUT

Formatted as in this example:

Andy buys for Barb

  Barb buys for Carl

  Carl buys for Didi

  Didi buys for Earl

  Earl buys for Fran

  Fran buys for Andy

答:
Windows PowerShell, 83

```<code>$i=random 5
($n=-split'Andy Barb Carl Didi Earl Fran')|%{"$_ buys for "+$n[++$i%6]}
</code>```

History:

2011-02-11 22:01 (136) – First attempt.

2011-02-11 22:05 (130) – Inlined a few things. Shuffling the names now, not the indexes.

2011-02-13 16:13 (128) – I don't need the modulus as $i will be recreated every time.

2011-02-13 16:20   (87) – Borrowed the idea from Anon.'s C# solution. Just generate a random offset and then just let them gift in circles.

2011-02-13 16:26   (83) – Changed random number generation and indexing. Pulled $_ into the string to save the +.

ContentLicense: CC BY-SA 2.5

Title: Holiday Gift Exchange

Body:
Windows PowerShell, 83

$i=random 5
($n=-split'Andy Barb Carl Didi Earl Fran')|%{"$_ buys for "+$n[++$i%6]}

History:

2011-02-11 22:01 (136) – First attempt.

2011-02-11 22:05 (130) – Inlined a few things. Shuffling the names now, not the indexes.

2011-02-13 16:13 (128) – I don't need the modulus as $i will be recreated every time.

2011-02-13 16:20   (87) – Borrowed the idea from Anon.'s C# solution. Just generate a random offset and then just let them gift in circles.

2011-02-13 16:26   (83) – Changed random number generation and indexing. Pulled $_ into the string to save the +.


问:
Determine number of connected components
You are given a graph represented through an adjacency list. For example, the input

```<code>1-2 2-3 3-4 4-1
</code>```

would correspond to the graph with nodes 1, 2, 3 and 4, where 1 is connected to 2, 2 is connected to 3, 3 is connected to 4, and 4 is connected to 1 (forming a square).

The task is to determine the number of of connected components of the graph represented by an inputted adjacency list. A "connected component" is a set of nodes from which there is no path to any other node that is not in the set.

Example:

Intput: 1-2 2-3 4-5

  Output: 2

Language of your choice - shortest code possible.

答:
Ruby, 77 characters

```<code>gets;0while$_.sub!(/\b(\d+)\b(.*) (\1-\d+|\d+-\1)\b/,'\3\2');p$_.count(" ")+1
</code>```

A first plain attempt in Ruby. It collects the sub-graphs using a regular expression until no more connections can be made.

Examples:

```<code>> 1-2 2-3 3-4 4-1
1

> 1-2 2-3 4-5
2

> 1-2 3-4 8-9 1-6 5-7 7-4 10-9
3
</code>```

Body:
Ruby, 77 characters

gets;0while$_.sub!(/\b(\d+)\b(.*) (\1-\d+|\d+-\1)\b/,'\3\2');p$_.count(" ")+1

A first plain attempt in Ruby. It collects the sub-graphs using a regular expression until no more connections can be made.

Examples:

> 1-2 2-3 3-4 4-1
1

> 1-2 2-3 4-5
2

> 1-2 3-4 8-9 1-6 5-7 7-4 10-9
3


问:
Substring Sum Set

Introduction

Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2].

Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array:

```<code>[3, 2, 4, 1, 1, 5, 1, 2]
 ^
</code>```

The element at the first index is 3, so we now take a substring of length three with the same index as the starting position:

```<code>[3, 2, 4]
</code>```

When summed up, this results into 9, so the first element of the substring sum set is 9.

We do this for all the elements in the array:

```<code>3 -> [3, 2, 4]
2 -> [2, 4]
4 -> [4, 1, 1, 5]
1 -> [1]
1 -> [1]
5 -> [5, 1, 2]
1 -> [1]
2 -> [2]
</code>```

You can see that the number 5 is a bit of a weird case. That number exceeds the length of the array:

```<code>[3, 2, 4, 1, 1, 5, 1, 2]
                ^  ^  ^  ^  ^
</code>```

We'll ignore everything that exceeds the array, so we just use [5, 1, 2].

The last step is to sum everything up:

```<code>[3, 2, 4]     -> 9
[2, 4]        -> 6
[4, 1, 1, 5]  -> 11
[1]           -> 1
[1]           -> 1
[5, 1, 2]     -> 8
[1]           -> 1
[2]           -> 2
</code>```

And that is the array that needs to be outputted:

```<code>[9, 6, 11, 1, 1, 8, 1, 2]
</code>```

The Task

Given an non-empty array with positive (non-zero) integers, output the substring sum set. This is code-golf, so the submission with the smallest number of bytes wins!

Test cases

```<code>[1, 2, 3, 4, 5] -> [1, 5, 12, 9, 5]
[3, 3, 3, 3, 3, 3, 3, 3] -> [9, 9, 9, 9, 9, 9, 6, 3]
[5, 1, 2, 4, 1] -> [13, 1, 6, 5, 1]
[1] -> [1]
</code>```

答:
Pyth, 6 bytes

```<code>ms<~tQ
</code>```

Test suite

This is a different solution from any others so far. It loops over the input, slicing an summing the initial values, then removing the first element of the stored input, and repeat.

Explanation:

```<code>ms<~tQ
ms<~tQdQ    Implicit variable introduction
            Implicit: Q = eval(input())
m      Q    Map d over the input, Q
  <  Qd     Take the first d elements of Q
 s          Sum them
   ~tQ      Afterwards, set Q to the tail of Q, removing the first element.
</code>```

Title: Substring Sum Set

Body:
Pyth, 6 bytes

ms<~tQ

Test suite

This is a different solution from any others so far. It loops over the input, slicing an summing the initial values, then removing the first element of the stored input, and repeat.

Explanation:

ms<~tQ
ms<~tQdQ    Implicit variable introduction
            Implicit: Q = eval(input())
m      Q    Map d over the input, Q
  <  Qd     Take the first d elements of Q
 s          Sum them
   ~tQ      Afterwards, set Q to the tail of Q, removing the first element.