答:
Minecraft, 27 bytes

```<code>say Hello @p, I'm Minecraft
</code>```

say Prints the given string and replaces @p with the name of the nearest player

Title: Introduce Your Language!

Body:
Your task is to write a program or function that takes a string as input, and prints Hello (input), I'm (language name).

Examples

Python:

Input: Oliver

Output: Hello Oliver, I'm Python

C++:

Input: Jacob

Output: Hello Jacob, I'm C++

etc.

Remember, this is code-golf, so the code with the lowest number of bytes wins.

Leaderboards

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

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>```

var QUESTION_ID=94485,OVERRIDE_USER=12537;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:
Minecraft, 27 bytes

say Hello @p, I'm Minecraft

say Prints the given string and replaces @p with the name of the nearest player


问:
Translate number pairs to guitar notes
A guitar fretboard diagram looks like this:

```<code>  0  1  2  3  4  5  6  7  8  9 10 11 12   <- Fret number (0 means it's open)
|-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E
|-B--C--C#-D--D#-E--F--F#-G--G#-A--A#-B
|-G--G#-A--A#-B--C--C#-D--D#-E--F--F#-G
|-D--D#-E--F--F#-G--G#-A--A#-B--C--C#-D
|-A--A#-B--C--C#-D--D#-E--F--F#-G--G#-A
|-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E
</code>```

As you can see, the first string (from the top) open is an E. The first fret on the first string is an F. The fourth fret on the third string is a B. Note that the first note is the zeroth fret, not the first.

This can be written with numbers on the format string, fret. The strings are numbered from 1 to 6 from top to bottom.
The frets are numbered from 0 to 12 from left to right. The first E is therefore 1, 0. Some other examples:

```<code>1, 0 --> E
1, 1 --> F
3, 5 --> C
5, 1 --> A#
6, 6 --> A#
</code>```

Challenge:

Take N pairs of numbers (s and f), and output a delimited note succession.

The input may be on any suitable format. tuples, 2D-matrix, two separate lists, an interweaved list (string,fret,string,fret...) etc.

The output tone should be separated, but the delimiter is optional (comma, space, dash...). The output can be in either upper or lower case.

s (for string) will be in the range [1, 6] (you may choose to have i 0-indexed)

f (for fret) will be in the range [0, 12]

Test cases and examples:

```<code>1 4 5 2 1 3   <- String
4 2 6 3 5 1   <- Fret
G# E D# D A G#

6 2 3 1 4 2 3 2 2 2 6 5 2
0 1 2 3 4 5 6 7 8 9 10 11 12
E C A G F# E C# F# G G# D G# B

3 3 3 3 3 3 3 3 3 3 3 3 3   <- String
0 3 5 0 3 6 5 0 3 5 3 0 0   <- Fret
G A# C G A# C# C G A# C A# G G

// The same test case, but different input and output format:
(3,0)(3,3)(3,5)(3,3)(3,6)(3,5)(3,0)(3,3)(3,5)(3,3)(3,0)(3,0)
G,A#,C,G,A#,C#,C,G,A#,C,A#,G,G
</code>```

Good luck, and happy golfing!

ContentLicense: CC BY-SA 3.0

Title: Translate number pairs to guitar notes

Body:
Java 7  197,163 bytes

void f(int[]s,int[]f){String[]l={"A","A#","B","C","C#","D","D#","E","F","F#","G","G#"};int[]d={0,7,2,10,5,0,7};int j=0;for(int i:s)out.print(l[(d[i]+f[j++])%12]);}

Ungolfed

  void f(int[]s,int[]f){
 String[]l={"A","A#","B","C","C#","D","D#","E","F","F#","G","G#"};
int[]d={0,7,2,10,5,0,7};
    int j=0;
    for(int i:s)
        out.print(l[(d[i]+f[j++])%12]);

}


答:
Python 2, <s>94, 91</s>, 88 bytes

```<code>for s,f in input():print"A A# B C C# D D# E F F# G G#".split()[([7,2,10,5,0,7][s]+f)%12]
</code>```

There are probably some obvious improvements to be made. Input is a list of pairs, and the strings are 0-indexed, e.g:

```<code>[0, 4], [3, 2], [4, 6]...
</code>```

Title: Translate number pairs to guitar notes

Body:
A guitar fretboard diagram looks like this:

```<code>  0  1  2  3  4  5  6  7  8  9 10 11 12   <- Fret number (0 means it's open)
|-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E
|-B--C--C#-D--D#-E--F--F#-G--G#-A--A#-B
|-G--G#-A--A#-B--C--C#-D--D#-E--F--F#-G
|-D--D#-E--F--F#-G--G#-A--A#-B--C--C#-D
|-A--A#-B--C--C#-D--D#-E--F--F#-G--G#-A
|-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E
</code>```

As you can see, the first string (from the top) open is an E. The first fret on the first string is an F. The fourth fret on the third string is a B. Note that the first note is the zeroth fret, not the first.

This can be written with numbers on the format string, fret. The strings are numbered from 1 to 6 from top to bottom.
The frets are numbered from 0 to 12 from left to right. The first E is therefore 1, 0. Some other examples:

```<code>1, 0 --> E
1, 1 --> F
3, 5 --> C
5, 1 --> A#
6, 6 --> A#
</code>```

Challenge:

Take N pairs of numbers (s and f), and output a delimited note succession.

The input may be on any suitable format. tuples, 2D-matrix, two separate lists, an interweaved list (string,fret,string,fret...) etc.

The output tone should be separated, but the delimiter is optional (comma, space, dash...). The output can be in either upper or lower case.

s (for string) will be in the range [1, 6] (you may choose to have i 0-indexed)

f (for fret) will be in the range [0, 12]

Test cases and examples:

```<code>1 4 5 2 1 3   <- String
4 2 6 3 5 1   <- Fret
G# E D# D A G#

6 2 3 1 4 2 3 2 2 2 6 5 2
0 1 2 3 4 5 6 7 8 9 10 11 12
E C A G F# E C# F# G G# D G# B

3 3 3 3 3 3 3 3 3 3 3 3 3   <- String
0 3 5 0 3 6 5 0 3 5 3 0 0   <- Fret
G A# C G A# C# C G A# C A# G G

// The same test case, but different input and output format:
(3,0)(3,3)(3,5)(3,3)(3,6)(3,5)(3,0)(3,3)(3,5)(3,3)(3,0)(3,0)
G,A#,C,G,A#,C#,C,G,A#,C,A#,G,G
</code>```

Good luck, and happy golfing!

Body:
Python 2, <s>94, 91</s>, 88 bytes

for s,f in input():print"A A# B C C# D D# E F F# G G#".split()[([7,2,10,5,0,7][s]+f)%12]

There are probably some obvious improvements to be made. Input is a list of pairs, and the strings are 0-indexed, e.g:

[0, 4], [3, 2], [4, 6]...


答:
MATL, <s>48</s> <s>47</s> 45 bytes

Thanks to @Emigna for a correction regarding input format.

Guitar and code golf... I had to answer this one!

```<code>'$)-27<'i)-'F F# G G# A A# B C C# D D#
</code>```

Input format is: an array of (1-based) string, then an array of (0-based) frets.

Try it online!

Explanation

Some language features used in this answer:

A string is automatically converted to a numerical array of ASCII code
points when some arithmetic operation is applied to it.

Arithmetical operations work element-wise, i.e. vectorized. So the subtraction of a string and a numerical array of the same size gives an array with the subtraction of corresponding entries.

Indexing is 1-based and modular.

A cell array is like a list in other languages. It can contain arbitrary elements, possibly arrays of different types or sizes. Here a cell array will be used to store strings of different lengths (the notes' names).

Commented code:

```<code>'$)-27<'                       % Push this string
i                              % Take first input (array of guitar strings)
)                              % Index into the string. For example, input [1 3] gives
                               % the string '$-' (indexing is 1-based)
-                              % Implicitly take second input (array of guitar frets).
                               % Subtract element-wise. This automatically converts the
                               % previous string into an array of ASCII codes. For
                               % example, second input [1 5] gives a result [-35 -40],
                               % which is [1 5] minus [36 45], where 36 and 45 are the
                               % ASCII codes of '$-'
'F F# G G# A A# B C C# D D# E' % Push this string
Yb                             % Split at spaces. Gives a cell array of 12 (sub)strings:
                               % {'F', 'F#', 'G', ..., 'E'}
w)                             % Swap and index into the cell array of strings.
                               % Indexing is 1-based and modular. In the example, since
                               % the cell array has 12 elements, the indexing array
                               % [-35 -40] is the same [1 8], and thus it gives a
                               % (sub-)array formed by the first and eighth cells:
                               % {'F', 'C'}. This is displayed as the cells' contents,
                               % one per line
