答:
sh, 24 bytes

```<code>echo "Hello $1, I'm sh!"
</code>```

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:
sh, 24 bytes

echo "Hello $1, I'm sh!"


问:
Introduce Your Language!
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

```

答:
Pyke, 21 bytes

```<code>"Hello , I'm Pyke"6Q:
</code>```

Try it here!

ContentLicense: CC BY-SA 3.0

Title: Introduce Your Language!

Body:
Pyke, 21 bytes

"Hello , I'm Pyke"6Q:

Try it here!


答:
Nim, 40 bytes

```<code>echo "Hello "&stdin.readAll&", I'm Nim!"
</code>```

Title: Introduce Your Language!

Body:
Nim, 40 bytes

echo "Hello "&stdin.readAll&", I'm Nim!"


答:
S.I.L.O.S <s>112</s> 110 bytes

```
loadLine
def : lbl
print Hello
a=256
:a
x=get a
if x c
if 1 e
:c
printChar x
a+1
if x a
lble
print , I'm S.I.L.O.S
```

It should be loosely readable. Just a trivial modification of the cat program

Try it online!

Title: Introduce Your Language!

Body:
S.I.L.O.S <s>112</s> 110 bytes

loadLine
def : lbl
print Hello
a=256
:a
x=get a
if x c
if 1 e
:c
printChar x
a+1
if x a
lble
print , I'm S.I.L.O.S

It should be loosely readable. Just a trivial modification of the cat program

Try it online!


答:
Python, 29 bytes

"Hello {}, I'm Python".format
```

<p>Strings methods for the win! The built-in method format of a string substitutes the arguments (here a single string) into any replacement fields (here <code>{}</code>). </p>

<p>Usage: </p>

<pre class="lang-python prettyprint-override"><code>f = "Hello {}, I'm Python".format
print f("xnor")
</code>```

Hello xnor, I'm Python
```

<p>Previous 30-byte: </p>

<pre class="lang-python prettyprint-override"><code>"Hello %s, I'm Python".__mod__
</code>```

Title: Introduce Your Language!

Body:
Python, 29 bytes

"Hello {}, I'm Python".format

Strings methods for the win! The built-in method format of a string substitutes the arguments (here a single string) into any replacement fields (here {}).

Usage:

f = "Hello {}, I'm Python".format
print f("xnor")

Hello xnor, I'm Python

Previous 30-byte:

"Hello %s, I'm Python".__mod__

ContentLicense: CC BY-SA 4.0


答:
PHP, 29 Bytes

```<code><?="Hello $argv[1], I'm PHP";
</code>```

Title: Introduce Your Language!

Body:
PHP, 29 Bytes

<?="Hello $argv[1], I'm PHP";


答:
Java, 88 bytes

interface A{static void main(String[]a){System.out.print("Hello "+a[0]+", I'm Java!");}}
```

Takes input on first command-line argument. Verbose Java is verbose.

Title: Introduce Your Language!

Body:
Java, 88 bytes

interface A{static void main(String[]a){System.out.print("Hello "+a[0]+", I'm Java!");}}

Takes input on first command-line argument. Verbose Java is verbose.


答:
Pyth, 21 bytes

```<code>X6"Hello , I'm Pyth"Q
</code>```

Try it here!

Title: Introduce Your Language!

Body:
Pyth, 21 bytes

X6"Hello , I'm Pyth"Q

Try it here!


答:
05AB1E, <s>21</s> 17 bytes

```<code>”Ÿ™ ÿ, I'm 05AB1E
</code>```

Try it online!

Title: Introduce Your Language!

Body:
05AB1E, <s>21</s> 17 bytes

”Ÿ™ ÿ, I'm 05AB1E

Try it online!


答:
JavaScript, 32 bytes

```<code>x=>`Hello ${x}, I'm JavaScript`
</code>```

Simple enough. ${x} is inline x, the argument.

Title: Introduce Your Language!

Body:
JavaScript, 32 bytes

x=>`Hello ${x}, I'm JavaScript`

Simple enough. ${x} is inline x, the argument.


答:
C, <s>50</s> 39 bytes

