答:
Perl, 147 bytes (non competing, takes more than 10 seconds per move)

Includes +4 for -0p

The program plays X. It will play a perfect game.

Input the board on STDIN, e.g.:

```<code>tictaclatin.pl
-X-O
-X--
X-X-
O--O
^D
</code>```

The ouptut will be the same board with all X replaced by O and vice versa. The empty spots will be filled with a number indicating the result if X would play there, with 1 meaning the result will be a win, 2 a draw and 3 a loss. A finished game just returns the same position with the colors reversed.

In this example the output would be:

```<code>1O1X
1O33
O3O3
X33X
</code>```

So the position is a win for X if he plays in the 3 spots along the top and the left. All other moves lose.

This confusing output is actually convenient if you want to know how the game continues after a move. Since the program always plays X you have to swap X and O to see the moves for O. Here for example it's pretty clear that X wins by playing in the top left, but what about if X plays in the third position along the top ? Just copy the output, put an O in place of the move you select and replace all other numbers by - again, so here:

```<code>-OOX
-O--
O-O-
X--X
</code>```

Resulting in:

```<code>3XXO
3X33
X3X3
O33O
</code>```

Obviously every move by O should lose, so how does he lose if he plays in the top left ? Again do this by putting O in the top left and replacing the digits by -:

```<code>OXXO
-X--
X-X-
O--O
</code>```

Giving:

```<code>XOOX
1O33
O3O3
X33X
</code>```

So X has only one way to go for his win:

```<code>XOOX
OO--
O-O-
X--X
</code>```

Giving

```<code>OXXO
XX33
X3X3
O33O
</code>```

The situation for O remains hopeless. It's easy to see now that every move allows X to immediately win. Let's at least try to go for 3 O's in a row:

```<code>OXXO
XX--
X-X-
O-OO
</code>```

Giving:

```<code>XOOX
OO13
O3O3
X3XX
</code>```