</code>```

Title: Translate number pairs to guitar notes

Body:
MATL, <s>48</s> <s>47</s> 45 bytes

Thanks to @Emigna for a correction regarding input format.

Guitar and code golf... I had to answer this one!

'$)-27<'i)-'F F# G G# A A# B C C# D D#

Input format is: an array of (1-based) string, then an array of (0-based) frets.

Try it online!

Explanation

Some language features used in this answer:

A string is automatically converted to a numerical array of ASCII code
points when some arithmetic operation is applied to it.

Arithmetical operations work element-wise, i.e. vectorized. So the subtraction of a string and a numerical array of the same size gives an array with the subtraction of corresponding entries.

Indexing is 1-based and modular.

A cell array is like a list in other languages. It can contain arbitrary elements, possibly arrays of different types or sizes. Here a cell array will be used to store strings of different lengths (the notes' names).

Commented code:

'$)-27<'                       % Push this string
i                              % Take first input (array of guitar strings)
)                              % Index into the string. For example, input [1 3] gives
                               % the string '$-' (indexing is 1-based)
-                              % Implicitly take second input (array of guitar frets).
                               % Subtract element-wise. This automatically converts the
                               % previous string into an array of ASCII codes. For
                               % example, second input [1 5] gives a result [-35 -40],
                               % which is [1 5] minus [36 45], where 36 and 45 are the
                               % ASCII codes of '$-'
'F F# G G# A A# B C C# D D# E' % Push this string
Yb                             % Split at spaces. Gives a cell array of 12 (sub)strings:
                               % {'F', 'F#', 'G', ..., 'E'}
w)                             % Swap and index into the cell array of strings.
                               % Indexing is 1-based and modular. In the example, since
                               % the cell array has 12 elements, the indexing array
                               % [-35 -40] is the same [1 8], and thus it gives a
                               % (sub-)array formed by the first and eighth cells:
                               % {'F', 'C'}. This is displayed as the cells' contents,
                               % one per line


问:
The Programming Language Quiz

Congratulations to Dennis who won both the cops' and the robbers' challenge! Calvin's Hobbies has already delivered on his promise and wrote this challenge for Dennis for winning the robbers' challenge.

Notice: This challenge is closed for further cop answers as of 2015-09-01 02:00:00 UTC. Any new answers posted will not be eligible for winning and will not count towards the robbers' scores if cracked. However, you may still post new answers for the other users' enjoyment, so that there are still some puzzles available for future visitors. These new answers are included in the "Vulnerable Cops" section of the leaderboard and their non-competing status is marked separately.

Welcome to the Cops-and-Robbers edition of The Hello World Quiz! (If you've never played the quiz, feel free to try it out for a minute or 30. You don't need to have played it for this challenge though.)

The Cops' Challenge

Choose a programming language. Valid languages must have either an English Wikipedia article, an esolangs article or a Rosetta Code article at the time this challenge was posted (note that the linked lists are not necessarily complete because they are curated manually). They must also satisfy our usual standards for programming languages, so things like HQ9+ are out. Lastly, there must be a free (as in beer) interpreter or compiler available for the language (at the time this challenge was posted).

Write a Hello World program. That is, write a full program in the chosen language which prints Hello, World! (exactly like that, i.e. this exact byte stream) and optionally a single trailing newline to STDOUT or closest alternative.

You must not assume a REPL environment, existing boilerplate code, or non-standard compiler/interpreter flags. The program must be in the form of one or more source files (to rule out quirky languages like Folders) and must fit into your answer in full (so it must not be longer than 30,000 characters) - this shouldn't be an issue for any serious submission.

If your code contains bytes outside the printable ASCII range, please include a pastebin or hex dump to make sure your code is actually testable.

The program must terminate within 1 minute on a typical desktop PC.

That's it. The catch is that you want to obfuscate your code such that it's not obvious which language you picked. Also note that you don't want your code to accidentally be a valid Hello World program in any other language, although I expect that to be unlikely for sufficiently obfuscated programs.

You must not under any circumstances edit the source code of your submission once posted (as this may invalidate a robbers' active attempts at cracking your answer). So make sure that you golf it as well as you can (or dare) before posting. If you realise that your answer does not work after posting it, simply delete your answer and post a fixed version if you want to.

If no one finds a language your code is valid in for 7 days, you may reveal the chosen language (ideally with an explanation for your obfuscated code), which will make your answer safe. Note that your submission can still be cracked until you reveal the language.

The shortest safe submission (in bytes) wins.

Formatting

(Feel free to skip this section and read The Robbers' Challenge if you're not planning to participate as a cop right now.)

At the bottom of this post, you'll find a Stack Snippet which generates leaderboards as well as a list of submissions which can still be cracked. For the snippet to work, it is important that you include a certain header in your answer:

New answers should include a header like

```<code># ???, [N] bytes
</code>```

where [N] is the size of your code in bytes and ??? should appear literally.

If the answer is not cracked for 7 days and you want to make your answer safe by revealing the language, simply replace the ???, e.g.

```<code># Ruby, [N] bytes
</code>```

Feel free to have the language name link to a relevant website like an esolangs page or a GitHub repository. The link will then be displayed in the leaderboard.

If another user successfully cracked your submission (see below), please also add the language, along with a notice like

```<code># Ruby, [N] bytes, cracked by [user]
</code>```

where [user] is the name of the user who submitted the first valid crack. If the language used in the crack is different from the one you intended, I'd recommend using the robbers' guess and mentioning in the answer that you intended it to be something else. Feel free to make the user name a link to their profile page.

The Robbers' Challenge

Find a vulnerable answer. That is an answer, which hasn't been cracked yet and which isn't safe yet.

Crack it by figuring out its language. That is, find any language in which the given program is a valid Hello World program (subject to the rules outlined in The Cops' Challenge above). It doesn't matter if this is the language the cop intended.

If you've found such a language, leave a comment with the language's name. If possible, you should include a link to an online interpreter, showing that the code actually works in that language as required.

Every user only gets one guess per answer. You must not crack your own answer (obviously...).

The user who cracked the largest number of answers wins the robbers' challenge. Ties are broken by the sum of bytes of cracked answers (more is better).

Because the robbers' challenge is held exclusively in comments, there won't be any reputation incentive for the robbers. However, the Grand Master of Challenge Writing, Calvin's Hobbies, has kindly offered to write a challenge about the user who wins the robbers' challenge!

Challenge Dashboard

The Stack Snippet below generates leaderboards for the cops and robbers and will also list all answers which can still be cracked. Let me know if anything appears not to be working properly, and I'll try to fix it as soon as possible. If you can think of additional features which would make the dashboard more useful, leave a comment as well.

/* Configuration */

var QUESTION_ID = 54807; // 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 DAYS_TILL_SAFE = 7;
var OVERRIDE_USER = 8478;
var CUTOFF_DATE = new Date(Date.UTC(2015, 8, 1, 2));

var MS_TILL_SAFE = DAYS_TILL_SAFE * 24 * 60 * 60 * 1000;

/* App */

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

function answersUrl(index) {
  // Must load over https (this comment is because I need to change 6+ chars)
  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 VULNERABLE_REG = /<h\d>[?]{3},[^\n\d,]*(\d+)[^\n,]*<\/h\d>/;
var SAFE_REG = /<h\d>\s*([^\n,]*[^\s,]),[^\n\d,]*(\d+)[^\n,]*<\/h\d>/;
var CRACKED_REG = /<h\d>\s*([^\n,]*[^\s,]),[^\n\d,]*(\d+)[^\n,]*,\s*cracked\s*by\s*(.*[^\s<])<\/h\d>/i;
var OVERRIDE_REG = /^Override\s*header:\s*/i;

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

function process() {
  console.log(answers);
  var vulnerable = [];
  var cops = [];
  var robbers_hash = {};

  var now = Date.now();

  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;
    if (VULNERABLE_REG.test(body)) {
      vulnerable.push({
        user: getAuthorName(a),
        size: +body.match(VULNERABLE_REG)[1],
        time_left: (a.creation_date*1000 > CUTOFF_DATE) ? Infinity : MS_TILL_SAFE - (now - a.creation_date*1000),
        link: a.share_link,
      });
    } else if (SAFE_REG.test(body)) {
      if (a.creation_date*1000 < CUTOFF_DATE) {
        match = body.match(SAFE_REG);
        cops.push({
          user: getAuthorName(a),
          size: +match[2],
          language: match[1],
          link: a.share_link,
        });
      }
    } else if (CRACKED_REG.test(body)) {
      if (a.creation_date*1000 < CUTOFF_DATE) {
        match = body.match(CRACKED_REG);
        var language = match[1];
        var size = +match[2];
        var user = match[3];
        if (/<a/.test(user)) user = jQuery(user).text();
        var robber = robbers_hash[user] || {
          user: user,
          cracks: 0,
          total_size: 0,
          languages: [],
        };
        ++robber.cracks;
        robber.total_size += size;
        robber.languages.push({
          language: language,
          link: a.share_link,
        });
        robbers_hash[user] = robber;
      }
    }
  })

  console.log(vulnerable);
  console.log(cops);
  console.log(robbers_hash);

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

  vulnerable.forEach(function (a) {
    var answer = jQuery("#vulnerable-template").html();
    var time = a.time_left;
    var time_string = "";
    if (time == Infinity)
      time_string = "Answer is not competing";
    else if (time > 0) {
      time_string += ((time / (1000 * 60 * 60 * 24))|0) + "d ";
      time %= 1000 * 60 * 60 * 24;
      time_string += ((time / (1000 * 60 * 60))|0) + "h ";
      time %= 1000 * 60 * 60;
      time_string += ((time / (1000 * 60))|0) + "m ";
      time %= 1000 * 60;
      time_string += ((time / (1000))|0) + "s";
    }
    else
      time_string = "Cop may reveal language!";

    answer = answer.replace("{{NAME}}", a.user)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{TIME}}", time_string)
                   .replace("{{TIME}}", a.time_left)
                   .replace("{{HUE}}", a.time_left <= 0 ? 0 : a.time_left == Infinity ? 160 : a.time_left/MS_TILL_SAFE*80+40)
                   .replace("{{LINK}}", a.link);

    answer = jQuery(answer)

    jQuery("#vulnerable").append(answer);
  });

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

  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  cops.forEach(function (a) {
    var answer = jQuery("#cops-template").html();
    var size = a.size;
    if (size != lastSize)
      lastPlace = place;
    lastSize = size;
    ++place;
    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("#cops").append(answer);
  });

  var robbers = [];
  for (var r in robbers_hash)
    if (robbers_hash.hasOwnProperty(r))
      robbers.push(robbers_hash[r]);

  robbers.sort(function (a, b) {
    var aB = a.cracks,
        bB = b.cracks,
        aC = a.total_size,
        bC = b.total_size;
    return (bB - aB) || (bC - aC);
  });

  place = 1;
  var lastCracks = null;
  lastSize = null;
  lastPlace = 1;
  robbers.forEach(function (a) {
    var answer = jQuery("#robbers-template").html();
    var cracks = a.cracks;
    var size = a.total_size;
    if (size != lastSize || cracks != lastCracks)
      lastPlace = place;
    lastSize = size;
    lastCracks = cracks;
    ++place;
    var languages = "";
    var first = true;
    a.languages.forEach(function (l) {
      if (!first) {
        languages += ", ";
      }
      first = false;
      var lang = l.language;
      if (/<a/.test(lang)) lang = jQuery(l.language).text();
      languages += '' + lang + '';
    });
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{CRACKS}}", a.cracks)
                   .replace("{{TOTAL_SIZE}}", a.total_size)
                   .replace("{{LANGUAGES}}", languages);

    answer = jQuery(answer)

    jQuery("#robbers").append(answer);
  });
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body { text-align: left !important}

#vulnerable-cops {
  padding: 10px;
  width: 600px;
}

#cops-leaderboard {
  padding: 10px;
  width: 600px;
}

#robbers-leaderboard {
  padding: 10px;
  width: 600px;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

.time-ms {
  display: none;
}</code>```

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