f(char*s){printf("Hello %s, I'm C",s);}
```

Title: Introduce Your Language!


答:
J, 22 bytes

```<code>', I''m J',~'Hello '&,
</code>```

This is a fork:

```<code>', I''m J' ,~ 'Hello '&,
</code>```

'Hello '&, prepends Hello and ', I''m J' ,~ appends , I'm J.

Example run:

```<code>   (', I''m J',~'Hello '&,)'Conor'
Hello Conor, I'm J
</code>```

Title: Introduce Your Language!

Body:
J, 22 bytes

', I''m J',~'Hello '&,

This is a fork:

', I''m J' ,~ 'Hello '&,

'Hello '&, prepends Hello and ', I''m J' ,~ appends , I'm J.

Example run:

   (', I''m J',~'Hello '&,)'Conor'
Hello Conor, I'm J


问:
IPv4 Integer Conversion Function
Write the shortest function to convert an IP address into it's integer representation and output it as an integer.

To change an IPv4 address to it's integer representation, the following calculation is required:

Break the IP address into it's four octets.

(Octet1 * 16777216) + (Octet2 * 65536) + (Octet3 * 256) + (Octet4)

Sample Input

```<code>192.168.1.1           10.10.104.36           8.8.8.8
</code>```

Sample Output

```<code>3232235777            168454180              134744072
</code>```

答:
C: 79 characters

```<code>main(i,a)char**a;{i=i<<8|strtol(a[1],a+1,0);*a[1]++?main(i,a):printf("%u",i);}
</code>```

EDIT: removed C++, would not compile without headers; with GCC, the printf and strtol function calls trigger built-in functions, hence headers can be skipped. Thx to @ugoren for the tips. This will compile as is without additional options to gcc.

EDIT2: return is actually redundant :)

ContentLicense: CC BY-SA 2.5

Title: IPv4 Integer Conversion Function

Body:
C: 79 characters

main(i,a)char**a;{i=i<<8|strtol(a[1],a+1,0);*a[1]++?main(i,a):printf("%u",i);}

EDIT: removed C++, would not compile without headers; with GCC, the printf and strtol function calls trigger built-in functions, hence headers can be skipped. Thx to @ugoren for the tips. This will compile as is without additional options to gcc.

EDIT2: return is actually redundant :)


答:
Jolf, <s>20</s> 17 bytes

```<code>"Ξ\x08£C¦i, I‘m Jolf
</code>```

Try it here! Replace \x08 with the literal character.

¦i is interpolated input, and Ξ\x08£C is compressed form of Hello with a trailing space. This outputs, for input Conor:

```<code>Hello Conor, I'm Jolf
</code>```

Alternatively, for 23 bytes:

```<code>"Hello ¦i, I‘m ¦ᖒ
</code>```

Title: Introduce Your Language!

Body:
Jolf, <s>20</s> 17 bytes

"Ξ\x08£C¦i, I‘m Jolf

Try it here! Replace \x08 with the literal character.

¦i is interpolated input, and Ξ\x08£C is compressed form of Hello with a trailing space. This outputs, for input Conor:

Hello Conor, I'm Jolf

Alternatively, for 23 bytes:

"Hello ¦i, I‘m ¦ᖒ


问:
Checkmate (aka the urinal problem)
My Precalc teacher has one of his favorite problems that he made up (or more likely <s>stole</s> inspired by xkcd) that involves a row of n urinals. "Checkmate" is a situation in which every urinal is already occupied OR has an occupied urinal next to them. For instance, if a person is an X, then

X-X--X

is considered checkmate. Note that a person cannot occupy a urinal next to an already occupied urinal.

Task

Your program will take a number through stdin, command line args, or a function argument. Your program will then print out or return the number of ways that checkmate can occur in with the inputted number of urinals.

Examples

0 -> 1 (the null case counts as checkmate)

1 -> 1 (X)

2 -> 2 (X- or -X)

3 -> 2 (X-X or -X-)

4 -> 3 (X-X-, -X-X, or X--X)

5 -> 4 (X-X-X, X--X-, -X-X-, or -X--X)

6 -> 5 (X-X-X-, X--X-X, X-X--X, -X--X- or -X-X-X)

7 -> 7 (X-X-X-X, X--X-X-, -X-X--X, -X--X-X, X-X--X-, X--X--X or -X-X-X-)

8 -> 9 (-X--X--X, -X--X-X-, -X-X--X-, -X-X-X-X, X--X--X-, X--X-X-X, X-X--X-X, X-X-X--X, X-X-X-X-)

...

Scoring

The smallest program in bytes wins.

答:
Perl, <s>35</s> 34 bytes

Includes +1 for -p

Give input on STDIN

```<code>checkmate.pl <<< 8
</code>```

checkmate.pl:

```<code>#!/usr/bin/perl -p
$\+=$b-=$.-=$\-$b*4for(++$\)x$_}{
</code>```

A newly developed secret formula. Ripple update 3 state variables without the need for parallel assignments.

It is equally short (but a lot slower and taking a lot more memory) to just solve the original problem:

```<code>#!/usr/bin/perl -p
$_=grep!/XX|\B-\B/,glob"{X,-}"x$_
</code>```

but that doesn't work for 0

Title: Checkmate (aka the urinal problem)

Body:
Perl, <s>35</s> 34 bytes

Includes +1 for -p

Give input on STDIN

checkmate.pl <<< 8

checkmate.pl:

#!/usr/bin/perl -p
$\+=$b-=$.-=$\-$b*4for(++$\)x$_}{

A newly developed secret formula. Ripple update 3 state variables without the need for parallel assignments.

It is equally short (but a lot slower and taking a lot more memory) to just solve the original problem:

#!/usr/bin/perl -p
$_=grep!/XX|\B-\B/,glob"{X,-}"x$_

but that doesn't work for 0


答:
MATL, 24 bytes

```<code>'Hello %s, I''m MATL'jYD
</code>```

Try it Online!

Title: Introduce Your Language!

Body:
MATL, 24 bytes

'Hello %s, I''m MATL'jYD

Try it Online!


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

答:
Pyth, 21 bytes

```<code>jCmX*3\ h._d0-M.:CMz2
</code>```

A program that takes input of an unquoted string on STDIN and prints the result.

This uses a similar idea to @MartinEnder's CJam answer.

Try it online or Verify all test cases.

How it works

```<code>jCmX*3\ h._d0-M.:CMz2  Program. Input: z
                 CMz   Map ordinal over z, yielding the code-points of the characters
               .:   2  Yield all length-2 sublists of that
             -M        Map subtraction over that
  m                    Map the following over that with variable d:
         ._d            Yield the sign of d
        h               Increment that (i)
    *3\                 Yield string literal of 3 spaces, "   "
   X        0           Replace the space at index i with 0
 C                     Transpose that
j                      Join that on newlines
                       Implicitly print
</code>```

Title: Draw a Bumpy String

Body:
Pyth, 21 bytes

jCmX*3\ h._d0-M.:CMz2

A program that takes input of an unquoted string on STDIN and prints the result.

This uses a similar idea to @MartinEnder's CJam answer.

Try it online or Verify all test cases.

How it works

jCmX*3\ h._d0-M.:CMz2  Program. Input: z
                 CMz   Map ordinal over z, yielding the code-points of the characters
               .:   2  Yield all length-2 sublists of that
             -M        Map subtraction over that
  m                    Map the following over that with variable d:
         ._d            Yield the sign of d
        h               Increment that (i)
    *3\                 Yield string literal of 3 spaces, "   "
   X        0           Replace the space at index i with 0
 C                     Transpose that
j                      Join that on newlines
                       Implicitly print


答:
dc, 23 bytes

```<code>[, I'm dc!]?[Hello ]PPP
</code>```

dc doesn't provide any means of getting raw strings, so you have to wrap your input in [brackets]. For example:

```<code>$ dc hello.dc <<< [Daniel]
Hello Daniel, I'm dc!
</code>```

Title: Introduce Your Language!

Body:
dc, 23 bytes

[, I'm dc!]?[Hello ]PPP

dc doesn't provide any means of getting raw strings, so you have to wrap your input in [brackets]. For example:

$ dc hello.dc <<< [Daniel]
Hello Daniel, I'm dc!


答:
Jelly, 16 bytes

```<code>“' ṗr>ƊḳȧT°ḋZ»Ỵj
</code>```

Try it online!

How it works

Call the argument of the main link s.

```<code>“' ṗr>ƊḳȧT°ḋZ»
</code>```

represents an integer in bijective base 256 that encodes a sequence of dictionary words and/or characters. In this specific case, it encodes the dictionary word Hello, followed by ¶, I'm with a leading space (¶ represents a linefeed), followed by the dictionary word Jelly with a leading space.

The result is as follows.

```<code>Hello
, I'm Jelly
</code>```

The Ỵ atoms splits this string at linefeeds, yielding the following array.

```<code>["Hello ", "", I'm Jelly"]
</code>```

Finally, the j atom joins that array, using the string s as separator.

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:
Jelly, 16 bytes

“' ṗr>ƊḳȧT°ḋZ»Ỵj

Try it online!

How it works

Call the argument of the main link s.

“' ṗr>ƊḳȧT°ḋZ»

represents an integer in bijective base 256 that encodes a sequence of dictionary words and/or characters. In this specific case, it encodes the dictionary word Hello, followed by ¶, I'm with a leading space (¶ represents a linefeed), followed by the dictionary word Jelly with a leading space.

The result is as follows.

Hello
, I'm Jelly

The Ỵ atoms splits this string at linefeeds, yielding the following array.

["Hello ", "", I'm Jelly"]

Finally, the j atom joins that array, using the string s as separator.


问:
Cheating a multiple choice test, part 2
This is sequel to this challenge by Adnan. If you like this challenge, chances are you'll like the other one too. Check it out!

A multiple choice test with 8 questions each with 4 choices might have the answers: BCADBADA. Converted to four different arrays, with true and false if the current letter is the answer, it will look like this

```<code>Q#: 1  2  3  4  5  6  7  8
    B  C  A  D  B  A  D  A
A: [0, 0, 1, 0, 0, 1, 0, 1]
B: [1, 0, 0, 0, 1, 0, 0, 0]
C: [0, 1, 0, 0, 0, 0, 0, 0]
D: [0, 0, 0, 1, 0, 0, 1, 0]
</code>```

This can be compressed using a bit of logic. Each of the choices A, B, C and D can be represented
by two true/false values shown below:

```<code>A: 1 0
B: 0 1
C: 0 0
D: 1 1
</code>```

Using this logic, we can compress the four vectors above to just two:

```<code> 1  2  3  4  5  6  7  8
 B  C  A  D  B  A  D  A
[0, 0, 1, 1, 0, 1, 1, 1]
[1, 0, 0, 1, 1, 0, 1, 0]
</code>```

That is, the solution to your test is simply: 00110111, 10011010. By concatenating these, we get the binary number
0011011110011010, or 14234 in decimal. Use this decimal value to cheat on your test!

Challenge

Take a number N in the (inclusive) range [0, 65535], and output a string with the answer to the multiple choice test.

Test cases:

```<code>14234
BCADBADA

38513
ABBDCAAB

0
CCCCCCCC

120
CBBBBCCC

65535
DDDDDDDD

39253
ABCDABCD
</code>```

The output may be in upper or lower case letters, but you can not use other symbols.

答:
MATL, 16 bytes

```<code>16&B8eXB'BADC'w)
</code>```

Try it Online!

or Verify all test cases

Explanation

```<code>        % Implicitly grab input
16&B    % Convert to binary string with at least 16 bits
8e      % Reshape the resulting string to have 8 rows and 2 columns
XB      % Convert each row from binary to decimal
'BADC'  % Push this string literal
w)      % Use the decimal numbers to index into this string (modular indexing)
        % Implicitly display the resulting string
</code>```

Title: Cheating a multiple choice test, part 2

Body:
MATL, 16 bytes

16&B8eXB'BADC'w)

Try it Online!

or Verify all test cases

Explanation

        % Implicitly grab input
16&B    % Convert to binary string with at least 16 bits
8e      % Reshape the resulting string to have 8 rows and 2 columns
XB      % Convert each row from binary to decimal
'BADC'  % Push this string literal
w)      % Use the decimal numbers to index into this string (modular indexing)
        % Implicitly display the resulting string


答:
Assembly (x86-64, Linux), <s>217</s> 205 bytes

4927 segmentation faults later...

.global main
.data
s:.ascii"Hello %qs, I'm Assembly\n"
f:.ascii"%qs"
i:.ascii""
main:mov $i,%rsi
mov $f,%rdi
mov $0,%rax
call scanf
mov $0,%rax
mov $i,%rsi
mov $s,%rdi
call printf
end:mov $0,%rax
call exit
```
<p>Doesn't work for inputs with a length greater than 7, because this exceeds the memory limits of a quadword(?). Also, because I'm a noob in Assembly.</p>
<h3>Explanation:</h3>
<pre class="lang-assembly prettyprint-override"><code>.global main

.data

output_string: .ascii "Hello %qs, I'm Assembly\n"
format_input: .ascii "%qs"
input_string: .ascii ""

main:
    mov $input_string, %rsi     # Place the memory address to the second argument
    mov $format_input, %rdi     # Place the format string to the first argument
    mov $0, %rax                # Set RAX to 0
    call scanf                  # Call scanf with RDI and RSI as the arguments

    mov $0, %rax                # Set RAX to 0
    mov $input_string, %rsi     # Place the input string to the second argument
    mov $output_string, %rdi    # Place the output format to the first argument
    call printf                 # Call printf with RDI and RSI as the arguments

end:
    mov $0, %rax                # Set RAX to 0 (which is the exit code)
    call exit                   # Call the exit function
</code>```

Save in a file called myProgram.s and do the following:

```<code>$ gcc -o myProgram myProgram.s
$ ./myProgram
</code>```

Title: Introduce Your Language!

Body:
Assembly (x86-64, Linux), <s>217</s> 205 bytes

4927 segmentation faults later...

.global main
.data
s:.ascii"Hello %qs, I'm Assembly\n"
f:.ascii"%qs"
i:.ascii""
main:mov $i,%rsi
mov $f,%rdi
mov $0,%rax
call scanf
mov $0,%rax
mov $i,%rsi
mov $s,%rdi
call printf
end:mov $0,%rax
call exit

Doesn't work for inputs with a length greater than 7, because this exceeds the memory limits of a quadword(?). Also, because I'm a noob in Assembly.

Explanation:

.global main

.data

output_string: .ascii "Hello %qs, I'm Assembly\n"
format_input: .ascii "%qs"
input_string: .ascii ""

main:
    mov $input_string, %rsi     # Place the memory address to the second argument
    mov $format_input, %rdi     # Place the format string to the first argument
    mov $0, %rax                # Set RAX to 0
    call scanf                  # Call scanf with RDI and RSI as the arguments

    mov $0, %rax                # Set RAX to 0
    mov $input_string, %rsi     # Place the input string to the second argument
    mov $output_string, %rdi    # Place the output format to the first argument
    call printf                 # Call printf with RDI and RSI as the arguments

end:
    mov $0, %rax                # Set RAX to 0 (which is the exit code)
    call exit                   # Call the exit function

Save in a file called myProgram.s and do the following:

$ gcc -o myProgram myProgram.s
$ ./myProgram


答:
GolfScript, 27 bytes

```<code>"Hello "\", I'm GolfScript"
</code>```

Takes input from STDIN.

Title: Introduce Your Language!

Body:
GolfScript, 27 bytes

"Hello "\", I'm GolfScript"

Takes input from STDIN.


答:
CJam, 21 bytes

```<code>"Hello "l", I'm CJam"
</code>```

Try it online!

Title: Introduce Your Language!

Body:
CJam, 21 bytes

"Hello "l", I'm CJam"

Try it online!


答:
Cheddar, 26 bytes

```<code>"Hello %s I'm Cheddar"&(%)
</code>```

Title: Introduce Your Language!

Body:
Cheddar, 26 bytes

"Hello %s I'm Cheddar"&(%)


问:
Convert infix expressions to postfix notation
When I saw the title of this closed question, I thought it looked like an interesting code golf challenge.  So let me present it as such:

Challenge:

Write a program, expression or subroutine which, given an arithmetical expression in infix notation, like 1 + 2, outputs the same expression in postfix notation, i.e. 1 2 +.

(Note: A similar challenge was posted earlier in January.  However, I do feel the two tasks are sufficiently different in detail to justify this separate challenge.  Also, I only noticed the other thread after typing up everything below, and I'd rather not just throw it all away.)

Input:

The input consists of a valid infix arithmetical expression consisting of numbers (non-negative integers represented as sequences of one or more decimal digits), balanced parentheses to indicate a grouped subexpression, and the four infix binary operators +, -, * and /.  Any of these may be separated (and the entire expression surrounded) by an arbitrary number of space characters, which should be ignored.1

For those who like formal grammars, here's a simple BNF-like grammar that defines valid inputs.  For brevity and clarity, the grammar does not include the optional spaces, which may occur between any two tokens (other than digits within a number):

```<code>expression     := number | subexpression | expression operator expression
subexpression  := "(" expression ")"
operator       := "+" | "-" | "*" | "/"
number         := digit | digit number
digit          := "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
</code>```

1 The only case where the presence of spaces may affect the parsing is when they separate two consecutive numbers; however, since two numbers not separated by an operator cannot occur in a valid infix expression, this case can never happen in valid input.

Output:

The output should be a postfix expression equivalent to the input.  The output expression should consist only of numbers and operators, with a single space character between each pair of adjacent tokens, as in the following grammar (which does include the spaces)2:

```<code>expression  := number | expression sp expression sp operator
operator    := "+" | "-" | "*" | "/"
number      := digit | digit number
digit       := "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
sp          := " "
</code>```

2 Again for simplicity, the number production in this grammar admits numbers with leading zeros, even though they're forbidden in the output by the rules below.

Operator precedence:

In the absence of parentheses, the following precedence rules apply:

The operators * and / have higher precedence than + and -.

The operators * and / have equal precedence to each other.

The operators + and - have equal precedence to each other.

All operators are left-associative.

For example, the following two expressions are equivalent:

```<code>1 + 2 / 3 * 4 - 5 + 6 * 7
((1 + ((2 / 3) * 4)) - 5) + (6 * 7)
</code>```

and they should both yield the following output:

```<code>1 2 3 / 4 * + 5 - 6 7 * +
</code>```

(These are the same precedence rules as in the C language and in most languages derived from it.  They probably resemble the rules you were taught in elementary school, except possibly for the relative precedence of * and /.)

Miscellaneous rules:

If the solution given is an expression or a subroutine, the input should be supplied and the output returned as a single string.  If the solution is a complete program, it should read a line containing the infix expression from standard input and print a line containing the postfix version to standard output.

Numbers in the input may include leading zeros.  Numbers in the output must not have leading zeros (except for the number 0, which shall be output as 0).

You are not expected to evaluate or optimize the expression in any way.  In particular, you should not assume that the operators necessarily satisfy any associative, commutative or other algebraic identities.  That is, you should not assume that e.g. 1 + 2 equals 2 + 1 or that 1 + (2 + 3) equals (1 + 2) + 3.

You may assume that numbers in the input do not exceed 231 − 1 = 2147483647.

These rules are intended to ensure that the correct output is uniquely defined by the input.

Examples:

Here are some valid input expressions and the corresponding outputs, presented in the form "input" -> "output":

```<code>"1"                  ->  "1"
"1 + 2"              ->  "1 2 +"
" 001  +  02 "       ->  "1 2 +"
"(((((1))) + (2)))"  ->  "1 2 +"
"1+2"                ->  "1 2 +"
"1 + 2 + 3"          ->  "1 2 + 3 +"
"1 + (2 + 3)"        ->  "1 2 3 + +"
"1 + 2 * 3"          ->  "1 2 3 * +"
"1 / 2 * 3"          ->  "1 2 / 3 *"
"0102 + 0000"        ->  "102 0 +"
"0-1+(2-3)*4-5*(6-(7+8)/9+10)" -> "0 1 - 2 3 - 4 * + 5 6 7 8 + 9 / - 10 + * -"
</code>```

(At least, I hope all these are correct; I did the conversion by hand, so mistakes might have crept in.)

Just to be clear, the following inputs are all invalid; it does not matter what your solution does if given them (although, of course, e.g. returning an error message is nicer than, say, consuming an infinite amount of memory):

```<code>""
"x"
"1 2"
"1 + + 2"
"-1"
"3.141592653589793"
"10,000,000,001"
"(1 + 2"
"(1 + 2)) * (3 / (4)"
</code>```

答:
Javascript (ES6), 244 bytes

```<code>f=(s,o={'+':1,'-':1,'*':2,'/':2},a=[],p='',g=c=>o[l=a.pop()]>=o[c]?g(c,p+=l+' '):a.push(l||'',c))=>(s.match(/[)(+*/-]|\d+/g).map(c=>o[c]?g(c):(c==')'?eval(`for(;(i=a.pop())&&i!='(';)p+=i+' '`):c=='('?a.push(c):p+=+c+' ')),p+a.reverse().join` `)
</code>```

Example:

Call: f('0-1+(2-3)*4-5*(6-(7+8)/9+10)')

Output: 0 1 - 2 3 - 4 * + 5 6 7 8 + 9 / - 10 + * -  (with a trailing space)

Explanation:

```<code>f=(s,                                                     //Input string
    o={'+':1,'-':1,'*':2,'/':2},                          //Object used to compare precedence between operators
    a=[],                                                 //Array used to stack operators
    p='',                                                 //String used to store the result
    g=c=>                                                 //Function to manage operator stack
        o[l=a.pop()]>=o[c]?                               //  If the last stacked operator has the same or higher precedence
            g(c,p+=l+' '):                                //  Then adds it to the result and call g(c) again
            a.push(l||'',c)                               //  Else restack the last operator and adds the current one, ends the recursion.
)=>
    (s.match(/[)(+*/-]|\d+/g)                             //Getting all operands and operators
    .map(c=>                                              //for each operands or operators
        o[c]?                                             //If it's an operator defined in the object o
            g(c)                                          //Then manage the stack
            :(c==')'?                                     //Else if it's a closing parenthese
                eval(`                                    //Then
                    for(;(i=a.pop())&&i!='(';)            //  Until it's an opening parenthese
                        p+=i+' '                          //  Adds the last operator to the result
                `)
                :c=='('?                                  //Else if it's an opening parenthese
                    a.push(c)                             //Then push it on the stack
                    :p+=+c+' '                            //Else it's an operand: adds it to the result (+c removes the leading 0s)
        )
    )
    ,p+a.reverse().join` `)                               //Adds the last operators on the stack to get the final result
</code>```

Body:
Javascript (ES6), 244 bytes

f=(s,o={'+':1,'-':1,'*':2,'/':2},a=[],p='',g=c=>o[l=a.pop()]>=o[c]?g(c,p+=l+' '):a.push(l||'',c))=>(s.match(/[)(+*/-]|\d+/g).map(c=>o[c]?g(c):(c==')'?eval(`for(;(i=a.pop())&&i!='(';)p+=i+' '`):c=='('?a.push(c):p+=+c+' ')),p+a.reverse().join` `)

Example:

Call: f('0-1+(2-3)*4-5*(6-(7+8)/9+10)')

Output: 0 1 - 2 3 - 4 * + 5 6 7 8 + 9 / - 10 + * -  (with a trailing space)

Explanation:

f=(s,                                                     //Input string
    o={'+':1,'-':1,'*':2,'/':2},                          //Object used to compare precedence between operators
    a=[],                                                 //Array used to stack operators
    p='',                                                 //String used to store the result
    g=c=>                                                 //Function to manage operator stack
        o[l=a.pop()]>=o[c]?                               //  If the last stacked operator has the same or higher precedence
            g(c,p+=l+' '):                                //  Then adds it to the result and call g(c) again
            a.push(l||'',c)                               //  Else restack the last operator and adds the current one, ends the recursion.
)=>
    (s.match(/[)(+*/-]|\d+/g)                             //Getting all operands and operators
    .map(c=>                                              //for each operands or operators
        o[c]?                                             //If it's an operator defined in the object o
            g(c)                                          //Then manage the stack
            :(c==')'?                                     //Else if it's a closing parenthese
                eval(`                                    //Then
                    for(;(i=a.pop())&&i!='(';)            //  Until it's an opening parenthese
                        p+=i+' '                          //  Adds the last operator to the result
                `)
                :c=='('?                                  //Else if it's an opening parenthese
                    a.push(c)                             //Then push it on the stack
                    :p+=+c+' '                            //Else it's an operand: adds it to the result (+c removes the leading 0s)
        )
    )
    ,p+a.reverse().join` `)                               //Adds the last operators on the stack to get the final result


问:
Counterfeit Coins on a Pointer Scale
You sell gold coins. Each gold coin you sell is supposed to be 1 ounce. However, you find out that one of your coin suppliers is cheating you. By alloying the gold material with something else, their coins weigh only 0.9 ounces. With a help of a pointer scale (one that shows the exact weight of a quantity of matter set on it), you want to determine which of your coin suppliers is selling you the counterfeit coins.

Apparently, you are not the only one to have this problem - lots of gold sellers buy coins from this supplier, and the supplier knows that it is being dodgy and is changing their branding accordingly. All of these sellers have the same problem - 1 ounce coins that end up being 0.9 ounces from this supplier - and need to solve it, fast! How can you determine, out of n suppliers, which one is the cheating supplier with the minimum number of weighings on the pointer scale?

Your task is to write a program function that can solve this problem automatically for n suppliers. It's input includes:

an integer number of suppliers, n,

an oracle function that represents weighing a set of coins on the balance scale

It must take this information, calling this function a minimum number of times and returning, as output, the index number of the cheating supplier.

The oracle function has the following specifications:

It takes as input an int->int mapping (as an array or dictionary, whichever your language prefers) mapping each supplier index (from 0 to n-1) to a number of gold coins that you want to try weighing on the scale.

The returned output is the total weight, in ounces, of the coins put on the scale.

The function is in whatever format your language prefers for passing procedures as data. For instance, functional languages will pass lambdas, C will take a function pointer, Java 7 and earlier will take a functional interface. Languages that support none of these, but do support string execution, will take these as strings.

In those cases when the oracle can be stringified or otherwise inspected as data, you may assume that it is sufficiently obfuscated such that you cannot tell which supplier is cheating without executing it.

This is also code-golf: among the solutions that call the function the minimum number of times, the smallest solution in bytes is the winner!

NOTE: If your language does not support functions at all, but does support string execution, write your program as a standalone program - assume that the number of suppliers, followed by the oracle, will be passed into standard input. If your language does not support string execution, assume that a file path to a binary oracle will be provided instead.

答:
Pyth, 9 bytes

```<code>-FsMlBm*T
</code>```

As o cannot be used for the oracle in Pyth (it takes in a lambda itself), I instead defined the oracle as l.  Any one-input function other than s should work as the oracle.  Returns 0-indexed input.

Explanation (assuming the 3rd vendor is the faulty one):

```<code>      m*T        Map d*10 over all d in range(input): [0, 10, 20, 30] for input = 4
    lB           Bifurcate over the oracle function: [[0,10,20,30],58.0]
  sM             Map sum (for arrays, floors numbers): [60,58]
-F               Fold over subtraction: 2
                 Implicitly print
</code>```

Try it online! (first line sets up the oracle function)

Try changing the faulty vendor!  (The faulty vendor is 0-indexed: from 0 to first input - 1.  Any other value will cast the blame on the 0th vendor.)

Title: Counterfeit Coins on a Pointer Scale

Body:
Pyth, 9 bytes

-FsMlBm*T

As o cannot be used for the oracle in Pyth (it takes in a lambda itself), I instead defined the oracle as l.  Any one-input function other than s should work as the oracle.  Returns 0-indexed input.

Explanation (assuming the 3rd vendor is the faulty one):

      m*T        Map d*10 over all d in range(input): [0, 10, 20, 30] for input = 4
    lB           Bifurcate over the oracle function: [[0,10,20,30],58.0]
  sM             Map sum (for arrays, floors numbers): [60,58]
-F               Fold over subtraction: 2
                 Implicitly print

Try it online! (first line sets up the oracle function)

Try changing the faulty vendor!  (The faulty vendor is 0-indexed: from 0 to first input - 1.  Any other value will cast the blame on the 0th vendor.)


问:
Solve Grid-Tangram
The Tangram is a dissection puzzle made from seven shapes: Five differently sized triangles, a parallelogram and a square. Given a shape, the goal is recreating the shape using all the pieces and without overlapping. There are obviously infinitely many ways to arrange this set of pieces in the plane. An interesting subset are the

Grid Tangrams

We can draw the "standard" Tangram square into a bigger square which is subdivided by a grid into 16 smaller squares.  Grid tangrams are just shapes made up of the tangram pieces, such that all vertices of the pieces are on the grid points.

These are the kinds of Tangram puzzles we want to consider in this challenge, as they are probably easier to handle than the more general ones.

As a side note: The Chinese mathematicians Chuan-Chin Hsiung and Fu Traing Wang proved in 1942 that there are only 13 convex tangrams. They first showed that the problem can be reduced to grid tangrams, and then used some combinatorial and geometric arguments. These are all of those 13:

Challenge

Given a solvable grid tangram, output a dissection of the grid tangram into the seven tangram pieces.

IO

A tangram is given as a black and white image (the shape is in black, background in white), with both sides multiples of 50px. The grid has a width of exactly 50px. The grid lines are parallel to the sides of the image.

EDIT: The image can be accepted as input and returned as output in any convenient raster image format like PNG,TIFF,PBM etc. but a representation as a binary 2d array or string or matrix is acceptable.

The output should again have the same size and should have again the same shape, but with each piece a different colour, or alternatively with white lines separating all the pieces. It is worth noting that the non rectangular quadrangle can be flipped.

The pixels on the border of the pieces do not exactly have to match the one on the shape, also if there are aliasing effects or other fuzz this is still ok.

Example Input and Output:

Examples:

Possible solutions:

答:
BBC BASIC, <s>570 514</s> 490 bytes ASCII

Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html

435 bytes tokenised

Full program displays an input from L.bmp on the screen, then modifies it to find a solution.

```<code>*DISPLAY L
t=PI/8q=FNa(1)
DEFFNa(n)IFn=7END
LOCALz,j,p,i,c,s,x,y,m,u,v
F.z=0TO99u=z MOD10*100v=z DIV10*100ORIGINu,v
F.j=0TO12S.4p=0F.i=j+3TOj+9S.2c=9*COS(i*t)s=9*SIN(i*t)p=p*4-(POINT(c,s)<>0)*2-(POINT(9*c,9*s)<>0)N.
m=n:IFn=5A.(43A.p)=0p=0m=7
IF(ASCM."??O|(C",n)-64A.p)=0THEN
F.i=-1TO0GCOL0,-i*n:c=99*COS(j*t)s=99*SIN(j*t)y=402/3^m MOD3-1MOVE-c-s*y,c*y-s:x=n<3MOVEc*x-s*x,s*x+c*x:x=2778/3^m MOD3-1y=5775/3^m MOD3-1PLOT85-32*(n MOD6>3),c*x-s*y,s*x+c*y:IFi q=FNa(n+1)ORIGINu,v
N.
ENDIF
N.N.=0
</code>```

Explanation

Note that in BBC basic a distance of 1 pixel = 2 units, so the 50x50 pixel grid becomes a 100x100 grid.

We use a recursive function to place the 2 large triangles, medium triangle, square and parallelogram into the shape. The earlier shape in the list is drawn before the next recursive call is made. if a recursive call returns without finding a solution, the earlier shape is overdrawn in black and a new position of the earlier shape is tried.

Once these five shapes are drawn, placing the two small triangles is just a formality. It is necessary to draw one of them though, in order to distiguish them if they share a common edge. We only colour one of the two small triangles. The other is left in natural black.

Placing of each shape is attempted at different x,y coordinates and in 4 different rotations. To test if there is free space to draw a shape we use the template below, with 45 degree angles. The rotations are made about the * and the 8 pixels tested are in 2 semicircles of radius 9 and 81 units and fall on radiating lines at odd multiples of 22.5 degrees to the x and y axes.

For a large triangle all 8 spaces are required to be clear. For other shapes only some of the cells must be clear so a mask is applied.

```<code>+----+----   Shape             Mask HGFEDCBA Mask decimal
|\ E/|\G /
| \/F|H\/    1,2. Large triangle    11111111    -1
|C/\ | /     3. Med triangle        00001111    15
|/ D\|/      4. Square              00111100    60
+----*       5. Parallelogram       11101000   -24
|\ B/        6. Small triangle      00000011     3
|A\/         7. Parallogr reversed  00101011    43
| /          Note: reversed parallelogram is checked/drawn at recursion depth n=5
|/           with a special check, but the coordinates are encoded as m=7.
</code>```

Once it is established that a shape will fit, it must be drawn. If it is a triangle it is plotted with PLOT 85, if it is a parallelogram, the number is 32 higher (note that for PLOT purposes we consider a square a special parallelogram). In either case 3 consecutive vertices must be given. The second vertex is the origin of the shape (marked * in the above table) except in the case of the large triangle, where (prior to rotation) it is -1,-1. The other 2 vertices can have x and y coordinates of -1,0 or 1 which are extracted from base 3 encoded numbers, then scaled by 99 and rotated as necessary by transformation with c and s.

Ungolfed code

```<code>  *DISPLAY L
  t=PI/8                                          :REM Constant 22.5 degrees.
  q=FNa(1)                                        :REM Call function, return dummy value to q
  END                                             :REM End the program gracefully if no solution. Absent in golfed version.

  DEFFNa(n)                                       :REM Recursive function to place shapes.
  IFn=7END                                        :REM If n=7 solution found, end program.
  LOCALk,z,j,p,i,c,s,x,y,m,u,v                    :REM declare local variables for function.
  k=ASCMID$("??O|(C",n)-64                        :REM Bitmasks for big tri, big tri, med tri, sq, normal paralellogram, small tri.
  FORz=0TO99                                      :REM For each point on the grid
    u=z MOD10*100:v=z DIV10*100                   :REM calculate its x and y coordinates relative to bottom left of screen
    ORIGINu,v                                     :REM and set the origin to this point.
    FORj=0TO12STEP4                               :REM For each rotation 0,90,180,270deg
      p=0                                         :REM assume no non-black pixels found
      FORi=j+3TOj+9STEP2                          :REM test angles of 3,5,7,9 times 22.5 deg anticlockwise from right x axis.
        c=9*COS(i*t)                             :REM Coords of test points at radius ll
        s=9*SIN(i*t)
        p*=4                                      :REM Leftshift any existing data in p
        p-=(POINT(c,s)<>0)*2+(POINT(9*c,9*s)<>0)  :REM and check pixels at radius 11 and 99.
      NEXT
      m=n                                         :REM The index of the shape to plot normally corresponds with recursion depth n.
      IF n=5 AND (43ANDp)=0 p=0:m=7               :REM If n=5 check if a reverse parallelogram is possible (mask 43). If so, clear p and change m to 7.
      REM                                         :REM Check p against mask k, if the shape fits then...
      IF (k ANDp)=0 THEN
        FOR i=-1 TO 0                               :REM draw the shape in colour, and if deeper recursions prove unsuccesful, redraw it in black.
          GCOL0,-i*n                                :REM Colour is equal to n.
          c=99*COS(j*t)                             :REM Set parameters c and s for scaling by 99
          s=99*SIN(j*t)                             :REM and rotation by 0,90,180 or 270 as appropriate.
          x=-1                                      :REM For vertex 1, x=-1 always.
          y=402/3^m MOD3-1                          :REM Lookup y value for vertex 1.
          MOVEc*x-s*y,s*x+c*y                       :REM Use c and s to transform the vertex and move to it.
          x=n<3                                     :REM For vertex 2, coords are 0,0 except for large triangle where they are -1,-1
          y=x                                       :REM in BBC BASIC, TRUE=-1
          MOVEc*x-s*y,s*x+c*y                       :REM Use c and s to transform the vertex and move to it.
          x=2778/3^m MOD3-1                         :REM Lookup x and y value for vertex 3.
          y=5775/3^m MOD3-1                         :REM PLOT85 uses last 2 points + specified point to make triangle, PLOT85+32 makes paralelogram (or square.)
          PLOT85-32*(n MOD6>3),c*x-s*y,s*x+c*y      :REM Use c and s to transform the vertex and draw shape.
          IFi q=FNa(n+1):ORIGINu,v                  :REM If i=-1 recurse to next level. If it fails, reset the origin before replotting this level's shape in black.
        NEXT
      ENDIF
    NEXT
  NEXT
  =0                                                :REM Dummy value to return from function
