text:
Overcoming cluster size
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, an evil plot of the designers of FAT12 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

Read all input and print it.

Print Hello, World!.

Read a line/argument (name) as input and print Happy Birthday, [name]!.

Read all input and print I love tabs! if it contains one or more tabulators (0x09) and I hate spaces! if it doesn't.

Read two lines/arguments and print a truthy value if the second is a substring of the first and a falsy value if not.

Read a line/argument and print a truthy value if its characters are in strictly ascending order and a falsy value if not.

Read a line/argument and a character and print the indexes of all occurrences of that character.

Read a line/argument and print any of the characters with the highest number of occurrences.

math

Read two integers between 0 and 255 and print their sum.

Read a single integer between 0 and 255 and print the quotient and residue of its division by 7.

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.

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.

Read two integers between 0 and 255 and print the larger one.

Read a decimal integer between 0 and 255 print its hexadecimal representation.

Read a single integer between 0 and 255 and print its Hamming weight (number of 1-bits).

Read a single integer n between 1 and 13 and print the Fn, the nth Fibonacci number.
For example, for the input 13, print 233.

ascii-art

Read a line/argument of input and frame it.
For example, for the input Programming Puzzles & Code Golf, print this:
+---------------------------------+
| Programming Puzzles & Code Golf |
+---------------------------------+

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

Read an integer between 1 and 40 and print a diamond of that side length.
For example, for the input 3, print this:
   /\
  /  \
 /    \
 \    /
  \  /
   \/

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

Are JavaScript and CoffeeScript different enough to be considered different languages?

Yes, those count as different.

your challenge #4 is nonsense >:(

Quote: All output to STDERR will be ignored. Does this mean that when we call the script/program with 2>/dev/null and get the correct output to stdout, it is okay? Just to be sure.

@Cabbie407 Precisely. Per consensus on meta, this rule actually applies by default to all challenges. I just wanted to make sure that everybody was aware of it.