Vulnerable Cops

User	Size	Time Left

Leaderboard of Safe Cops

	User	Language	Size

Leaderboard of Robbers

	User	Cracks	Total Size	Languages (link to answers)

{{NAME}}	{{SIZE}}	{{TIME}}	Link	{{TIME_MS}}

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

{{PLACE}}	{{NAME}}	{{CRACKS}}	{{TOTAL_SIZE}}	{{LANGUAGES}}

```

Title: The Programming Language Quiz

Body:
///, 84 bytes

/"""""\
| _ _ |
||.|_||
||_|__|
 / \_______________
 \________________/Hello, World!

Hopefully this isn't too easy or a polyglot.


答:
Clora, 55 bytes

@T[0,7,2,10,5,0,7]+N%12@T[,A,A#,B,C#,D,D#,E,F,F#,G,G#]!

Explanation

@ numeric mode (read input as numbers)

T[0,7,2,10,5,0,7] Transform input using the array, ex array[Input]

+N Add N (Next input value) to current Input

%12 Modulo 12 the current input value

@ Flag numeric mode off

T[,A,A#,B,C#,D,D#,E,F,F#,G,G#] Translate the input into an array

! Use input as output value

Title: Translate number pairs to guitar notes


答:
05AB1E, <s>48</s> <s>47</s> <s>43</s> 40 bytes

Uses CP-1252 encoding.

Both strings and frets are 0-based.

```<code>v7YT5¾7)y`Šè+•™ÎÚ,Ülu•žh'#A«‡•7V3•3BS£è,
</code>```

Explanation

```<code>v                                # for each pair in input
 7YT5¾7)                         # the list [7,2,10,5,0,7]
 y`                              # flatten the pair [string, fret] and places on stack
 Šè                              # index into the list above using the string
 +                               # add the fret
 •™ÎÚ,Ülu•žh'#A«‡•7V3•3BS£       # list of accords
 è                               # index into the string using the number calculated above
 ,                               # print
</code>```

Try it online!

Saved 7 bytes thanks to Adnan

Title: Translate number pairs to guitar notes

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

Uses CP-1252 encoding.

Both strings and frets are 0-based.

v7YT5¾7)y`Šè+•™ÎÚ,Ülu•žh'#A«‡•7V3•3BS£è,

Explanation

v                                # for each pair in input
 7YT5¾7)                         # the list [7,2,10,5,0,7]
 y`                              # flatten the pair [string, fret] and places on stack
 Šè                              # index into the list above using the string
 +                               # add the fret
 •™ÎÚ,Ülu•žh'#A«‡•7V3•3BS£       # list of accords
 è                               # index into the string using the number calculated above
 ,                               # print

Try it online!

Saved 7 bytes thanks to Adnan


问:
Number Triangles

Credit

My thanks to Rand Al'Thor's letter-based question for the inspiration for this code-golf challenge.

Background

The nature of this challenge is based off the algorithm mentioned by Rand in his "A Triangle Formed of Three Letters":

Start with a sequence of 10 letters each of which is X, Y, or Z.

Under each row, construct the next row as follows. If two adjacent letters are the same, write the same letter beneath them; if they're different, write the third letter beneath them.

You would then repeat the previous step until you have one letter in your tenth row.

Challenge

We're going to put a mathematical spin on the above algorithm:

Let's start with a sequences of 10 digits, each separated by a space, and each of which is either 1, 2 or 3.

Under each row, construct the next row as follows. If two adjacent digits are the same, write the same digit beneath them; if they're different, write the third digit beneath them.

Repeat the previous step until you have one final number.

So, following this algorithm, if starting with the row 1 2 3 3 1 3 1 3 1 2, for example, the following triangle is generated:

```<code>Input: 1 2 3 3 1 3 1 3 1 2

Output:

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

I'm also curious to know the sum of all the digits in the number triangle, so add all these digits, and put this total in an eleventh row, right-justified to the last digit in the first row. So, our number triangle will look something like the following (spaces in my example are represented below by the . character to show formatting.)

```<code>Input: 1 2 3 3 1 3 1 3 1 2

Output:

1.2.3.3.1.3.1.3.1.2
.3.1.3.2.2.2.2.2.3.
..2.2.1.2.2.2.2.1..
...2.3.3.2.2.2.3...
....1.3.1.2.2.1....
.....2.2.3.2.3.....
......2.1.1.1......
.......3.1.1.......
........2.1........
.........3.........
................109
</code>```

Your challenge is to write code that can start with an inputted string/array/etc. of ten digits, as per my example, and then apply the algorithm to generate the ten rows that would create the number triangle, followed by an 11th row that would display the total of all digits with right-justification.

Testing

Testing of this string can be performed with a randomly generated string of ten digits of your choosing, or one generated from the snippet below...

c1=()=>('1331123221'+(Math.random()*(1<<24)|0).toString(4)).replace(/0/g, "").slice(-10).split("").join(" ");

$("#btn").click(function(){
  $("#str").val(c1());
});```
<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>
<input type="text" id="str"><button id="btn">Get numbers</button>
<br>
Please use this snippet to generate a starting row for testing your code. Alternatively, you can also use a string of your choice, so long as it's ten digits (ranging from 1 to 3), separated by single spaces.</code>```

Rules

Code-golf rules apply, so lowest number of bytes wins the challenge. In the event that there are two entries with the same low score, the winner will be awarded based on the number of up-votes.

What we're basically after is 11 rows, 19 characters long... How you render your final output is entirely up to you: array, console, file output, STDOUT, etc., so please use whatever output method you like that will work to your advantage. The only rule in the output is that we have 11 rows with 19 characters in each row in a similar format to above...

If it helps your code, use whatever separator for the digits... Just remember that legibility may be a contributing factor.

No silly loopholes.

Hard-coding of the input is not allowed. The purposes of this code is such that it can be used to produce different results each time with varying input. Hard-coding of 1 1 1 1 1 1 1 1 1 1 for example, completely negates the whole point of the algorithm.

Look forward to seeing what you all can come up with!

答:
Python 2, 164 bytes

A relatively simple iterative solution.

L=input()
s=0
for i in range(len(L)):
    print" "*-~i+" ".join(`L`[1::3]);s+=sum(L);N=L;L=[]
    for a,b in zip(N,N[1:]):L+=[list({1,2,3}-{a,b}),[a]][a==b]