</code>```

Output

This is a montage of the solutions found by the program for the test cases. Use of 99 instead of 100 for golfing reasons leaves some small black gaps. As the shapes are redrawn during the searches, it can take a few seconds to run for some cases, and is quite fascinating to watch.

Title: Solve Grid-Tangram

Body:
BBC BASIC, <s>570 514</s> 490 bytes ASCII

Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html

435 bytes tokenised

Full program displays an input from L.bmp on the screen, then modifies it to find a solution.

*DISPLAY L
t=PI/8q=FNa(1)
DEFFNa(n)IFn=7END
LOCALz,j,p,i,c,s,x,y,m,u,v
F.z=0TO99u=z MOD10*100v=z DIV10*100ORIGINu,v
F.j=0TO12S.4p=0F.i=j+3TOj+9S.2c=9*COS(i*t)s=9*SIN(i*t)p=p*4-(POINT(c,s)<>0)*2-(POINT(9*c,9*s)<>0)N.
m=n:IFn=5A.(43A.p)=0p=0m=7
IF(ASCM."??O|(C",n)-64A.p)=0THEN
F.i=-1TO0GCOL0,-i*n:c=99*COS(j*t)s=99*SIN(j*t)y=402/3^m MOD3-1MOVE-c-s*y,c*y-s:x=n<3MOVEc*x-s*x,s*x+c*x:x=2778/3^m MOD3-1y=5775/3^m MOD3-1PLOT85-32*(n MOD6>3),c*x-s*y,s*x+c*y:IFi q=FNa(n+1)ORIGINu,v
N.
ENDIF
N.N.=0

Explanation

Note that in BBC basic a distance of 1 pixel = 2 units, so the 50x50 pixel grid becomes a 100x100 grid.

We use a recursive function to place the 2 large triangles, medium triangle, square and parallelogram into the shape. The earlier shape in the list is drawn before the next recursive call is made. if a recursive call returns without finding a solution, the earlier shape is overdrawn in black and a new position of the earlier shape is tried.

Once these five shapes are drawn, placing the two small triangles is just a formality. It is necessary to draw one of them though, in order to distiguish them if they share a common edge. We only colour one of the two small triangles. The other is left in natural black.

Placing of each shape is attempted at different x,y coordinates and in 4 different rotations. To test if there is free space to draw a shape we use the template below, with 45 degree angles. The rotations are made about the * and the 8 pixels tested are in 2 semicircles of radius 9 and 81 units and fall on radiating lines at odd multiples of 22.5 degrees to the x and y axes.

For a large triangle all 8 spaces are required to be clear. For other shapes only some of the cells must be clear so a mask is applied.

+----+----   Shape             Mask HGFEDCBA Mask decimal
|\ E/|\G /
| \/F|H\/    1,2. Large triangle    11111111    -1
|C/\ | /     3. Med triangle        00001111    15
|/ D\|/      4. Square              00111100    60
+----*       5. Parallelogram       11101000   -24
|\ B/        6. Small triangle      00000011     3
|A\/         7. Parallogr reversed  00101011    43
| /          Note: reversed parallelogram is checked/drawn at recursion depth n=5
|/           with a special check, but the coordinates are encoded as m=7.

Once it is established that a shape will fit, it must be drawn. If it is a triangle it is plotted with PLOT 85, if it is a parallelogram, the number is 32 higher (note that for PLOT purposes we consider a square a special parallelogram). In either case 3 consecutive vertices must be given. The second vertex is the origin of the shape (marked * in the above table) except in the case of the large triangle, where (prior to rotation) it is -1,-1. The other 2 vertices can have x and y coordinates of -1,0 or 1 which are extracted from base 3 encoded numbers, then scaled by 99 and rotated as necessary by transformation with c and s.

Ungolfed code

  *DISPLAY L
  t=PI/8                                          :REM Constant 22.5 degrees.
  q=FNa(1)                                        :REM Call function, return dummy value to q
  END                                             :REM End the program gracefully if no solution. Absent in golfed version.

  DEFFNa(n)                                       :REM Recursive function to place shapes.
  IFn=7END                                        :REM If n=7 solution found, end program.
  LOCALk,z,j,p,i,c,s,x,y,m,u,v                    :REM declare local variables for function.
  k=ASCMID$("??O|(C",n)-64                        :REM Bitmasks for big tri, big tri, med tri, sq, normal paralellogram, small tri.
  FORz=0TO99                                      :REM For each point on the grid
    u=z MOD10*100:v=z DIV10*100                   :REM calculate its x and y coordinates relative to bottom left of screen
    ORIGINu,v                                     :REM and set the origin to this point.
    FORj=0TO12STEP4                               :REM For each rotation 0,90,180,270deg
      p=0                                         :REM assume no non-black pixels found
      FORi=j+3TOj+9STEP2                          :REM test angles of 3,5,7,9 times 22.5 deg anticlockwise from right x axis.
        c=9*COS(i*t)                             :REM Coords of test points at radius ll
        s=9*SIN(i*t)
        p*=4                                      :REM Leftshift any existing data in p
        p-=(POINT(c,s)<>0)*2+(POINT(9*c,9*s)<>0)  :REM and check pixels at radius 11 and 99.
      NEXT
      m=n                                         :REM The index of the shape to plot normally corresponds with recursion depth n.
      IF n=5 AND (43ANDp)=0 p=0:m=7               :REM If n=5 check if a reverse parallelogram is possible (mask 43). If so, clear p and change m to 7.
      REM                                         :REM Check p against mask k, if the shape fits then...
      IF (k ANDp)=0 THEN
        FOR i=-1 TO 0                               :REM draw the shape in colour, and if deeper recursions prove unsuccesful, redraw it in black.
          GCOL0,-i*n                                :REM Colour is equal to n.
          c=99*COS(j*t)                             :REM Set parameters c and s for scaling by 99
          s=99*SIN(j*t)                             :REM and rotation by 0,90,180 or 270 as appropriate.
          x=-1                                      :REM For vertex 1, x=-1 always.
          y=402/3^m MOD3-1                          :REM Lookup y value for vertex 1.
          MOVEc*x-s*y,s*x+c*y                       :REM Use c and s to transform the vertex and move to it.
          x=n<3                                     :REM For vertex 2, coords are 0,0 except for large triangle where they are -1,-1
          y=x                                       :REM in BBC BASIC, TRUE=-1
          MOVEc*x-s*y,s*x+c*y                       :REM Use c and s to transform the vertex and move to it.
          x=2778/3^m MOD3-1                         :REM Lookup x and y value for vertex 3.
          y=5775/3^m MOD3-1                         :REM PLOT85 uses last 2 points + specified point to make triangle, PLOT85+32 makes paralelogram (or square.)
          PLOT85-32*(n MOD6>3),c*x-s*y,s*x+c*y      :REM Use c and s to transform the vertex and draw shape.
          IFi q=FNa(n+1):ORIGINu,v                  :REM If i=-1 recurse to next level. If it fails, reset the origin before replotting this level's shape in black.
        NEXT
      ENDIF
    NEXT
  NEXT
  =0                                                :REM Dummy value to return from function

Output

This is a montage of the solutions found by the program for the test cases. Use of 99 instead of 100 for golfing reasons leaves some small black gaps. As the shapes are redrawn during the searches, it can take a few seconds to run for some cases, and is quite fascinating to watch.


答:
pl, 15 bytes

```<code>Hello _, I'm pl
</code>```

Try it online!

Title: Introduce Your Language!

Body:
pl, 15 bytes

Hello _, I'm pl

Try it online!


答:
Ruby, 32 bytes

```<code>puts "Hello #{$*[0]}, I'm Ruby"
</code>```

Save as intro.rb, run as ruby intro.rb <name>.

Title: Introduce Your Language!

Body:
Ruby, 32 bytes

puts "Hello #{$*[0]}, I'm Ruby"

Save as intro.rb, run as ruby intro.rb <name>.


答:
Element, 28 bytes

```<code>Hello\ _\,\ I\'m\ Element..`
</code>```

(link to TIO)

Woo! Two months since this site's previous Element answer!

Title: Introduce Your Language!

Body:
Element, 28 bytes

Hello\ _\,\ I\'m\ Element..`