It does? Wow, that's news to me. But okay, I can live with that. ;)

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 (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 (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 (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 (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.
><> (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. 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 (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 xxxs 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).
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. 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.

Great stuff. What's the task for TRANSCRIPT?

@Cabbie407 I'm still trying to optimise which language gets which task, but currently TRANSCRIPT has taken Hello World, and Rail has changed to the tabs task.

Ah, now I can see it ;) I'm procrastinating changing anything in my answer, because of the long description. lol

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

17 different versions of Pip, 383 bytes (invalid)
While this question was sandboxed, I combed through all the revisions of my language 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
Diagnostic: (oTM0,0i) (fixed a bug with TriM 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
Diagnostic: EN1 (added ENumerate operator)
Task 1: Iv<2W##YqlPBy (same setup code as above) followed by l?lJnl (join on newlines)
0.15.08.03
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
Diagnostic: Y1 (added Yank 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
Diagnostic: RCk (added Random Choice 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
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 (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
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
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 To Base 16)
0.15.05.24
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
Diagnostic: rZ4 (added Zip operator)
Task 12: h=1 (sum of bits from task 15 must equal 1)
0.15.05.11
Diagnostic: AB6 (added ABsolute 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
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
Diagnostic: BN8 (added Bitwise Negation operator)
Task 9: a+b
0.15.04.23
Diagnostic: AZ (preinitialized AZ variable to uppercase alphabet)
Task 5: bINa (IN gives count of occurrences)
0.15.04.20
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
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.

14 15 languages, 487 bytes
brainfuck, Thue, Fission, Rail, Perl, ><>, Surface, Whitespace, Gol><>, Befunge-93, Hexagony, Python 3, PingPong, Cardinal, Ruby
#\&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
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!
2. Thue
This executes the lines with ::= towards the end of the program, ignoring any other lines. This simply looks for any ms in the rest of the program after ::= and prints "Hello, World!" for each of them.
m::=~Hello, World!
::=
  m

Try it online!
3. 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!
4. Rail
This starts from the line that starts with $'main'. This is essentially a golfed version of SP3000's Rail 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!
5. Perl
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!
 6:
7: ><>
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!
 8.
9. 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!
10. Whitespace
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!
11. Gol><>
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!
12. 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 xs 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!
13. 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!
14. Python 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 xs sprinkled in liberally.
print(0x0or'%x'%(0x0+int(input())))

Try it online!
15. 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!
16. Cardinal
Cardinal is a bit of a pain, since it initially spawns pointers at all %s, which usually need to be squashed with xs. 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!
 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!
 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.

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, task 1
This was pretty easy to fit into comment lines. I used the 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 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!

The brainfuck one has a problem; the code has unbalanced brackets and won't run correctly (you have to run the whole file, not just the relevant part). Also, the checkerboard's squares are actually 4x3 instead of 4x4 to look more square in text.

Thanks for the hint. Well it runs fine here. I always run the whole file as you can see in my script. Not sure if the interpreter should check the brackets before running. Mine doesn't mind. But I overlooked that line count. Got to change that.

Well I looked into it again and I hope I fixed it.

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.

You can put the literal ESCape character in the string literal, just add a note that it's there (the first character in the first string literal is the byte ASCII 27); your score is 226.

@cat Yeah, I think you're right, I've left as-is for now, but I did put 226 in the title. I've forgotten how much I enjoyed this challenge, I could probably do a bit more now and using ES6 I could have .match'\x09' (where the ' are `) maybe I'll see if I can add more at some point!

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
I haven't seen that number before!
Write a program that goes through a string of non-whitespace characters (you may assume that they are digits 0 to 9, but nothing in the way they are to be processed depends on this) and adds spaces according to the following rules.

Let the current token be the empty string, and the previously emitted tokens be an empty set.
Iterate through the characters of the string. For each character, first append the character to the current token. Then if the current token is not already in the set of previously emitted tokens, add the current token to that set and let the new current token be the empty string.
If when you reach the end of the string the current token is empty, output the previously emitted tokens in order of emission, separated by a space character. Otherwise output the original string verbatim.

Input
The input to the STDIN should be a sequence of digits.
Output
The program should print the result as specified in step 3.
Samples
Sample inputs
2015
10101010
4815162342
101010101010
3455121372425
123456789101112131415
314159265358979323846264338327950288419716939937

Sample outputs
2 0 1 5
10101010
4 8 1 5 16 2 3 42
1 0 10 101 01 010
3 4 5 51 2 1 37 24 25
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
3 1 4 15 9 2 6 5 35 8 97 93 23 84 62 64 33 83 27 95 0 28 841 971 69 39 937

This is code golf, so standard CG rules apply. Shortest program in bytes wins.
(Please request any clarifications in the comments. I'm still new to this. Thanks!)

4815162342 I see what you did there, brotha.

I suggest to get rid of the “repeat at the end of the number” part of rule 7. (It confused me too.) Maybe you could say, there are not enough digits to form a distinct number.

Probable error in the spec: step 6 asks us to repeat steps 3 and 4, so the only number in the output which can be more than one digit long is the second one. If that were to be corrected simply by changing it to "Repeat steps 4 and 5 ...", the movement in step 5 would mean that each number in the output should have an odd number of digits. And numbers which have leading zeroes are equal to the number without the leading zeroes, so if you want to distinguish 01 from 1 you should stop talking about numbers altogether and talk about strings instead.

A test case which my code originally failed despite passing all the ones in the challenge: 11312123133

Proposed OEIS entry: numbers which are split into at least two segments by this process.

@Sok Notice that 10101010 can result in 1 0 10 1010, which fits the rules.

@IsmaelMiguel Step 5 (as any other step) can only advance one digit at a time. Once you’ve got 1 0 10 , the next iteration will find 1 (already used), then advance one to find 10 (already used), then advance one to find 101, which is new and would be ‘added’. It would then add a space and you'd get to a new 0, which has already been used, but is here at the end of the string. Therefore, the output would be 1 0 10 101 0, which is invalid (0 is repeated), and the script must then just output the input string. It could only make 1010 if 101 had already been used.

You list 10101010 as an output. That looks like a mistake.

@kasperd No If a unique number cannot be formed at the end of the string, then the input should be printed verbatim 10101010  cannot be split so it is printed as is.

@edc65 I see. I had misunderstood that rule.

@JanusBahsJacquet, no. Given input 10101010 steps 1 to 3 give 1 ^0101010 (with ^ to indicate the position of the cursor); then step 4 gives 1 0^101010, step 5 gives 1 0 ^101010; step 4 gives 1 0 1^01010; step 5 gives 1 0 10^1010; step 4 gives 1 0 101^010; step 5 gives 1 0 101 ^010; step 4 gives 1 0 101 0^10; step 5 gives 1 0 101 01^0; step 4 gives 1 0 101 010^; step 5 gives 1 0 101 010; and the loop breaks. So the specified output for that input is 1 0 101 010

@PeterTaylor No. 10 has not been used yet at 1 0 10^1010, so it wouldn't continue to 1 0 101^010, but add a space, making 1 0 10 ^1010. Moving on to 101 doesn't happen until the next ‘group of 10’ when it reaches 1 0 10 101^0.

@JanusBahsJacquet, step 5 doesn't have a self-loop. It either inserts a space or moves one right. Then you go back to step 4. That's why I pointed out in my first comment that the spec requires each generated part to have an odd number of digits.

@PeterTaylor Exactly. It adds a space if doing so creates a number which has not already been used. At the relevant position, 10 has not yet been used, so step 5 adds a space and does not move to the right. I don't see how that would imply that the output must be an odd number of digits.

But when you enter step 5, the space would be after the 1, which would be a repeat. So instead you move right one in space 5, and then you move right one again in step 4, and you enter step 5 again and create 101.

@PeterTaylor Aaah, yes. I see what you mean now. Really, step 4 should be done away with entirely, and step 5 should be the only repeated one. Well spotted! (Really, steps 2 through 4 can all be scrapped, since the first digit will always be unused the first time it's reached.)

@PeterTaylor Looks like you beat me to the editing. Thanks!

Pyth, 22 bytes
 faW!}=+kTYY~kdz?tkzsY

Leading space is important.

Retina, 68 61 bytes
+`\b(\w+?)(?<!\b\1 .*)(\w+)$
$1 $2
(?=.* (.+)$(?<=\b\1 .+))
<empty>

<empty> is an empty line. Note the trailing space on line 3. You can run the above code from a single file with the -s flag.
Explanation
+`\b(\w+?)(?<!\b\1 .*)(\w+)$
$1 $2

This first step implements rules 1 to 6. It is a regex substitution which is applied repeatedly until the string stops changing (that's what the + is for). In each step we add a single space into the string from left to right (following the rules of the challenge). The regex matches the shortest string of digits which hasn't appeared in the already processed part of the string. We ensure that we're looking at a prefix of the remaining string with the word boundary \b and checking that we can reach the end of the string without passing spaces with (\w+)$. The latter also ensures that we only perform one replacement per step.
(?=.* (.+)$(?<=\b\1 .+))
<empty>

This matches any space (which is at the end of the regex), provided that the last segment of the string is the same as any other segment in the string, and replaces them with the empty string. That is, we undo the first step if it resulted in an invalid final segment, implementing rule 7.

Pyth, 24 23 bytes
VzI!}=+kNYaY~k"";?kzjdY

Try it out here.
VzI!}=+kNYaY~k"";?kzjdY    Implicit: z=input(), k='', Y=[], d=' '
Vz              ;          For N in z:
     =+kN                    Append N to k
  I!}    Y                   Is the above not in Y?
          aY k               Append k to Y
            ~k""             After append, reset k to ''
                 ?k        Is k truthy (i.e. not '')
                   z       Print original input
                    jdY    Otherwise print Y joined on spaces

Thanks to @FryAmTheEggman for saving a byte :o)

@FryAmTheEggman A good call, I got pretty caught up in trying to preserve k's original value

Python 3, 92 bytes
i,n,*o=input(),""
for c in i:n+=c;o,n=[o+[n],o,"",n][n in o::2]
print([" ".join(o),i][n>""])

Basically a heavily golfed version of @Willem's solution.

[" ".join(o),i][n>""]

@FryAmTheEggman Ah cool, I had tried that with bool(n) but I didn't think of n>"".

Python 3, 100 99 bytes
o=[];n="";i=input()
for c in i:
 n+=c
 if not n in o:o.append(n);n=""
print(i if n else" ".join(o))

I fixed your byte count. Also, you should remove the space from else ".

Some common golfs Also, your original score was 100 bytes, I think.

Cool thanks! I didn't know that the space after "else" could be removed. Another day lived, another day learned :)

Brachylog, 91 bytes
:_:_{h:0<|bhN,?hh:NrcH,?hB(l1,-1=A;BbA),?rhL:I(mH:Ar:[L]c:1&;:[H]:\"~w \"w,L:[H]c:_:Ar:1&)}

This made me realize that there's a lot of things about the syntax I need to change...
Explanation
:_:_              § Creates a list [Input,[],[]]
{...}             § Define a new predicate between the brackets and call it with the previous list as input
h:0<              § If the head of the input is negative, stop
|                 § Else
bhN,              § Second element of Input is called N
?hh:NrcH,         § N concatenated with the first element of Input is H
?hB(l1,-1=A;BbA), § Remaining digits A are either -1 if there's only one digit left or all the digits but the head otherwise
?rhL:I            § List of used integers is called L
(
   mH:Ar:[L]c:1&  § If H is already in L, call the predicate with input [A,H,L]
   ;              § Else
   :[H]:\"~w \"w, § Print H followed by a space
   L:[H]c:_:Ar:1& § Call the predicate with input [A,[],M] where M is L with H appended to it
)

CJam, 26 bytes
LLq{+_a2$&{a+L}|}/:X+X!S**

Test it here.
Explanation
L        e# Push an empty array to keep track if the previous segments.
L        e# Push an empty array to build the current segment.
q{       e# For each character in the input...
  +      e#   Add it to the current segment.
  _a2$&  e#   Duplicate and check if it's already in the segment list.
  {      e#   If not...
    a+L  e#     Add it to the list and push a new empty array for the next segment.
  }|
}/
:X+      e# Store the trailing segment in X and add it's *characters* to the list.
         e# For valid splittings, this trailing segment will be empty, so that the
         e# list remains unchanged.
X!       e# Push X again and take the logical NOT.
S*       e# Get that many spaces, i.e. 1 for valid segments and 0 otherwise.
*        e# Join the list with this string between elements.

JavaScript (ES6), 109
My output format is not exactly the same of the output samples in the questioin (there is a leading space). I don't see that as a flaw, as the output format is not specified (just The program should print the number after the number...)
Test running the snippet below in a EcmaScript 6 compliant browser. Developed with Firefox, tested and running on the latest Chrome.

/* Test: redirect console.log */ console.log=x=>O.innerHTML+=x+'\n';

F=s=>{for(z=s,b=l=o=' ';s[+l];)~o.search(b+(n=s.slice(0,++l)+b))||(s=s.slice(l),o+=n,l=0);console.log(s?z:o)}

/* Test cases */
test = [
  '2015',
,'10101010'
,'4815162342'
,'101010101010'
,'3455121372425'
,'123456789101112131415'
,'11312123133'
,'314159265358979323846264338327950288419716939937']

test.forEach(t=>{console.log('\n'+t);F(t)})

GNU sed, 83 77 73 71 bytes
(Score one extra because we require -r flag)
h
s/./&_/
:
/(\b[^ ]+).*\b\1_/{
s/_(.)/\1_/
t
g
}
s/_(.)/ \1_/
t
s/_//

The inner loop tests for a repeated sequence and appends characters as needed until a unique number appears after the separator _.  The outer loop moves _ along.
Expanded, annotated version:
#!/bin/sed -rf

# Stash original in hold space
h

# Add separator
s/./&_/

:
# If current candidate is a duplicate, ...
/(\b[^ ]+).*\b\1_/{
#  ...then attempt to lengthen it ...
s/_(.)/\1_/
# ... and repeat if we succeeded, ...
t
# ... otherwise, restore original string
g
}
# Insert a space, and move our separator along
s/_(.)/ \1_/
t

# Remove the separator if we still have it
s/_//

You could combine both the t's into one.

Also /((\b[^ ]+).*\b\2)_/{ can be rewritten as /(\b[^ ]+).*\b\1_/{, no reason for 2 capture groups.

No problem :), you need to change the reference to \1 though!

Ruby, 57 + 1 = 58 bytes
s=''
l={}
$_.chars{|c|l[s<<c]||=s=''}
l[s]||$_=l.keys*' '

Uses the command line flag -p (or pl if your input has a trailing newline). Exploits several traits of Ruby Hash dictionaries: you can safely mutate the string you used to define a key without it changing the key (which doesn't work for other mutable types), .keys returns the keys in the order they were inserted, and the []||= operator provides a terse way of branching on whether a given key is already there.

Haskell, 105 bytes
f does it.
e""s""=unwords s
e t s""=concat s++t
e t s(c:r)|t&c`elem`s=e(t&c)s r|0<1=e""(s&(t&c))r
a&b=a++[b]
f=e""[]

PHP - 148 bytes
Cool challenge, lots of fun!
$x=fgets(STDIN);$w=array();$k='';$l='';for($i=0;$i<strlen($x);$i++){$k.=$x[$i];if(!isset($w[$k])){$l.=$k.' ';$w[$k]=1;$k='';}}echo strlen($k)?$x:$l;

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Loves me, loves me not
Loves me, Loves me not
This simple kids' game is old, but still popular. Since we are living in 21st century now, let's digitize it!
Specification
Program must take no input, unless you are using a language that can't generate random seed - in that case you are allowed to take the seed as an input. Your task is to write a program that will output randomly a total of 3 to 20 lines inclusive: "Loves me..." and "Loves me not..." in turns, as in the game (and one additional line; keep reading).
However, there are some restrictions. Each line should be followed by newline. The first line must be "Loves me...". The last line (either "Loves me" or "Loves me not") should end with exclamation mark or a single dot, respectively. After the last line, you need to output either a heart( <3 ) or a broken heart ( </3 ) in the new line, depending whether "Loves me!" or "Loves me not." was the last sentence.
Trailing whitespace are allowed.
Example Output
Output:

Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me!
<3

Another output:

Loves me...
Loves me not...
Loves me...
Loves me not.
</3

This is the code-golf, so the shortest entry wins!
Also, my first challenge :) Good luck!

Are there any restrictions on the distribution of the number of lines, i.e., should it be uniformly random, or is it enough that all lengths between 3 and 20 have a positive probability?

I didn't think about this, but I'd say that any distribution is fine - so they don't have to be uniformly random.

Is it 3 to 20 ([3, 20)) or 3 up to including 20 ([3, 20])?

@orlp Edited to adress that concern. 3 is minimum, 20 is maximum. So 20 lines is ok, but no 21.

@MatthewRock What if the language we want to use can't seed a random number on their own? Can the user supply a random seed?

@minxomat I'd prefer it to be random-random, so no user should generate randomness. Couldn't you get time or anything similar?

@minxomat Are you trying to do this in Brainf*** or what?

@MatthewRock No. There are a few languages that do not have support for timers. I'd like to require a seed from the user. I still have to implement a proper PRNG, so the challenge isn't easier for me.

@minxomat what language is it?

@MatthewRock let him take the seed as a input.

@minxomat Whatever, it's just a game. Go on, changed the rules.

I don't think this fits with [kolmogorov-complexity] if you can have two different outputs.

Pyth, 54 53 51 50 48 bytes
pj+*3\.bm+W~!Z"Loves me"" not"+3O18@".!"Z%hZ"</3

%2tWZ"<</33 for the heart printing saves 1. Not convinced this is the best way though.

@FryAmTheEggman Made it save two.

Merging the last two strings together saves another one, but I had to switch back to my %.

@".!"Z%hZ"</3 saves two bytes

Since there has been no entry for few days, I'm accepting this answer. Congratulations!

CJam, 53 50 49 bytes
Thanks to Dennis for saving 1 byte.
Imr3+{"Loves me"X!:X" not"*'.3*N}*&"!."X=N'<'/X*3

Test it here.
Explanation
The code just dumps the string in bits and pieces onto the stack, which is printed automatically at the end of the program:
Imr3+         e# Generate a random number in [3,20]
{             e# Execute this block that many times.
  "Loves me"  e#   Push "Loves me", we always need that.
  X!:X        e#   Toggle X (initially 1) between 0 and 1 and leave it on the stack.
  " not"*     e#   Repeat " not" that many times, removing it on every other line.
  '.3*N       e#   Push "..." and a newline.
}*
&             e# Set intersection of "..." and newline, turning them into an empty array.
"!."X=        e# Select "!" or "." based on the last value of X.
N'<           e# Push a newline and "<".
'/X*          e# Include "/" or not depending on the last value of X.
3             e# Push a 3.

one could imagine CJam would've been developed exclusively for code-golf ^^

@larkey but it is...

@larkey CJam is derived from GolfScript, and GolfScript (as its name implies) is designed for golfing.

@ChrisJester-Young it was ment a bit tongue-in-cheek ;-)

Brainfuck, 2766 bytes (currently invalid)
Just because. I'll add an ungolfed version later.
Code
>+<+[>[>[-]+<-]>[<+>>+[->,----------[<+>[>>>>>>>>>+<<<<<<<<<-]>>>>>>>>>[>+<<<<<<<<<<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]]<]<-]>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<[>[-]+<-]>[<+>>>>>>>>>>>>[<<<<<<<<<<+>>>>>>>>>>-]>[<<<<<<<<<<+>>>>>>>>>>-]<<<<<<<<+++++++[<+++++++++++>-]<[<<[>>>>>>>>>>+<<<<<<<+<<<-]>>>[<<<+>>>-]<<[>>>>>>>>>+<<<<<<<+>+<<<-]>>>[<<<+>>>-]<[>>>>>>>>+[<<<<<<<+>+>>>>>>-]<<<<<<[>>>>>>+<<<<<<-]+<[>-<[-]]>[>>>>>+<<<<<-]<<-]<-]++++++[>++++++++<-]>-[<<[>>>>>>>>>+<<<<<<<<+<-]>[<+>-]>-]<<<[-]>[-]+++++[<+++++>-]<[>>>>>>>>>>>+[<<<<<<<<<<+>+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]+<[>-<[-]]>[>>>>>>>>+<<<<<<<<-]<<-]++++++[>>>>>>>>>>+++++++++<<<<<<<<<<-]>>>>>>>>>>[<<+<<<<<<<<+>>>>>>>>>>-]<<<<<<<<<<[>>>>>>>>>>+<<<<<<<<<<-]>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>[-]++++++++++++++++++++<<[<<<+>>>-]>>[<<<<<<<<+>+<<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>>[>>[<+<<<+>>>>-]<<<<[>>>>+<<<<-]+>>>[<<->>>-<<<<->>>[-]]<<<[>>[-]+<<-]>>-]>>[>>>-<<<[-]]<<<[-]>>>>>>>>[-]<[>+<<<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>>>>[-]+++<<<[<<<<<+>>>>>-]>>>[<<<<<<<<<<<+>+<<+>>>>>>>>>>>>-]<<<<<<<<<<<<[>>>>>>>>>>>>+<<<<<<<<<<<<-]>>[>>[<+<<<+>>>>-]<<<<[>>>>+<<<<-]+>>>[<<->>>-<<<<->>>[-]]<<<[>>[-]+<<-]>>-]<[>>>>>>>>-<<<<<<<<[-]]>>>[-]>>>[<<<<<<<+>>>>>>>-]<<<<<<<[>>>>>>>-<<<<<<<[-]]>>>>>>>>>[<<<<<<<<<+>+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]<[>>>>>>>[-]-<<<<<<<[-]]>>>>>>>[>>>>>>+<<<<<<<<<<<<<<<->>>>>>>>>[-]]<<<<<<<<-]>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<[>[-]+<-]>[<+>>+++++++++++[>+++++++>++++++++++>+++++++++>+++>++++<<<<<-]>-.>+.+++++++.>++.<---.>>-.<<------.>.>>++...[-]<[-]<[-]<[-]<[-]<++++++++++.[-]>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>->[-]<[>+<-][-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>[-]<<[<<<<<<+>>>>>>-]->>[<<<<<<<<-<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>[>>>>>>+<<<<<<[-]]<->>>>>>>[<<<<<<<->>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>>>>>>>[>>>>>>>>+<<<<<<<<<<<<<<<<<->>>>>>>>>[-]]<<<<<<<<-]<[>[-]+<-]>[<+>>++++++[>++++++++++<-]>.---------.[-]<<<-<->>-]>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<[>[-]+<-]>[<+>>+++++++++++[>+++++++>++++++++++>+++++++++>+++>++++<<<<<-]>-.>+.+++++++.>++.<---.>>-.<<------.>.>.<<+.+.+++++.>>>++...[-]<[-]<[-]<[-]<[-]<++++++++++.[-]>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>->[-]<[>+<-][-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>[-]<<[<<<<<<+>>>>>>-]->>[<<<<<<<<-<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>[>>>>>>+<<<<<<[-]]<->>>>>>>[<<<<<<<->>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>>>>>>>[>>>>>>>+<<<<<<<<<<<<<<<<->>>>>>>>>[-]]<<<<<<<<-]<[>[-]+<-]>[<+>>++++++[>++++++++++<-]>.-------------.++++.<<<<->>-]<<]

Pseudocode
loop
    get a random byte
until random byte is >2 and <21

point to byte
[
    output "Loves me..."
    decrease byte by 1
    if byte is 0
        output "<3"
        exit
    eif
    output "Loves me not..."
    decrease byte by 1
]
output "</3"

Sample
When run, the program enters an interactive session waiting for input. Input should be a number. This number is used as a seed.
Seed: 1 (random number is 5, takes 218,168,042 operations)
1
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
<3

Seed: 3 (random number is 20, takes 463,253,048 operations)
3
Loves me...
Loves me not...
(...)
Loves me...
Loves me not...
</3

I'd suggest that you do not seed with 6, as it takes 2,105,900,375 iterations to compute the result :).
Compiling / Running
You need a fast interpreter for this. No online interpreter I've tested could handle the execution speed. The ips (iterations per second) should be more than 100,000,000. So I came up with another solution.
This is a Brainfuck to C compiler written in Brainfuck. You can use any online interpreter to transpile my code to pure C. I suggest using brainfuck.tk. Paste my code in the stdin input, past this code in the code input:
+++[>+++++<-]>>+<[>>++++>++>+++++>+++++>+>>+<++[++<]>---]>++++.>>>.+++++.>------.<--.+++++++++.>+.+.<<<<---.[>]<<.<<<.-------.>++++.<+++++.+.>-----.>+.<++++.>>++.>-----.<<<-----.+++++.-------.<--.<<<.>>>.<<+.>------.-..--.+++.-----<++.<--[>+<-]>>>>>--.--.<++++.>>-.<<<.>>>--.>.<<<<-----.>----.++++++++.----<+.+++++++++>>--.+.++<<<<.[>]<.>>,[>>+++[<+++++++>-]<[<[-[-<]]>>[>]<-]<[<+++++>-[<+++>-[<-->-[<+++>-[<++++[>[->>]<[>>]<<-]>[<+++>-[<--->-[<++++>-[<+++[>[-[-[-[->>]]]]<[>>]<<-]>[<+>-[<->-[<++>-[<[-]>-]]]]]]]]]]]]]<[-[-[>+<-]>]<[<<<<.>+++.+.+++.-------.>---.++.<.>-.++<<<<.[>]>>>>>>>>>]<[[<]>++.--[>]>>>>>>>>]<[<<++..-->>>>>>]<[<<..>>>>>]<[<<..-.+>>>>]<[<<++..---.+>>>]<[<<<.>>.>>>>>]<[<<<<-----.+++++>.----.+++.+>---.<<<-.[>]>]<[<<<<.-----.>++++.<++.+++>----.>---.<<<.-[>]]<[<<<<<----.>>.<<.+++++.>>>+.++>.>>]<.>]>,]<<<<<.<+.>++++.<----.>>---.<<<-.>>>+.>.>.[<]>++.[>]<.>[.---->.---,....]

Download the source and compile it:
gcc.exe -c main.c -o main.o
gcc.exe main.o -o loveme.exe

You can also run a copy of the C code online here: via. CodingGround.
Optimizations
There is still some work to do, but the cell re-use is almost optimal.
Remarks
You can use words or phrases as a seed:
Programming Puzzles & Code Golf
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
<3

+1 for having the audacity to write a PRNG in Brainfuck ...

@TimmyD There are better ways to write PRNGs in BF, but most of them are time based (run the program, and stop execution at some point, then read memory), but that would require user interaction and two separate programs, which is against the rules.

Nice pseudocode. More people should do that, especially since half the golfing languages are basically unreadable if you don't know them.

Unfortunately your output is wrong. Last "Loves me" should end with an exclamation point(so, "Loves me!"), and "Loves me not" should end with single dot("Loves me not.").

@MatthewRock Will fix.

Can we have some pseudocode of the RNG?

Link is borked.

Javascript (ES6), 119 104 99 98 bytes
for(i=new Date%18+3,s=i&1?`!
<3`:`.
</3`;i--;)s=`...
Loves me`+(i&1?' not':'')+s
alert(s.slice(4))

Good one! It may be shorter to use string concatenation for creating the heart, and possibly in the creation of each line. Mind if I use the new Date trick in my answer?

@ETHproductions Go for it, so long as you're fine with me using those hearts haha (and why didn't I use alert... for some reason I convinced myself arrow functions would be shorter, but needing return negates that...). I actually just got it down to 104 now with some other tricks as well =)

Dang... nice job :) I keep rearranging mine, but always end up at 104.

The breakthrough for me was combining the length/iteration variable by concatenating backwards, and defining the hearts in the initialization. I tried it a while back with little savings, but your heart simplification made it much more efficient.

Wait a minute... Trying this, I get Loves me not... Loves me... Loves me not! <3 and Loves me not... Loves me... Loves me not... Loves me. </3. I think you'll have to change one of the conditionals to fix this. EDIT: Oh, just switch the '' and ' not' in the fourth line.

@ETHproductions Seems to reverse on me every time I touch anything to do with that iterator haha. Thanks!

Python, 147
from random import*;t=randint(3,20)
print"\n".join("LLoovveess  mmee  n o t"[i%2::2].strip()+"..."*(i<t-1)for i in range(t))+"!.\n\n<<3/ 3"[t%2::2]

Uses the from random import* instead of import random and randint instead of randrange to save a few bytes. There's probably some bytes left to golf out.

The alternation "LLoovveess  mmee  n o t"[i%2::2].strip() seems needlessly complicated. Can't you just do "Loves me"+~i%2*" not"?

Even ["Loves me","Loves me not"][i%2] is more optimal, since you're now wasting chars on .strip() and a couple of spaces. But yes, use xnor's code

Javascript (ES6), 110 102 bytes
a='';for(i=j=new Date%18+3;i--;)a+='Loves me'+(j-i&1?'':' not')+(i?`...
`:j&1?`!
<3`:`.
</3`);alert(a)

This was a short but fun little challenge. It may be possible to shorten more. Thanks to Mwr247 for some byte-saving tricks!
Alternate version using repeat(), 105 bytes:
a='';for(i=j=new Date%18+3;i;)a+='Loves me'+' not'.repeat(j-i--&1)+(i?`...
`:j&1?`!
<3`:`.
</3`);alert(a)

Darn JS 5+-char built-in names. Oh well. Suggestions welcome!

Impressive condensing. I'm curious though, why the 18+3|0?

@Mwr247 Oh, duh, that was from when I used Math.random(). Guess it's not necessary now.

Perl 5 + -M5.10.0, 76 bytes
print"...
"x!!$_,"Loves me"," not"x$|--for 0..2+rand 18;say$|?"!
<3":".
</3"

Try it online!

Ruby, 91 bytes
(n=3+rand(18)).times{|i|puts"Loves me"+[""," not"][i%2]+(i<n-1?"...":i%2>0?".
</3":"!
<3")}

Common Lisp 106 104 bytes
(format t"~{Loves me~[ not~]~#[~:*~[.~%</~;!~%<~]3~:;...~]~%~}"(subseq'#1=(1 0 . #1#)0(+ 3(random 18))))

This only works on lisps that don't check for a proper sequence (e.g. cmucl, sbcl, clisp) ccl will check for circularity and error out on default safety level.  ecl will loop forever.
Explanation:
#1=(1 0 . #1#) generates a circular list containing 1 and 0 and subseq is used to make a list of length [3,20] (this is the only non-portable part, as subseq is only required by the standard to work on proper (i.e. non-circular) lists).
Our format is now operating on a list of 1 0 1 0... of length [3,20]
Explanation of format directives:
~{ iterates over this list
~[ followed by any number of ~; and terminated with ~] will select the Nth item, based on the value of the format argument.   This is used here so that the first item in a ~[ will be the "loves me not" case and the second one the "loves me" case.  Note that with ~[ a separator of ~:; selects a default case.
~#[ works like ~[ except the argument is the number of remaining arguments.  0 remaining arguments means we are at the end, the default case is to print ...
~:* backs up the argument list one position, which allows us to print the correct trailer.

This was a group effort by the #lisp IRC channel.  Many thanks to phf for the clever iterative format-string and the subseq hack.

Python 2, 161 159 156 144 bytes
from random import*;a=randrange(3,21)
for i in range(a):print'Loves me'+i%2*' not'+('...'if i!=a-1 else'.'if i%2 else'!')
print['<3','</3'][i%2]

It's 39 bytes just to get the random number.
A big thank you to muddyfish, fryamtheeggman, and orlp for their help.
PYG, 109 bytes
a=RR(3,21)
for i in R(a):P('Loves me'+i%2*' not'+('...'if i!=a-1 else'.'if i%2 else'!'))
P(['<3','</3'][i%2])

You can do the range statement in a single line. you can also do import random as r

you can also put the contents of the last print statement onto the line above.

I think you can change print'</3'if i%2 else'<3' to print['<3','</3'][i%2] to save 3 bytes.

Yes indeed I can; thanks!

Thanks! Interestingly, import random as r;a=r.randrange(3,21) and import random;a=random.randrange(3,21) are the same length.

Many standard golfs

['...','!','.'][(i==a-1)*(1+i%2)] and ' not'*(i%2).

Thanks FryAmTheEggman and orlp. I added parts of what you two suggested but would feel guilty taking all of FryAmTheEggman's comment.

Julia, 98 bytes
r=rand(3:20)
for i=1:r println("Loves me"*(i%2>0?" not":"")*(i<r?"...":i%2>0?".\n</3":"!\n<3"))end

Ungolfed:
# Define a random number 3 ≤ r ≤ 20
r = rand(3:20)

for i = 1:r
    # The loveless lines occur when i is even
    println("Loves me" *
            (i % 2 > 0 ? " not" : "") *
            (i < r ? "..." : i % 2 > 0 ? ".\n</3" : "!\n<3"))
end

UNIX shell, 193 bytes
t=$(seq 2 19|shuf|head -1)
l=t
p=...
while [ $t -ge 0 ];do
case $l:$t in t:0)p=!;h=\<3;;f:0)p=.;h=\</3;;esac
case $l in t)l=f;n=;; f)l=t;n=\ not;;esac
t=$((t-1))
echo Loves me$n$p
done
echo $h

Java, 210 209 203 200 177 bytes

flipped i%2==0 to i%2<1
trimmed { ... } braces for for-loop, moved e declaration to loop
re-ordered conditionals
removed modifiers and unnecessary parentheses, reworked Random usage and increment for i

Note: newline is added below for formatting on this site, the count above is for a single line.
class F{public static void main(String[]a){for(int e=3+(int)(Math.random()*18),i=0;++i<=e;)
System.out.println("Loves me"+(i%2>0?i<e?"...":"!\n<3":" not."+(i<e?"..":"\n</3")));}}

Ungolfed:
class F {
    public static void main(String[] a) {
        for (int e = 3 + (int) (Math.random() * 18), i = 0; ++i <= e; )
            System.out.println("Loves me" + (i % 2 > 0 ? i < e ? "..." : "!\n<3"
                    : " not." + (i < e ? ".." : "\n</3")));
    }
}

You can save 13 bytes by removing public.

@Luminous I'll still need to keep the one for main() though...

@TimmyD I second that.

C, 123, 121, 109 106 characters (108 bytes)
(with a little ♥♥♥cheating♥♥♥)
O;main(o){for(o=time(O)%18+3;o-O++;printf("Loves me%s%s\n",O&1?"":" not",o-O?"...":O%2?"!\n♥":".\n</3"));}

There's also a broken heart Unicode point at 1f494, but I had difficulties finding a font which implements it.

This shows 120 characters and 122 bytes...

I don't think you need O=0, because C auto-initialize ints to 0?

@FryAmTheEggman Good find! In a previous version I had O in main(o,O) where it had to be initialized.

Nice, I like it! I didn't think of using time as a random number... Clever!

@MatthewRock If you think about it, all the other program using srand(time(0)) will change their answer with the same frequency. The srand is completely useless :-)

@TimmyD I believe it's the way the unicode character is counted. In vim, it was 123 bytes including the final newline.

Even though you "need"  a trailing newline according to C documentation, most compilers actually don't care, and as long as one referenceable implementation works that way all the time, it's valid here :P

Why don't you change ♥♥♥ for <3? It's  actually 1 byte less. Plus, your answer - as for now - doesn't meet the requirements.

@MatthewRock Guess I'm a bit anarchic and like to break^Wcreatively twist the rules. If the winner is the shortest program, C has no chance anyway, with CJam around.

@Jens Creatively twisting the rules is for [tag:popularity-contest]s, which this is not :P

PowerShell, 121 119 111 Bytes
$i=2..19|Random;1..$i|%{"Loves me$(if(!($_%2)){" not"})..."};"Loves me$(if(!($i%2)){"!`n<"}else{" not.`n</"})3"

Edit--actually shorter to explicitly include "Loves me" rather than declaring $l
Edit2--forgot that I can golf for() loops by pipelining...durr...
Not too shabby. Uses inline code execution blocks $(...) to dynamically adjust the printed string as we're for()-looping. Note that because this uses an implicit Get- in front of Random to save a couple bytes, this may operate extremely slowly on certain PowerShell versions. Reference
Expanded below for clarification:
# Create a collection of (2,3,4,...18,19) and pipe it as input to Get-Random
$i = 2..19 | Get-Random

# Create a collection of (1,2,...$i-1,$i) and pipe it to seed a ForEach-Object loop
1..$i | ForEach-Object {
  if(!($_%2)) {
    # If the input number is even, we're on an even line
    Write-Output "Loves me not..."
  }
  Else {
    # The input number is odd
    Write-Output "Loves me..."
  }
}
If(!($i%2)) {
  # Our random number is odd
  Write-Output "Loves me!"
  Write-Output "<3"
}
Else {
  # Our random number is even
  Write-Output "Loves me not."
  Write-Output "</3"
}

C++, 210 193 184 168 bytes
In C++.. because.. Why not?
:)
#include <iostream>
main(){auto&c=std::cout;srand(time(0));int i,j=3+rand()%18;while(i++<j)c<<"Loves me"<<(i%2?"":" not")<<(i==j?"":"...\n");c<<(j%2?"!\n<3":".\n</3");}

Live:
210
193
184
168
Just hope that any of my changes are not platform dependent.
Thanks to Ben Voigt for the help. Also, thanks to all the comments, they were very helpful.

Humn.. just realize its 3 to 20. I will fix that later. Probably will add 2 more bytes... j=3+(int)(rand()*17.0/RAND_MAX)

You can save a lot by replacing #define c cout and using namespace std; by auto&c=std::cout;

Also save some with int i=0,j=rand()*20.0/RAND_MAX;while(i<j)

Hello, found a bug: Last line should be "Loves me!", not "Loves me."

20.0 could be shortened to 20. or 20f.

Do you really need () around rand?

You are correct. We dont need the ().. neither the {} in the while if we change the ;c<< to <<. I just found this nice article about random. To be [3,20] inclusive, I have to change to 18.f. Just found out that I could have used % instead of RAND_MAX... but if I change it now will look similar to tonysdg answer. Trying to see where else it can be optimized.

I'd say it's okay - C and C++ are similar. And right now this code is longer than Java...

And actually you can just use time instead of srand and rand ;)

You can remove the space in #include <iostream>. @MatthewRock Longer than Java. wat. It's actually 9 bytes shorter... I knew it was impossible!

@RK. At the time of writing my comment, the code was longer than Java's.

I do not understand how it can work without #include <time.h>...

@GuillaumeLethuillier thats a good question. I didnt know for sure myself.. I had the idea it was included somewhere on ostream. Just google'd and looks like it's something like that, ctime is used for locale support

Groovy, 110 bytes
A groovy kind of love:
int r=Math.random()*18;print((0..r+2).collect{"Loves me"+" not"*(it%2)}.join('...\n')+['!\n<3','.\n</3'][r%2])

Python 2, 117 bytes
from random import*
n=randint(3,20)
print"...\n".join("Loves me"+i%2*" not"for i in range(n))+[".\n</3","!\n<3"][n%2]

Observe that every Loves me( not)? is followed by ... and a newline, except for the last one. So this looks like a job for join.

A bit late but ".!\n\n<</33"[n%2::2] is 2 bytes shorter.

@FryAmTheEggman Yeah, I did see that but decided not to steal it from Loovjo. In the meantime, someone else has posted exactly that solution. [shrug]

I hadn't noticed someone else posting it, but I am pretty sure my comment was the first that had it in it, so you can use it if you want :P

R, 141 132 128 114 111 109 bytes
Code
k=sample(3:23,1);for(i in 1:k)cat("Loves",c("me not...\n","me...\n","me not.\n</3","me!\n<3")[1+i%%2+2*!i<k])

Ungolfed
k <- sample(3:23, 1)        # Generates random "k" number from 3 to 23
for(i in 1:k) {             # Loop this block increasing i from 1 until k by 1
  cat                       # Concatenate and paste everything inside this block
  ("Loves",                 # Push "Loves" on every iterations of the loop
      c(                    # Create a vector of strings
        "me not...\n",      # Push string to the index "1" of vector
        "me...\n",          #   to the index "2"
        "me not.\n</3",     #   to the index "3"
        "me!\n<3"           #   to the index "4"
        )[1+i%%2            # Subset the vector by the index (1 or 2)
          +2*!i<k])}        #   if final iteration of loop then index += 2 (3 or 4)

I've took some inspiration from Eric Brooks code.
Edit 1: Now the code correctly outputs the last punctuation as pointed
   out by Martin
Edit 2: Changed the for loop to a sapply and included the hearts
   inside the last line string.
Edit 3: Removed the {} and changed +(x==k)*2 to +2*!x<k
Edit 4: Back to for loop and removed the () from (i%%2)+1
Edit 5: Wrote me 4 times and removed the sep=""

R, 119 111 105 bytes
x<-sample(3:20,1);cat(rep(c("Loves me...\n","Loves me not...\n"),x)[1:x]);cat(ifelse(x%%2==1,"<3","</3"))

Edits 1,2: Coding the two options explicitly is saving space.

You can save a byte by using = for assignment rather than <- and another by doing x%%2>0 in place of x%%2==1. Also note that this doesn't handle the last line correctly; there should be a . or ! rather than .... (See example output in the question.)

@Alex A. You don't need x%%2>0 either; just x%%2

Good points, thanks. I need to go back and fix the ending

C 226 bytes
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void main(){srand(time(NULL));int i=rand()%18+3;int j;for(j=0;j<i;j++)printf("Loves me%s%s\n",(j%2)?" not":"",(j==i-1)?(j%2)?".":"!":"...");printf("<%s3\n",(j%2)?"":"/");}

(With formatting)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main() {
    srand(time(NULL));
    int i = rand()%18 + 3;
    int j;
    for (j = 0; j < i; j++)
        printf("Loves me%s%s\n", (j % 2) ? " not" : "", (j==i-1) ? (j % 2) ? "." : "!" : "...");
    printf("<%s3\n", (j%2) ? "" : "/");
    return 0;
}

Remove return type from main (-5 bytes), make i and j global with default type (-8 bytes, -3 more because of default 0 in j), use 0 instead of NULL (-3). Other things - use only one variable and make the loop counting down maybe. Import stdio is not usually needed when golfing.

mSL, 178 176 156 154 bytes
Edit 1: Changed == 0 to < 1
Edit 2: Removed unnecessary whitespace, thanks AlexA!
Edit 3: Removed parentheses
alias l {
var %n 1
while %n <= $rand(3,20) {
var %m $+(Love me,$iif($calc(%n % 2) < 1,$chr(32) $+ not),...)
echo %m
inc %n
}
echo $iif(n isin %m,</3,<3)
}

Your solution is currently 176 bytes, not 177. Is all of the whitespace necessary? If not, you could shorten your code by a significant amount simply by removing unneeded whitespace.

@AlexA. Oh don't know why I wrote 177, and thanks for pointing out the necessity of whitespace, it is indeed not needed!

Python 2, 115 bytes
from random import*
n=randint(2,20)
print'...\n'.join('Loves me'+i%2*' not'for i in range(n))+'.!\n\n<</33'[n%2::2]

Lua, 137 132 bytes
Probably can be golfed a lot more, but here it is for now:
t=math.random(3,20)for i=1,t do io.write(i%2==0 and"Loves me"or"Loves me not")print(i==t and(i%2==0 and"!\n<3"or".\n</3")or"...")end

Code explanation and ungolfed:
t=math.random(3,20) --Generates a random number between 1 and 30. We need to assign it to a variable to check if the loop is over later.
for i=1,t do
  io.write(i%2==0 and"Loves me"or"Loves me not") --If i%2 is 0 write without a newline Loves me, if not print Loves me not.
  print(i==t and (i%2==0 and"!\n<3" or ".\n</3") or "...") --If it is not the end of the loop, put ..., else if we ended on an even print ! a newline, and then a heart, but if we ended on an odd put ., a newline and a broken heart :(
end

Edit: Chopped off some whitespace.

C# (160)
The code is inspired by the answer from h.j.k., credit goes to him.
class P{static void Main(){for(int e=3+new Random().Next(0,18),i=0;++i<=e;)Console.WriteLine("Loves me"+(i%2>0?i<e?"...":"!\n<3":" not."+(i<e?"..":"\n</3")));}}

Ungolfed:
class P
{
    private static void Main()
    {
        for (int e = 3 + new Random().Next(0, 18), i = 0; ++i <= e;)
            Console.WriteLine("Loves me" + (i % 2 > 0 ? i < e ? "..." : "!\n<3" : " not." + (i < e ? ".." : "\n</3")));
    }
}

Hassium, 265 Bytes
func main(){rnd=new Random();times=rnd.next(3,21);println("Loves me...");for(x=0;x<times-1;x++){if(x%2==0)println("Loves me not...");else println("Loves me...");}if((times-1)%2==0){println("Loves me not.");println("</3");}else{println("Loves me!");println("<3");}}

The answer has been golfed.

Your solution is currently 458 bytes, not 523. You can better your score by removing unnecessary whitespace and shortening variable names. See the other Hassium solution for examples.

As I noted on the other Hassium answer, the random number generator seems to be extremely biased. I ran this 500 times with the latest version and only got two </3.

+Dennis The Random generator is built directly on top of the C# Random number generator. See: https://github.com/HassiumTeam/Hassium/blob/master/src/Hassium/HassiumObjects/Random/HassiumRandom.cs

It doesn't seem to get seeded correctly. If I execute rnd = new Random();rnd.next(0,2); 1000 times, the distribution is OK. However, if I execute rnd = new Random(); once and rnd.next(0,2); 1000 times, I always get exactly 533 0s and 467 1s.

Hassium, 161 165 bytes
I golfed Reagan's answer.
func main()println(range(-1,t=new Random().next(3,21)).select(x=>"Loves me"+(x%2==0?" not":"")+(x==t-2?(x%2==0?".":"!"):"...")).join("\n"),"\n",t%2==0?"</3":"<3");

Unleashing the power of Hassium.
Ungolfed version
func main()
{
    t = new Random().next(3,21); # initialize the love number
    loveNumber = range(-1, t); # creates an array like this Array { -1 0 1 2 ... ... up to n } where n is a random number between 3 and 21 }
    loves = loveNumber.select(x => # iterates through the array
                                {
                                    ret = "Loves me";
                                    if (x % 2 == 0) # check if x is even
                                    {
                                        ret += " not"; # add ' not' to the result
                                    }
                                    ret += (x == t ? (x % 2 == 0 ? "." : "!") : "...");
                                    return ret;
                                }).join("\n"); # join the result with Unix newlines (\n)
    println(loves); # print it
    println(t%2==0?"</3":"<3");
}

The random number generator seems to be extremely biased. I ran this 500 times and only got two </3.

@Dennis however, if you got various lengths, I would say it's fine - I specified that any distribution is allowed - so although 2 in 500 isn't much, it's still acceptable, by the rules.

PHP, 191 187 146 165 Bytes
$x=rand(5,22);for($i=2;++$i<=$x;){echo"\nLoves me";if($i%2<1)echo" not";if($i<$x)echo"...";if($i==$x&&$i%2<1){echo".\n</3\n";}elseif($i==$x&&$i%2>0){echo"!\n<3\n";}}

Ungolfed:
$x=rand(5,22);
for($i=2;++$i<=$x;){
    echo "\nLoves me";
    if($i%2<1) echo " not";
    if($i<$x) echo "...";
    if($i==$x && $i%2<1){
        echo ".\n</3\n";
    }
    elseif($i==$x && $i%2>0){
        echo "!\n<3\n";
    }
}

48,49 bytes for pyth and cjam ... wow :)

Changed $i%2==0 to $i%2<1 (x2) and $i%2!=0 to $i%2>0 (x2)

turns out ternary operators are not the best answer at all times :)

Perl, 97 bytes
$_='She loves me...
'x(3+rand 18);s/(me.*?)me/$1me not/gs;s/e...
$/e!
<3/;s/t...
$/t.
<\/3/;print

Readable version:
$_="She loves me...\n"x(3+rand 18);
s/(me.*?)me/$1me not/gs;
s/e...$/e!\n<3/;
s/t...$/t.\n<\/3/;
print

Jelly, 55 bytes
“¢zḞzƘFq»,;¥“ not”ṁ18X+2¤j“...¶”µċ⁷Ḃ©”/ẋ;3⁾¶<;®ị⁾.!¤;⁸;

Try it online!
As usual Jelly sucks with strings.

PowerShell, 85 88 bytes
+3 bytes thanks Veskah: That's a good point.
0..(1..19|Random)|%{($l='Loves me')+' not'*($n=$_%2)+'...'}
$l+('!
<3',' not.
</3')[!$n]

Try it online!

This can generate "Loves me, Loves me not </3", which, based on how I read the specs, is below the minimum number of lines.

Indeed of *3* to 20 lines inclusive. Thanks!

ß, 138 bytes
Works (with valid output). More a solution than the solution, could be golfed further:
R=ß!G3,20,1)µL='Loves me'µD='...@LF@'µ€L&D)°/X=0°(R-1µ€L)°\mod(X,2)=0°{€' not')µ€D)°)€L)°\mod(R,2)°{µ€'!'&@LF&'<3')°]€' not.'&@LF&'</3')°}

Sample:
$ sharps "R=ß!G3,20,1)µL='Loves me'µD='...@LF@'µ€L&D)°/X=0°(R-1µ€L)°\mod(X,2)=0°{€' not')µ€D)°)€L)°\mod(R,2)°{µ€'!'&@LF&'<3')°]€' not.'&@LF&'</3')°}"
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me!
<3

Japt, 77 76 bytes
Mq17 +3 o £`Lov ´{Y%2?" not":""}...`Ã
U· +`
Lov ´`+(UÊ%2?" not.
</3":"!
<3

Probably can be golfed a lot further.
Try it Online!

1. Python 3, 179 171 167 bytes
from random import*;n=randint(3,20);s=""
for i in range(n):
    b=i%2==0;s+="Loves me"+(""if b else" not")
    if i<n-1:s+="...\n"
s+="!\n<3"if b else".\n</3";print(s)

ink, 78 bytes
-(l)Loves me{&| not}{
-l<3||l>20||RANDOM(0,1):<>...
->l
}{l%2:!|.}
<{1-l%2:/}3

Try it online!
\$p(n) = \begin{cases}
\frac{1}{2^{n-3}}& \text{if }3 \le n \le 19\\
\frac{1}{2^{16}}& \text{if }n=20\\
0& \text{otherwise}
\end{cases}\$
This is probably my least favourite of the three approaches I tried. But the others clocked in at 79 and 80 bytes.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/