X plays the only winning move (notice that this makes XXXO along the third column:

```<code>XOOX
OOO-
O-O-
X-XX
</code>```

Here the output is:

```<code>OXXO
XXX-
X-X-
O-OO
</code>```

because the game was already finished. You can see the win on the third column.

The actual program tictaclatin.pl:

```<code>#!/usr/bin/perl -0p
y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/sx;$@<=>0||s%-%$_="$`O$'";$$_||=2+do$0%eg&&(/1/||/2/-1)
</code>```

Applied to the empty board this evaluates 9506699 positions which takes 30Gb and 41 minutes on my computer. The result is:

```<code>2222
2222
2222
2222
</code>```

So every starting move draws. So the game is a draw.

The extreme memory usage is mostly caused by the recursion using do$0. Using this 154 byte version using a plain function needs 3Gb and 11 minutes:

```<code>#!/usr/bin/perl -0p
sub f{y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/sx;$@<=>0||s%-%$_="$`O$'";$$_||=2+&f%eeg&&(/1/||/2/-1)}f
</code>```

which is more bearable (but still too much, something must still be leaking memory).

Combining a number of speedups leads to this 160 byte version (5028168 positions, 4 minutes and 800M for the empty board):

```<code>#!/usr/bin/perl -0p
sub f{y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/osx;$@<=>0||s%-%$_="$`O$'";$a{$_}//=&f+1or return 1%eeg&&/1/-1}f
</code>```

That last one uses 0 for a win (don't confuse with O), 1 for a draw and 2 for a loss. The output of this one is also more confusing. It fills in the winning move for X in case of a win without color swap, but if the input game was already won is still does the color swap and does not fill in any move.

All versions of course get faster and use less memory as the board fills up. The faster versions should generate a move in under 10 seconds as soon as 2 or 3 moves have been made.

In principle this 146 byte version should also work:

```<code>#!/usr/bin/perl -0p
y/XO/OX/,$@=-$@while/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^/sx,--$|;$@<=>0||s%-%$_="$`O$'";$$_||=2+do$0%eg&&(/1/||/2/-1)
</code>```

but on my machine it triggers a perl bug and dumps core.

All versions will in principle still work if the 6 byte position caching done by $$_||= is removed but that uses so much time and memory that it only works for almost filled boards. But in theory at least I have a 140 byte solution.

If you put $\= (cost: 3 bytes) just before the $@<=>0 then each output board will be followed by the status of the whole board: 1 for X wins, 0 for draw and -1 for loss.

Here is an interactive driver based on the fastest version mentioned above. The driver has no logic for when the game is finished so you have to stop yourself. The golfed code knows though. If the suggested move returns with no - replaced by anything the game is over.

#!/usr/bin/perl
sub f{
    if ($p++ % 100000 == 0) {
        local $| = 1;
        print ".";
    }
y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/osx;$@<=>0||s%-%$_="$`O$'";$a{$_}//=&f+1or return 1%eeg&&/1/-1}

# Driver
my $tomove = "X";
my $move = 0;
@board = ("----\n") x 4;
while (1) {
    print "Current board after move $move ($tomove to move):\n  ABCD\n";
    for my $i (1..4) {
        print "$i $board[$i-1]";
    }
    print "Enter a move like B4, PASS (not a valid move, just for setup) or just press enter to let the program make suggestions\n";
    my $input = <> // exit;
    if ($input eq "\n") {
        $_ = join "", @board;
        tr/OX/XO/ if $tomove eq "O";
        $p = 0;
        $@="";
        %a = ();
        my $start = time();
        my $result = f;
        if ($result == 1) {
            tr/OX/XO/ if $tomove eq "O";
            tr/012/-/;
        } else {
            tr/OX/XO/ if $tomove eq "X";
            tr/012/123/;
        }
        $result = -$result if $tomove eq "O";
        my $period = time() - $start;
        print "\nSuggested moves (evaluated $p positions in $period seconds, predicted result for X: $result):\n$_";
        redo;
    } elsif ($input =~ /^pass$/i) {
        # Do nothing
    } elsif (my ($x, $y) = $input =~ /^([A-D])([1-4])$/) {
        $x = ord($x) - ord("A");
        --$y;
        my $ch = substr($board[$y],$x, 1);
        if ($ch ne "-") {
            print "Position already has $ch. Try again\n";
            redo;
        }
        substr($board[$y],$x, 1) = $tomove;
    } else {
        print "Cannot parse move. Try again\n";
        redo;
    }
    $tomove =~ tr/OX/XO/;
    ++$move;
}
```

Title: Become the Champion

Body:
Tic-Tac-Latin!

This is a true story, so names have been altered.

My latin teacher, Mr. Latin, created his own proprietary (no joke) tic tac toe variant. Let's call it tic-tac-latin. The game is simple, it is essentially tic tac toe played on a four by four grid.

Formal rule declaration

A line is either a row, column or a diagonal. There are two symbols, 'X' and 'O', but one or both may be substituted for a different symbol.

You score one point when you have three of your symbol and one of the other character.

These arrangements score:

```
---O
-O--
<b>XXXO</b>
XOOX

<b>O</b>-XX
-<b>O</b>--
--<b>X</b>-
---<b>O</b>
```

These do not score:

```
----
XXXX
----
OOOO

----
XXX-
----
OOO-
```

The game is won whenever one player has more points then another. The game is a draw only if the board gets filled up.

Challenge

Solve this game. Your job is to provide a way to guarantee a win or tie, whichever is the optimal result.

Your solution may choose to either start first or second (and may therefore choose it's symbol). It is not mandatory to implement an interactive game where the user inputs moves and the corresponding display changes. It may also be a function or program which takes input as a game state, and outputs a new board or a description of their move. Either option must run within approximately ten seconds per move made.

Playing your player against any sequence of moves must give the optimal result. This means that you may assume the input position is one that it reachable from play with your player. Submissions must be deterministic, and do not necessarily need to supply a proof of optimality, but if they get cracked (by being beaten) your submissions will be considered invalid (you may leave it up, but add (cracked) in the headline).

This is a non-trivial task, so any valid submission is impressive and is worthy of an accepted tick, but I will make code golf the primary winning criterion.

The winner is chosen by going down this list till one winner is chosen.

Shortest solved implemenation which always wins

Shortest implementation

Body:
Perl, 147 bytes (non competing, takes more than 10 seconds per move)

Includes +4 for -0p

The program plays X. It will play a perfect game.

Input the board on STDIN, e.g.:

tictaclatin.pl
-X-O
-X--
X-X-
O--O
^D

The ouptut will be the same board with all X replaced by O and vice versa. The empty spots will be filled with a number indicating the result if X would play there, with 1 meaning the result will be a win, 2 a draw and 3 a loss. A finished game just returns the same position with the colors reversed.

In this example the output would be:

1O1X
1O33
O3O3
X33X

So the position is a win for X if he plays in the 3 spots along the top and the left. All other moves lose.

This confusing output is actually convenient if you want to know how the game continues after a move. Since the program always plays X you have to swap X and O to see the moves for O. Here for example it's pretty clear that X wins by playing in the top left, but what about if X plays in the third position along the top ? Just copy the output, put an O in place of the move you select and replace all other numbers by - again, so here:

-OOX
-O--
O-O-
X--X

Resulting in:

3XXO
3X33
X3X3
O33O

Obviously every move by O should lose, so how does he lose if he plays in the top left ? Again do this by putting O in the top left and replacing the digits by -:

OXXO
-X--
X-X-
O--O

Giving:

XOOX
1O33
O3O3
X33X

So X has only one way to go for his win:

XOOX
OO--
O-O-
X--X

Giving

OXXO
XX33
X3X3
O33O

The situation for O remains hopeless. It's easy to see now that every move allows X to immediately win. Let's at least try to go for 3 O's in a row:

OXXO
XX--
X-X-
O-OO

Giving:

XOOX
OO13
O3O3
X3XX

X plays the only winning move (notice that this makes XXXO along the third column:

XOOX
OOO-
O-O-
X-XX

Here the output is:

OXXO
XXX-
X-X-
O-OO

because the game was already finished. You can see the win on the third column.

The actual program tictaclatin.pl:

#!/usr/bin/perl -0p
y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/sx;$@<=>0||s%-%$_="$`O$'";$$_||=2+do$0%eg&&(/1/||/2/-1)

Applied to the empty board this evaluates 9506699 positions which takes 30Gb and 41 minutes on my computer. The result is:

2222
2222
2222
2222

So every starting move draws. So the game is a draw.

The extreme memory usage is mostly caused by the recursion using do$0. Using this 154 byte version using a plain function needs 3Gb and 11 minutes:

#!/usr/bin/perl -0p
sub f{y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/sx;$@<=>0||s%-%$_="$`O$'";$$_||=2+&f%eeg&&(/1/||/2/-1)}f

which is more bearable (but still too much, something must still be leaking memory).

Combining a number of speedups leads to this 160 byte version (5028168 positions, 4 minutes and 800M for the empty board):

#!/usr/bin/perl -0p
sub f{y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/osx;$@<=>0||s%-%$_="$`O$'";$a{$_}//=&f+1or return 1%eeg&&/1/-1}f

That last one uses 0 for a win (don't confuse with O), 1 for a draw and 2 for a loss. The output of this one is also more confusing. It fills in the winning move for X in case of a win without color swap, but if the input game was already won is still does the color swap and does not fill in any move.

All versions of course get faster and use less memory as the board fills up. The faster versions should generate a move in under 10 seconds as soon as 2 or 3 moves have been made.

In principle this 146 byte version should also work:

#!/usr/bin/perl -0p
y/XO/OX/,$@=-$@while/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^/sx,--$|;$@<=>0||s%-%$_="$`O$'";$$_||=2+do$0%eg&&(/1/||/2/-1)

but on my machine it triggers a perl bug and dumps core.

All versions will in principle still work if the 6 byte position caching done by $$_||= is removed but that uses so much time and memory that it only works for almost filled boards. But in theory at least I have a 140 byte solution.

If you put $\= (cost: 3 bytes) just before the $@<=>0 then each output board will be followed by the status of the whole board: 1 for X wins, 0 for draw and -1 for loss.

Here is an interactive driver based on the fastest version mentioned above. The driver has no logic for when the game is finished so you have to stop yourself. The golfed code knows though. If the suggested move returns with no - replaced by anything the game is over.

#!/usr/bin/perl
sub f{
    if ($p++ % 100000 == 0) {
        local $| = 1;
        print ".";
    }
y/XO/OX/,$@=-$@while$|-=/(@{[map{(O.".{$_}O"x3)=~s%O%Z|$`X$'|Z%gr}0,3..5]})(?{$@++})^|$/osx;$@<=>0||s%-%$_="$`O$'";$a{$_}//=&f+1or return 1%eeg&&/1/-1}

# Driver
my $tomove = "X";
my $move = 0;
@board = ("----\n") x 4;
while (1) {
    print "Current board after move $move ($tomove to move):\n  ABCD\n";
    for my $i (1..4) {
        print "$i $board[$i-1]";
    }
    print "Enter a move like B4, PASS (not a valid move, just for setup) or just press enter to let the program make suggestions\n";
    my $input = <> // exit;
    if ($input eq "\n") {
        $_ = join "", @board;
        tr/OX/XO/ if $tomove eq "O";
        $p = 0;
        $@="";
        %a = ();
        my $start = time();
        my $result = f;
        if ($result == 1) {
            tr/OX/XO/ if $tomove eq "O";
            tr/012/-/;
        } else {
            tr/OX/XO/ if $tomove eq "X";
            tr/012/123/;
        }
        $result = -$result if $tomove eq "O";
        my $period = time() - $start;
        print "\nSuggested moves (evaluated $p positions in $period seconds, predicted result for X: $result):\n$_";
        redo;
    } elsif ($input =~ /^pass$/i) {
        # Do nothing
    } elsif (my ($x, $y) = $input =~ /^([A-D])([1-4])$/) {
        $x = ord($x) - ord("A");
        --$y;
        my $ch = substr($board[$y],$x, 1);
        if ($ch ne "-") {
            print "Position already has $ch. Try again\n";
            redo;
        }
        substr($board[$y],$x, 1) = $tomove;
    } else {
        print "Cannot parse move. Try again\n";
        redo;
    }
    $tomove =~ tr/OX/XO/;
    ++$move;
}


问:
Prime counting function

Introduction

The Prime Counting Function, also known as the Pi function \$\pi(x)\$, returns the amount of primes less than or equal to x.

Challenge

Your program will take an integer x which you can assume to be positive, and output a single integer equal to the amount of primes less than or equal to x. This is a code-golf challenge, so the winner will be the program with the fewest bytes.

You may use any language of your choosing provided that it existed before this challenge went up, but if the language has a built-in prime-counting function or a primality checking function (such as Mathematica), that function cannot be used in your code.

Example Inputs

Input:

1

Output:

0

Input:

2

Output:

1

Input:

5

Output:

3

A000720 - OEIS

答:
Actually, 10 bytes

If my first Actually answer is disallowed for using a prime-generating function, here is a backup answer using Wilson's theorem. Golfing suggestions welcome. Try it online!

```<code>R`;D!²%`MΣ
</code>```

Try it online

```<code>         Implicit input n.
R        Push range [1..n]
`...`M   Map the following function over the range. Variable k.
  ;        Duplicate k.
  D        Decrement one of the copies of k.
  !²       Push ((k-1)!)².
  %        Push ((k-1)!)² % k. This returns 1 if k is prime, else 0.
Σ        Sums the result of the map, adding all the 1s that represent primes,
          giving the total number of primes less than n.
         Implicit return.
</code>```

ContentLicense: CC BY-SA 4.0

Title: Prime counting function

Body:
Actually, 10 bytes

If my first Actually answer is disallowed for using a prime-generating function, here is a backup answer using Wilson's theorem. Golfing suggestions welcome. Try it online!

R`;D!²%`MΣ

Try it online

         Implicit input n.
R        Push range [1..n]
`...`M   Map the following function over the range. Variable k.
  ;        Duplicate k.
  D        Decrement one of the copies of k.
  !²       Push ((k-1)!)².
  %        Push ((k-1)!)² % k. This returns 1 if k is prime, else 0.
Σ        Sums the result of the map, adding all the 1s that represent primes,
          giving the total number of primes less than n.
         Implicit return.

ContentLicense: CC BY-SA 3.0


问:
Non-transitive dice game
Those of you who like Numberphile would be familiar with Dr. James Grime, who described a non-transitive dice game on his channel.

The game consists of three 6-faced dice:

Die 1: 3,3,3,3,3,6

Die 2: 2,2,2,5,5,5

Die 3: 1,4,4,4,4,4

Two players each select a die to use. They roll them and the higher die wins, best-of-whatever.

Probabilistically, die 1 beats dies 2 with >50% chance. Similarly, die 2 beats die 3, and, interestingly, die 3 beats die 1.

Write a program taking 1, 2 or 3 as input. This indicates the die the user chooses. The program then choose the die that would beat the user and output the results of 21 rolls, and "Computer/User wins with x points"

Rules

Code-golf, votes as tiebreaker

You must use RNG (or the likes) to actually simulate the dice rolls.

I am not too strict on output format. It's okay as long as you show the dices, somehow separate between the 21 rolls (in a way different from how you separate the dice in the same roll), and output that sentence above.

Input can be stdin, command line argument, from screen, etc.

Example

Input

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

Output

```<code>4 3
4 3
4 3
4 3
4 3
4 3
4 3
4 3
4 3
4 6
1 3
4 3
4 3
1 3
4 3
1 3
4 3
4 3
4 3
4 3
4 6
 Computer wins with 16 points
</code>```

Here, the user chooses die 1 and his rolls are shown on the right column. The program chooses die 3 and beats him.

答:
GolfScript, 112 105 characters

```<code>3,21*{..+6rand<3*+)}%3/\{)\.+-1%>2<.p~<}+,,"User
Computer"n/1$11<=" wins with "+\[.~22+]$1>~+" points"+
</code>```

Run it online.

The script expects the input on STDIN and then prints the outcome of the dice rolls (first column computer, second user) and the final statistics to STDOUT.

Title: Non-transitive dice game

Body:
GolfScript, 112 105 characters

3,21*{..+6rand<3*+)}%3/\{)\.+-1%>2<.p~<}+,,"User
Computer"n/1$11<=" wins with "+\[.~22+]$1>~+" points"+

Run it online.

The script expects the input on STDIN and then prints the outcome of the dice rolls (first column computer, second user) and the final statistics to STDOUT.


答:
Racket 60 bytes

```<code>(require math)(λ(n)(length(filter prime?(range 1(+ 1 n)))))
</code>```

Testing:

```<code>(require math)
(define f
    (λ(n) (length (filter prime? (range 1 (+ 1 n)))))
)

(f 1)
(f 2)
(f 3)
(f 5)
</code>```

Output:

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

Title: Prime counting function

Body:
Introduction

The Prime Counting Function, also known as the Pi function \$\pi(x)\$, returns the amount of primes less than or equal to x.

Challenge

Your program will take an integer x which you can assume to be positive, and output a single integer equal to the amount of primes less than or equal to x. This is a code-golf challenge, so the winner will be the program with the fewest bytes.

You may use any language of your choosing provided that it existed before this challenge went up, but if the language has a built-in prime-counting function or a primality checking function (such as Mathematica), that function cannot be used in your code.

Example Inputs

Input:

1

Output:

0

Input:

2

Output:

1

Input:

5

Output:

3

A000720 - OEIS

Body:
Racket 60 bytes

(require math)(λ(n)(length(filter prime?(range 1(+ 1 n)))))

Testing:

(require math)
(define f
    (λ(n) (length (filter prime? (range 1 (+ 1 n)))))
)

(f 1)
(f 2)
(f 3)
(f 5)

Output:

0
1
2
3


答:
PARI/GP, 15 bytes

```<code>n->#factor(n!)~
</code>```

Take the factorial and count its unique prime factors.

Title: Prime counting function

Body:
PARI/GP, 15 bytes

n->#factor(n!)~

Take the factorial and count its unique prime factors.


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

答:
MATL, <s>16</s> 14 Bytes

```<code>dZSqq_tn:79Z?c
</code>```

Try it online!

This grew out of a discussion of DJMCMahem's answer. Even though this answer is <s>2 characters longer</s> the same length, the method is somewhat different so it may be of independent interest.

Thanks to Luis Mendo for a suggestion saving 2 bytes (see comments)

Explanation:

'dZS' gets a vector where each entry is the sign of the differences between sucessive characters, then 'qq_' decrements each entry by two and flips the sign, so now if the character increases it is 1, if it stays the same 2, and if it decreases 3. For example,

```<code>dZSqq_ applied to 'HELLOWORLD' creates the vector [3 1 2 1 1 3 1 3 3]
</code>```

Next, 't' makes a copy of the previous vector on the stack, then 'n:' places the vector [1,2,3,4,...] on the stack as well. Then '79' places the value 79 on the stack. The value 79 is chosen because it is the number for the unicode character 'o', which will be our output later. (Thanks to Luis Mendo for the idea to put the value 79 here rather than later)

```<code>tn:79 applied to [3 1 2 1 1 3 1 3 3] creates the following items:
[3 1 2 1 1 3 1 3 3]   <-- first item on the stack
[1 2 3 4 5 6 7 8 9]   <-- second item on the stack
79                    <-- third item on the stack
</code>```

At this point we have precisely the row indices, column indices, and nonzero value of a sparse matrix that has the value 79 wherever we want the output character, and 0 wherever we want to output whitespace. We take these three items off the stack and create this sparse matrix with MATL's sparse matrix command 'Z?'. That is,

```<code>dZSqq_tn:79 Z? applied to 'HELLOWORLD' outputs the following:
[0  79 0  79 79 0  79 0  0 ]
[0  0  79 0  0  0  0  0  0 ]   <-- 3-by-n sparse matrix
[79 0  0  0  0  79 0  79 79]
</code>```

All that is left is to convert the matrix from numbers to unicode characters, which is done by the command 'c'. The 79's become 'o', and the 0's become spaces:

```<code>dZSqq_tn:79Z?c applied to 'HELLOWORLD' outputs:
[  o   o o   o    ]
[    o            ]   <-- 3-by-n sparse matrix of characters.
[o         o   o o]
</code>```

The resulting matrix of chars is then implicitly displayed.

Title: Draw a Bumpy String

Body:
MATL, <s>16</s> 14 Bytes

dZSqq_tn:79Z?c

Try it online!

This grew out of a discussion of DJMCMahem's answer. Even though this answer is <s>2 characters longer</s> the same length, the method is somewhat different so it may be of independent interest.

Thanks to Luis Mendo for a suggestion saving 2 bytes (see comments)

Explanation:

'dZS' gets a vector where each entry is the sign of the differences between sucessive characters, then 'qq_' decrements each entry by two and flips the sign, so now if the character increases it is 1, if it stays the same 2, and if it decreases 3. For example,

dZSqq_ applied to 'HELLOWORLD' creates the vector [3 1 2 1 1 3 1 3 3]

Next, 't' makes a copy of the previous vector on the stack, then 'n:' places the vector [1,2,3,4,...] on the stack as well. Then '79' places the value 79 on the stack. The value 79 is chosen because it is the number for the unicode character 'o', which will be our output later. (Thanks to Luis Mendo for the idea to put the value 79 here rather than later)

tn:79 applied to [3 1 2 1 1 3 1 3 3] creates the following items:
[3 1 2 1 1 3 1 3 3]   <-- first item on the stack
[1 2 3 4 5 6 7 8 9]   <-- second item on the stack
79                    <-- third item on the stack

At this point we have precisely the row indices, column indices, and nonzero value of a sparse matrix that has the value 79 wherever we want the output character, and 0 wherever we want to output whitespace. We take these three items off the stack and create this sparse matrix with MATL's sparse matrix command 'Z?'. That is,

dZSqq_tn:79 Z? applied to 'HELLOWORLD' outputs the following:
[0  79 0  79 79 0  79 0  0 ]
[0  0  79 0  0  0  0  0  0 ]   <-- 3-by-n sparse matrix
[79 0  0  0  0  79 0  79 79]

All that is left is to convert the matrix from numbers to unicode characters, which is done by the command 'c'. The 79's become 'o', and the 0's become spaces:

dZSqq_tn:79Z?c applied to 'HELLOWORLD' outputs:
[  o   o o   o    ]
[    o            ]   <-- 3-by-n sparse matrix of characters.
[o         o   o o]

The resulting matrix of chars is then implicitly displayed.


Title: Draw a Bumpy String

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

Body:
Ruby, <s>66</s> 64 bytes

->s{(-1..1).map{|n|s.gsub(/.(?=(.))/){"o  "[n+($1<=>$&)]}.chop}}

See it on eval.in: https://eval.in/649503


答:
Actually, 3 bytes

This uses a prime factorization function, which may or may not be allowed after the OP clarifies. Golfing suggestions welcome. Try it online!

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

Ungolfing

```<code>     Implicit input n.
!    Push n factorial.
 y   Push a list of all of the positive prime factors of n! (every prime < n)
  l  Take the length of that list of primes.
     Implicit return.
</code>```

Title: Prime counting function

Body:
Actually, 3 bytes

This uses a prime factorization function, which may or may not be allowed after the OP clarifies. Golfing suggestions welcome. Try it online!

!yl

Ungolfing

     Implicit input n.
!    Push n factorial.
 y   Push a list of all of the positive prime factors of n! (every prime < n)
  l  Take the length of that list of primes.
     Implicit return.


答:
Perl, 47 bytes

Includes +1 for -p

Give input on STDIN:

```<code>bumpy.pl <<< ABBCBA
</code>```

bumpy.pl:

```<code>#!/usr/bin/perl -p
$_ x=3;s%.%/\G(.)(.)/?$2cmp$1^$.&&$":--$.>0%eg
</code>```

Title: Draw a Bumpy String

Body:
Perl, 47 bytes

Includes +1 for -p

Give input on STDIN:

bumpy.pl <<< ABBCBA

bumpy.pl:

#!/usr/bin/perl -p
$_ x=3;s%.%/\G(.)(.)/?$2cmp$1^$.&&$":--$.>0%eg


问:
Create a pyramidal matrix
A pyramidal matrix is a square matrix where all numbers increase or decrease from the center point, like the two matrices below:

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

Or:

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

Given a non-zero integer n, create a pyramidal matrix where the numbers goes from 1 to n either in increasing order (if n<0), or decreasing order (if n>0) from the center. If n is even, then there will be 4 center numbers (see the examples).

As always:

Optional input and output format

Number of spaces, delimiter etc. is optional

Test cases:

```<code>1
1

-1
1

5
1  1  1  1  1  1  1  1  1
1  2  2  2  2  2  2  2  1
1  2  3  3  3  3  3  2  1
1  2  3  4  4  4  3  2  1
1  2  3  4  5  4  3  2  1
1  2  3  4  4  4  3  2  1
1  2  3  3  3  3  3  2  1
1  2  2  2  2  2  2  2  1
1  1  1  1  1  1  1  1  1

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

```<code>2
1  1  1  1
1  2  2  1
1  2  2  1
1  1  1  1

-2
2  2  2  2
2  1  1  2
2  1  1  2
2  2  2  2

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

答:
R, 112 bytes

```<code>k=abs(n);l=2*k;m=diag(l);for(i in 1:k){m[i:(l+1-i),i:(l+1-i)]=i};if(n%%2==1){m=m[-k,-k]};if(n<0){m=abs(m-1+n)};m
</code>```

Needs integer n in workspace, otherwise run n=scan() for an extra 8 bytes.

```<code>k=abs(n)
l=2*k
m=diag(l)                    # Initialize quadratic 2*|n| matrix
for(i in 1:k){
    m[i:(l+1-i),i:(l+1-i)]=i # Assign values to matrix elements according
                             # to their index
}
if(n%%2==1){
   m=m[-k,-k]                # If n is odd, delete middle row and column
}
if(n<0){
    m=abs(m-1+n)             # If n < 0, flip values
}
m                            # Print matrix
</code>```

Title: Create a pyramidal matrix

Body:
R, 112 bytes

k=abs(n);l=2*k;m=diag(l);for(i in 1:k){m[i:(l+1-i),i:(l+1-i)]=i};if(n%%2==1){m=m[-k,-k]};if(n<0){m=abs(m-1+n)};m

Needs integer n in workspace, otherwise run n=scan() for an extra 8 bytes.

k=abs(n)
l=2*k
m=diag(l)                    # Initialize quadratic 2*|n| matrix
for(i in 1:k){
    m[i:(l+1-i),i:(l+1-i)]=i # Assign values to matrix elements according
                             # to their index
}
if(n%%2==1){
   m=m[-k,-k]                # If n is odd, delete middle row and column
}
if(n<0){
    m=abs(m-1+n)             # If n < 0, flip values
}
m                            # Print matrix


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

Please post one tip per answer.

S.I.L.O.S can be run here.

答:
Abuse the preprocessor

All SILOS programs can optionally have a macro statement on the second line

Consider the following program... One of my favorite SILOS submissions by betseg.

```
a=97
def q print z bottle v beer L Line g wall x IntNoLine h the c around
qL 99 zs of v on h g, 99 zs of v.
lbls
q Take one down and pass it c,
a+1
qx a
qL  zs of v on h g.
qx a
q  zs of v on h g,
qx a
qL  zs of v.
a-2
if a s
qL Take one down and pass it c, 1 z of v on h g.
qL 1 z of v on h g, 1 z of v.
q Go to h store and buy some more, 99 zs of v on h g.
```

Look at that savings
Try it out!

Title: Tips for golfing in S.I.L.O.S

Body:
Abuse the preprocessor

All SILOS programs can optionally have a macro statement on the second line

Consider the following program... One of my favorite SILOS submissions by betseg.

a=97
def q print z bottle v beer L Line g wall x IntNoLine h the c around
qL 99 zs of v on h g, 99 zs of v.
lbls
q Take one down and pass it c,
a+1
qx a
qL  zs of v on h g.
qx a
q  zs of v on h g,
qx a
qL  zs of v.
a-2
if a s
qL Take one down and pass it c, 1 z of v on h g.
qL 1 z of v on h g, 1 z of v.
q Go to h store and buy some more, 99 zs of v on h g.

Look at that savings
<a href="http://silos.tryitonline.net/#code=YT05NwpkZWYgcSBwcmludCB6IGJvdHRsZSB2IGJlZXIgTCBMaW5lIGcgd2FsbCB4IEludE5vTGluZSBoIHRoZSBjIGFyb3VuZApxTCA5OSB6cyBvZiB2IG9uIGggZywgOTkgenMgb2Ygdi4KbGJscwpxIFRha2Ugb25lIGRvd24gYW5kIHBhc3MgaXQgYywgCmErMQpxeCBhCnFMICB6cyBvZiB2IG9uIGggZy4KcXggYQpxICB6cyBvZiB2IG9uIGggZywgCnF4IGEKcUwgIHpzIG9mIHYuCmEtMgppZiBhIHMKcUwgVGFrZSBvbmUgZG93biBhbmQgcGFzcyBpdCBjLCAxIHogb2YgdiBvbiBoIGcuCnFMIDEgeiBvZiB2IG9uIGggZywgMSB6IG9mIHYuCnEgR28gdG8gaCBzdG9yZSBhbmQgYnV5IHNvbWUgbW9yZSwgOTkgenMgb2YgdiBvbiBoIGcu&input=&args=" rel="nofollow">Try it out!


答:
Never declare variables

There is no need to declare a variable. All variables are automa<s>t</s>gically initialized to 0.

Hence, this-

```
a=0
a=97
printInt a
```

Is the same as this

```
a=97
printInt a
```

Title: Tips for golfing in S.I.L.O.S

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

Please post one tip per answer.

S.I.L.O.S can be run here.

Body:
Never declare variables

There is no need to declare a variable. All variables are automa<s>t</s>gically initialized to 0.

Hence, this-

a=0
a=97
printInt a

Is the same as this

a=97
printInt a


问:
Emulate a 7-segment display

Task

The task is to display any of the 128 possible states of a
7-segment display.

Your program should accept a string of 7 characters ("bits") that are either 0 or 1.
First bit of input corresponds to segment A of the following illustration, the
second to B, etc (ignore dp):

How you represent the display is up to you -- a single Unicode or ASCII symbol,
ASCII art, grafically, or whatever you can come up with. However, each
input must have it's own distinct output. If you come up with something fancy I'm sure you can harvest upvotes by showing off some examples.

All 128 possible states of the display are:

Rules

Codegolf

As I said, any kind of output is allowed, but it would be nice if you specified it.

Input can be stdin or command line argument.

Examples

Input

```<code>1101101
</code>```

Output

As ASCII/Unicode:

```<code>2
</code>```

Different kinds of ASCII art (I'm not too good at this)

```<code> _   ╺┓  ╒╗   ---
 _|  ┏┛  ╔╝     |
|_   ┗╸  ╚╛   ---
              |
              ---
</code>```

答:
Mathematica 264

Getting the output to look right required many bytes, so no cigar this time.
But here's the verbose (264 chars) code anyway.

```<code>{a, b, c, d, e, g} = {{-1, 5}, {1, 5}, {1, 3}, {1, 1}, {-1, 1}, {-1, 3}};
f@n_ := Graphics[{Yellow, Thickness[.1], CapForm["Round"],
   Line /@ {{g, c}, {g, a}, {g, e}, {e, d}, {d, c}, {c, b}, {b, a}}[[Flatten@
   Position[IntegerDigits[n, 2, 7], 1]]]},
   Background -> Blue, PlotRange -> {{-1, 1}, {1, 5}}, PlotRangePadding -> 1]
</code>```

The complete set of characters:

```<code>GraphicsGrid[Partition[Table[f[p], {p, 0, 128}], 16]]
</code>```

The digits:

```<code>{f[63], f[6], f[91], f[79], f[102], f[109], f[125], f[7], f[127], f[111]}
</code>```

Title: Emulate a 7-segment display

Body:
Mathematica 264

Getting the output to look right required many bytes, so no cigar this time.
But here's the verbose (264 chars) code anyway.

{a, b, c, d, e, g} = {{-1, 5}, {1, 5}, {1, 3}, {1, 1}, {-1, 1}, {-1, 3}};
f@n_ := Graphics[{Yellow, Thickness[.1], CapForm["Round"],
   Line /@ {{g, c}, {g, a}, {g, e}, {e, d}, {d, c}, {c, b}, {b, a}}[[Flatten@
   Position[IntegerDigits[n, 2, 7], 1]]]},
   Background -> Blue, PlotRange -> {{-1, 1}, {1, 5}}, PlotRangePadding -> 1]

The complete set of characters:

GraphicsGrid[Partition[Table[f[p], {p, 0, 128}], 16]]

The digits:

{f[63], f[6], f[91], f[79], f[102], f[109], f[125], f[7], f[127], f[111]}


问:
Shortest infinite loop producing no output
Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

Each submission must be a full program.

You must create the shortest infinite loop.

Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.

The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.

The program must not write anything to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge.
-Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D

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

This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.

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

There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.

Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be  improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

```<code># Language name, X bytes
</code>```

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

```<code>#[Language name](http://link.to/the/language), X bytes
</code>```

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
Emotinomicon, (2 chars) 6 bytes

```<code>ℹ⏩
</code>```

I cleverly chose the ℹ character for 3 bytes instead of 4. Explanation:

```<code>ℹ⏩ explanation
ℹ  push the imaginary unit to the stack
 ⏩ close loop
</code>```

It works, because 1) ⏩ has got a value (i) 2) ⏩ can't find a ⏪.

To test the code, do the following:

Open the interpreter.

Clean the box and then put a  in it (not part of the code, just in case you have a dirty output stream).

Paste the code after that one-big-toothed strange guy.

Click on "generate explanation". Watch the steps done there (also, no mono-spacing issues).

Click on "submit". Warning: the code will run after this step!

Body:
Emotinomicon, (2 chars) 6 bytes

ℹ⏩

I cleverly chose the ℹ character for 3 bytes instead of 4. Explanation:

ℹ⏩ explanation
ℹ  push the imaginary unit to the stack
 ⏩ close loop

It works, because 1) ⏩ has got a value (i) 2) ⏩ can't find a ⏪.

To test the code, do the following:

Open the interpreter.

Clean the box and then put a  in it (not part of the code, just in case you have a dirty output stream).

Paste the code after that one-big-toothed strange guy.

Click on "generate explanation". Watch the steps done there (also, no mono-spacing issues).

Click on "submit". Warning: the code will run after this step!


答:
Copy, 10 bytes

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

Copy the current instruction at the next location.

Basically a Core war imp.

Title: Shortest infinite loop producing no output

Body:
Your task is to create the shortest infinite loop!

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

Rules

Each submission must be a full program.

You must create the shortest infinite loop.

Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.

The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.

The program must not write anything to STDERR.

Feel free to use a language (or language version) even if it's newer than this challenge.
-Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D

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

This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.

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

There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.

Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be  improved.

Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

```<code># Language name, X bytes
</code>```

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

```<code>#[Language name](http://link.to/the/language), X bytes
</code>```

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

Body:
Copy, 10 bytes

copy 0 0 1

Copy the current instruction at the next location.

Basically a Core war imp.


问:
Shortest way to strip the commas from column n given a .csv file/input
Ok, so the input here is going to be a .csv file and so is the output. Now, given a .csv file/input like so

```<code>"apple","banana","apple,banana","orange"
"grape","orange","grape,orange","sprout"
# 0       1        2              3
</code>```

strip out all commas for a given nth column's entries (index starts at 0). So, for the input above, the program would output a .csv file like so for n = 2:

```<code>"apple","banana","applebanana","orange"
"grape","orange","grapeorange","sprout"
</code>```

If the particular column's entries do not have commas, then it does nothing. Could have any allowable/manageable number of columns, and if you somehow find that creating a program that takes more than one argument, say, a, b, c, ..., z like this

```<code>program(a=1,b=4,c=65, ..., z=0, mycsv.csv)
</code>```

for respective columns 2, 5, and 66, which all strip out commas for each, to be shorter, then do that.

Shortest code measured in bytes wins, and it doesn't have to be a file that is output/input.

答:
Ruby, 80 bytes

```<code>require'csv'
->n,x{CSV.read(x).map{|a|a[n].delete!',';a.to_csv(force_quotes:1)}}
</code>```

A lambda that takes n and a file path argument, and returns a list of CSV rows.

Body:
Ruby, 80 bytes

require'csv'
->n,x{CSV.read(x).map{|a|a[n].delete!',';a.to_csv(force_quotes:1)}}

A lambda that takes n and a file path argument, and returns a list of CSV rows.


答:
05AB1E, 27 bytes

```<code>U|vy“","“©¡vyNXQi","-}})®ý,
</code>```

Explanation

```<code>U                           # store index in X
 |v                         # for each line
   y“","“©¡                 # split on ","
           v          }     # for each in the split list
            yNXQi","-}      # if it's index equals X, remove any commas
                       )    # wrap in list
                        ®ý, # merge on "," and print
</code>```

Try it online!

Title: Shortest way to strip the commas from column n given a .csv file/input

Body:
Ok, so the input here is going to be a .csv file and so is the output. Now, given a .csv file/input like so

```<code>"apple","banana","apple,banana","orange"
"grape","orange","grape,orange","sprout"
# 0       1        2              3
</code>```

strip out all commas for a given nth column's entries (index starts at 0). So, for the input above, the program would output a .csv file like so for n = 2:

```<code>"apple","banana","applebanana","orange"
"grape","orange","grapeorange","sprout"
</code>```

If the particular column's entries do not have commas, then it does nothing. Could have any allowable/manageable number of columns, and if you somehow find that creating a program that takes more than one argument, say, a, b, c, ..., z like this

```<code>program(a=1,b=4,c=65, ..., z=0, mycsv.csv)
</code>```

for respective columns 2, 5, and 66, which all strip out commas for each, to be shorter, then do that.

Shortest code measured in bytes wins, and it doesn't have to be a file that is output/input.

Body:
05AB1E, 27 bytes

U|vy“","“©¡vyNXQi","-}})®ý,

Explanation

U                           # store index in X
 |v                         # for each line
   y“","“©¡                 # split on ","
           v          }     # for each in the split list
            yNXQi","-}      # if it's index equals X, remove any commas
                       )    # wrap in list
                        ®ý, # merge on "," and print