(link to TIO)

Woo! Two months since this site's previous Element answer!


答:
Batch, 25 bytes

```<code>@echo Hello %*, I'm Batch
</code>```

Conveniently ' isn't a quote character in Batch.

Title: Introduce Your Language!

Body:
Batch, 25 bytes

@echo Hello %*, I'm Batch

Conveniently ' isn't a quote character in Batch.


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

答:
MATL, 2 bytes

```<code>ds
</code>```

Try it online!

Explanation:

d gets the difference between consecutive characters and s sums the resulting array. Then, the value on top of the stack is implicitly printed. Not much else to say about that.

Interestingly enough, even though Dennis discovered an awesome shortcut, using it would be significantly longer in MATL.

Title: Output a string's cumulative slope

Body:
MATL, 2 bytes

ds

Try it online!

Explanation:

d gets the difference between consecutive characters and s sums the resulting array. Then, the value on top of the stack is implicitly printed. Not much else to say about that.

Interestingly enough, even though Dennis discovered an awesome shortcut, using it would be significantly longer in MATL.


问:
The Versatile Integer Printer
Write a piece of code that is executable in at least three different languages. The code must output the integer 1 in language number one, 2 in language number two, 3 in language number three etc.

Rules:

The output must be only the integer, but trailing newlines are OK.