print"%19s"%s
```

Try it online

Title: Number Triangles

Body:
Python 2, 164 bytes

A relatively simple iterative solution.

L=input()
s=0
for i in range(len(L)):
    print" "*-~i+" ".join(`L`[1::3]);s+=sum(L);N=L;L=[]
    for a,b in zip(N,N[1:]):L+=[list({1,2,3}-{a,b}),[a]][a==b]
print"%19s"%s

Try it online


问:
The shortest code to invert bit-wise a binary string
Me thinks there aren't enough easy questions on here that beginners can attempt!

The challenge: Given a random input string of 1's and 0's such as:

```<code>10101110101010010100010001010110101001010
</code>```

Write the shortest code that outputs the bit-wise inverse like so:

```<code>01010001010101101011101110101001010110101
</code>```

答:
Clora, 6 bytes (Noncompeting)

```<code><0I?01
</code>```

Explanation:

<0I Means, if 0 < I (Current input character), set flag as true

?01 If the flag is true (I is 1), output 0, else output 1

ContentLicense: CC BY-SA 4.0

Body:
Clora, 6 bytes (Noncompeting)

<0I?01

Explanation:

<0I Means, if 0 < I (Current input character), set flag as true

?01 If the flag is true (I is 1), output 0, else output 1


问:
Simple cat program
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and concatenate) several files read from disc.

Task

You should write a full program which reads the contents of the standard input stream and writes them verbatim to the standard output stream. If and only if your language does not support standard input and/or output streams (as understood in most languages), you may instead take these terms to mean their closest equivalent in your language (e.g. JavaScript's prompt and alert). These are the only admissible forms of I/O, as any other interface would largely change the nature of the task and make answers much less comparable.

The output should contain exactly the input and nothing else. 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. This also applies to trailing newlines. If the input does not contain a trailing newline, the output shouldn't include one either! (The only exception being if your language absolutely always prints a trailing newline after execution.)

Output to the standard error stream is ignored, so long as the standard output stream contains the expected output. In particular, this means your program can terminate with an error upon hitting the end of the stream (EOF), provided that doesn't pollute the standard output stream. If you do this, I encourage you to add an error-free version to your answer as well (for reference).

As this is intended as a challenge within each language and not between languages, there are a few language specific rules:

If it is at all possible in your language to distinguish null bytes in the standard input stream from the EOF, your program must support null bytes like any other bytes (that is, they have to be written to the standard output stream as well).

If it is at all possible in your language to support an arbitrary infinite input stream (i.e. if you can start printing bytes to the output before you hit EOF in the input), your program has to work correctly in this case. As an example yes | tr -d \\n | ./my_cat should print an infinite stream of ys. It is up to you how often you print and flush the standard output stream, but it must be guaranteed to happen after a finite amount of time, regardless of the stream (this means, in particular, that you cannot wait for a specific character like a linefeed before printing).

Please add a note to your answer about the exact behaviour regarding null-bytes, infinite streams, and extraneous output.

Additional rules

This is not about finding the language with the shortest solution for this (there are some where the empty program does the trick) - this is about finding the shortest solution in every language. Therefore, no answer will be marked as accepted.

Submissions in most languages will be 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.

Feel free to use a language (or language version) even if it's newer than this challenge. Languages specifically written to submit a 0-byte answer to this challenge are fair game but not particularly interesting.

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.

Also note that languages do have to fulfil our usual criteria for programming languages.

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

Unless they have been overruled earlier, all standard code-golf rules apply, including the http://meta.codegolf.stackexchange.com/q/1061.

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 author actually had to put effort into golfing the code.

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>## [><>](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

```

答:
Clora, 1 byte

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

Explanation:

! use Input as Output value

Title: Simple cat program

Body:
Clora, 1 byte

!

Explanation:

! use Input as Output value


问:
Output a string's cumulative slope

Challenge

Given a string such as Hello World!, break it down into its character values: 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33.

Then calculate the difference between each consecutive pair of characters: 29, 7, 0, 3, -79, 55, 24, 3, -6, -8, -67.

Finally, sum them and print the final result: -39.

Rules

Standard loopholes apply

No using pre-made functions that perform this exact task

Creative solutions encouraged

Have fun

This is marked as code-golf, the shortest answer in bytes wins but will not be selected.

答:
Befunge-93, 16 bytes

```<code>~:v_$-.@
~\<^`0:
</code>```

Befunge-98, 14 bytes

```<code>~v >-.@
\>#^~
</code>```

Reads (~) the first character, and then loops reading (~) a character and swaping (\) the top 2 items in the stack (so the first character keeps being raised to the top of the stack) until EOF, then substracts (-) the top 2 items, outputs (.) the result and ends (@).

Title: Output a string's cumulative slope

Body:
Befunge-93, 16 bytes

~:v_$-.@
~\<^`0:

Befunge-98, 14 bytes

~v >-.@
\>#^~

Reads (~) the first character, and then loops reading (~) a character and swaping (\) the top 2 items in the stack (so the first character keeps being raised to the top of the stack) until EOF, then substracts (-) the top 2 items, outputs (.) the result and ends (@).


问:
Praming Puzles & Colf: Condense a String
Having spend some time on this site I have come to enjoy things being as short as possible. That may be the reason why I'm recently kind of offended by strings containing the same characters more than once. Your job is to write a function or program which condenses a given string according to the following rules:

Start with a 0-condensation, that is look for the first (leftmost) pair of the same characters with 0 other characters between them. If such a pair is found, remove one of the two characters and restart the algorithm by performing another 0-condensation. If no such pair is found, proceed with the next step. Examples:

  programming -C0-> programing

  aabbcc -C0-> abbcc

  test -C0-> test

Then perform a 1-condensation, that is look for the first pair of same characters with 1 other character between them. If such a pair is found remove one of them and all characters between them and restart with a 0-condensation. If no such pair is found, proceed with the next step. Examples:

abacac -C1-> acac

java -C1-> ja

Continue with a 2-condensation and so on up to a n-condensation with n being the length of the original string, each time restarting after a condensation removed some letters. Examples:

programing -C2-> praming

abcdafg -C3-> afg

The resulting string is called condensed and contains each character at most once.

Input:

A lower case string of printable ascii-characters.

Output:

The condensed string according to the rules above.

Examples:

```<code>examples     -> es
programming  -> praming
puzzles      -> puzles
codegolf     -> colf
andromeda    -> a
abcbaccbabcb -> acb
if(x==1):x++ -> if(x+
fnabnfun     -> fun
abcdefae     -> abcde
</code>```

Detailed examples to clarify how the algorithm works:

```<code>fnabnfun -C0-> fnabnfun -C1-> fnabnfun -C2-> fnfun -C0-> fnfun -C1-> fun -C0-> fun
 -C1-> fun -C2-> ... -C8-> fun

abcbaccbabcb -C0-> abcbacbabcb -C0-> abcbacbabcb -C1-> abacbabcb -C0-> abacbabcb
 -C1-> acbabcb -C0-> acbabcb -C1-> acbcb -C0-> acbcb -C1-> acb -C0-> acb
 -C1-> ... -C12-> acb
</code>```

Your approach doesn't have to implement the algorithm from above as long as your solution and the algorithm return the same output for all allowed inputs.
This is a code-golf challenge.

Thanks to @Linus for helpful sandbox comments!

答:
JavaScript (ES6), 74 bytes

f=
(s,n=0,m=s.match(`(.).{${n}}\\1`))=>s[n]?m?f(s.replace(...m)):f(s,n+1):s
;```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input oninput=o.textContent=f(this.value)><pre id=o></code>```

Body:
JavaScript (ES6), 74 bytes

f=
(s,n=0,m=s.match(`(.).{${n}}\\1`))=>s[n]?m?f(s.replace(...m)):f(s,n+1):s
;

<input oninput=o.textContent=f(this.value)><pre id=o>


答:
Ruby, 63 bytes

takes an array of 2-element arrays, in the order [string,fret].

```<code>->x{x.map{|i|"BEADGCF"[6-n=((i[0]-3)%5+2+i[1]*7)%12]+?#*(n/7)}}
</code>```

Explanation

In standard tuning the guitar is one of the few stringed instruments (bowed or fretted) that has inconsistent intervals between its strings. Most have either a consistent 5-semitone interval between all pairs of adjacent strings (a "fourth") or a consistent 7-semitone interval between all pairs of adjacent strings (a "fifth.") These correspond to frequency ratios of 3:4 and 2:3 respectively, and are second in importance only to the "octave" with frequency ratio 1:2.

The guitar has mostly 5-semitone intervals. If it had 5 of these it would have a difference of 25 semitones between the 1st and 6th string. Instead, the interval between the 2nd and 3rd string is reduced to 4 semitones, giving a difference of 24 semitones (2 octaves) which is better for playing chords.

This is inconvenient for the program, so we start by changing the 1-indexed guitar intonation into a 0 indexed 5-string-bass intonation, which has all intervals of 5 semitones:

```<code>formula (i[0]-3)%5
Before                            After
String      6 5 4 3 2 1           String 4 3 2 1 0
Note        E A D G B E           Note   B E A D G

</code>```

Next we add 2, and give the tuning of a fictitious 12 string bass, with intonation of the open strings as follows, and all intervals being 5 semitones (12 string "basses" do exist but I am not sure there are many with precisely this tuning.)

```<code>String       11 10 9  8  7  6  5  4  3  2  1  0
Note         A# D# G# C# F# B  E  A  D  G  C  F
</code>```