Try it online!


答:
Sh + GNU Sed <s>GNU Sed</s>, 36 <s>28 + 1</s> bytes

Run with -r flag.

```<code>sed -r 's/(,?"\w*),?(\w*")/\1\2/'$1
</code>```

One argument to select proper column (1-indexed). This uses a GNU-specific sed extension.

Old version: s/(,?\"\w*),?(\w*\")/\1\2/3

This required replacing the last 3 to select the proper column (1-indexed), which I'm not sure is allowed.

Body:
Sh + GNU Sed <s>GNU Sed</s>, 36 <s>28 + 1</s> bytes

Run with -r flag.

sed -r 's/(,?"\w*),?(\w*")/\1\2/'$1

One argument to select proper column (1-indexed). This uses a GNU-specific sed extension.

Old version: s/(,?\"\w*),?(\w*\")/\1\2/3

This required replacing the last 3 to select the proper column (1-indexed), which I'm not sure is allowed.


问:
The Base in the mix
Input:

A list/array of integers for which each item is in the range of 2-36.

Output:

The sum of the integers (as base 10), where each next integer is in the base of the previous value (starting with a regular base 10).

Example:

Let's say we have an input like this: [4, 12, 34, 20, 14, 6, 25, 13, 33]

Then we have a sum like this:

```<code>4    (4  in base-10) +
6    (12 in base-4 ) +
40   (34 in base-12) +
68   (20 in base-34) +
24   (14 in base-20) +
6    (6  in base-14) +
17   (25 in base-6 ) +
28   (13 in base-26) +
42   (33 in base-13)
= 235
</code>```

Mathematical base explained:

I considered assuming everyone knows how base works, but I'll give a brief example of how it works anyway, just in case. Let's take the 34 in base-12 for example, how did we get 40?

```<code>1-34 in regular base-10:
 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
 So, from 1 to 34 is 34 steps in base-10

1-34 in base-12:
 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2A, 2B, 30, 31, 32, 33, 34
 So, from 1 to 34 is 40 steps in base-12
</code>```

Here is perhaps a useful calculator.

Challenge rules:

Array size will be in reasonable range (like 1-100 / see test cases).

The test cases will never contain integers of which the current value is invalid for it's previous base (i.e. You will never have something like 19 in base-6 or 6 in base-6, because base-6 only contains the digits 0-5).

You can take the input any way you'd like. Can be as an int-array, as a comma/space-separated string, etc. Your call. (You are also allowed to take the int-array reversed, which could be useful for stack-based programming languages.)

General Rules:

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

Don't let code-golf languages discourage you from posting answers with non-golfing languages. Try to come up with as short an answer as possible for any programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>[4, 12, 34, 20, 14, 6, 25, 13, 33]                            ->   235
 4+ 6+  40+ 68+ 24+ 6+ 17+ 28+ 42

[5, 14, 2, 11, 30, 18]                                        ->   90
 5+ 9+  2+ 3+  33+ 38

[12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 12, 2, 11, 3, 10, 2, 10]    ->   98
 12+ 13+ 11+ 9+ 8+ 7+ 6+ 5+ 4+ 3+ 5+  2+ 3+  3+ 3+  2+ 2

[36, 36]                                                      ->   150
 36+ 114
</code>```

答:
Common Lisp, 83

```<code>(lambda(s)(loop for b ="10"then x for x in s sum(#1=parse-integer x :radix(#1#b))))
</code>```

Details

```<code>(defun base-mix (list)
  (loop
     for base = "10" then string
     for string in list
     sum (parse-integer string :radix (parse-integer base))))
</code>```

The loop construct accepts "v then w" iteration constructs, where v is an expression to be evaluated the first time the iteration variable is computed, and w is the expression to be evaluated for the successive iterations. Declarations are evaluated one after the other, so base is first "10", then the previous element stringof the list list being iterated. The sum keyword computes a sum: the integer read from string with base b, where b is the integer parsed from the base string, in base 10. #1= and #1# are notations to define and use reader variables: the first affects an s-expression to a variable, the other one replaces the reference by the same object. This saves some characters for long names.

Example

```<code>(base-mix '("4" "12" "34" "20" "14" "6" "25" "13" "33"))
=> 235
</code>```

Title: The Base in the mix

Body:
Common Lisp, 83

(lambda(s)(loop for b ="10"then x for x in s sum(#1=parse-integer x :radix(#1#b))))

Details

(defun base-mix (list)
  (loop
     for base = "10" then string
     for string in list
     sum (parse-integer string :radix (parse-integer base))))

The loop construct accepts "v then w" iteration constructs, where v is an expression to be evaluated the first time the iteration variable is computed, and w is the expression to be evaluated for the successive iterations. Declarations are evaluated one after the other, so base is first "10", then the previous element stringof the list list being iterated. The sum keyword computes a sum: the integer read from string with base b, where b is the integer parsed from the base string, in base 10. #1= and #1# are notations to define and use reader variables: the first affects an s-expression to a variable, the other one replaces the reference by the same object. This saves some characters for long names.

Example

(base-mix '("4" "12" "34" "20" "14" "6" "25" "13" "33"))
=> 235


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

答:
05AB1E, <s>19</s> <s>18</s> 16 bytes

Code:

```<code>žH+b¦2äøC’c‰±’sè
</code>```

Uses the CP-1252 encoding. Try it online!

Explanation:

First, we add 65536 to the number (žH is a constant defined to 65536), which is also 10000000000000000 in binary. This is to pad the number with zeroes. Let's take the number 14234 as an example. 14234 + 65536 is equal to 79770. Which in binary is:

```<code>10011011110011010
</code>```

We remove the first character, resulting in:

```<code>0011011110011010
</code>```

We split the string into two pieces using 2ä:

```<code>00110111, 10011010
</code>```

After that, we zip the array with ø:

```<code>01, 00, 10, 11, 01, 10, 11, 10
</code>```

Converting them back into decimal (using C) results in:

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

Now, we only need to index it with the string cbad. The compressed version for this string is ’c‰±’, which can also be tested here. Finally, we get the characters at the index of the above array. For the above example, this results in:

```<code>1, 0, 2, 3, 1, 2, 3, 2
b  c  a  d  b  a  d  a
</code>```

Title: Cheating a multiple choice test, part 2

Body:
05AB1E, <s>19</s> <s>18</s> 16 bytes

Code:

žH+b¦2äøC’c‰±’sè

Uses the CP-1252 encoding. Try it online!

Explanation:

First, we add 65536 to the number (žH is a constant defined to 65536), which is also 10000000000000000 in binary. This is to pad the number with zeroes. Let's take the number 14234 as an example. 14234 + 65536 is equal to 79770. Which in binary is:

10011011110011010

We remove the first character, resulting in:

0011011110011010

We split the string into two pieces using 2ä:

00110111, 10011010

After that, we zip the array with ø:

01, 00, 10, 11, 01, 10, 11, 10

Converting them back into decimal (using C) results in:

1, 0, 2, 3, 1, 2, 3, 2

Now, we only need to index it with the string cbad. The compressed version for this string is ’c‰±’, which can also be tested here. Finally, we get the characters at the index of the above array. For the above example, this results in:

1, 0, 2, 3, 1, 2, 3, 2
b  c  a  d  b  a  d  a


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

Please post one tip per answer.

答: If you just want a truthy value (or even just a value), without using it, use ℹ. It's 3 bytes, while the others are 4 bytes.

Title: Tips for golfing in Emotinomicon


问:
Write the longest sentence using keywords of a programming language
As the title said, the challenge is to write the longest sentence by only using the keywords of 1 programming language.

For instance, using the keywords of C++, it is possible to write this sentence:

do not try this float

What can you come up with?

答:
Common Lisp

```<code>:In :Common :Lisp :a :keyword :is :simply :a :symbol :which :has :the :KEYWORD :home :package :which :is :true :of :all :symbols :starting :with :a :colon :so :you :can :construct :arbitrarily :long :sentences. :Do :I :win?
</code>```

This, for example:

```<code>(every #'keywordp '(:In :Common :Lisp :a :keyword :is :simply :a :symbol :which :has :the :KEYWORD :home :package :which :is :true :of :all :symbols :starting :with :a :colon :so :you :can :construct :arbitrarily :long :sentences. :Do :I :win?))
</code>```

Evaluates to T

See http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_k.htm

Body:
Common Lisp

:In :Common :Lisp :a :keyword :is :simply :a :symbol :which :has :the :KEYWORD :home :package :which :is :true :of :all :symbols :starting :with :a :colon :so :you :can :construct :arbitrarily :long :sentences. :Do :I :win?

This, for example:

(every #'keywordp '(:In :Common :Lisp :a :keyword :is :simply :a :symbol :which :has :the :KEYWORD :home :package :which :is :true :of :all :symbols :starting :with :a :colon :so :you :can :construct :arbitrarily :long :sentences. :Do :I :win?))

Evaluates to T

See http://www.lispworks.com/documentation/HyperSpec/Body/26_glo_k.htm


答: If you want to output 2 chars or less, do not use ⏪⏬⏩, use the number of ⏬s needed.

Title: Tips for golfing in Emotinomicon

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

Please post one tip per answer.


答: Because of a bug in the interpreter, if you want to append 1 to a number (e.g. 10 -> 101), use . As it is right now, you have to use ➕ for the true function of .

Title: Tips for golfing in Emotinomicon


答:
Should be answers to respective challenges (if they exist). Note that some of these code samples might alerady be answers somewhere else.

If you just want to print undefined, use this 4-byte, 1-char program.

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

Infinite loop (6 bytes, 2 chars).

```<code>ℹ⏩
</code>```

Cat (owned by Conor O'Brien) (15 bytes, 5 chars).

```<code>⏫⏪⏬⏫⏩
</code>```

This program should output the 8 phases of the moon, but it doesn't seem to work (61 bytes, 16 chars).

```<code>⏪⏬⏩
</code>```

Hypothenuse (27 bytes, 7 chars).

```<code>➕
</code>```

Title: Tips for golfing in Emotinomicon

Body:
Should be answers to respective challenges (if they exist). Note that some of these code samples might alerady be answers somewhere else.

If you just want to print undefined, use this 4-byte, 1-char program.

Infinite loop (6 bytes, 2 chars).

ℹ⏩

Cat (owned by Conor O'Brien) (15 bytes, 5 chars).

⏫⏪⏬⏫⏩

This program should output the 8 phases of the moon, but it doesn't seem to work (61 bytes, 16 chars).

⏪⏬⏩

Hypothenuse (27 bytes, 7 chars).

➕


答:
PHP, 57 Bytes

```<code>for($i=8;$i--;)echo CBAD[($n=$argv[1])>>$i+7&2|$n>>$i&1];
</code>```

Version without Bitwise operators 70 Bytes

```<code>for(;$i<8;)echo CABD[($s=sprintf("%016b",$argv[1]))[$i]+$s[8+$i++]*2];
</code>```

Title: Cheating a multiple choice test, part 2

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

Body:
PHP, 57 Bytes

for($i=8;$i--;)echo CBAD[($n=$argv[1])>>$i+7&2|$n>>$i&1];

Version without Bitwise operators 70 Bytes

for(;$i<8;)echo CABD[($s=sprintf("%016b",$argv[1]))[$i]+$s[8+$i++]*2];


答:
Mathematica, <s>75</s> <s>73</s> <s>68</s> 66 bytes

```<code>StringPart["CBAD",#+##+1]&@@IntegerDigits[#,2,16]~Partition~8<>""&
</code>```

Thanks to @MartinEnder for saving 2 bytes.

Title: Cheating a multiple choice test, part 2

Body:
Mathematica, <s>75</s> <s>73</s> <s>68</s> 66 bytes

StringPart["CBAD",#+##+1]&@@IntegerDigits[#,2,16]~Partition~8<>""&

Thanks to @MartinEnder for saving 2 bytes.


答:
JavaScript, <s>113</s> <s>93</s> <s>90</s> 88 bytes

A big thanks to @Neil for helping me save 20 bytes!

-3 bytes thanks to @Cyoce
<s>

```<code>n=>{r="";b=("0".repeat(15)+n.toString(2)).slice(-16);for(i=0;i<8;i++)r+="CBAD"[parseInt(b[i]+b[i+8],2)];return r}
</code>```

</s><s>

```<code>n=>{r="";b=(65536+n).toString(2).slice(1);for(i=0;i<8;i++)r+="CBAD"[+b[i+8]+2*b[i]];return r}
</code>```

</s>
<s>

```<code>n=>eval('r="";b=(65536+n).toString(2).slice(1);for(i=0;i<8;i++)r+="CBAD"[+b[i+8]+2*b[i]]')
</code>```

</s>

```<code>n=>eval('r="";b=n.toString(2).padStart(16,0);for(i=0;i<8;i++)r+="CBAD"[+b[i+8]+2*b[i]]')
</code>```

Sadly, JavaScript lacks functions like decbin, bindec, and str_pad that PHP has.

Title: Cheating a multiple choice test, part 2

Body:
JavaScript, <s>113</s> <s>93</s> <s>90</s> 88 bytes

A big thanks to @Neil for helping me save 20 bytes!

-3 bytes thanks to @Cyoce
<s>

n=>{r="";b=("0".repeat(15)+n.toString(2)).slice(-16);for(i=0;i<8;i++)r+="CBAD"[parseInt(b[i]+b[i+8],2)];return r}

</s><s>

n=>{r="";b=(65536+n).toString(2).slice(1);for(i=0;i<8;i++)r+="CBAD"[+b[i+8]+2*b[i]];return r}

</s>
<s>

n=>eval('r="";b=(65536+n).toString(2).slice(1);for(i=0;i<8;i++)r+="CBAD"[+b[i+8]+2*b[i]]')

</s>

n=>eval('r="";b=n.toString(2).padStart(16,0);for(i=0;i<8;i++)r+="CBAD"[+b[i+8]+2*b[i]]')

Sadly, JavaScript lacks functions like decbin, bindec, and str_pad that PHP has.


问:
I'm not the language you're looking for!
Isn't it annoying when you find a piece of code and you don't know what language it was written in? This challenge attempts to somewhat solve this.

Challenge

You will have to write a program that when run in two different languages, will output the string:

This program wasn't written in <language program compiled/interpreted in>, it was built for <other language the program can be run in>!

In the output, language names should have official capitalization. eg: CJam, C++

Neither program should take any input from the user.

When run in both languages, output should be to stdout or equivalent.

There should be no output to stderr in either program.

You may use comments in either language.

Two different versions of the same language count as different languages.

If this is done, the program should output the major version number, and if running on two different minor versions, should report the minor version also.

You should not use prebuilt version functions (this includes variables that have already been evaluated at runtime).

Example output:

Perl and Ruby:

Perl: This program wasn't written in Perl, it was built for Ruby!

Ruby: This program wasn't written in Ruby, it was built for Perl!

Python and C:

Python: This program wasn't written in Python, it was built for C!

C: This program wasn't written in C, it was built for Python!

Python 2 and Python 3:

Python 2: This program wasn't written in Python 2, it was built for Python 3!

Python 3: This program wasn't written in Python 3, it was built for Python 2!

Python 2.4 and Python 2.7:

Python 2.4: This program wasn't written in Python 2.4, it was built for Python 2.7!

Python 2.7: This program wasn't written in Python 2.7, it was built for Python 2.4!

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

答:
Emotinomicon/Python 2, 168 bytes

```<code>#!2 nohtyP rof tliub saw ti ,nocimonitomE ni nettirw t'nsaw margorp sihT⏪⏬⏩
print"This program wasn't written in Python 2, it was built for Emotinomicon!"
</code>```

or with more languages:

Emotinomicon/Python 2/><>, 267 bytes

```<code>v=0
 #!2 nohtyP rof tliub saw ti ,nocimonitomE ni nettirw t'nsaw margorp sihT⏪⏬⏩
for _ in[0]:print"This program wasn't written in Python 2, it was built for ><>!"
"""
"
>v
v>"!nocimonitomE rof tliub saw ti ,><> ni nettirw t'nsaw margorp sihT"
>l?!;o
"""
</code>```

but I'm bored so let's add another language:

Emotinomicon/Python 2/><>/Gol><>, 358 bytes

```<code>v=0
 #!2 nohtyP rof tliub saw ti ,nocimonitomE ni nettirw t'nsaw margorp sihT⏪⏬⏩
for _ in[0]:print"This program wasn't written in Python 2, it was built for ><>!"
"""
`
"
?
>v
v>"!><>loG rof tliub saw ti ,><> ni nettirw t'nsaw margorp sihT"
>l?!;o
"
>!v~~~~~"!nocimonitomE rof tliub saw ti ,><>loG ni nettirw t'nsaw margorp sihT"0q
  >l?!;o
"""
</code>```

Body:
Emotinomicon/Python 2, 168 bytes

#!2 nohtyP rof tliub saw ti ,nocimonitomE ni nettirw t'nsaw margorp sihT⏪⏬⏩
print"This program wasn't written in Python 2, it was built for Emotinomicon!"

or with more languages:

Emotinomicon/Python 2/><>, 267 bytes

v=0
 #!2 nohtyP rof tliub saw ti ,nocimonitomE ni nettirw t'nsaw margorp sihT⏪⏬⏩
for _ in[0]:print"This program wasn't written in Python 2, it was built for ><>!"
"""
"
>v
v>"!nocimonitomE rof tliub saw ti ,><> ni nettirw t'nsaw margorp sihT"
>l?!;o
"""

but I'm bored so let's add another language:

Emotinomicon/Python 2/><>/Gol><>, 358 bytes

v=0
 #!2 nohtyP rof tliub saw ti ,nocimonitomE ni nettirw t'nsaw margorp sihT⏪⏬⏩
for _ in[0]:print"This program wasn't written in Python 2, it was built for ><>!"
"""
`
"
?
>v
v>"!><>loG rof tliub saw ti ,><> ni nettirw t'nsaw margorp sihT"
>l?!;o
"
>!v~~~~~"!nocimonitomE rof tliub saw ti ,><>loG ni nettirw t'nsaw margorp sihT"0q
  >l?!;o
"""


答:
Make use of built-ins.

Some cases are:

⁉❕ -> ❔

The numbers 0-10, 100 and i are ℹ, respectively.

Multiplication with 2-4 is done with ☺, respectively.

Division with 2-4 is done with , respectively.

Exponentiation with 2-4 is done with , respectively.

Rooting:

n-Rooting with n being 2-4 is done with , respectively.

For other n, use n➗. n is not a literal n, but the power of rooting.

Title: Tips for golfing in Emotinomicon


答:
CJam, 22 bytes

```<code>ri2bG0e[8/:.{1$=)^'A+}
</code>```

Try it online!

Explanation

Powered by magic...

The mapping of bit pairs to letters in this challenge is a bit arbitrary. If we represent ABCD by 0, 1, 2, 3 (so we can just add them to the character A) then we want the following mapping:

```<code>i1   i2   o
0    0    2
0    1    1
1    0    0
1    1    3
</code>```

This mapping can be computed with a magical little formula: ((i1 == i2) + 1) ^ i1, where the equality check returns 0 or 1. Check out the following table, where each column corresponds to one input, each row corresponds to one operation, and each cell will show the stack at that point:

```<code>[i1, i2]:  [0, 0]     [0, 1]     [1, 0]     [1, 1]
copy i1:   [0, 0, 0]  [0, 1, 0]  [1, 0, 1]  [1, 1, 1]
equals:    [0, 1]     [0, 0]     [1, 0]     [1, 1]
inc:       [0, 2]     [0, 1]     [1, 1]     [1, 2]
xor:       [2]        [1]        [0]        [3]
</code>```

With that in mind here is the full breakdown of the source code:

```<code>ri     e# Read input, convert to integer.
2b     e# Get binary representation.
G0e[   e# Pad to 16 bits with zeros.
8/     e# Split into two halves of 8 bits each.
:.{    e# For each pair of bits, i1 and i2...
  1$   e#   Copy i1.
  =    e#   Check equality with i2.
  )    e#   Increment.
  ^    e#   Bitwise XOR.
  'A+  e#   Add to 'A'
}
</code>```

An alternative solution with the same byte count which is decidedly less magical:

```<code>ri2bG0e[8/z2fb"CBAD"f=
</code>```

And in case it's useful to anyone, if you turn the i1 and i2 bits back into a single number (i.e. when you want the mapping 0 -> 2, 1 -> 1, 2 -> 0, 3 -> 3) this can be computed even more easily as (~n - 1) & 3 or (~n - 1) % 4 if your language gets modulo on negative values right. I think this can be written concisely as 3&~-~n in many languages. In CJam this turns out to be a byte longer, because of the additional conversion back from base 2.

Title: Cheating a multiple choice test, part 2

Body:
CJam, 22 bytes

ri2bG0e[8/:.{1$=)^'A+}

Try it online!

Explanation

Powered by magic...

The mapping of bit pairs to letters in this challenge is a bit arbitrary. If we represent ABCD by 0, 1, 2, 3 (so we can just add them to the character A) then we want the following mapping:

i1   i2   o
0    0    2
0    1    1
1    0    0
1    1    3

This mapping can be computed with a magical little formula: ((i1 == i2) + 1) ^ i1, where the equality check returns 0 or 1. Check out the following table, where each column corresponds to one input, each row corresponds to one operation, and each cell will show the stack at that point:

[i1, i2]:  [0, 0]     [0, 1]     [1, 0]     [1, 1]
copy i1:   [0, 0, 0]  [0, 1, 0]  [1, 0, 1]  [1, 1, 1]
equals:    [0, 1]     [0, 0]     [1, 0]     [1, 1]
inc:       [0, 2]     [0, 1]     [1, 1]     [1, 2]
xor:       [2]        [1]        [0]        [3]

With that in mind here is the full breakdown of the source code:

ri     e# Read input, convert to integer.
2b     e# Get binary representation.
G0e[   e# Pad to 16 bits with zeros.
8/     e# Split into two halves of 8 bits each.
:.{    e# For each pair of bits, i1 and i2...
  1$   e#   Copy i1.
  =    e#   Check equality with i2.
  )    e#   Increment.
  ^    e#   Bitwise XOR.
  'A+  e#   Add to 'A'
}

An alternative solution with the same byte count which is decidedly less magical:

ri2bG0e[8/z2fb"CBAD"f=

And in case it's useful to anyone, if you turn the i1 and i2 bits back into a single number (i.e. when you want the mapping 0 -> 2, 1 -> 1, 2 -> 0, 3 -> 3) this can be computed even more easily as (~n - 1) & 3 or (~n - 1) % 4 if your language gets modulo on negative values right. I think this can be written concisely as 3&~-~n in many languages. In CJam this turns out to be a byte longer, because of the additional conversion back from base 2.


答:
Infinite Looping

If you want to loop a program infinitely, from index n, you can use n to jump behind the nth character. For example, this 34-byte, 12-char program for yes:

```<code>⏪sey⏪⏬⏩⏩
</code>```

Becomes this 32-byte, 11-char program:

```<code>sey⏪⏬⏩
</code>```

Title: Tips for golfing in Emotinomicon

Body:
Infinite Looping

If you want to loop a program infinitely, from index n, you can use n to jump behind the nth character. For example, this 34-byte, 12-char program for yes:

⏪sey⏪⏬⏩⏩

Becomes this 32-byte, 11-char program:

sey⏪⏬⏩


Title: Non-transitive dice game

Body:
Those of you who like Numberphile would be familiar with Dr. James Grime, who described a non-transitive dice game on his channel.

The game consists of three 6-faced dice:

Die 1: 3,3,3,3,3,6

Die 2: 2,2,2,5,5,5

Die 3: 1,4,4,4,4,4

Two players each select a die to use. They roll them and the higher die wins, best-of-whatever.

Probabilistically, die 1 beats dies 2 with >50% chance. Similarly, die 2 beats die 3, and, interestingly, die 3 beats die 1.

Write a program taking 1, 2 or 3 as input. This indicates the die the user chooses. The program then choose the die that would beat the user and output the results of 21 rolls, and "Computer/User wins with x points"

Rules

Code-golf, votes as tiebreaker

You must use RNG (or the likes) to actually simulate the dice rolls.

I am not too strict on output format. It's okay as long as you show the dices, somehow separate between the 21 rolls (in a way different from how you separate the dice in the same roll), and output that sentence above.

Input can be stdin, command line argument, from screen, etc.

Example

Input

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

Output

```<code>4 3
4 3
4 3
4 3
4 3
4 3
4 3
4 3
4 3
4 6
1 3
4 3
4 3
1 3
4 3
1 3
4 3
4 3
4 3
4 3
4 6
 Computer wins with 16 points
</code>```

Here, the user chooses die 1 and his rolls are shown on the right column. The program chooses die 3 and beats him.

Body:
R 206

u=scan()
D=list(c(rep(3,5),6),c(2,5),c(1,rep(4,5)))
S=sample
U=S(D[[u]],21,T)
C=S(D[[(u+1)%%3+1]],21,T)
print(cbind(U,C))
W=sum(U>C)
I=(W>10)+1
cat(c("Computer","User")[I],"wins with",c(21-W,W)[I],"points")


答:
Jelly, 14 bytes

```<code>d⁹+⁹BZḄḊị“BADC
</code>```

Try it online! or verify all test cases.

How it works

```<code>d⁹+⁹BZḄḊị“BADC  Main link. Argument: n

d⁹              Divmod 256; yield [n : 256, n % 256].
  +⁹            Add 256; yield [n : 256 + 256, n % 256 + 256].
    B           Binary; convert both integers to base 2.
     Z          Zip; group the quotient bits with corresponding remainder bits.
      Ḅ         Unbinary; convert from base 2 to integer.
       Ḋ        Dequeue; discard the first integer, which corresponds to the
                dummy value introduced by adding 256 to quotient and remainder.
        ị“BADC  Index into that string, mapping [1, 2, 3, 0] to "BADC".
</code>```

Title: Cheating a multiple choice test, part 2

Body:
Jelly, 14 bytes

d⁹+⁹BZḄḊị“BADC

Try it online! or verify all test cases.

How it works

d⁹+⁹BZḄḊị“BADC  Main link. Argument: n

d⁹              Divmod 256; yield [n : 256, n % 256].
  +⁹            Add 256; yield [n : 256 + 256, n % 256 + 256].
    B           Binary; convert both integers to base 2.
     Z          Zip; group the quotient bits with corresponding remainder bits.
      Ḅ         Unbinary; convert from base 2 to integer.
       Ḋ        Dequeue; discard the first integer, which corresponds to the
                dummy value introduced by adding 256 to quotient and remainder.
        ị“BADC  Index into that string, mapping [1, 2, 3, 0] to "BADC".


答:
JavaScript (ES6), <s>55</s> 48 bytes

f=(n,i=8)=>i--?"CBAD"[n>>i&1|n>>i+7&2]+f(n,i):''

console.log(f(14234)); // BCADBADA
console.log(f(38513)); // ABBDCAAB
console.log(f(0));     // CCCCCCCC
console.log(f(120));   // CBBBBCCC
console.log(f(65535)); // DDDDDDDD
console.log(f(39253)); // ABCDABCD```
</div>
</div>
</p>
<h3>Non-recursive version (55 bytes)</h3>
<p>Using a regular expression, we can do:</p>
<pre class="lang-js prettyprint-override"><code>n=>"76543210".replace(/./g,i=>"CBAD"[n>>i&1|n>>+i+7&2])
</code>```

Title: Cheating a multiple choice test, part 2

Body:
JavaScript (ES6), <s>55</s> 48 bytes

f=(n,i=8)=>i--?"CBAD"[n>>i&1|n>>i+7&2]+f(n,i):''

console.log(f(14234)); // BCADBADA
console.log(f(38513)); // ABBDCAAB
console.log(f(0));     // CCCCCCCC
console.log(f(120));   // CBBBBCCC
console.log(f(65535)); // DDDDDDDD
console.log(f(39253)); // ABCDABCD

Non-recursive version (55 bytes)

Using a regular expression, we can do:

n=>"76543210".replace(/./g,i=>"CBAD"[n>>i&1|n>>+i+7&2])


Title: Cheating a multiple choice test, part 2

Body:
Perl, 42 bytes

Includes +1 for -n

Give input on STDIN:

perl -nE 'say+(A..D)[2-($`>>8-$_&257)%127]for/$/..8' <<< 39253

Just the code:

say+(A..D)[2-($`>>8-$_&257)%127]for/$/..8


答:
Python 2, 53 bytes

f=lambda n,k=8:k*'_'and f(n/2,k-1)+'CBAD'[n>>7&2|n&1]
```

Test it on Ideone.

Title: Cheating a multiple choice test, part 2

Body:
Python 2, 53 bytes

f=lambda n,k=8:k*'_'and f(n/2,k-1)+'CBAD'[n>>7&2|n&1]

Test it on Ideone.


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

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

The Rules

Each submission must be a full program.

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

The program must not write anything to STDERR.

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

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

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

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

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

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

For inspiration, check the Hello World Collection.

The Catalogue

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

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

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

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

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

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

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

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

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

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

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

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

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

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

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

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

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

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

table thead {
  font-weight: bold;
}

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
CILOS, 43 bytes

```<code>int main(){__silos_print("Hello, World!");}
</code>```

CILOS is a subset of C99 compiling to SILOS.

Title: "Hello, World!"

Body:
CILOS, 43 bytes

int main(){__silos_print("Hello, World!");}

CILOS is a subset of C99 compiling to SILOS.


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

```

答:
Python, 33 bytes

```<code>lambda a:"Hello %s, I'm Python"%a
</code>```

Title: Introduce Your Language!

Body:
Python, 33 bytes

lambda a:"Hello %s, I'm Python"%a