The code can't take input of any kind

Different major versions of the same language are considered unique. So, your code can be executable in Python 2 and Python 3, however Python 2.5 and Python 2.7 are not considered unique.

You may use a new language if and only if it has an esolang/wiki article, available interpreter and documentation, and has been used by at least two users on PPCG prior to using it in this challenge. It must also adhere to these 4 rules.

The score of your submission is the number of bytes in your code divided by the number of languages it can run in cubed. So, a 54 byte solution that is executable in 3 languages will have a score of 2:

```<code>54 / 3^3 = 2
</code>```

Lower score is better.

答:
3 languages, 15 bytes, score 0.555...

Gonna add more languages later.

```<code>2//1+1#
</code>```

1. Emotinomicon

Emotinomicon pretty much ignores any text that isn't a string.  pushes 1 to stack and  outputs the TOS as a number.

2. Javascript

Comments in Javascript start with //, so only the 2 part gets executed.

3. Python 2/3 REPL

Comments in Python start with #, so only the 2//1+1 part gets executed. // is integer division in Python 3, and it is the same as / in Python 2. 2 divided by 1 is 2, plus 1 is 3.

Title: The Versatile Integer Printer

Body:
3 languages, 15 bytes, score 0.555...

Gonna add more languages later.

2//1+1#

