[Question]
  [
Fed up with the reliability of flash storage, you decided to store all your programs on one of those good old 1,440 KiB floppies. However, after copying not even 3,000 programs, the disk was full. How's that even possible? Skilled in the art of code golf as you are, most of your programs aren't even 100 bytes long, so there should be plenty of room left...
After asking about it on Super User, you discover that you have been wronged by the file system's [cluster size](https://support.microsoft.com/en-us/kb/140365), an evil plot of the designers of [FAT12](https://en.wikipedia.org/wiki/File_Allocation_Table) that leaves a significant portion of your floppy unused and forces you to buy more than you actually need.
Buy more floppies? Never! Cluster size will be less of an issue if we simply save multiple programs in one file, which is possible because different compilers/interpreters will behave differently for the same source code.
### Task
Write a polyglot that fits in a single cluster (512 bytes or less) and solves as many of the following tasks as possible.
[string](/questions/tagged/string "show questions tagged 'string'")
1. Read all input and print it.
2. Print **Hello, World!**.
3. Read a line/argument (**name**) as input and print **Happy Birthday, [name]!**.
4. Read all input and print **I love tabs!** if it contains one or more tabulators (0x09) and **I hate spaces!** if it doesn't.
5. Read two lines/arguments and print a truthy value if the second is a substring of the first and a falsy value if not.
6. Read a line/argument and print a truthy value if its characters are in strictly ascending order and a falsy value if not.
7. Read a line/argument and a character and print the indexes of all occurrences of that character.
8. Read a line/argument and print any of the characters with the highest number of occurrences.
[math](/questions/tagged/math "show questions tagged 'math'")
9. Read two integers between **0** and **255** and print their sum.
10. Read a single integer between **0** and **255** and print the quotient and residue of its division by **7**.
11. Read a single integer between **1** and **255** and print a truthy value if it is a composite number (neither 1 nor prime) and a falsy value if not.
12. Read a single integer between **1** and **255** and print a truthy value if it is a power of 2 and a falsy value if not.
13. Read two integers between **0** and **255** and print the larger one.
14. Read a decimal integer between **0** and **255** print its hexadecimal representation.
15. Read a single integer between **0** and **255** and print its Hamming weight (number of 1-bits).
16. Read a single integer **n** between **1** and **13** and print the **Fn**, the **n**th [Fibonacci number](https://en.wikipedia.org/wiki/Fibonacci_number).
For example, for the input `13`, print `233`.
[ascii-art](/questions/tagged/ascii-art "show questions tagged 'ascii-art'")
17. Read a line/argument of input and frame it.
For example, for the input `Programming Puzzles & Code Golf`, print this:
```
+---------------------------------+
| Programming Puzzles & Code Golf |
+---------------------------------+
```
18. Read a rectangular block of characters and rotate it a quarter turn clockwise.
For example, for the input
```
 tye
 xll
 epb
 tma
  id
  sa
 s e
 i r
 hsn
 Tiu
```
print this:
```
 This  text
 is  simply
 unreadable
```
19. Read an integer between **1** and **40** and print a diamond of that side length.
For example, for the input `3`, print this:
```
   /\
  /  \
 /    \
 \    /
  \  /
   \/
```
20. Print this:
```
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 ....@@@@....@@@@....@@@@....@@@@
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
 @@@@....@@@@....@@@@....@@@@....
```
### Scoring
The answer that manages to incorporate the highest number of programs in a single file that fits in a single 512-byte cluster wins. Ties are broken by byte count (lower is better).
### Additional rules
* For each task you claim for your score, the same file (byte per byte) must constitute a full program – in a language of your choice – that solves this particular task.
* Each task has to be solved in a different language.
Languages count as different if they are not different versions of the same language. For example, there's only one JavaScript, one Python and one TI-BASIC, but C, C++, Octave and MATLAB are four different languages.
* The selected language for each task has to satisfy our usual definition of [programming language](http://meta.codegolf.stackexchange.com/a/2073).
In addition, the language must have been published and implemented before September 9, 2015.
* Your compiler/interpreter may not require any non-standard flags to produce the expected behavior.
Exceptions to this rule include flags required to specify a particular language, to read the program from a (single) file or to suppress a banner.
* The input for each task will consist of printable ASCII characters (0x20 to 0x7E), tabs (0x09), and linefeeds (0x0A), and it will not exceed **255** bytes in length.
* All *integers* can be read in decimal or unary, unless stated otherwise in the task.
* Behavior for invalid input is undefined.
* You may read input from STDIN (or its closest alternative) or as command-line arguments.
If a task requires reading two pieces of input, you can read them – in any order – separated by a one-byte delimiter of your choice, as separate command-line arguments or one from STDIN and the other as command-line argument.
If one of the input pieces is a line, the only possible delimiter is a linefeed.
* Print the output to STDOUT (or closest alternative). All output to STDERR will be ignored.
* For each task, standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply.
In particular, this includes the <http://meta.codegolf.stackexchange.com/q/1061>, with the exception of *hard-coding the output*, which is explicitly allowed for this challenge.
  
[Answer]
# ~~7~~ ~~8~~ ~~9~~ 10 languages, ~~398~~ ~~431~~ ~~447~~ 507 bytes
This is probably the most I can fit in the current solution.
```
#if      + 0+0/*^",v  +- '[.,][[" ,yadhtrib yppaH"l?!;offf4+ + +0.0 +aa<*/
a=0--0;b=input();print(sorted(set(b))==list(b));[[""""                 ^ <
print("Hello, World!")--[[vv? +<
#endif/*  >.!0 + +1ffr"!"~< */
#include<stdio.h>/*>:1 +?!^>i:1^*/
int main(){int a=1,b=1,c,i;scanf("%d",&i);if(1//**/1==2
){printf("%x",/*>&:7/.7%.@*/i);}else{for(;--i-1>0;a=b,b=c)c=a +b;printf("%d",b);}}/*]]--"""]];#@;_J + + \+*\-hhlz \+s[\|dzd\|)J "` + +,*.]]]*/SSSTNSSNSNSTNTTTTTSSSTNSNSTNTTTTTTSSTNTTSNSSNNSSSNTTTTNSTNNNN
```
The last line contains Whitespace code encoded so that SE doesn't eat it. To run the code, replace all `S` with spaces, `T` with tabs and `N` with newlines.
## C89, task 16
Here's what the compiler sees:
```
int main(){int a=1,b=1,c,i;scanf("%d",&i);if(1/ 1==2
){printf("%x",i);}else{for(;--i-1>0;a=b,b=c)c=a+b;printf("%d",b);}}
```
Everything else is stripped as comments or inside the `#if 0`.
## C++, task 14
I used a trick stolen from [here](https://codegolf.stackexchange.com/a/55989/30164) to differentiate between C89 and C++.
```
int main(){int a=1,b=1,c,i;scanf("%d",&i);if(1
){printf("%x",i);}else{for(;--i-1>0;a=b,b=c)c=a+b;printf("%d",b);}}
```
## Lua, task 2
Here's the basic structure.
```
#comment
a=0--comment
print("Hello, World!")--[[
... multiline comment ...
]]--comment
```
## Brainfuck, task 1
I just had to ensure no infinite loops or stray `.,`s are found. Lua's multiline comments also double as BF comments. Everything apart from the first 2 characters is a large NOP loop.
```
++,+-[.,][[,+++.+<--[[<,--[[+<>.++<<.>>+>,,,,,>..--->,+,]]--]]+++-+[++,.]]]
```
## Python, task 6
Again, I'm using language-specific features to NOP or comment out the other code.
```
#comment
a=0--0;b=input();print(sorted(b)==list(b));[["""
... multiline string ...
"""]];#comment
```
## Pyth, task 17
Pyth is nice for this thing. It takes the first `#` as a `while True:` loop *that exits silently on error*. So, I just make most of the code a string (as to avoid `;`s ending the loop early), then just end the loop, exit another created by the Python comment and do the task. Here's it with all non-empty strings replaced with `" string "`, it's still functionally equivalent:
```
#if      + 0+0/*^" string " ,yadhtrib yppaH" string """" string "Hello, World!" string "!"  string "%d"  string "%x" string "%d" string """]];#@;_J + + \+*\-hhlz \+s[\|dzd\|)J " string
```
## ><>, task 3
This one is very interesting. The execution bounces around in the code, using jumps where necessary to get around obstacles. The relevant parts:
```
#                  v            " ,yadhtrib yppaH"l?!;offf4+ + +0.0 +aa<*/
                   i                                                   ^ <
                   !      vv? +<
          >.!0 + +1ffr"!"~<
                   >:1 +?!^>i:1^
```
## [Starry](http://esolangs.org/wiki/Starry), task 9
Here I had to start going into the "discard all characters except " languages. Anything else stripped out, it looks like:
```
      + +*,  + '., , + + +. +*                  ,  +*  . + + *.* +*  ,,,,**,*..*, +,* + + +* + ` + +,*.*
```
The code skips most of the punctuation with a jump to avoid a hard time, just using the start and end of the code. The code is functionally equivalent to
```
      + +*,  + + +,*.*
```
## Befunge-98, task 10
Works similarly to the ><> one. Luckily, `#` is a mirror in ><> and a skip in Befunge, so we can implement different behavior. Also, `0/0 == 0`.
```
#if      + 0+0/*^
                >&:7/.7%.@
```
## [Whitespace](http://esolangs.org/wiki/Whitespace), task 13
This was the last thing I fit in. The first few lines are just pushing zeroes onto the stack, as they only contain spaces and newlines from the "normal" code. The code is encoded; replace all `S` with space, `T` with tabs and `N` with newlines.
```
SSSSSSSSSSSSSSSN
SSSSSSSSSSSSSSSSSSN
SSN
SSSSSN
SN
SSN
SSSSSSSSSSSTN
SSN
SN
STN
TTTTTSSSTN
SN
STN
TTTTTTSSTN
TTSN
SSN
N
SSSN
TTTTN
STN
N
N
```
[Answer]
# 12 languages, 418 bytes
```
"1\"# &&+.@\""" "" "
#=
''''
<<s
""'("']0=~2base{+}*}
 ?
 :_7/!\_7%!@
"
R"Happy Birthday, "[?S"!"*"
>0[0>i:0(?v:{)?v0n;\!/
$'main';n1< .95<
 \@-[I love tabs!]o#
  \ >qi---@
( @-[ ]e<''';print hex(
input())#-[I hate spaces!]o#"]];ri:X{_~X+S*'/@S*_'\4$N}%_sW%1>"))?(!?)
'''=#print(([1 1;1 0]^int(readline()))[1,2])
#=
Tr is here.
>Tr, Hello, World!
>X Tr
s
l=gets
a='+-'+?-*~/$/+'-+'
puts a+'
| %s |
'%l+a#=#.91<0#'''#";
```
This is a fun challenge. It's getting hard to fit more languages in, but with this many bytes left I could probably do about one more.
Makes gratuitous use of 2D languages. Note that the char on between the `[ ]` on the `@-[ ]e<` line is a tab. Also, this requires `\n` line endings for TRANSCRIPT to work.
## [Prelude](http://esolangs.org/wiki/Prelude) (Task 1 / Cat)
```
( 
      )?(!?)
```
`?(!?)` is just a direct translation of `,[.,]` in BF. Prelude `()` loops act like BF `[]` loops, so everything from the `(` in the leftmost column to the `)` before the core program is unexecuted.
Prelude's syntax rules mean that parentheses need to be matched (reading left-to-right column-wise), and there can only be one parenthesis per column. Other than that, it's a pretty easy language to fit in.
Make sure `NUMERIC_OUTPUT` is set to `False` if you're using the Python interpreter.
## [TRANSCRIPT](https://esolangs.org/wiki/TRANSCRIPT) (Task 2 / Hello world)
```
Tr is here.
>Tr, Hello, World!
>X Tr
```
TRANSCRIPT is a thematic esolang based on interactive fiction. Lines not recognised by TRANSCRIPT are ignored, making it easy to fit in.
`Tr is here.` declares a `Tr` string variable, and the second line sets the contents of the variable to `Hello, World!`. `X Tr` (`X` for examine) then outputs the string.
Although TRANSCRIPT is very easy to fit in, it's a pretty verbose language, so I made it take the easiest challenge.
## [Fission](http://esolangs.org/wiki/Fission) (Task 3 / Birthday message)
```
R"Happy Birthday, "[?S"!"*
                   \!/
```
which prints the first part, cats the input with a small 2D loop, then outputs the trailing exclamation mark. The `R` signifies that an atom starts here moving rightward, which is useful because this program can be moved around anywhere.
## [Rail](http://esolangs.org/wiki/Rail) (Task 4 / Tabs)
```
$'main'
 \@-[I love tabs!]o#
  \ >qi---@
  @-[ ]e<
         -[I hate spaces!]o#
```
Like Fission, Rail is a 2D language which has the advantage of being able to be moved around anywhere. Execution starts from the `$` of the `main` function, heading southeast.
First we head down the `\`s, turn left at `-`, hitting `[<tab>]` which pushes a tab. `e<` then branches based on EOF – if EOF, we head down and print `"I hate spaces!"` before halting, else we head up. If we headed upwards, we read the next char and compare it with the tab, once again branching – if tab, head up and print `"I love tabs!"` before halting, else head down and continue the input loop.
This program is pretty expensive, but since TRANSCRIPT took Hello World it was hard to pick and appropriate task for Rail.
## [><>](http://esolangs.org/wiki/Fish) (Task 6 / Ascending input)
```
"1\"#      \""" "" "
>0[0>i:0(?v:{)?v0n;
       ;n1< .95<
        .91<
```
Prints `1` if strictly ascending, `0` otherwise.
><> is another 2D language, and execution starts from the top left. `"..."` is string mode, pushing the inner chars one at a time. After the first string we hit `#`, which reflects the IP leftward, pushing more strings and wrapping around (><> is toroidal) before hitting `\`, a mirror which reflects us upwards.
At the bottom of the program is `.91<`, which teleports us to `(9, 1)`, where the core program is. After this `0[` removes all the junk from the strings, `0` pushes a zero to represent the last char read, and after this it's just reading chars one at a time, making sure we're still ascending.
It's probably better to move the core program down instead of teleporting, but I'll deal with that later if necessary.
## Befunge (Task 9 / Addition)
```
"1\"# &&+.@
```
Tested with the interpreter found [here](https://github.com/TieSoul/Multilang). This is a pretty straightforward program, with the start pushing a useless string and `#` jumping over the space. After that it's just the core program `&&+.@`.
## [Labyrinth](http://esolangs.org/wiki/Labyrinth) (Task 10 / Divmod by 7)
```
"1
 =
 '
 <
""'("']
 ?
 :_7/!\_7%!@
```
Conveniently, `'` and `"` are NOPs in Labyrinth which act like a walkable path in the maze. I'll skip the messy navigation, but basically there's a lot of turning and wandering around going on before we hit the `?`, which is the start of the core program.
The program is not quite flush left to account for Prelude (e.g. `?` is read input in Prelude).
## Python 2 (Task 14 / Hexadecimal)
```
"1\"# &&+.@\""" "" "
#=
''''
xxx
xxx''';print hex(
input())#xxx
'''
xxx
xxx'''#";
```
The `xxx`s represent irrelevant portions commented out by multiline strings or comments. In between is `print hex(input())`, the core progam. This outputs with a leading `0x`, but I'm assuming that's okay (if not, then it's an easy fix anyway).
The first line is a string `"1\"# &&+.@\""` followed by two `" "`s. These three strings are concatenated by the parser, and left unused (this first line works similarly for Ruby and Julia later).
## GolfScript (Task 15 / Hamming weight)
```
"1\"# &&+.@\""" "" "
#=
''''
<<s
""'("']0=~2base{+}*}
```
The first line pushes three strings, and the second line is a comment. `''''` pushes two more strings, then `<<` does two comparisons (`s` is ignored). Finally, `""'("'` pushes another two strings.
All of this is junk is then removed by wrapping it in an array and getting the first element (`]0=`), which is the input initially on the stack. We then evaluate the input with `~`, turn into binary with `2base` then sum the bits with `{+}*`. The next `}` is unmatched, and super-comments the rest of the program.
## Julia (Task 16, Fibonacci)
```
"1\"# &&+.@\""" "" "
#=
xxx
xxx=#print(([1 1;1 0]^int(readline()))[1,2])
#=
xxx
xxx=#.91<0#xxx
```
`#=` starts a multiline comment and `=#` ends a multiline comment. The core program uses matrix exponentiation to calculate Fibonacci numbers (taken from [Rosetta](http://rosettacode.org/wiki/Fibonacci_numbers#Julia)).
## Ruby (Task 17 / ASCII frame)
```
"1\"# &&+.@\""" "" "
#=
''''
<<s
xxx
s
l=gets
a='+-'+?-*~/$/+'-+'
puts a+'
| %s |
'%l+a#xxx
```
This program assumes that the input does not end with a trailing newline.
We have a useless string, a comment, another useless string then a heredoc which comments out most of the program. After that is the core program, followed by a single line `#` comment.
## CJam (Task 19 / Diamond)
```
"1\"# &&+.@\""" "" "
#=
''''
<<s
""'("xxx
"
R"xxx"[?S"!"*"
xxx
xxx"ri:X{_~X+S*'/@S*_'\4$N}%_sW%1>"xxx
xxx
xxx";
```
The two space strings at the end of the first line are to satisfy CJam, since `#=` are two binary operators. I won't go into too much detail with this one, but basically it's a mess, with the core program being the mere
```
ri:X{_~X+S*'/@S*_'\4$N}%_sW%1>
```
in between.
The key differentiator between GolfScript and CJam is that, in CJam, a single quote `'` doesn't start and end strings, but instead pushes the next character to the stack. This means that in CJam
```
'("'
```
pushes a `(` then starts a string with `"` (the first char of which is `'`), whereas the above is just a straight single string in GolfScript.
[Try it online](http://cjam.aditsu.net/#code=%221%5C%22%23%20%26%26%2B.%40%5C%22%22%22%20%22%22%20%22%0A%23%3D%0A''''%0A%3C%3Cs%0A%22%22'%28%22'%5D0%3D~2base%7B%2B%7D*%7D%0A%20%3F%0A%20%3A_7%2F!%5C_7%25!%40%0A%22%0AR%22Happy%20Birthday%2C%20%22%5B%3FS%22!%22*%22%0A%3E0%5B0%3Ei%3A0%28%3Fv%3A%7B%29%3Fv0n%3B%5C!%2F%0A%24'main'%3Bn1%3C%20.95%3C%0A%20%5C%40-%5BI%20love%20tabs!%5Do%23%0A%20%20%5C%20%3Eqi---%40%0A%28%20%40-%5B%20%5De%3C'''%3Bprint%20hex%28%0Ainput%28%29%29%23-%5BI%20hate%20spaces!%5Do%23%22%5D%5D%3Bri%3AX%7B_~X%2BS*'%2F%40S*_'%5C4%24N%7D%25_sW%251%3E%22%29%29%3F%28!%3F%29%0A'''%3D%23print%28%28%5B1%201%3B1%200%5D%5Eint%28readline%28%29%29%29%5B1%2C2%5D%29%0A%23%3D%0ATr%20is%20here.%0A%3ETr%2C%20Hello%2C%20World!%0A%3EX%20Tr%0As%0Al%3Dgets%0Aa%3D'%2B-'%2B%3F-*~%2F%24%2F%2B'-%2B'%0Aputs%20a%2B'%0A%7C%20%25s%20%7C%0A'%25l%2Ba%23%3D%23.91%3C0%23'''%23%22%3B&input=3). `1>` is used instead of `(` to account for Prelude.
---
Here's **12 languages, 373 bytes**. Some tasks have moved around, TRANSCRIPT has been removed (it made Rail too expensive) and Scheme (chicken) has been added. This is just my golfing ground for to-be updates since updating the main post takes forever.
```
"1\"09!#.&&+.@"" "" "#|"
#=
''''
<<s
11]0=~2base{+}*}
 ?
 :_7/!\_7%!@
"
R"Happy Birthday, "[?S"!"*"
>0[0>i:0(?v:{)?v0n;\!/
$'main';n1< .95<
(-[Hello, World!]o#''';print(input()in input());'''"]];ri:X{_~X+S*'/@S*_'\4$N}%_sW%1>"=#print(([1 1;1 0]^int(readline()))[1,2])#=)?(!?)
s
l=gets
a='+-'+?-*~/$/+'-+'
puts a+'
| %s |
'%l+a# =##'''#";e# |#(print(format"~x"(eval(read))))
```
I could save a few bytes for Julia since unterminated multiline comments raise an error to STDERR.
[Answer]
# 17 different versions of Pip, 383 bytes (invalid)
While this question was sandboxed, I combed through all the revisions of [my language Pip](http://github.com/dloscutoff/pip) and came up with a polyglot using 17 of them. Sadly, versions of the same language are disallowed by the challenge rules now, but with Dennis's permission and a disclaimer I'm posting my work anyway.
### The raw code
```
I!ga:0m@0:0v:uIN[(oTM0,0i)EN1N1Y1RCkw(hR`1.+0``&2o`)@>3@AB0`u`rZ4AB6({a}V7)BN8AZ9@m]Iv<2W##YqlPByc:((J['.'@]X4)X4RL3)Jnc.:n.RVcc:cRL4|0Iv=3{d:sXaRLaFj,ad@j@j:'\d:(RVdR'\'/).d|0dJ:n}m:'+.'-X#a+2.'+.n."| "Iv=5La{i+:oSio}j:ak:bPv=11?a>1&0INa%(2,a)[((J_M ZRVl)|0)Jnl?lJnlcJnd.n.RVdm.a.RVmih:$+TBa({j@aEQk}FI0,#a).saTB16a>b?abh=1ua//7.s.a%7a+bbINa"Happy Birthday, ".a.'!"Hello, World!"]@v
```
### The strategy
In Pip, lowercase letters are variables. Uppercase letters are more complicated: they are broken into runs of at most two characters, which can be operators or variables. If an uppercase token isn't specifically defined as a variable or operator, it is assumed to be an undefined variable, which evaluates to nil.
So, to distinguish between two versions of Pip, I just have to find some variable or alphabetic operator that was added in the newer of the two. In the older one, it will be nil instead. The code `v:uIN[...]` puts together a big list containing one of these checks for each version I want to test, finds out how many nils are in that list (the `u` variable is explicitly initialized to nil), and stores the number in `v` (for "version").
After some other calculations, there's another big list that calculates the results for 17 of the tasks from the challenge and uses `v` to select one based on what version this is.
### Versions and tasks
**[0.15.09.04](https://github.com/dloscutoff/pip/commit/e48d5b489232eabb02e6ad4286d1c3bdd40a861d)**
Diagnostic: `(oTM0,0i)` (fixed a bug with `T`ri`M` operator where trimming 0 characters from each end of a string would give the empty string instead; indexing into empty string gives nil)
Task 18: `Iv<2W##YqlPBy` (setup: read all lines from stdin if `v` is less than 2) followed by `((J_M ZRVl)|0)Jn` (reverse list of lines, transpose, and join back into string)
**[0.15.08.06](https://github.com/dloscutoff/pip/commit/70b627dba9335de5119162b64edc2402cc2eff60)**
Diagnostic: `EN1` (added `EN`umerate operator)
Task 1: `Iv<2W##YqlPBy` (same setup code as above) followed by `l?lJnl` (join on newlines)
**[0.15.08.03](https://github.com/dloscutoff/pip/commit/7509874d3d2a8f58fe4061cfd0c676c217c92d80)**
Diagnostic: `1N1` (added `N` as short version of `IN` operator)
Task 20: `c:((J['.'@]X4)X4RL3)Jnc.:n.RVcc:cRL4|0` (setup: generate list containing upper and lower halves of chessboard and store in `c`) followed by `cJn` (join on newline)
**[0.15.08.01](https://github.com/dloscutoff/pip/commit/0e071318c8562ead146b99b01e38e59763c53672)**
Diagnostic: `Y1` (added `Y`ank operator)
Task 19: `Iv=3{d:sXaRLaFj,ad@j@j:'\d:(RVdR'\'/).d|0dJ:n}` (setup: if `v` is 3, build top half of diamond in `d`) followed by `d.n.RVd` (reverse for bottom half and join on newline)
**[0.15.06.19](https://github.com/dloscutoff/pip/commit/915cec54915af23d18b453d2d954f57becd220c0)**
Diagnostic: `RCk` (added `R`andom `C`hoice operator)
Task 17: `m:'+.'-X#a+2.'+.n."| "` (setup: build `+----+\n|`  string in `m`) followed by `m.a.RVm` (wrap input in `m` and reverse of `m`)
**[0.15.06.12](https://github.com/dloscutoff/pip/commit/db31988953d0ec0fb288a4df84490af6d02c06f1)**
Diagnostic: `k` (preinitialized `k` variable to `", "`; previously it was undefined and thus nil)
Task 16: `Iv=5La{i+:oSio}` (if `v` is 5, generate Fibonacci number in `i`) followed by `i`
**[0.15.06.08](https://github.com/dloscutoff/pip/commit/cb19dfa7a0922af7c2314114f125000a432eec87)** (note: version number wasn't changed till the following commit)
Diagnostic: `w` (preinitialized `w` variable to ``\s+``)
Task 15: `h:$+TBa` (convert input to binary and sum digits; save result in `h` for task 12 later)
**[0.15.05.29](https://github.com/dloscutoff/pip/commit/063bf12392a59c64c129cfb973204b69a10f0b32)**
Diagnostic: `(hR`1.+0``&2o`)@>3@AB0`
This version added `&` as a replacement pattern for the whole matched string in a regex replacement (inspired by sed). The code above takes `h` (`100`) and replaces it with ``&2o`` (i.e. `"1002o"` in newer versions but simply `"&2o"` in older versions). It then slices all characters after the 3rd (`"2o"` in newer versions, `""` in older versions) and attempts to index into that string. Indexing into an empty string gives nil.
Task 7: `j:ak:b` (setup: copies local vars `a`,`b` to global vars `j`,`k` so they'll be available inside a function) followed by `({j@aEQk}FI0,#a).s` (filter for indices in `a` where the corresponding character equals `b`, and join on space)
**[0.15.05.26](https://github.com/dloscutoff/pip/commit/5d2b2bb483e0875ecd33182756e96635934d760f)**
Diagnostic: ``u`` (added Pattern type; in previous versions, backticks are ignored as unrecognized characters, and the expression evaluates to `u`, which is nil)
Task 14: `aTB16` (convert `T`o `B`ase 16)
**[0.15.05.24](https://github.com/dloscutoff/pip/commit/21af91f8b70bb243fd32a5c9299191e2dec5add6)**
Diagnostic: `rZ4` (created `r` special variable which returns a random value between 0 and 1 each time it is referenced; previously it was undefined and thus the expression evaluated to nil)
Task 13: `a>b?ab` (ternary expression)
**[0.15.05.12](https://github.com/dloscutoff/pip/commit/2379b057330204d4daedddd4abcc42d96097f3c1)**
Diagnostic: `rZ4` (added `Z`ip operator)
Task 12: `h=1` (sum of bits from task 15 must equal 1)
**[0.15.05.11](https://github.com/dloscutoff/pip/commit/5072cc90437ff0b60c0944d27db7b130783e5286)**
Diagnostic: `AB6` (added `AB`solute value operator)
Task 11: `Pv=11?a>1&0INa%(2,a)[...]@v` (if `v` is 11, output `1` if input is greater than 1 and a smaller number divides it exactly, `0` otherwise; if `v` is anything else, use `v` as an index to the list to decide what to output)
**[0.15.05.02](https://github.com/dloscutoff/pip/commit/c5f3d86b43e25a6fce38225fdfe4a1a0662bcc4a)**
Diagnostic: `({a}V7)` (added `V` operator; when `V` was undefined, this sent arguments nil and 7 to a function `{a}` that returns its first argument)
Task 10: `a//7.s.a%7` (input int-divided by 7 and mod 7, space-separated)
**[0.15.04.26](https://github.com/dloscutoff/pip/commit/1d329faace0f27e5dc334c04a9ed8c1c311484b8)**
Diagnostic: `BN8` (added `B`itwise `N`egation operator)
Task 9: `a+b`
**[0.15.04.23](https://github.com/dloscutoff/pip/commit/864df0b7c7e6e7d597c4da96df8bb72a78938c4c)**
Diagnostic: `AZ` (preinitialized `AZ` variable to uppercase alphabet)
Task 5: `bINa` (`IN` gives count of occurrences)
**[0.15.04.20](https://github.com/dloscutoff/pip/commit/16302f7494712a4efce79c46bcd7a8f923ecf784)**
Diagnostic: `m@0:0` followed by `9@m`
The `m` variable is preinitialized to 1000. In this commit, the `@` operator was fixed to return lvalues; previously, assigning to `m@0` gave a warning and did nothing. Thus, post-bugfix, the first statement sets `m` to `0000`, which is a legal index for `9`; pre-bugfix, `m` stays `1000`, which is not a legal index. (Indices were not yet cyclical.)
Task 3: `"Happy Birthday, ".a.'!`
**[0.15.04.18](https://github.com/dloscutoff/pip/commit/3058cb802bf12f9ffa07b0c000f391f214729c41)**
All previous diagnostics result in a nil being added to the diagnostic list.
Task 2: `"Hello, World!"`
---
Most of the other code is tweaks I had to make to avoid errors in various versions. This post is already far too long, so if you want to know about anything I haven't explained, let's take the discussion to the [esoteric languages chatroom](http://chat.stackexchange.com/rooms/27364/esoteric-programming-languages).
[Answer]
# ~~14~~ 15 languages, 487 bytes
### [brainfuck](https://github.com/TryItOnline/brainfuck), [Thue](https://esolangs.org/wiki/Thue), [Fission](https://github.com/C0deH4cker/Fission), [Rail](https://esolangs.org/wiki/Rail), [Perl](https://www.perl.org/), [><>](https://esolangs.org/wiki/Fish), [Surface](https://github.com/TryItOnline/surface), [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), [Gol><>](https://github.com/Sp3000/Golfish), [Befunge-93](https://github.com/catseye/Befunge-93), [Hexagony](https://github.com/m-ender/hexagony), [Python 3](https://docs.python.org/3/), [PingPong](https://github.com/graue/esofiles/tree/master/pingpong), [Cardinal](https://www.esolangs.org/wiki/Cardinal), [Ruby](https://www.ruby-lang.org/)
```
#\&v/,[.,][   	.hzPSIv?:<     
#!oan-2l.1*8=;?(1:i::< 
# :< /2_0#!x%x2$:_.#-@#1:
#>,>, 	\
#	o->+o				 
#/o?  </  			
#>:@	 	 	
 	 
		
#.....\?{?'-~^!@0!;J$?0J$ " ,yadhtriB yppaH"L  			
print	([]and(0and("#{a=$<.map(&:chars);a[-1].zip(*a).map{|z|z[1,10].reverse*''}*$/}")or"@{[1+index<>,<>]} ")or	0x0or'%x'%(0x0+int(input())))		
__DATA__=1 	
+1;"""
@.<x
v: %+v
>-\*<<
^?/~^
m::=~Hello, World!
::=
$'main'-\
@-[	]e</i-@
 x>qfq--[I hate spaces!]o
@-[I love tabs!]o
 '+`\@:+/=
2% ^/*;#\
]"""
```
Lots of 2D languages. I'm pretty sure I could fit at least ~~two~~ one more languages in here, but a few of the ones I was thinking of ended up being newer than 2015, plus this is fast approaching the size limit.
### 1. [brainfuck](https://github.com/TryItOnline/brainfuck)
This is a simple cat program on the first line, followed by wrapping most of the rest of the program in a non-executing loop to prevent anymore printing.
```
    ,[.,][
]
```
[Try it online!](https://tio.run/##JVHbbptAEH3e/YqBhYCB5eKnarmmykMc5aFSK/UBMF0bLKPaQDBBxI79687SnpGORmeO5qLZ9Lxudu/bv/c7yR5Gx0ptK08BANn784@fqzFmAczARGp5Q5cH2zO@hX6se6xmooYJCHaWhUukSZ2WCitsQhPiMUwiK7IAZZiglkZmiwSE32ljgMARIxASHpYgEIEF4VmwZ2TxJdbobS0lruS/KLH7ooAM1gcv90Nff4ePruPP8uv/Hl1fNwPS05w3pe7OJJMLD5XAPvJOf2DbPe9PC5@n1Mvtc93pBl/Mpcvn@fOcepbn5nZfjVV/qgxNuxqKc5UXbS8nl9Qz66aspiCygii/wiwjd3LbXlMnTdVFKgyDXjfd@6AvBMQ6RfH0@OuxKEJPXGV6vizLOLGDCY8MVHPEEc2MIMDr2Lmt8ZGx8PZcHQ6tBb/b/lBKWChY0Y7iLxrNcEJTlFeBU9MEwxS97d4oTVew50MFp45vq5OUt7NrBYd2rGDgm38KaOafLGGmE@KlCmvH8EmGc7HL/c4327LafQE "brainfuck – Try It Online")
### 2. [Thue](https://esolangs.org/wiki/Thue)
This executes the lines with `::=` towards the end of the program, ignoring any other lines. This simply looks for any `m`s in the rest of the program after `::=` and prints "Hello, World!" for each of them.
```
m::=~Hello, World!
::=
  m
```
[Try it online!](https://tio.run/##JU/LjptAEDzPfEXDwIKB4eFTNDw3ymG9yiFSIuUAmEzWRCBhhsUsYu21f90Zkmqp1KoudVdPzVt9v5PiYfac3HXKHACQ25y/fd/NKYtgBSaK4D3ddm5gfYrD1AxYy@QME5DsbSufKIu@bDVWuYRmJGCYJE7iACowQYImtkAS0u@JFCDy5AmEpIdlCGRhSXgV3BVFekkNetsrma@Ez1rqP2uggvPOD800tp/hfRj4k/r1/45hbPsJmXnJ@4Ppr6SSC4@1yD3ywXxgLw0fT5uQ5zQo3XM7mBbfrKPLx/njnAdO4JfuWM/1eKotw7hamndVN2JUs0se2G1/qJcocaKkvMIqI3/xxWjoi6GbspWGyWz74W0yNxIyTlV9efzxWFVxIL@yg1BVVZy50YJnBro944QWVhThferd9vjIWHx7qrtOOPBTjN1BwVLBmnHkbW/QAmc0R2UdeS3NMCzJ659XSvMdNHyq4TTwl/qklGJ17aATcw0T//1PAcP@VWTM9mK81WHvWSEpcCmz3O9/AQ "Thue – Try It Online")
### 3. [Fission](https://github.com/C0deH4cker/Fission)
This starts execution from the `L` on the tenth line (it also starts from the `D` in `__DATA__`, but we immediately kill that). This first prints "Happy Birthday, ", then does a cat program.
```
#0!;J$?0J$ " ,yadhtriB yppaH"L
```
[Try it online!](https://tio.run/##JU9Nb5tAED2zv2JgIWBg@fCpWj5T5RBHPURqpR4A021M5JVslgBBxI79190lfSM9jd48zbx55cPARXu74fJu8t3Cc6sCABRvf3r@uZkyGsMChFXBWrI@eKH9LYkyK6ScyhnCINlf1wFWZ2Ne67T2MMlxSBFO3dQFpURYESR1hCIh/b7IAGJfnlAU6aG5ArKQJLQI3oIyO2cmuW7VPFCjJz0LnnTQwP1gu/3Y8@/w0XXsUfvxf0fX83ZUrKJi7c4KFtLwmSV67B1ZZ93Rlz3rh1XEChJW3ol3ls1Wy@j8efo8FaEbBpXXN1PTD41tmhdb9y/aSvRafi5Ch7e7Zo5TN06rCyyyEsyB6E1jNg1LttIwWrzt3kdrJSHj1PXD/a/7uk5C@ZUTRpqmodyLZzRRMJwJpaS04xhtM/@6RUdKk@tjczgIF36L/rBTkVSQbh4Zb01SopwUStXEPic5gjl9e30jpNjAno0NDB17aQa1EotrAwcxNTCyv18KmM6fMqeOn6C1AVvfjnCJKpnldnto2pYP/wA "Fission – Try It Online")
### 4. [Rail](https://esolangs.org/wiki/Rail)
This starts from the line that starts with `$'main'`. This is essentially a golfed version of [SP3000's Rail](https://codegolf.stackexchange.com/a/58152/76162) program, compressed to four lines and about 15 bytes shorter. It essentially has the same logic, but crosses over itself a couple extra times.
```
$'main'-\
@-[ ]e</i-@
  >qfq--[I hate spaces!]o
@-[I love tabs!]o
```
[Try it online!](https://tio.run/##JU9db5tAEHy@@xULBwEDx4efqgMDqfoQR32I1Ep9AEwvhspImCOYImLH/uvukc5Ko9XsaHd24E17v5P8YfKczHWKDACQezi//NhOCYtgASaK4B1dt25gfdmEiRmwhskZJiDZW5c@UWZ9XmusdAlNScAwiZ3YAZRjggSNbYEkpN8TCUDkyRMISQ9LEcjCkvAiuAvy5JIY9LZTUl8Jn7XEf9ZABeedV4dxaL7Ce9/zJ/X7/x390HQjMrOCd5XpL6SSC99okXvkvfnA9gc@nFYhz2hQuOemNy2@WkaXj/PHOQucwC/coZ7q4VRbhnG1NO@qrsSgppcssJuuqucodqK4uMIiI3/2xWDos6GbspWG0Wy6/u9oriRknLL89vjzsSw3gfzKDkJVVXHqRjOeGOj2hGOaW1GEd4l32@EjY5vbU922woFfYmgrBUsFa8aRN51Bc5zSDBV15DU0xTDHb3/eKM22cOBjDaee7@uTUojFtYVWTDWM/PVTAcP@nafM9jZ4rcPOs0KS40Jmud/5K9pX/wA "Rail – Try It Online")
### 5. [Perl](https://www.perl.org/)
This is part of a smaller polyglot with Python and Ruby. Generally, `[]` is truthy in Perl and Ruby but not Python, and `0` is truthy in Ruby but not Perl. This checks the index of one input in another, and adds one to the result to make it 0 for falsey and a positive number for truthy. This is enclosed in a string interpolation to avoid syntax errors with Ruby and Python. We also have the `__DATA__=1` line to prevent it from parsing further than that.
```
print "@{[1+index<>,<>]} "
```
[Try it online!](https://tio.run/##JU9db5tAEHzmfsXCQcDA8WGpUnV8pupDHPUhUiv1ATA9m6uMhIFggogd@6@7RzorjVazo93Zng/Nl/sd5w@Ta2eOXWQAIDmH88vPzZTQEBYgLHesJevG8c2vUZAYPq2pmCEMgt116WF51ua1SksHkxT7FOHYjm2QcoSljsRWJwkIv9slAKErTkiS8NBUAlFIEFoEZ0GeXBKd3LZy6snBs5p4zyooYL@z6jAO9Td473v2pPz4v6Mf6naUjKxgbWV4Cyn4wiI1dI6sNx7o/sCG0ypgGfEL51z3hslWy@jycf44Z77te4Uz8IkPJ27q@tVU3auy6gYlvWS@VbcVn8PYDuPiCossebPXDbo265ohWmEYjbrt30ZjJSDilOX3x1@PZRn54ivLDxRFQakTzmiioFkTikluhiHaJu5ti46URrcn3jSdDb@7oalkJBSk6kdWtzrJUUoyqeChW5MUwRy//n0lJNvAgY0cTj3b85NcdItrA003cRjZ7lMB3fqTp9RyI7TWYOuaAc5RIbLc72y3r9Bu/w8 "Perl 5 – Try It Online")
###  ~~6:~~
### 7: [><>](https://esolangs.org/wiki/Fish)
This takes input of the character through the command line and the string through STDIN. This first reflects of the first `#`, then uses `v?:` to distinguish between this and Gol><>. This goes down to the second line and loops over the input, checking each character against the command argument, printing the stack height if so.
```
#                    v?:<
 !oan-2l.1*8=;?(1:i::< 
```
[Try it online!](https://tio.run/##JU/LjptAEDzPfEXzWjAwPHyKhudGOaxXOURKpBwAk1mbFUg2wwKLWHvtXydDUi2VWtWl7urXZqiXRckfJtfOHLvIAAA59eXHz92U0BBWYEXirCXbk@ObX6IgMXzaUDHDCgh2t6WnSLM2b1VaOgpJFZ9iJbZjG1COFcRJbHEkIPwuTwBCV5xASHhoikAUFoRXwVmRJ9dEJ/e9lHpS8Kwm3rMKMtgf7FiPffMVPrqOPcnf/@/o@qYdkZEVrD0a3kqycmWRGjpn1hkP9FCzftgELCN@4VyazjDZZh1dPy@fl8y3fa9w@mqq@qEydf1mqu5N3vBeTq@ZbzXtsZrD2A7j4garjLzZ472uzbpmiFYYRqNpu/fR2AiIOGX57fHXY1lGvvjK8gNZlnHqhDOeKGjWhGOSm2GI94l73@MzpdH9qTqduA2/eX86SlgoWNXPrGl1kuOUZKioQrchKYY5fnt9IyTbQc3GCoaOHapBKvjq2sGJTxWM7OWfArr1J0@p5UZ4q8HeNQMlx4XIsizs5cAWMrC/ "><> – Try It Online")
###  ~~8.~~
### 9. [Surface](https://github.com/TryItOnline/surface)
Surface is a 2D language ignoring characters it doesn't recognise. It reflects off the `\` and reads the input numbers into two cells with `>,>,`. Next it enters a loop, decrementing one number and incrementing the other, exiting once one reaches zero. Finally it prints the resulting cell as number.
```
 \
 >,>,  \
  o->+o
 /o?  </
 >:@
```
[Try it online!](https://tio.run/##JVFNb5tAED3v/oqBhYCB5cPqoV0wkKiHOOqhUiv1AJhuYyIjYZYAQcSO/dfdpX0jPY3ePM2HZnjrX/hzdbuR/G7ynMx1igwAkHs4ff@xnRIWwQJMFMFbum7cwPq8CRMzYDWTNUxAsrcufaLM@rzWWOkSmpKAYRI7sQMoxwQJGtsCSUi/JxKAyJMjEJIeliKQgSXhRXAX5Mk5Meh1p6S@Ej5pif@kgQrOO98fxr5@gPeu44/qt/89ur5uR2RmBW/3pr@QSs58o0XukXfmHXs@8H5YhTyjQeGe6s60@GopnT9OH6cscAK/cPtqqvqhsgzjYmneRV2JXk3PWWDX7b6ao9iJ4uICi4z82Re9oc@GbspUGkazbru30VxJyHXK8uv9z/uy3ATyKjsIVVXFqRvNeGKg2xOOaW5FEd4l3nWHj4xtro9V0wgHfom@2StYKlgzjrxuDZrjlGaoqCKvpimGOX59eaU028KBjxUMnXzcoBRicW2hEVMFI//zTwHD/p2nzPY2eK3DzrNCkuNC7nK7fcJf/gI "Surface – Try It Online")
### 10. [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php)
This one is rather hard to see, but it essentially executes the instructions:
```
push 32  (SSSTSSSSSL)
dup      (SLS)
dup      (SLS)
readi    (TLTT) (saves to heap at 32)
retrieve (TTT) (retrieves from 32)
dup      (SLS)
push 7   (SSSTTTL)
div      (TSTS)
printi   (TLST)
swap     (SLT)
printc   (TLSS)
push 7   (SSSTTTL)
mod      (TSTT)
printi   (TLST)
```
[Try it online!](https://tio.run/##JVHbbptAEH3e/YrhFjCwXKxWqhYMpOpDHPWhUiv1ATDdxluBhFmCCSV27F93l/SMdDQ6czQXzd@6GfmxZ0/8dtOKu8l3c88tcwBAXn369n07pTSGBVhTBOvIuvVC@9MmSq2QNlTWsAaS/XUVaMpszGudVp5GMi2kWEvcxAVUYA0JkjgCSUi/L1KA2JcjEJIemiGQgSXhRfAWFOk5Ncl1p2SBEj3qafCogwruK9vX49B8hte@Zw/q1/89@qHpRmTlJev2VrCQqp3ZRo@9A@utO/pUs@G4ilhOwtI7Nb1ls9VSOr@d3k556IZB6Q184sOR26Z5sXX/oq7EoGbnPHSabs/nOHHjpLzAIqNgDsRgGrNpWDKVhtFquv5ltFYScp2q@nL/476qNqG8ygkjVVVx5sUznigYzoQTUthxjHepf93hA6Wb6wNvW@HCTzG0ewVLBevmgTWdSQqckRyVPPYbkmGYk@c/z4TkW6jZyOH9cUelFItrC62YOIzs97sCpvOryKjjb/DagJ1vR1qBS7nL7fbh4z8 "Whitespace – Try It Online")
### 11. [Gol><>](https://github.com/Sp3000/Golfish)
This follows a similar path to ><>, diverging at the behaviour of `?:`, since popping the stack results in `0`. It then executes read input as number (`I`), is it prime (`SP`), is it zero (`z`), halt and output (`h`).
```
#              hzPSI ?:<
```
[Try it online!](https://tio.run/##JU9Nb5tAED2zv2JgIWBg@TpVy2eqHOIoh0qt1ANguo1JQcIswQQRO/Zfd5f2jfQ0evM08@YP717bY3O74eJudu3cscscACSnOX37vp1TGsEKhGXOehJ0jm9@icPU8GlLxQxhEOwGlYflRVsClVYOJhn2KcKJndggFQhLnCQWlwSE3@UpQOSKE5IkPDSTQBQShFbBWVGk51Qn152ceXL4pKbekwoK2B9s30xj@xU@hoE9Ks//dwxj20@SkZes3xveSgo@s1iNnAMbjDv60rDxuAlZTvzSObWDYbLNOjp/nj5PuW/7XumM9VyPx9rU9Yupuhdlw0clO@e@1fb7eokSO0rKC6yy5C0eH3Vt0TVDtMIwGW0/vE/GRkDEqaqH@x/3VRX74ivLDxVFQZkTLWimoFkzSkhhRhHape51hw6UxtfHuuu4DT/52O1lJBSk6gfW9jopUEZyqawjtyUZgiV5e30jJN9Cw6YajgN7qY9yyVfXFjo@1zCx3/8U0K1fRUYtN0aBBjvXDHGBSpHldvODvw "Gol><> – Try It Online")
### 12. [Befunge-93](https://github.com/catseye/Befunge-93)
This interprets `#` as a skip instead of a reflect, taking input (`&`) and going down at the `v` then to the third line. This interpreter ignores invalid characters, skipping past the `a` and the pair of `x`s later. This divides the input by two until either it is odd or it is one, and then outputs accordingly (I could probably simplify this check couldn't I?).
```
# &v   
# :< /2_0#! % 2$:_.#-@#1:
```
[Try it online!](https://tio.run/##JU/bbptAEH3e/YrhFjCwXPwULddUfYijPlRqpT4Appt4UyNhlmCCiB37192lPSMdjc4czZx55q/v3R9@u2nl3eS7hedWBQAgb3/6/mMzZTSGBVhTBOvIuvVC@z6JMiukDZUzrIFkf10HmjIb81qntaeRXAsp1lI3dQGVWEOCpI5AEtLviwwg9uUJhKSH5ghkYUl4EbwFZXbOTHLdKnmgRE96FjzpoIL7wXb7cWi@wEffs0f12/8d/dB0I7KKinU7K1hI1c4s0WPvwHrrjr7s2XBcRawgYeWdmt6y2WoZnT9Pn6cidMOg8gY@8eHIbdO82Lp/UVdiUPNzETpNt@NznLpxWl1gkVEwB2Iwjdk0LNlKw2g1Xf8@WisJGaeuvz78fKjrJJRfOWGkqirOvXjGEwXDmXBKSjuO8Tbzr1t8oDS5PvK2FS78EkO7U7BUsG4eWNOZpMQ5KVDFY78hOYY5fXt9I6TYwJ6NHI49e@FHpRKLawOtmDiM7PmfAqbzu8yp4yd4bcDWtyOtxJXMcrvd/wU "Befunge-93 – Try It Online")
### 13. [Hexagony](https://github.com/m-ender/hexagony)
Hexagony has a strange path, with the second character being a `\`, but it eventually ends up at after the `.....` on the tenth line. Here it gets the inputs into adjacent edges (`?{?`), then subtracts one from the other (`'-~`), and then navigates based on whether that is negative, printing the larger one and terminating (`^!@`). Note that Hexagony appears to have a bug where a number cannot be the first input without a space before it.
```
 \
          \?{?'-~^!@
```
[Try it online!](https://tio.run/##JU/LjptAEDzPfEXzWjAwPBwpiobnRjmsVzlESqQcAJPJehKQbIbFBGF77V93hqRaKrWqS93VDZ/Zb9Gd7netfJh8t/DcqgAA5DXnL183U0ZjWIA1RbCOrPdeaH9IoswKaUvlDGsg2V/XgabMxrzWae1pJNdCirXUTV1AJdaQIKkjkIT0@yIDiH15AiHpoTkCWVgSXgRvQZldMpPctkoeKNGzngXPOqjgntiuGYf2I5z6nj2pn//v6Ie2G5FVVKzbWcFCqnZhiR57B9ZbD/SlYcNxFbGChJV3bnvLZqtldHk7v52L0A2Dyhv4xIcjt03zauv@VV2JQc0vRei03Y7PcerGaXWFRUbBHIjBNGbTsGQrDaPVdv2f0VpJyDh1/enx22NdJ6H8ygkjVVVx7sUznigYzoRTUtpxjLeZf9viA6XJ7Ynv98KF72LY7xQsFaybB9Z2JilxTgpU8dhvSY5hTl9/vRJSbKBhI4djz174UanE4trAXkwcRvbznwKm86PMqeMneG3A1rcjrcSVzHK/wzt4/xc "Hexagony – Try It Online")
### 14. [Python 3](https://docs.python.org/3/)
This is pretty a simple task in Python (`'%x'%int(input())`), but made more complicated by the `%`s spawning Cardinal pointers. We compensate for these with `x`s sprinkled in liberally.
```
print(0x0or'%x'%(0x0+int(input())))
```
[Try it online!](https://tio.run/##JU9dj5swEHy2f8WC4SCA@UilqjIEuKoPl1MfKrVSH4BQ90IFEsEc4RBJLvnrqWlnpdFqdrQ725/GWnQf7neSP0yek7lOkQEAcuvzt@/bKWERLMBEEbyj69YNrE@bMDED1jA5wwQke@vSJ8qsz2uNlS6hKQkYJrETO4ByTJCgsS2QhPR7IgGIPHkCIelhKQJZWBJeBHdBnlwSg952Suor4bOW@M8aqOCc@L4eh@YznPqeP6lf/@/oh6YbkZkVvNub/kIqufCNFrkH3psP7KXmw3EV8owGhXtuetPiq2V0eT@/n7PACfzCHaqpGo6VZRhXS/Ou6koManrJArvp9tUcxU4UF1dYZOTPvhgMfTZ0U7bSMJpN17@N5kpCxinLL48/HstyE8iv7CBUVRWnbjTjiYFuTzimuRVFeJd4tx0@MLa5PVVtKxz4KYZ2r2CpYM048KYzaI5TmqGiiryGphjm@PXPK6XZFmo@VnDs@Ut1VAqxuLbQiqmCkf/@p4Bh/8pTZnsbvNZh51khyXEhs9zvH/2/ "Python 3 – Try It Online")
### 15. [PingPong](https://github.com/graue/esofiles/tree/master/pingpong)
PingPong skips over the `\` with the initial `#`, wrapping to the bottom at the `/`. This goes to the bottom of the code, and enters the loop there, continuly integer dividing by two and summing the modulo by 2 until the input reaches `0`. Then it outputs the sum it has collected.
```
#  v/
...
 '+`\@:+/=
2% ^/*;#\
```
[Try it online!](https://tio.run/##JU9db5tAEHy@@xULBwEDx4elStXxmaoPcdSHSK3UB8D0GtMYCXMEU0Ts2H/dOdpZabSaHe3O9k330ovu5XYjxd3kObnrlDkAIHd/evq@mVIWwQJMFME7um7dwPoch6kZsIbJGSYg2VtXPlFmfV5rrHIJzUjAMEmcxAFUYIIETWyBJKTfEylA5MkTCEkPyxDIwpLwIrgLivScGvS6VTJfCR@11H/UQAXnje/249B8gbe@5w/qt/87@qHpRmTmJe92pr@QSs481iL3wHvzjj3v@XBchTynQememt60@GoZnd9P76c8cAK/dId6qodjbRnGxdK8i7oSg5qd88Buul09R4kTJeUFFhn5sy8GQ58N3ZStNIxm0/V/R3MlIeNU1df7H/dVFQfyKzsIVVXFmRvNeGKg2xNOaGFFEd6m3nWLD4zF14e6bYUDP8XQ7hQsFawZB950Bi1wRnNU1pHX0AzDnLz@eaU038CejzUce/5cH5VSLK4NtGKqYeS//ylg2L@KjNlejNc6bD0rJAUuZZbbLfj0AQ "PingPong – Try It Online")
### 16. [Cardinal](https://www.esolangs.org/wiki/Cardinal)
Cardinal is a bit of a pain, since it initially spawns pointers at all `%`s, which usually need to be squashed with `x`s. The one we do use in near the bottom, in the string literal. This spawns two pointers, one which collects the input and decrements until it reaches zero, and one that is continually generating the fibonacci numbers by flipping its two values and adding them. Once the first pointer reaches zero it is destroyed by the `?`, leading to the second pointer being reflected upwards into the `. <` to be printed.
```
. <x
v: %+v
>-\*<<
^?/~^
```
[Try it online!](https://tio.run/##JU9Nb5tAED2zv2L4ChhYYDlVy2eqHuKoh0it1ANgujVURsIswQQRO/Zfd5b2jfQ0evM082bPxrrtWXe/q8XD7Dm565Q5AEju4fzyYzunNIIVSJU563HQucT6EoepSWhLxQypINgLKl@VF30JNFq5Ks5UQpGaOIkDUoFUiePE5pKA8Hs8BYg8cUKShIdmEohCgtAquCuK9JIa@LaTM18On7XUf9ZAAeed1YdpbL/C@zCwJ@X7/x3D2PaTZOYl62vTX0lRLyzWIvfIBvOB7g9sPG1ClmNSuud2MC22WUeXj/PHOScO8Ut3bOZmPDWWYVwtzbsqGz4q2SUndtvXzRIlTpSUV1hlyV98Phr6YuimaIVhMtt@eJvMjYCIU1XfHn8@VlVMxFc2CRVFQZkbLWimoNszSnBhRRHapd5th46Uxrenpuu4A7/42NUyEgrSjCNrewMXKMO5VDaR1@IMwZK8/n3FON/CgU0NnAa2b05yyVfXFjo@NzCxP/8UMOzfRUZtL0aBDjvPCtUClSLL/U6CTw "Cardinal – Try It Online")
###  ~~17.~~
### 18. Ruby
Probably the language with the most code, this takes place in a string interpolation as usual. This splits up the input into a 2D array, then zips and joins them together in reverse to produce the transposed output.
```
print "#{a=$<.map(&:chars);a[-1].zip(*a).map{|z|z[1,10].reverse*''}*$/}"
```
[Try it online!](https://tio.run/##JU/LjptAEDzTX9G8FgwMD5@iMQY2ymG9yiFSVsoBMBmvJzISBhYwwvbav@4MSbVUalWXuqu70@78eKjZ0@g5qevkKSJK7uHy4@dmjGmIM0CVG1aTZeUG1pf1KjYDWlIxAxUFe8vCV@VJn5YaLVyVJGpAQY2cyEEpA1VqSGQ3koDwe02MGHrihCQJD00kFAWCYBbcGVl8jQ1y38qJL69etdh/1VBB58z2h6Erv@K5bdmL8v3/jrYr60Ey05zVe9OfSVGvbK2F7pG15hN9P7CuX6xYSoLcvZStabHFPLp@Xj4vaeAEfu52fORdzy3DuFmad1MWTack1zSwy3rPpzBywii/4SxL/uQ3naFPhm6KVhgGs6zb02AuBEScovj2/PZcFOtAfGUHK0VRIHHDCUaKuj1CRDIrDGEbe/ctHCld3194VTUO/mq6ai@DUEAzjqysDZJBQlIp56FXkgRwij7@fBCSbvDABo59y955L@fN7Npg1YwcB7b7p6Bh/84SantrWOq49ayVmkEusjwew5nDVFXA2x0MRwZY7gF7Bj1yKLGDQ1/DW3n6Cw "Ruby – Try It Online")
###  ~~19.~~
###  ~~20.~~
## Future work
I'll need to find some new languages to work in there, hopefully 2D languages with arbitrary starting points. Challenge 6 should be pretty easy for any simple language, 8 is a bit tougher. 17 should be achievable with a practical language, 19 and 20 may have to use a golfing lang of some sort to be able to fit within the remaining space. To add more than just challenge 6, I might have to replace some of the longer languages and shuffle them around.
[Answer]
# 6 languages, 226 bytes (229 depending on how `\x1b` is accepted!)
```
/&&#[+.#]@>>+[>,]<[<]>>[.>]>\[/;//;#<?die("\x1bc".max($argv[1],$argv[2]));/*
$a=['Hello','World'];//;printf"%s, %s!
",$a[0]||'Happy Birthday',$a[1]||pop;#";$a="\
#";alert(prompt().match("\t")?"I hate tabs!":"I love spaces!");/\]/
```
So, I don't think I made the best choice of languages and I imagine this isn't particularly competetive but I found this an interesting challenge nonetheless! Overall, not many challenges complete, but I could probably shoehorn a challenge in whitespace or something similar, but this is what I have so far:
---
### 1. Brainfuck
```
[+.]>>+[>,]<[<]>>[.>]>[<.[],[][,],,[],[].]
```
Tested on <http://copy.sh/brainfuck/> and <http://brainfuck.tk/>.
After stripping out all ignored chars, the above program is all we're left with, which is just the example cat program with some extra empty loops to bypass the other languages use of the symbols.
### 2. Ruby
```
/&&#[+.#]@>>+[>,]<[<]>>[.>]>\[/;//;
$a=['Hello','World'];//;printf"%s, %s!
",$a[0]||'Happy Birthday',$a[1]||pop;
```
Usage:
```
ruby cluster
```
The above is the code after all comments are removed. The first line is entirely useless in Ruby as we define some regular expressions to contain the Befunge-93 and brainfuck code, then we create an array to contain `Hello` and `World` and print it using `printf` (to add the `,` and `!`).
### 3. Perl
```
/&&#[+.#]@>>+[>,]<[<]>>[.>]>\[/;//;
$a=['Hello','World'];//;printf"%s, %s!
",$a[0]||'Happy Birthday',$a[1]||pop;
```
Usage:
```
perl cluster <name>
```
Very similar to Ruby, except that since we're storing an array reference in `$a`, when we try to access `$a[0]` it's empty, so we can replace it with the text for challenge 3, `Happy Birthday` and `pop` (which shows the last argument to the command-line program).
### 4. JavaScript
```
/&&#[+.#]@>>+[>,]<[<]>>[.>]>\[/;
$a=['Hello','World'];
",$a[0]||'Happy Birthday',$a[1]||pop;#";$a="\
#";alert(prompt().match("\t")?"I hate tabs!":"I love spaces!");/\]/
```
Usage: paste into browser console and run.
Same as Ruby and Perl, the first line essentially creates useless `RegExp` objects, we then store a useless array in `$a` and instantiate two useless strings, one containing the Ruby/Perl code and one containing a newline and a `#`, then we `prompt()` for input and `alert()` the result expected by most humans for challenge 4. We end with another useless `RegExp` object to close off the brainfuck loop.
### 9. Befunge-93
```
/&&#[+.#]@
```
Tested on <http://www.quirkster.com/iano/js/befunge.html>.
As I understand it, `/` divides the stack and pushes the result which has no ill-effects except pushing `NaN` on the above site, `&` asks for input of an integer so we read both numbers required by challenge 9 onto the stack, the `#` ensures we skip over the `[` which is there for brainfuck, `+` then adds the top two numbers on the stack, `.` outputs them, `#]` for brainfuck again and `@` exits.
### 13. PHP (running in Bash)
```
/&&#[+.#]@>>+[>,]<[<]>>[.>]>\[/;//;#<?die("\x1bc".max($argv[1],$argv[2]));
```
Usage:
```
php cluster <x> <y>
```
In PHP, anything not included within the `<?` tags is output verbatim, so this outputs the Befunge-93 and brainfuck code so we `die()` immediately in the code, output a screen clear (`\x1bc`) then the `max()` of the first two arguments.
[Answer]
# 6 languages, ~~450~~ 404 bytes
### bash, brainfuck, C, gawk4, JavaScript and Minimal-2D
```
/*\t/#[R,+/D
/\t/ # UL.-L<script>var s=prompt().split(' ');alert(+s.pop()+ +s.pop())</script>
sed "s/^\(.*\)$/Happy Birthday, &!/;q"&&0
/\t/#*/
#define func
func main(){puts("Hello, World!");}
//{split($0,b,_);for(i in b)a[NR][i]=b[i++]}END{for(;j++<i;print"")for(k=NR;k;)printf a[k--][j]}
#//]++++++++[>+>+>++++++>++++++++<<<<-]>>++>--<<[>>>>>+++[<++++[<<....>....>-]<<<.>>>>-]<<<[>>+<<-]<[[>+<-]<]>>-]
```
Update: Golfed it down a little. Still not sure what else to add, and I'm not sure how the competing members would think about me using their languages for different tasks. Trying to explain the brainfuck algorithm.
Well this is/was my first polyglot experience, so I had to learn everything from scratch. Starting with awk was not the smartest idea I think, because it is relatively unforgiving. Because the number of completed tasks is relevant I started with the easiest tasks first. Not sure if that was a smart move. This is not very much golfed, because I had enought trouble getting these six working together, but I did what I could to keep it short.
Here are the languages and what they do in alphabetical order. I'll show an easy way to test them all further down. Because some of this might be version specific I'll give you the version numbers of the tools I used.
## bash, task 3
Well, its obvious that I used sed. I tried to put a sed script in this somehow, but I couldn't get it to work, so I went the bash route. The way I dit it, it is inside a C comment and awk evaluates it to `False`.
`sed --version` gives `sed (GNU sed) 4.2.2`
`bash --version` gives `GNU bash, Version 4.3.30(1)-release (x86_64-pc-linux-gnu)`
So the sed part comes down to
```
sed "s/^\(.*\)$/Happy Birthday, &!/;q"
```
It groups the input, pastes it into a new string and prints the result. Pretty common stuff.
## brainfuck, task 20
Well this is always pretty easy to hide I guess. A line starting with `#//` is ignored by C and awk. Or at least they can live with rubbish behind that.
`bf` gives `bf - a Brainfuck interpreter version 20041219`
This is the condensed code. The first line is only the garbage from the other languages.
```
[,+.-<>.+.++.<>.,,,,[][][++]++<[--][]]
++++++++[>+>+>++++++>++++++++<<<<-]>>++>--<<
[>>>>>+++[<++++[<<....>....>-]<<<.>>>>-]<<<[>>+<<-]<[[>+<-]<]>>-]
```
### I'll try to explain how it works
```
++++++++[>+>+>++++++>++++++++<<<<-]>>++>--<<
```
this arranges the tape and pointer to this
```
0 8 10 46 64 C2 C1
  ^
```
the cell holding 8 is the global counter for the following loop  
it's the number of times 3 same lines are printed
```
[>>>>>+++
```
sets `C1` to 3, the number of same lines
```
    [<++++
```
sets `C2` to 4, the number of "`....@@@@`" in a line (in the beginning)
```
        [<<....>....>-]<<<.>>>
    >-]
```
prints a complete line decrementing `C2` in the process  
when `C2` is zero it prints a newline and decrements `C1`. 
if `C1` is zero the magic happens
```
    <<<[>>+<<-]
    <[[>+<-]<]
```
the 46 is moved behind the 64  
the 10 and the global counter are moved one to the right
```
>>-]
```
then the global counter is decremented  
if it's zero the program exits
## C, task 2
I exhaust every last little ability of C here by printing "Hello, World!". Well, somebody had to do the job...
`gcc --version` gives `gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2`
The actual C code
```
#define func
func main(){puts("Hello, World!");}
#
```
The `#define func` is to make awk okay with this. It thinks this is an awk function. Abbreviation to func is a gawk feature.
## gawk4, task 18
Since I have used awk for pretty much everything on here, I decided, that it had to be in this.
`awk --version` gives `GNU Awk 4.1.1, API: 1.1 (GNU MPFR 3.1.2-p11, GNU MP 6.0.0)`
awk sees this
```
/*\t/
/\t/
sed "s/^\(.*\)$/Happy Birthday, &!/;q"&&0
/\t/
func main(){puts("Hello, World!");}
//{split($0,b,_);for(i in b)a[NR][i]=b[i++]}END{for(;j++<i;print"")for(k=NR;k;)printf a[k--][j]}
#
```
The search patterns including `\t` evaluate to `false`. I chose tab here, because I think it can't be in the input. `sed` evaluates to `false`. `"the string"&&0` evaluates to false. The function is okay. The program is executed if an empty pattern is matched, which it is for any input.
It does this
### Input
```
elaic
parli
ucfit
srigs
```
### Output
```
supe
rcal
ifra
gili
stic
```
You have to make sure all the input lines have the same length. Use spaces to fill them up.
## JavaScript, task 9
I'm not sure if this is legit, because this was too easy. If you give the program file a html ending, and open it in a browser (I used Firefox 40.0.3 and chrome 45.0.2454.85) it prompts you for an input. You have to enter two numbers separated by space, and it will alert the sum of those.
```
<script>var s=prompt().split(' ');alert(+s.pop()+ +s.pop())</script>
```
## [Minimal-2D](https://esolangs.org/wiki/Minimal-2D), task 1
This was pretty easy to fit into comment lines. I used [the interpreter](https://esolangs.org/wiki/User:Marinus/Minimal-2D_interpreter), who runs in python, to test this. It prints the input to the output. The program looks like this
```
R,+/D
UL.-L
```
R U D L are right, up, down and left. So it starts going right, reads a character from stdin into memory and adds one. The slash skips the next command if the memory has the value 0. This is to end this. If a character with value -1 is read, the input has ended. So if -1 is read it skips the D and terminates. If something else is read it goes down an left, adds that 1 back to the memory and prints the character to stdout. Then it goes left and up and starts over.
# Testing
*Disclaimer:* I won't take any responsibility for any damages you do to your system with this.
This is assuming you have bash & co, gawk (at least version 4, because this uses multidimensional arrays), gcc, python, bf as a brainfuck interpreter and Firefox installed.
To make it easy, copy the program source to a file named `cluster.html`. Make that file executable for the bash task. Copy and paste the [interpreter for Minimal-2d](https://esolangs.org/wiki/User:Marinus/Minimal-2D_interpreter) into a file named `minimal2D.py` in the same directory. Then copy and paste the following script to a script file and put it into the same directory, make it executable and run it... well, who am I talking to. If you read this you probably don't need that much explanation and are gonna get it to run somehow anyway.
```
#!/bin/bash
# Task  3: bash
echo "Dr. Hfuhruhurr" | ./cluster.html 2>/dev/null;echo
# Task 18: awk 
printf "elaic\nparli\nucfit\nsrigs\n" | awk -f cluster.html 2>/dev/null;echo
# Task  2: C
cp ./cluster.html ./cluster.c;gcc -w -o cluster cluster.c;./cluster;rm cluster cluster.c;echo
# Task  1: Minimal-2D
python minimal2D.py cluster.html <<<"This
has
to be
copied     !!!";echo
# Task 20: brainfuck
bf cluster.html;echo
# Task  9: JavaScript
firefox cluster.html 2>/dev/null
#google-chrome cluster.html 2>/dev/null
```
In there you also find the command for running the tests individually.
Have fun!
]