As can be seen, all the sharps are grouped together. This pattern can be repeated ad infinitum. It is known as the "circle of fifths" and is fundamental to the Western musical scale (with a bit of tuning adjustment the circle can be closed due to the fact that (3/2)**12 and 2**7 are very similar numbers.

Now we deal with the fret parameter. Unlike many other answers here, which translate the string parameter into a number of frets, I translate the fret parameter into a number of strings. In the table above  it can be seen that adding 7 to the string number puts us on a string whose note name is one semitone higher. (It's in a completely different octave but that does not matter.) So we add i[1]*7 to the string number, and take it modulo 12:

```<code>n=(i[0]-3)%5+2+i[1]*7)%12
</code>```

We subtract this from 6 to get a number in the range 6 to -5 and look up the letter in BEADGCF (Ruby allows negative indices to wrap around back to the end of the array.) If n>=7 we need to add a # symbol to complete the output.

Test program

```<code>f=->x{x.map{|i|"BEADGCF"[6-n=((i[0]-3)%5+2+i[1]*7)%12]+?#*(n/7)}}

z=[[6, 2, 3, 1, 4, 2, 3, 2, 2, 2, 6,5,2],[0, 1, 2, 3, 4 ,5 ,6 ,7, 8, 9, 10, 11, 12]].transpose

puts f[z]
</code>```

Output

```<code>E
C
A
G
F#
E
C#
F#
G
G#
D
G#
B
</code>```

Title: Translate number pairs to guitar notes

Body:
Ruby, 63 bytes

takes an array of 2-element arrays, in the order [string,fret].

->x{x.map{|i|"BEADGCF"[6-n=((i[0]-3)%5+2+i[1]*7)%12]+?#*(n/7)}}

Explanation

In standard tuning the guitar is one of the few stringed instruments (bowed or fretted) that has inconsistent intervals between its strings. Most have either a consistent 5-semitone interval between all pairs of adjacent strings (a "fourth") or a consistent 7-semitone interval between all pairs of adjacent strings (a "fifth.") These correspond to frequency ratios of 3:4 and 2:3 respectively, and are second in importance only to the "octave" with frequency ratio 1:2.

The guitar has mostly 5-semitone intervals. If it had 5 of these it would have a difference of 25 semitones between the 1st and 6th string. Instead, the interval between the 2nd and 3rd string is reduced to 4 semitones, giving a difference of 24 semitones (2 octaves) which is better for playing chords.

This is inconvenient for the program, so we start by changing the 1-indexed guitar intonation into a 0 indexed 5-string-bass intonation, which has all intervals of 5 semitones:

formula (i[0]-3)%5
Before                            After
String      6 5 4 3 2 1           String 4 3 2 1 0
Note        E A D G B E           Note   B E A D G

Next we add 2, and give the tuning of a fictitious 12 string bass, with intonation of the open strings as follows, and all intervals being 5 semitones (12 string "basses" do exist but I am not sure there are many with precisely this tuning.)

String       11 10 9  8  7  6  5  4  3  2  1  0
Note         A# D# G# C# F# B  E  A  D  G  C  F

As can be seen, all the sharps are grouped together. This pattern can be repeated ad infinitum. It is known as the "circle of fifths" and is fundamental to the Western musical scale (with a bit of tuning adjustment the circle can be closed due to the fact that (3/2)**12 and 2**7 are very similar numbers.

Now we deal with the fret parameter. Unlike many other answers here, which translate the string parameter into a number of frets, I translate the fret parameter into a number of strings. In the table above  it can be seen that adding 7 to the string number puts us on a string whose note name is one semitone higher. (It's in a completely different octave but that does not matter.) So we add i[1]*7 to the string number, and take it modulo 12:

n=(i[0]-3)%5+2+i[1]*7)%12

We subtract this from 6 to get a number in the range 6 to -5 and look up the letter in BEADGCF (Ruby allows negative indices to wrap around back to the end of the array.) If n>=7 we need to add a # symbol to complete the output.

Test program

f=->x{x.map{|i|"BEADGCF"[6-n=((i[0]-3)%5+2+i[1]*7)%12]+?#*(n/7)}}

z=[[6, 2, 3, 1, 4, 2, 3, 2, 2, 2, 6,5,2],[0, 1, 2, 3, 4 ,5 ,6 ,7, 8, 9, 10, 11, 12]].transpose

puts f[z]

Output

E
C
A
G
F#
E
C#
F#
G
G#
D
G#
B


Title: Praming Puzles & Colf: Condense a String

Body:
Having spend some time on this site I have come to enjoy things being as short as possible. That may be the reason why I'm recently kind of offended by strings containing the same characters more than once. Your job is to write a function or program which condenses a given string according to the following rules:

Start with a 0-condensation, that is look for the first (leftmost) pair of the same characters with 0 other characters between them. If such a pair is found, remove one of the two characters and restart the algorithm by performing another 0-condensation. If no such pair is found, proceed with the next step. Examples:

  programming -C0-> programing

  aabbcc -C0-> abbcc

  test -C0-> test

Then perform a 1-condensation, that is look for the first pair of same characters with 1 other character between them. If such a pair is found remove one of them and all characters between them and restart with a 0-condensation. If no such pair is found, proceed with the next step. Examples:

abacac -C1-> acac

java -C1-> ja

Continue with a 2-condensation and so on up to a n-condensation with n being the length of the original string, each time restarting after a condensation removed some letters. Examples:

programing -C2-> praming

abcdafg -C3-> afg

The resulting string is called condensed and contains each character at most once.

Input:

A lower case string of printable ascii-characters.

Output:

The condensed string according to the rules above.

Examples:

```<code>examples     -> es
programming  -> praming
puzzles      -> puzles
codegolf     -> colf
andromeda    -> a
abcbaccbabcb -> acb
if(x==1):x++ -> if(x+
fnabnfun     -> fun
abcdefae     -> abcde
</code>```

Detailed examples to clarify how the algorithm works:

```<code>fnabnfun -C0-> fnabnfun -C1-> fnabnfun -C2-> fnfun -C0-> fnfun -C1-> fun -C0-> fun
 -C1-> fun -C2-> ... -C8-> fun

abcbaccbabcb -C0-> abcbacbabcb -C0-> abcbacbabcb -C1-> abacbabcb -C0-> abacbabcb
 -C1-> acbabcb -C0-> acbabcb -C1-> acbcb -C0-> acbcb -C1-> acb -C0-> acb
 -C1-> ... -C12-> acb
</code>```

Your approach doesn't have to implement the algorithm from above as long as your solution and the algorithm return the same output for all allowed inputs.
This is a code-golf challenge.

Thanks to @Linus for helpful sandbox comments!

Body:
Perl 53 52

Includes +1 for -p

for($i=0;$i<length;){$i=(s/(.).{$i}\1/\1/)?0:$i+1;}

Try it on ideone.


问:
Draw a Bumpy String
(Inspired by this challenge.)

Let's say we have a string ABBCBA. We can say that there is a rise between A and B, for B follows A; we can say that there is a run between B and B, for nothing changes; and finally we can say there is a fall between C and B. We can draw a graph like this:

```<code>             A   B   B   C   B   A
Rising:        o       o
Continuing:        o
Falling:                   o   o
</code>```

Without the labels, and minimizing whitespace:

```<code>o o
 o
   oo
</code>```

This is the expected output for input ABBCBA.

You may use any non-whitespace character to replace o in the output. Further, each column may optionally have an extra space between them, like so:

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

The input will consist of at least three characters. The string will consist entirely of uppercase letters, but you may instead use lowercase letters.

Test cases

```<code>TEST CASE
LINE 1
LINE 2
LINE 3

HELLOWORLD
 o oo o
  o
o    o oo

TESTCASE
 oo  o

o  oo o

EXAMINATION
o o o o o

 o o o o o

ZSILENTYOUTH
  o ooo o

oo o   o oo

ABC
oo

ABCBA
oo

  oo
</code>```

答:
Lua 326 303 bytes
    tl=0 s=io.read() o1,o2,o3="","","" t={} for i=1,#s do t[i]=s:sub(i,i) tl=tl+1 end for v=1,tl-1 do if t[v]t[v+1] then o1=o1.." " o2=o2.." " o3=o3.."o" end end print(o1.."\n"..o2.."\n"..o3)

An ungolfed version

```<code>tl = 0 --set the tables length to 0
s = io.read() --Get the string from input
o1,o2,o3="","","" --Set the 3 output rows to empty strings
t = {} --Make a table for the string to be sent into
for i = 1, #s do --Loop from 1 to the length of the string
    t[i] = s:sub(i, i) --Set the I-th term in the table to the I-th character in the string
    tl = tl+1 --Add 1 to the table length
end --End the loop
for v=1,tl-1, 1 do --Loop from 1 to the tables length - 1, incrementing by 1
    if t[v] < t[v+1] then --Lua supports greater than less than and equals to with charactes, so this if statement detects if the string is rising
        o1=o1.."o" --Adds an o to the end of the first line of output
        o2=o2.." " --Adds a space to the second line
        o3=o3.." " --Adds a space to the third line
    elseif t[v] == t[v+1] then --Detects if the string is continuing
        o1=o1.." " --Adds a space to the first line
        o2=o2.."o" --Adds an o to the second line
        o3=o3.." " --Adds a space to the third line
    elseif t[v] > t[v+1] then --Detects if string is falling
        o1=o1.." " --Adds a space to the first line
        o2=o2.." " --Adds a space to the second line
        o3=o3.."o" --Adds an o to the third line
    end --Ends the if statement
end --Ends the loop
print(o1.."\n"..o2.."\n"..o3) --Prints the output
</code>```

Title: Draw a Bumpy String

Body:
Lua 326 303 bytes
    tl=0 s=io.read() o1,o2,o3="","","" t={} for i=1,#s do t[i]=s:sub(i,i) tl=tl+1 end for v=1,tl-1 do if t[v]t[v+1] then o1=o1.." " o2=o2.." " o3=o3.."o" end end print(o1.."\n"..o2.."\n"..o3)

An ungolfed version

tl = 0 --set the tables length to 0
s = io.read() --Get the string from input
o1,o2,o3="","","" --Set the 3 output rows to empty strings
t = {} --Make a table for the string to be sent into
for i = 1, #s do --Loop from 1 to the length of the string
    t[i] = s:sub(i, i) --Set the I-th term in the table to the I-th character in the string
    tl = tl+1 --Add 1 to the table length
end --End the loop
for v=1,tl-1, 1 do --Loop from 1 to the tables length - 1, incrementing by 1
    if t[v] < t[v+1] then --Lua supports greater than less than and equals to with charactes, so this if statement detects if the string is rising
        o1=o1.."o" --Adds an o to the end of the first line of output
        o2=o2.." " --Adds a space to the second line
        o3=o3.." " --Adds a space to the third line
    elseif t[v] == t[v+1] then --Detects if the string is continuing
        o1=o1.." " --Adds a space to the first line
        o2=o2.."o" --Adds an o to the second line
        o3=o3.." " --Adds a space to the third line
    elseif t[v] > t[v+1] then --Detects if string is falling
        o1=o1.." " --Adds a space to the first line
        o2=o2.." " --Adds a space to the second line
        o3=o3.."o" --Adds an o to the third line
    end --Ends the if statement
end --Ends the loop
print(o1.."\n"..o2.."\n"..o3) --Prints the output


问:
Make me a bad fade animation... please
Your task is to, as the title discreetly suggests, make a bad fade animation of one word turning into a second word for yours truly.

What exactly is this "fade animation" you may ask?

To make a spectacular(ly bad) fade animation, you take two strings which will contain only printable ASCII characters. You start by printing your starting string (the first of the two). Then, you randomly pick a character in the original word and change it to the corresponding character in the word you want to animate to. When the words are of unequal length, you must pad them with spaces.

You keep on doing this until all of the characters have been changed, but you will not change the character at a certain index more than once. Here is an example i/o:

```<code>Hey -> Peeps
Hey    # original string
Hey s  # replace char at index 4
Hey s  # replace char at index 1
Pey s  # replace char at index 0
Pee s  # replace char at index 2
Peeps  # replace char at index 3
</code>```

You must write a function or full program that changes a letter and then prints the new string at increments of one second. The input format is loose, but the output format is strict.

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

Some test cases (Form: init -> final):

```<code>Stringy -> Blingy
Banana -> Republic
United -> States
Make America -> Tissue box
I like walls -> I have small hands
Hello, -> world!
</code>```

Reference implementation in Python 2:

```<code>import random
import time
def F(c,f):
    print c                                      # before we do stuff
    if len(c)>len(f):f+=" "*(len(c)-len(f))      # add padding part 1
    if len(f)>len(c):c+=" "*(len(f)-len(c))      # add padding part 2
    c, f = list(c), list(f)
    ai = [i for i in range(len(c))]              # a list for keeping track
    while len(ai) > 0:                           #  of available indices
        time.sleep(1)                            # 1 second pause...
        i = ai.pop(random.randint(0,len(ai)-1))  # get a random index and remove
        c[i] = f[i]                              #   it from the list
        print ''.join(c)                         # print the new string
</code>```

答:
Perl, <s>109</s> <s>108</s> 99 bytes

Includes +3 for -n

Give strings on STDIN without final newline

```<code>echo -n "Make -> Tissue box" | perl -M5.010 fade.pl
</code>```

fade.pl:

```<code>#!/usr/bin/perl -n
/ -> /;$_=$`^$`^$'^$';{$==rand(y/\x00//)+sleep say+($`&~$_|$'&$_)=~y/\x00/ /r;s%(.*?\K\x00){$=}%\xff%&&redo}
</code>```

Works as shown, but replace \xhh by the literal characters to get the claimed score.

This way of using \K is new I think...

Title: Make me a bad fade animation... please

Body:
Perl, <s>109</s> <s>108</s> 99 bytes

Includes +3 for -n

Give strings on STDIN without final newline

echo -n "Make -> Tissue box" | perl -M5.010 fade.pl

fade.pl:

#!/usr/bin/perl -n
/ -> /;$_=$`^$`^$'^$';{$==rand(y/\x00//)+sleep say+($`&~$_|$'&$_)=~y/\x00/ /r;s%(.*?\K\x00){$=}%\xff%&&redo}

Works as shown, but replace \xhh by the literal characters to get the claimed score.

This way of using \K is new I think...


答:
Python 2, <s>117</s> <s>104</s> 101 bytes

Recursively do the necessary replacements. I build the regex dynamically.

import re
def f(s,i=0):t=re.sub(r"(.)%s\1"%("."*i),r"\1",s);e=s==t;return i>len(t)and t or f(t,i*e+e)
```

Try it online

Body:
Python 2, <s>117</s> <s>104</s> 101 bytes

Recursively do the necessary replacements. I build the regex dynamically.

import re
def f(s,i=0):t=re.sub(r"(.)%s\1"%("."*i),r"\1",s);e=s==t;return i>len(t)and t or f(t,i*e+e)

Try it online


问:
Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus:
This question was well-received when it was posted, but challenges
like this, asking answerers to Do X without using
Y
are likely to be poorly received. Try using the
sandbox
to get feedback on if you want to post a similar challenge.

It's <s>2017</s> <s>2018</s> <s>2019</s> <s>2020</s> <s>2021</s> <s>2022</s> 2023 already, folks, go home.

So, now that it's 2014, it's time for a code question involving the number 2014.

Your task is to make a program that prints the number 2014, without using any of the characters 0123456789 in your code, and independently of any external variables such as the date or time or a random seed.

The shortest code (counting in bytes) to do so in any language in which numbers are valid tokens wins.

Leaderboard:

var QUESTION_ID=17005,OVERRIDE_USER=7110;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

```

答:
Actually, 15 bytes

This language was created long after this challenge was made, but I thought I'd still try my hand at it. This answer avoids all numerals, including Actually's ² for a*a. Golfing suggestions welcome. Try it online!

```<code>╜⌐u;*⌐úl¬¬τu;*-
</code>```

Ungolfing

```<code>╜    Push register 0 (initialized to 0).
⌐u   Add 2 and increment. Returns 3.
;*   Duplicate and multiply. Equivalent to squaring. Returns 9.
⌐    Add 2 again. Returns 11.
úl   Pushes the lowercase alphabet and gets its length. Returns 26.
¬¬   Subtracts 2 twice. Returns 22.
τ    double(). Returns 44.
u    Increment. Returns 45.
;*   Square. Returns 2025.
-    Subtract. Returns 2025 - 11 == 2014.
</code>```

Body:
Actually, 15 bytes

This language was created long after this challenge was made, but I thought I'd still try my hand at it. This answer avoids all numerals, including Actually's ² for a*a. Golfing suggestions welcome. Try it online!

╜⌐u;*⌐úl¬¬τu;*-

Ungolfing

╜    Push register 0 (initialized to 0).
⌐u   Add 2 and increment. Returns 3.
;*   Duplicate and multiply. Equivalent to squaring. Returns 9.
⌐    Add 2 again. Returns 11.
úl   Pushes the lowercase alphabet and gets its length. Returns 26.
¬¬   Subtracts 2 twice. Returns 22.
τ    double(). Returns 44.
u    Increment. Returns 45.
;*   Square. Returns 2025.
-    Subtract. Returns 2025 - 11 == 2014.


答:
Perl, <s>38</s> <s>31</s> <s>30</s> 29 bytes

This should should leave the non-golfing languages far behind...

-1 for $-[0] thanks to Riley

-1 for @{-} thanks to Dada

Includes +1 for -p

Give input on STDIN

condense.pl:

```<code>#!/usr/bin/perl -p
s/(.)\K.{@{-}}\1// while/./g
</code>```

This 27 byte version should work but it doesn't because perl doesn't interpolate @- in a regex (see https://stackoverflow.com/questions/39521060/why-are-etc-not-interpolated-in-strings)

```<code>#!/usr/bin/perl -p
s/(.)\K.{@-}\1// while/./g
</code>```

Body:
Perl, <s>38</s> <s>31</s> <s>30</s> 29 bytes

This should should leave the non-golfing languages far behind...

-1 for $-[0] thanks to Riley

-1 for @{-} thanks to Dada

Includes +1 for -p

Give input on STDIN

condense.pl:

#!/usr/bin/perl -p
s/(.)\K.{@{-}}\1// while/./g

This 27 byte version should work but it doesn't because perl doesn't interpolate @- in a regex (see https://stackoverflow.com/questions/39521060/why-are-etc-not-interpolated-in-strings)

#!/usr/bin/perl -p
s/(.)\K.{@-}\1// while/./g


答:
Java, 174

String f(int[]s,int[]f){String o="";for(int i=0;i<s.length;++i){int n =(7*s[i]-7+f[i]+(s[i]>2?1:0))%12*2;o+="E F F#G G#A A#B C C#D D#".substring(n,n+2).trim()+" ";}return o;}
```

<p>Ungolfed:</p>

<pre class="lang-java prettyprint-override"><code>  String f(int[] s, int[] f) {
    String o = "";
    for (int i = 0; i < s.length; ++i) {
      int n = (7 * s[i] - 7 + f[i] + (s[i] > 2 ? 1 : 0)) % 12 * 2;
      o += "E F F#G G#A A#B C C#D D#".substring(n, n + 2).trim() + " ";
    }
    return o;
  }
</code>```

Title: Translate number pairs to guitar notes

Body:
A guitar fretboard diagram looks like this:

```<code>  0  1  2  3  4  5  6  7  8  9 10 11 12   <- Fret number (0 means it's open)
|-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E
|-B--C--C#-D--D#-E--F--F#-G--G#-A--A#-B
|-G--G#-A--A#-B--C--C#-D--D#-E--F--F#-G
|-D--D#-E--F--F#-G--G#-A--A#-B--C--C#-D
|-A--A#-B--C--C#-D--D#-E--F--F#-G--G#-A
|-E--F--F#-G--G#-A--A#-B--C--C#-D--D#-E
</code>```

As you can see, the first string (from the top) open is an E. The first fret on the first string is an F. The fourth fret on the third string is a B. Note that the first note is the zeroth fret, not the first.

This can be written with numbers on the format string, fret. The strings are numbered from 1 to 6 from top to bottom.
The frets are numbered from 0 to 12 from left to right. The first E is therefore 1, 0. Some other examples:

```<code>1, 0 --> E
1, 1 --> F
3, 5 --> C
5, 1 --> A#
6, 6 --> A#
</code>```

Challenge:

Take N pairs of numbers (s and f), and output a delimited note succession.

The input may be on any suitable format. tuples, 2D-matrix, two separate lists, an interweaved list (string,fret,string,fret...) etc.

The output tone should be separated, but the delimiter is optional (comma, space, dash...). The output can be in either upper or lower case.

s (for string) will be in the range [1, 6] (you may choose to have i 0-indexed)

f (for fret) will be in the range [0, 12]

Test cases and examples:

```<code>1 4 5 2 1 3   <- String
4 2 6 3 5 1   <- Fret
G# E D# D A G#

6 2 3 1 4 2 3 2 2 2 6 5 2
0 1 2 3 4 5 6 7 8 9 10 11 12
E C A G F# E C# F# G G# D G# B

3 3 3 3 3 3 3 3 3 3 3 3 3   <- String
0 3 5 0 3 6 5 0 3 5 3 0 0   <- Fret
G A# C G A# C# C G A# C A# G G

// The same test case, but different input and output format:
(3,0)(3,3)(3,5)(3,3)(3,6)(3,5)(3,0)(3,3)(3,5)(3,3)(3,0)(3,0)
G,A#,C,G,A#,C#,C,G,A#,C,A#,G,G
</code>```

Good luck, and happy golfing!

Body:
Java, 174

String f(int[]s,int[]f){String o="";for(int i=0;i<s.length;++i){int n =(7*s[i]-7+f[i]+(s[i]>2?1:0))%12*2;o+="E F F#G G#A A#B C C#D D#".substring(n,n+2).trim()+" ";}return o;}

Ungolfed:

  String f(int[] s, int[] f) {
    String o = "";
    for (int i = 0; i < s.length; ++i) {
      int n = (7 * s[i] - 7 + f[i] + (s[i] > 2 ? 1 : 0)) % 12 * 2;
      o += "E F F#G G#A A#B C C#D D#".substring(n, n + 2).trim() + " ";
    }
    return o;
  }


Body:
PHP, 90 Bytes

for($s=$argv[$c=1];$s[$i=++$i*!$c];)$s=preg_replace("#(.).{{$i}}\\1#","$1",$s,1,$c);echo$s;

or 92 Bytes

for($s=$argv[1];$s[$i];$i=++$i*!$c)$s=preg_replace("#(.).{".+$i."}\\1#","$1",$s,1,$c);echo$s;


问:
Build a nest
The challenge is simple: write a program or function that, when given a finite non-negative integer, outputs a nested array.

The rules

Your code must produce a unique valid nested array for every integer 0 ≤ n < 231.

Every possible nested array with up to 16 open brackets must be outputted within this range. (This does not mean that your code can never output a nested array with more than 16 open brackets.)

Your code may output a string representation of the nested array instead of an actual array (with or without commas).

One possible mapping:

```<code>0 -> []
1 -> [[]]
2 -> [[[]]]
3 -> [[], []]
4 -> [[[[]]]]
5 -> [[[], []]]
6 -> [[[]], []]
7 -> [[], [[]]]
8 -> [[], [], []]
9 -> [[[[[]]]]]
etc.
</code>```

Scoring

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

答:
Haskell, <s>87</s> 82 bytes

```<code>0#0=[""]
n#m=['[':x|n>0,x<-(n-1)#m]++[']':x|n<m,x<-n#(m-1)]
(([0..]>>= \y->y#y)!!)
</code>```

Outputs the array elements. Usage example: (([0..]>>= \y->y#y)!!) 3 -> "[][]".

Function # builds all nested arrays as strings for n open and m close brackets, by keeping track of how many of each are left over. Always starts with n == m.  The main function calls y # y for every y <- [0,1,...] and picks the element at the index  given by the input.

Title: Build a nest

Body:
Haskell, <s>87</s> 82 bytes

0#0=[""]
n#m=['[':x|n>0,x<-(n-1)#m]++[']':x|n<m,x<-n#(m-1)]
(([0..]>>= \y->y#y)!!)

Outputs the array elements. Usage example: (([0..]>>= \y->y#y)!!) 3 -> "[][]".

Function # builds all nested arrays as strings for n open and m close brackets, by keeping track of how many of each are left over. Always starts with n == m.  The main function calls y # y for every y <- [0,1,...] and picks the element at the index  given by the input.


答:
Mathematica, 101 bytes

```<code>NestWhile[i=0;StringReplace[#,a_~~_~RepeatedNull~i++~~a_:>a,1]&,#,SameQ,2,ByteCount@#]&~FixedPoint~#&
</code>```

There should be a way to make this shorter...

Body:
Mathematica, 101 bytes

NestWhile[i=0;StringReplace[#,a_~~_~RepeatedNull~i++~~a_:>a,1]&,#,SameQ,2,ByteCount@#]&~FixedPoint~#&

There should be a way to make this shorter...


答:
C, 69 bytes

```<code>main(i,e,z){while(EOF!=(i =getc(stdin))){z+=e-i;e=i;}putc(z,stdout);}
</code>```

Title: Output a string's cumulative slope

Body:
Challenge

Given a string such as Hello World!, break it down into its character values: 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33.

Then calculate the difference between each consecutive pair of characters: 29, 7, 0, 3, -79, 55, 24, 3, -6, -8, -67.

Finally, sum them and print the final result: -39.

Rules

Standard loopholes apply

No using pre-made functions that perform this exact task

Creative solutions encouraged

Have fun

This is marked as code-golf, the shortest answer in bytes wins but will not be selected.

Body:
C, 69 bytes

main(i,e,z){while(EOF!=(i =getc(stdin))){z+=e-i;e=i;}putc(z,stdout);}


Title: Build a nest

Body:
The challenge is simple: write a program or function that, when given a finite non-negative integer, outputs a nested array.

The rules

Your code must produce a unique valid nested array for every integer 0 ≤ n < 231.

Every possible nested array with up to 16 open brackets must be outputted within this range. (This does not mean that your code can never output a nested array with more than 16 open brackets.)

Your code may output a string representation of the nested array instead of an actual array (with or without commas).

One possible mapping:

```<code>0 -> []
1 -> [[]]
2 -> [[[]]]
3 -> [[], []]
4 -> [[[[]]]]
5 -> [[[], []]]
6 -> [[[]], []]
7 -> [[], [[]]]
8 -> [[], [], []]
9 -> [[[[[]]]]]
etc.
</code>```

Scoring

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

Body:
Spoon, 63 bytes (501 bits)

000001001001001011001101001010011011111001010001000000101010
101101100110100101101001000101100010001000000100011000010000
000000000000001110111110010000001110110110010100100100100100
000110011010001000000110110000010000001010110011011011011001
000000011010010010010001000000111011011011101001001001000110
110110010100100101011001000100000011010001000000111011011001
010010010010010001101101101001000110110010110001101101101101
100100010001010010001010011011001000000011001101001001010010
000001100101001000111

This is the following brainfuck program converted to spoon:

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

Reads an integer in binary on stdin, and outputs the nested list on stdin. Requires 0 to be input as the empty string (no digits), and requires a brainfuck interpreter with 8-bit cells. Same algorithm as my Python answer.

Readable version:

-[+[+<]>>+]<+++.           push open bracket and print it
[->+>+<<]                  dup
>>++                       increment to close bracket

>>,[                       read input loop
    >-[<->-----]+<+++          subtract 48 and set up if/else
    [-                         if c == 1
        <+                         increment s
        <<.>>>                     output open bracket
    >-<]>[-<                   else
        <-[->+<]                   decrement and move s
        <<<[-]                     zero l
        >>>>[-<+<<<+>>>>]          l = s and restore s
        <<.>                       output close bracket
        >+<[>-]>[-                 if s == 0
            <+                         undo s decrement
            <<.                        output open bracket
        >>>>]<<
    >>]<
,]

<<<<[                      if l
    >.>.                   output pair
<<[-]]
>>>+[-<.>]                 output close bracket s+1 times


答:
Pyth (fork), 5 bytes

```<code>s.+CM
</code>```

Does not work on the online interpreter, as current online interpreters are based only on the main repo.

Explanation:

```<code>   CM  Map ordinals over input
 .+    Deltas, calculates differences between consecutive numbers
s      Sums the result
</code>```

Title: Output a string's cumulative slope

Body:
Pyth (fork), 5 bytes

s.+CM

Does not work on the online interpreter, as current online interpreters are based only on the main repo.

Explanation:

   CM  Map ordinals over input
 .+    Deltas, calculates differences between consecutive numbers
s      Sums the result


答:
Haskell, 27 bytes

```<code>\x->(ord.last)x-(ord.head)x
</code>```

Unfortunately, Haskell has no knowledge of character codes until you import Data.Char. Fortunately, Haskell already treats strings as character arrays.

```<code>\x->                             --Syntax for anonymous function of 'x'
    (ord                         --Character code of...
        .last)                     --last element in the array
              x                  --Apply to argument
               -
                (ord             --Character code of...
                    .head)         --first element in the array
                          x      --Apply to argument
</code>```

Title: Output a string's cumulative slope

Body:
Haskell, 27 bytes

\x->(ord.last)x-(ord.head)x

Unfortunately, Haskell has no knowledge of character codes until you import Data.Char. Fortunately, Haskell already treats strings as character arrays.

\x->                             --Syntax for anonymous function of 'x'
    (ord                         --Character code of...
        .last)                     --last element in the array
              x                  --Apply to argument
               -
                (ord             --Character code of...
                    .head)         --first element in the array
                          x      --Apply to argument


答:
CJam, 35 bytes

```<code>rL{_,{{(_@_@#I={I)>]sj}*}h]s}fI}j
</code>```

Try it online!

```<code>rL{                            }j   | run recursion on input
   _,{                      }fI     | for I from 0 to length(input)
      {                 }h]s        | one pass & clean up
       (_@                          | slice and store leading element A
          _@#I={      }*            | if next A is I steps away
                I)>                 | slice off I+1 element
                   ]sj              | clean up & recursion
</code>```

You can see the individual condensations by inserting ed

Body:
Having spend some time on this site I have come to enjoy things being as short as possible. That may be the reason why I'm recently kind of offended by strings containing the same characters more than once. Your job is to write a function or program which condenses a given string according to the following rules:

Start with a 0-condensation, that is look for the first (leftmost) pair of the same characters with 0 other characters between them. If such a pair is found, remove one of the two characters and restart the algorithm by performing another 0-condensation. If no such pair is found, proceed with the next step. Examples:

  programming -C0-> programing

  aabbcc -C0-> abbcc

  test -C0-> test

Then perform a 1-condensation, that is look for the first pair of same characters with 1 other character between them. If such a pair is found remove one of them and all characters between them and restart with a 0-condensation. If no such pair is found, proceed with the next step. Examples:

abacac -C1-> acac

java -C1-> ja

Continue with a 2-condensation and so on up to a n-condensation with n being the length of the original string, each time restarting after a condensation removed some letters. Examples:

programing -C2-> praming

abcdafg -C3-> afg

The resulting string is called condensed and contains each character at most once.

Input:

A lower case string of printable ascii-characters.

Output:

The condensed string according to the rules above.

Examples:

```<code>examples     -> es
programming  -> praming
puzzles      -> puzles
codegolf     -> colf
andromeda    -> a
abcbaccbabcb -> acb
if(x==1):x++ -> if(x+
fnabnfun     -> fun
abcdefae     -> abcde
</code>```

Detailed examples to clarify how the algorithm works:

```<code>fnabnfun -C0-> fnabnfun -C1-> fnabnfun -C2-> fnfun -C0-> fnfun -C1-> fun -C0-> fun
 -C1-> fun -C2-> ... -C8-> fun

abcbaccbabcb -C0-> abcbacbabcb -C0-> abcbacbabcb -C1-> abacbabcb -C0-> abacbabcb
 -C1-> acbabcb -C0-> acbabcb -C1-> acbcb -C0-> acbcb -C1-> acb -C0-> acb
 -C1-> ... -C12-> acb
</code>```

Your approach doesn't have to implement the algorithm from above as long as your solution and the algorithm return the same output for all allowed inputs.
This is a code-golf challenge.

Thanks to @Linus for helpful sandbox comments!

Body:
CJam, 35 bytes

rL{_,{{(_@_@#I={I)>]sj}*}h]s}fI}j

Try it online!

rL{                            }j   | run recursion on input
   _,{                      }fI     | for I from 0 to length(input)
      {                 }h]s        | one pass & clean up
       (_@                          | slice and store leading element A
          _@#I={      }*            | if next A is I steps away
                I)>                 | slice off I+1 element
                   ]sj              | clean up & recursion

You can see the individual condensations by inserting ed


问:
Progruzzle & Colf
Ever fancied creating cool twitter hashtags such as #brexit or #brangelina? this golf is for you.

Write a program that accepts two strings A & B as input and merges them according to the following algorithm:

let n be the number of vowels groups in A (e.g. britain has 2 vowels groups : i in position 3 and ai in position 5).

if n = 1 : truncate A starting at its first vowel group position (example: bill => b)

if n > 1 : truncate A starting at its n-1th vowel group position (example: programming => progr, britain => br)

remove all consonants at the beginning of B (jennifer =>
ennifer)

concatenate the modified A & B

Vowels are aeiou; consonants are bcdfghjklmnpqrstvwxyz.

Input

You can assume the input strings are lowercase and contain at least one vowel and one consonant.

Examples

```<code>brad + angelina      => brangelina
britain + exit       => brexit
ben + jennifer       => bennifer
brangelina + exit    => brangelexit
bill + hillary       => billary
angelina + brad      => angelad
programming + puzzle => progruzzle
code + golf          => colf
out + go             => o
</code>```

答:
Python 2, 139 bytes

```<code>n=lambda a,b:a[:a.index(([l for l in[[l,"!"][i!=0and a[i-1]in v]for i,l in enumerate(a)]if l in v]*2)[-2])]+b[sorted([(b+v).index(c)for c in v])[0]:]
</code>```

This one was hard.

Check it out on repl.it

Title: Progruzzle & Colf

Body:
Python 2, 139 bytes

n=lambda a,b:a[:a.index(([l for l in[[l,"!"][i!=0and a[i-1]in v]for i,l in enumerate(a)]if l in v]*2)[-2])]+b[sorted([(b+v).index(c)for c in v])[0]:]

This one was hard.

Check it out on repl.it


问:
"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

```

答:
V, 14 bytes

```<code>iHello, World!
</code>```

Try it online! This enters insert mode, then inserts Hello, World! into the field.

Title: "Hello, World!"

Body:
V, 14 bytes

iHello, World!

Try it online! This enters insert mode, then inserts Hello, World! into the field.


答:
Java, 42

int f(char[]c){return c[c.length-1]-c[0];}
```

<p>Ungolfed:</p>

<pre class="lang-java prettyprint-override"><code>  int f(char[] c) {
    return c[c.length - 1] - c[0];
  }
</code>```

Explanation:

This uses the same principle as telescoping:

sum =
  c[4] - c[3]
+        c[3] - c[2]
+               c[2] - c[1]
+                      c[1] - c[0]
= c[4]                      - c[0]
```

Generalized for any sequence of characters of length n, the answer is c[n-1] - c[0] because all the stuff in the middle cancels out.

Title: Output a string's cumulative slope

Body:
Java, 42

int f(char[]c){return c[c.length-1]-c[0];}

Ungolfed:

  int f(char[] c) {
    return c[c.length - 1] - c[0];
  }

Explanation:

This uses the same principle as telescoping:

sum =
  c[4] - c[3]
+        c[3] - c[2]
+               c[2] - c[1]
+                      c[1] - c[0]
= c[4]                      - c[0]

Generalized for any sequence of characters of length n, the answer is c[n-1] - c[0] because all the stuff in the middle cancels out.


答:
Jelly, 28 bytes

```<code>ḃ2-*µSN;+\>-Ạ
1Ç#Ṫḃ2ṭ2;1ị⁾][
</code>```

This iterates over all strings of the characters [ and ] that start with a [ and end with a ], verifies if the brackets match, and prints the nth match.

Try it online!

Title: Build a nest

Body:
Jelly, 28 bytes

ḃ2-*µSN;+\>-Ạ
1Ç#Ṫḃ2ṭ2;1ị⁾][

This iterates over all strings of the characters [ and ] that start with a [ and end with a ], verifies if the brackets match, and prints the nth match.

Try it online!