1. Emotinomicon

Emotinomicon pretty much ignores any text that isn't a string.  pushes 1 to stack and  outputs the TOS as a number.

2. Javascript

Comments in Javascript start with //, so only the 2 part gets executed.

3. Python 2/3 REPL

Comments in Python start with #, so only the 2//1+1 part gets executed. // is integer division in Python 3, and it is the same as / in Python 2. 2 divided by 1 is 2, plus 1 is 3.


答:
Python, 63 bytes

x=map(ord,input())
print sum(map(lambda(a,b):b-a,zip(x,x[1:])))
```

Ideone it!

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:
Python, 63 bytes

x=map(ord,input())
print sum(map(lambda(a,b):b-a,zip(x,x[1:])))

Ideone it!


答:
Jelly, 3 bytes

```<code>OIS
</code>```

Try it online!

Take the Ordinals of the input string’s characters, then the Increments of that list, then the Sum of that list.

Title: Output a string's cumulative slope

Body:
Jelly, 3 bytes

OIS

Try it online!

Take the Ordinals of the input string’s characters, then the Increments of that list, then the Sum of that list.


答:
Python, 29 bytes

lambda s:ord(s[-1])-ord(s[0])
```

<p>The sum of the differences forms a telescopic series, so most summands cancel out and<br>
<strong>(s<sub>1</sub> - s<sub>0</sub>) + (s<sub>2</sub> - s<sub>1</sub>) + … + (s<sub>n-1</sub> - s<sub>n-2</sub>) + (s<sub>n</sub> - s<sub>n-1</sub>) = s<sub>n</sub> - s<sub>0</sub></strong>.</p>

<p>If taking a byte string as input is allowed</p>

<pre class="lang-python prettyprint-override"><code>lambda s:s[-1]-s[0]
</code>```

will work as well for 19 bytes.

Test both on Ideone.

Title: Output a string's cumulative slope

Body:
Python, 29 bytes

lambda s:ord(s[-1])-ord(s[0])

The sum of the differences forms a telescopic series, so most summands cancel out and

(s1 - s0) + (s2 - s1) + … + (sn-1 - sn-2) + (sn - sn-1) = sn - s0.

If taking a byte string as input is allowed

lambda s:s[-1]-s[0]

will work as well for 19 bytes.

Test both on Ideone.


答:
reticular, 12 bytes

```<code>idVc~@qVc-o;
</code>```

Try it online!

Using Dennis's observation, we can shorten an iterative process into a simpler one.

```<code>idVc~@qVc-o;
i             take input
 d            duplicate
  V           pop input copy, push last character
   c          get its char code
    ~         put it under the input in the stack
     @q       reverse the item at the top of the stack
       V      get the last item of that (first item of input)
        c     convert to char
         -    subtract
          o   output
           ;  and terminate
</code>```

Title: Output a string's cumulative slope

Body:
reticular, 12 bytes

idVc~@qVc-o;

Try it online!

Using Dennis's observation, we can shorten an iterative process into a simpler one.

idVc~@qVc-o;
i             take input
 d            duplicate
  V           pop input copy, push last character
   c          get its char code
    ~         put it under the input in the stack
     @q       reverse the item at the top of the stack
       V      get the last item of that (first item of input)
        c     convert to char
         -    subtract
          o   output
           ;  and terminate


答:
Brain-Flak, 51 bytes

48 bytes of code plus three bytes for the -a flag, which enables ASCII input (but decimal output. How convenient. :D)

```<code>{([{}]({})<>)<>}<>{}([]<>){({}[()])<>({}{})<>}<>
</code>```

Try it online!

This ones a little bit harder than my other answer, haha. Lets walk through it.

```<code>{           While the top of the stack is nonzero:
 (            Push:
  [{}]          The top of the stack times negative one. Pop this off.
  ({})          Plus the value on top of the stack, which is duplicated to save for later.
  <>          On to the other stack
 )
 <>         Move back to the first stack
}
<>          After the loop, move back again.
{}          We have one extra element on the stack, so pop it
([]<>)      Push the height of the alternate stack back onto the first stack
{           While the top of the stack is nonzero:
 ({}[()])     Decrement this stack
 <>           Move back to the alternate stack
 ({}{})       Sum the top two elements
 <>           Move back tothe first stack
}
<>          Switch back to the stack holding the sum
</code>```

Title: Output a string's cumulative slope

Body:
Brain-Flak, 51 bytes

48 bytes of code plus three bytes for the -a flag, which enables ASCII input (but decimal output. How convenient. :D)

{([{}]({})<>)<>}<>{}([]<>){({}[()])<>({}{})<>}<>

Try it online!

This ones a little bit harder than my other answer, haha. Lets walk through it.

{           While the top of the stack is nonzero:
 (            Push:
  [{}]          The top of the stack times negative one. Pop this off.
  ({})          Plus the value on top of the stack, which is duplicated to save for later.
  <>          On to the other stack
 )
 <>         Move back to the first stack
}
<>          After the loop, move back again.
{}          We have one extra element on the stack, so pop it
([]<>)      Push the height of the alternate stack back onto the first stack
{           While the top of the stack is nonzero:
 ({}[()])     Decrement this stack
 <>           Move back to the alternate stack
 ({}{})       Sum the top two elements
 <>           Move back tothe first stack
}
<>          Switch back to the stack holding the sum


答:
Ruby, 23 bytes

```<code>->s{s[-1].ord-s[0].ord}
</code>```

Assign to a variable like f=->s{s[-1].ord-s[0].ord} and call like f["Hello World!"]

Uses Dennis's observation about telescopic series.

Title: Output a string's cumulative slope

Body:
Ruby, 23 bytes

->s{s[-1].ord-s[0].ord}

Assign to a variable like f=->s{s[-1].ord-s[0].ord} and call like f["Hello World!"]

Uses Dennis's observation about telescopic series.


答:
MATLAB, 16 bytes

```<code>@(x)sum(diff(x))
</code>```

This creates an anonymous function named ans which can be called like: ans('Hello world!').

Here is an online demo in Octave which requires an additional byte + to explicitly convert the input string to a numeric array prior to computing the element-to-element difference

Title: Output a string's cumulative slope

Body:
MATLAB, 16 bytes

@(x)sum(diff(x))

This creates an anonymous function named ans which can be called like: ans('Hello world!').

Here is an online demo in Octave which requires an additional byte + to explicitly convert the input string to a numeric array prior to computing the element-to-element difference


答:
05AB1E, 3 bytes

```<code>Ç¥O
</code>```

Try it Online!

Uses CP-1252 encoding.

Explanation

```<code>Ç       Converts input string to ASCII
¥       Compute difference between successive elements
O       Sum the result
</code>```

Title: Output a string's cumulative slope

Body:
05AB1E, 3 bytes

Ç¥O

Try it Online!

Uses CP-1252 encoding.

Explanation

Ç       Converts input string to ASCII
¥       Compute difference between successive elements
O       Sum the result


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

答:
MATL, <s>31</s> 30 bytes

```<code>t13Y2XJmFwhdl=fql_):)itJmYsg)h
</code>```

Try it Online

Explanation

```<code>t       % Implicitly grab the input and duplicate it
13Y2    % Push the string literal 'aeiouAEIOU'
XJ      % Store this in clipboard J for later use
m       % Check which characters from the input are vowels (true for vowel)
Fwh     % Prepend FALSE to this logical array
dl=     % Compute the difference and find where we went from not-vowel to vowel
f       % Find the indices of these transitions
q       % Subtract 1 to get the location of the last consonant in each transition
l_)     % Get the next-to-last one of these
:)      % Grab the first string up to this location

% Now for the second component!

it      % Explicitly grab the input and duplicate
J       % Retrieve the string literal 'aeiouAEIOU' from clipboard J
m       % Find where the vowels are (true for vowel)
Ys      % Compute the cumulative sum along the array. The result will be 0
        % for all characters before the first vowel and non-zero after
g)      % Convert to logical and use this as an index so any characters
        % after the first value are retrieved

% Now to combine them

h       % Horizontally concatenate the first and second pieces together
        % Implicitly display the result
</code>```

Title: Progruzzle & Colf

Body:
MATL, <s>31</s> 30 bytes

t13Y2XJmFwhdl=fql_):)itJmYsg)h

Try it Online

Explanation

t       % Implicitly grab the input and duplicate it
13Y2    % Push the string literal 'aeiouAEIOU'
XJ      % Store this in clipboard J for later use
m       % Check which characters from the input are vowels (true for vowel)
Fwh     % Prepend FALSE to this logical array
dl=     % Compute the difference and find where we went from not-vowel to vowel
f       % Find the indices of these transitions
q       % Subtract 1 to get the location of the last consonant in each transition
l_)     % Get the next-to-last one of these
:)      % Grab the first string up to this location

% Now for the second component!

it      % Explicitly grab the input and duplicate
J       % Retrieve the string literal 'aeiouAEIOU' from clipboard J
m       % Find where the vowels are (true for vowel)
Ys      % Compute the cumulative sum along the array. The result will be 0
        % for all characters before the first vowel and non-zero after
g)      % Convert to logical and use this as an index so any characters
        % after the first value are retrieved

% Now to combine them

h       % Horizontally concatenate the first and second pieces together
        % Implicitly display the result


答:
JavaScript (ES6), <s>81</s> <s>73</s> 72 bytes

Saved 8 bytes thanks to @Jordan, 1 thanks to @DavidConrad

```<code>a=>b=>a.match(/.*?(?=(?:[aeiou]+[^aeiou]*){1,2}$)/)+b.match(/[aeiou].*/)
</code>```

Even though .match returns an array, array+array returns a string with the contents of the arrays concatenated (i.e. [0]+[1] returns "01").

Test snippet

f=a=>b=>console.log(a,"+",b,"=",a.match(/.*?(?=(?:[aeiou]+[^aeiou]*){1,2}$)/)+b.match(/[aeiou].*/))
f("brad")("angelina")
f("britain")("exit")
f("ben")("jennifer")
f("brangelina")("exit")
f("bill")("hillary")
f("angelina")("brad")
f("programming")("puzzle")
f("code")("golf")
f("progruzzle")("colf")
f("out")("go")```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input id=A value="super">
<input id=B value="chafouin">
<button onclick="f(A.value)(B.value)">Run</button></code>```

Jordan's excellent Ruby solution would be 53 bytes in JS:

```<code>x=>x.replace(/([aeiou]+[^aeiou]*){1,2} [^aeiou]*/,"")
</code>```

Title: Progruzzle & Colf

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

Body:
JavaScript (ES6), <s>81</s> <s>73</s> 72 bytes

Saved 8 bytes thanks to @Jordan, 1 thanks to @DavidConrad

a=>b=>a.match(/.*?(?=(?:[aeiou]+[^aeiou]*){1,2}$)/)+b.match(/[aeiou].*/)

Even though .match returns an array, array+array returns a string with the contents of the arrays concatenated (i.e. [0]+[1] returns "01").

Test snippet

f=a=>b=>console.log(a,"+",b,"=",a.match(/.*?(?=(?:[aeiou]+[^aeiou]*){1,2}$)/)+b.match(/[aeiou].*/))
f("brad")("angelina")
f("britain")("exit")
f("ben")("jennifer")
f("brangelina")("exit")
f("bill")("hillary")
f("angelina")("brad")
f("programming")("puzzle")
f("code")("golf")
f("progruzzle")("colf")
f("out")("go")

<input id=A value="super">
<input id=B value="chafouin">
<button onclick="f(A.value)(B.value)">Run</button>

Jordan's excellent Ruby solution would be 53 bytes in JS:

x=>x.replace(/([aeiou]+[^aeiou]*){1,2} [^aeiou]*/,"")


答:
NodeJS, 82 bytes

```<code>x=process.argv[2],a=[],t=0;for(y in x)a[y]=x.charCodeAt(y),t+=y!=0?a[y]-a[y-1]:0
</code>```

Explanation:

```<code>x = process.argv[2] // Get the input
a=[], // Initializes an array to store the differences' values.
t=0;  // Initializes a variable to store the total of the differences
for(y in x) // Iterates over the string as an array of characters
    a[y]=x.charCodeAt(y) // Transforms the input into an array of integers
    t+=y!=0?a[y]-a[y-1]:0 // Add the difference of the last two characters, except at the first iteration
</code>```

JavaScript, 79 bytes

```<code>f=x=>{a=[],t=0;for(y in x)a[y]=x.charCodeAt(y),t+=y!=0?a[y]-a[y-1]:0;return t}
</code>```

Same idea as above with a function input instead of an argument.

Title: Output a string's cumulative slope

Body:
NodeJS, 82 bytes

x=process.argv[2],a=[],t=0;for(y in x)a[y]=x.charCodeAt(y),t+=y!=0?a[y]-a[y-1]:0

Explanation:

x = process.argv[2] // Get the input
a=[], // Initializes an array to store the differences' values.
t=0;  // Initializes a variable to store the total of the differences
for(y in x) // Iterates over the string as an array of characters
    a[y]=x.charCodeAt(y) // Transforms the input into an array of integers
    t+=y!=0?a[y]-a[y-1]:0 // Add the difference of the last two characters, except at the first iteration

JavaScript, 79 bytes

f=x=>{a=[],t=0;for(y in x)a[y]=x.charCodeAt(y),t+=y!=0?a[y]-a[y-1]:0;return t}

Same idea as above with a function input instead of an argument.


答:
Ruby, <s>44</s> <s>43</s> 40 + 1 = 41 bytes

+1 byte for -p flag. Takes space-separated input on STDIN.

-1 byte thanks to Martin Ender

-2 bytes thanks to histocrat

sub /([aeiou]+([^aeiou]*)){,2} \g<2>/,""
```

<p>Try it online!</p>

<h2>GNU sed, <s>39</s> 37 + 1 = 38 bytes</h2>

<p>+1 byte for <code>-E</code> flag. Takes space-separated input on STDIN.<br>
-1 byte thanks to Martin Ender</p>

```s/([aeiou]+[^aeiou]*){,2} [^aeiou]*//
```

Try it online!

Not posting this as a separate answer because it is literally the same solution.

Title: Progruzzle & Colf

Body:
Ruby, <s>44</s> <s>43</s> 40 + 1 = 41 bytes

+1 byte for -p flag. Takes space-separated input on STDIN.

-1 byte thanks to Martin Ender

-2 bytes thanks to histocrat

sub /([aeiou]+([^aeiou]*)){,2} \g<2>/,""

Try it online!

GNU sed, <s>39</s> 37 + 1 = 38 bytes

+1 byte for -E flag. Takes space-separated input on STDIN.

-1 byte thanks to Martin Ender

s/([aeiou]+[^aeiou]*){,2} [^aeiou]*//

Try it online!

Not posting this as a separate answer because it is literally the same solution.


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

答:
JavaScript (ES6), <s>143</s> 142 bytes

Saved 1 byte thanks to @Neil

```<code>a=>a.map((_,i)=>(q=" ".repeat(i))+(a=a.map(c=>(x+=r=i&&p^(p=c)||c,r),p=i&&a.shift())).join` `+q,x=0).join`
`+`
`+(" ".repeat(18)+x).slice(-19)
</code>```

I tried combining various parts, but it ended up 5 bytes longer:

```<code>a=>[...a.map((_,i)=>(a=a.map(c=>(x+=r=i&&p^(p=c)||c,r),p=i&&a.shift())).join` `+" ".repeat(i),x=0),x].map(q=>(" ".repeat(18)+q).slice(-19)).join`
`
</code>```

Title: Number Triangles

Body:
JavaScript (ES6), <s>143</s> 142 bytes

Saved 1 byte thanks to @Neil

a=>a.map((_,i)=>(q=" ".repeat(i))+(a=a.map(c=>(x+=r=i&&p^(p=c)||c,r),p=i&&a.shift())).join` `+q,x=0).join`
`+`
`+(" ".repeat(18)+x).slice(-19)

I tried combining various parts, but it ended up 5 bytes longer:

a=>[...a.map((_,i)=>(a=a.map(c=>(x+=r=i&&p^(p=c)||c,r),p=i&&a.shift())).join` `+" ".repeat(i),x=0),x].map(q=>(" ".repeat(18)+q).slice(-19)).join`
`


答:
Mathematica, <s>104</s> <s>97</s> <s>90</s> 94 bytes

```<code>{Grid[List@*Row/@#],#~Total~2}~Column~Right&[NestList[3-Mod[+##,3]&@@@Partition[#,2,1]&,#,9]]&
</code>```

Explanation

```<code>Partition[#,2,1]
</code>```

Partitions the input into length 2, offset 1 partitions.

```<code>3-Mod[+##,3]&@@@
</code>```

Takes each partition, and calculates the corresponding output.

A trick involved here. I added up the two numbers, took mod 3, and subtracted that result from 3. That gives the desired number. (e.g. 3 - ((2 + 1) mod 3) = 3)

```<code>NestList[ ... ,9]
</code>```

Repeats the above process nine times, giving all iterations as the output.

```<code>Grid[List@*Row/@#]
</code>```

Format each iteration into rows, and put the entire thing in one column (center aligned), creating a triangle.

```<code>#~Total~2
</code>```

Take the total of all numbers.

```<code>{...}~Column~Right
</code>```

Combine the triangle and the total, and right align the entire thing (triangle is already aligned, so its alignment is not affected).

Title: Number Triangles

Body:
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!

Body:
Mathematica, <s>104</s> <s>97</s> <s>90</s> 94 bytes

{Grid[List@*Row/@#],#~Total~2}~Column~Right&[NestList[3-Mod[+##,3]&@@@Partition[#,2,1]&,#,9]]&

Explanation

Partition[#,2,1]

Partitions the input into length 2, offset 1 partitions.

3-Mod[+##,3]&@@@

Takes each partition, and calculates the corresponding output.

A trick involved here. I added up the two numbers, took mod 3, and subtracted that result from 3. That gives the desired number. (e.g. 3 - ((2 + 1) mod 3) = 3)

NestList[ ... ,9]

Repeats the above process nine times, giving all iterations as the output.

Grid[List@*Row/@#]

Format each iteration into rows, and put the entire thing in one column (center aligned), creating a triangle.

#~Total~2

Take the total of all numbers.

{...}~Column~Right

Combine the triangle and the total, and right align the entire thing (triangle is already aligned, so its alignment is not affected).