text:
"Hello world" that creates a different "Hello world" program
Create a program, that outputs a hello world string ("Hello world", "Hello, World" etc.), and source code. Output is written to stdout or equivalent. Hello world string is embedded in the source code.
For example, the output for might be
(some source code here)hello world(some source code here)

When the output is compiled or interpreted again, it should create a similar output, but the hello world string must have a different punctuation or capitalization. For example, the previous example could create the following output
(some source code here)hello, wORld(some source code here)

Each "(some source code here)" in these examples can change after each execution, or it can be the same.
Your output must contain a valid hello world string exactly once. It may contain any amount of invalid hello world strings. Source code may contain any amount of comments, and the hello world string may be embedded in comments. The first program can have either zero or one valid hello world strings, but no more.
Following punctuation is valid:
hello, world
hello world
helloworld

Any capitalization is acceptable. For example, these are valid hello world strings:
Hello, world
hellO WORld
HELLoworlD

These strings are not valid:
Hello     world
Hello(newline)world
Hello,world
Hello, Steve

Your program fails as soon as one of the following conditions are met:
It outputs a hello world string that has been output during some earlier execution,
output is no longer valid source code in the same language, or
output does not contain exactly one valid hello world string.
Your program is not valid for this contest unless at least two first executions are successful. This means that the third output is allowed to be invalid. Output of your program may not be random. First execution should always create the same second output, second execution should always create the same third output, etc.
Score is calculated as amount of bytes in the source code of the initial program. Lowest score wins.
Following bonuses do apply (up to -60%):
-5% * (N - 2), where N is the index of the execution after which your program produces invalid output. This bonus caps at -50%. If your program succeeds 12 times or more, you get the max bonus.
-10%, if your outputs (including first source code) include all three valid punctuation alternatives.
Your submission should include the first source code, and it should also contain the outputs of the successful executions. If your program succeeds more than 12 times, add output for 12 executions.
Example
Next line is the first source code. When we execute it, it is the first execution.
hello world(some source code here)

Next line is the output from the first source code code. It is the first output.
hello, world(some source code here)

Next line is the output from the second execution. It is the second output.
helloworld(some source code here)

When we executed the first output, this program became eligible for the -10% bonus. That means we have two outputs, and one original code, which all have different punctuation. Moreover, because the second output was valid, this program is eligible for this contest.
Next line is the output from the third execution. It is the third output.
Helloworld(some source code here)

Next line is the output from the fourth execution. It is the fourth output.
hellworld(some source code here)

This output was invalid. Index of the last valid execution was 4. This program is eligible for -5% * (4 - 2) bonus and -10% bonus from the punctuation. This makes total of -20%. The length of the first source code ("hello world(some source code here)") was 34 bytes, so the final score is 27.2.

Do the usual quine rules apply or is the program is allowed to read its own source file?

Usual quine rules do apply.

Does the original code count towards the bonuses? Likewise, does the original code have to contain a valid hello world?

Original code counts towards bonuses. Original code does not have to contain a valid hello world.

Are you sure about that latest rule change? Together with "The first program does not have to contain a valid hello world string, or it may contain multiple valid hello world strings." I could add the missing variations as a comment to the original  source code to get the bonus (probably not worth it in most cases but still looks like a loophole)

You are right. I will remove the "it may contain multiple valid hello world strings", as that does not break any of the existing answers.

$a=qq( )^helloworld;print map"\$a=qq(\0 )^$a;$_,q($_)",q(print map"\$a=qq(\0\0 )^$a;$_,q($_)") (94 bytes) should (I think) work in Perl 5, but isn't working on my machine (the \0 prints as a space for some reason). Maybe someone can fix it up and post it as an answer. It's based on Tushar Samant's quine.

Does the program ever need to produce an invalid answer, or can it keep going?

@anOKsquirrel There are 3072 valid answers. After you are done with those, your next output is invalid.

@Ville-ValtteriTiittanen What if I slightly change the source code? Can I do that?

@anOKsquirrel Source code can change as much as you want between each execution. However, as soon as you output a hello world string that has been output during some earlier execution, your program has failed. "Your program fails as soon as one of the following conditions are met: It outputs a hello world string that has been output during some earlier execution, output is no longer valid source code in the same language, or output does not contain exactly one valid hello world string."

@Ville-ValtteriTiittanen Oh, didn't see that thanks

Pyth, 17 bytes
A different Pyth solution:
"r\"helloworld\"1

Output:
r"helloworld"1

Second output:
HELLOWORLD

Rules currently state "Your program fails as soon as one of the following conditions are met: output is no longer valid source code in the same language" and "Your program is not valid for this contest unless at least three first executions are successful.". Is HELLOWORLD a valid program in Pyth? If yes, please post its output as well or explain what it does. If not, I think this program is invalid.

Additionally, I want to clarify that this program does not break rules about repeating the same string. This solution repeats "helloworld" that was in the first source code. Rules only forbid repeating a string that has been in the previous outputs. If the second output is a valid Pyth program, then this solution is perfectly valid.

At the time of answering, the rules were "Your program is not valid for this contest unless at least two first executions are successful"

Oh, you are right. I'm not sure why I have changed that because my example in the first post states that two outputs = valid solution. I will correct the rules to reflect this. So your solution is valid. It is also the best valid solution at the moment.

Beaten by 2 bytes in 5 years. Lol

Mathematica, 214 194 - 50% = 97 bytes
(a = "helloworld"; b = Apply[StringJoin, Tuples[Thread[Characters[{ToLowerCase[a], ToUpperCase[a]}]]], {1}]; StringReplacePart[ToString[#0, InputForm], b[[FirstPosition[b, a] + 1]], {7, 16}]) &

I decided to optimize for string count here. This runs for 1024 programs without stopping, going through every combination of uppercase and lowercase letters. The execution can be seen here.

A shame that you can't golf out whitespace and use prefix and infix notation in Mathematica quines, isn't it? ;) (This might be long enough for the opposite quine approach to work, where you store the code in a string s, and evaluate it with ToExpression.)

If I weren't trying to hit 1000, I'd drop a +100 bounty here.

Vitsy, 33 - 33*.05*(11-2) = 18.15 Bytes
Heh! Beat that! You probably will. :c
First output:
'0DV\{25^-V\}}1+{rd3*Z;helloworld
'                                 Start capturing as a string
 0DV                              Push 0 to the stack and set it as the final variable.
    \                             Repeat the next item this many times. (1, 2, 3... on outputs.)
     {                            Rotate the stack leftwards.
      25^                         Push 32 to the stack.
         -                        Subtract the top item by it - this will make lowercase uppercase.
          V\                      Do the next item final variable times.
            }                     Rotate the stack rightwards.
             }                    And again...
              1+                  Add one. This makes the 0 in this code a 1, then 2...
                r                 Reverse the stack.
                 d3*              Get the character '
                    Z             Output all items in the stack.
                     ;            End execution.
                      helloworld  String to manipulate.

Second output:
'1DV\{25^-V\}}1+{rd3*Z;helloworlD
Third output:
'2DV\{25^-V\}}1+{rd3*Z;helloworLD
Fourth output:
'3DV\{25^-V\}}1+{rd3*Z;hellowoRLD
Fifth output:
'4DV\{25^-V\}}1+{rd3*Z;hellowORLD
Sixth output:
'5DV\{25^-V\}}1+{rd3*Z;helloWORLD
Seventh output:
'6DV\{25^-V\}}1+{rd3*Z;hellOWORLD
Eighth output:
'7DV\{25^-V\}}1+{rd3*Z;helLOWORLD
Ninth output:
'8DV\{25^-V\}}1+{rd3*Z;heLLOWORLD
Tenth output:
'9DV\{25^-V\}}1+{rd3*Z;hELLOWORLD
Eleventh output:
':DV\{25^-V\}}1+{rd3*Z;HELLOWORLD
This is the last output, as it will cause an error.

o_o Simplex struggled down to 21. I'll work on beating 18.15, though!

@CᴏɴᴏʀO'Bʀɪᴇɴ Vitsy was practically built to edit its own source code and do basic string manipulation. XD I think this can be golfed down more, though.

I thought simplex would be awesome, since it has an outer program function, but noooo that would count as one program. le sigh

+1 for beating (or almost beating) the "classic" golfing languages

@ev3commander I would've beaten them if the iteration bonus was higher. :c

True. :C Well, 4th (?) place!

CJam, N = 3 4, 28 bytes - 10 % - 10 % = 22.4
{`_E=-"_~Hello!, World"2<}_~

this starts the following chain:
{`_E=-"_~Hello, World"2<}_~
{`_E=-"_~Hello World"2<}_~
{`_E=-"_~HelloWorld"2<}_~
{`_E=-"_~Helloorld"2<}_~

where the last one no longer contains a valid "Hello, World".
Test it here.
Explanation
{`     e# Quine framework. Leaves a string representation of the block on the stack.
  _E=  e# Make a copy and get the 14th element, which is the character of the first 'o'.
  -    e# Remove that character from the string.
  "_~Hello!, World" e# Push this string, so the "Hello, World!" is part of the code.
  2<   e# Truncate to just "_~" to get the output right.
}_~

Note that the initial program does not contain a valid "Hello, World", but that allows us to go one iteration further.

Does this qualify for the -10% bonus? The outputs only contain two of the three valid punctuation forms.

@MikeBufardeci Oh good question... I sort of assumed the original code was part of it.

I clarified rules so that original code is counted for the bonus. Though I have to admit I did not realize it is this easy to get -10%.

CJam 69 60 - 50% = 30
I'm still beginner, Please tell me how to golf in CJam.
{`_40>\40<_38>~)`2Te[\25<"helloworld"00YbATe[.{{el}{eu}?}`+]W%"_~"}_~

It's tedious to print each iteration, as it will valid for 99 iterations.
It works by enumerate the capitalization of hello word. The tedium is to splitting strings into parts as both "hello world" and the counter have to be updated.
Explanation
{`_40>\40<_38>~)`2Te[\25<"helloworld"00YbATe[.{{el}{eu}?}`+]W%"_~"}_~
{`                                                                      e# standard quine framework. Thanks for Dennis.
  _40>                                                                  e# get the Yb11..
      \40<                                                              e# get those that not included in top
          _38>~)`2Te[                                                   e# get the accumulator and increment it
                     \25<                                               e# get those before "hello world"
                         "helloworld"                                   e# the Hello World
                                     00                                 e# accumulator
                                        YbATe[                          e# convert to binary and align right.
                                              .{{el}{eu}?}              e# Uppercase if the corresponding bit is 0
                                                          `             e# add quote
                                                           +]W%         e# reorder stack
"_~"}_~

NOTE: I don't read the Mathematica answer, sorry, I think it was original
With reordering, and different capitalization, I lose 9 bytes.
{`_6<\"helloworld"01YbW%.{{eu}{el}?}`\I>_2<~)`2Te[\2>"_~"}_~
{`                                                   "_~"}_~ e# Standard quine framework
  _6<\                                                       e# Get "{~_6<\"
      "helloworld"                                            e# The helloworld
                  01                                          e# The accumulator
                    Yb                                        e# Convert to base 2
                      W%                                      e# Reverse the binary
                        .{{eu}{el}?}                          e# Convert to uppercase while the corresponding bit is 1.
                                    `                         e# Add quote
                                     _2<                      e# Get accumulator
                                        ~)`2Te[               e# Increment the accumulator
                                               \2>            e# get the rest

CJam 73 - 60% = 29.2
This time also enumerate the punctuation.
{`:Z6<"HELLOWORLD"0:AYbW%.{{eu}{el}?}`", ":B-_6<BA3%>@6>A)ZW%52<W%"_~"}_~
{`:Z                                                              "_~"}_~ e# Standard Quine Framework
    6<                                                                    e# take the first 6 character
      "HELLOWORLD"                                                        e# Hello, world
                  0:A                                                     e# Accumulator
                     YbW%.{{eu}{el}?}`                                    e# See above
                                      ", ":B                              e# Punctuation
                                            -                             e# Delete punctuation
                                             _6<                          e# "hello
                                                BA3%>                     e# punctuation
                                                     @6>                  e# world"
                                                        A)                e# incremented accumulator
                                                          ZW%52<W%        e# Remaining part

You have a different language and a shorter answer, so there's nothing wrong using same approach as the Mathematica answer.

Note that we are looking for the lowest score, not the fastest poster or the most novel algorithm.

@Ville-ValtteriTiittanen Still, Martin Büttner's answer is still lower than me

@ChristianIrwan Yours is interesting because it produces different capitalisations though (and I'm sure it's golfable to get near mine or maybe even beat it, but I don't have the time to look at it in detail right now).

GolfScript, 35 bytes − 50% = 17.5
0"HelloWorld"{@@{^.32&\}%`@".~"}.~

I decided to go for overkill on the number of executions before a repeat.  This program, with its output fed back into the GolfScript interpreter, will produce 890 distinct Hello World strings before the first repeat.  As a brief sample, here are the first 15 iterations:
0"HelloWorld"{@@{^.32&\}%`@".~"}.~
0"HeLlOWoRlD"{@@{^.32&\}%`@".~"}.~
0"HelLOWorLD"{@@{^.32&\}%`@".~"}.~
0"HeLLOWoRLD"{@@{^.32&\}%`@".~"}.~
0"HellowORLD"{@@{^.32&\}%`@".~"}.~
32"HeLlOworld"{@@{^.32&\}%`@".~"}.~
0"hELloWoRlD"{@@{^.32&\}%`@".~"}.~
32"helLowORld"{@@{^.32&\}%`@".~"}.~
0"HeLLoWORlD"{@@{^.32&\}%`@".~"}.~
32"HellOWORld"{@@{^.32&\}%`@".~"}.~
0"hElLOWORlD"{@@{^.32&\}%`@".~"}.~
32"heLLOWORld"{@@{^.32&\}%`@".~"}.~
32"HelloworLd"{@@{^.32&\}%`@".~"}.~
32"hElLoWoRLd"{@@{^.32&\}%`@".~"}.~
0"HEllOWorlD"{@@{^.32&\}%`@".~"}.~

The way it works is by iterating through the string, flipping the capitalization of each letter (by XORing its ASCII code with 32) if the previous letter (after possibly having its case flipped) is lowercase.  The first letter will have its case flipped if the number at the beginning program is 32 rather than 0 — and the number output for the next iteration will be 32 whenever the last letter of the string is lowercase, thus causing any changes at the end of the string to propagate back to the beginning on the next iteration.
(This particular feedback process was obtained in a totally ad hoc manner.  I originally wanted to just run a simple binary counter using uppercase and lowercase as the bits, but that took too many bytes to implement, so I started tweaking it to find something shorter that would still yield a fairly high cycle length.  Since the theoretical maximum, using case-flipping only, is 210 = 1024, getting an 890-iteration cycle is pretty nice.)
Alas, the bonus for additional iterations is capped at −50%; without the cap, this program would have a whopping −4440% bonus. ;-)

This is the "gray code" (wiki link here). I originally was going to use this for my answer, but I couldn't see how I could possibly make it short. Nicely done

@SamuelWaller: This isn't actually Gray code. In Gray code only one bit would flip on each iteration and it would take 1024 iterations for the 10-bit sequence to loop back to its starting value. My sequence satisfies neither of those properties.

you are correct, the conversion method from binary to Gray code is by xoring each digit with the one to the left of it, which is similar enough to what you are doing I got confused. Still, nice answer!

Pyth, 18 bytes
"-\"hello world\"d

Which returns:
-"hello world"d

Which in turn prints:
helloworld

I had a solution that did all three spellings, but it's longer even with the bonus.

Note that this answer was invalid briefly until the rules were reverted to requiring two iterations rather than three. It is now valid again, though.

Simplex, 21 bytes.
This is what Simplex was born for. I can definitely go farther with this.
(I keep on hitting Ctrl+Enter, sorry! I blame it on the tablet keyboard)
Attempt 3, v.0.8+, 31 -5% = 29.45 bytes (UTF-8 methinks)
That emote in the middle expresses myself. Sort of. Why did I do this, again? ._.
"\"f[helloworld]-:D-``\"§R'Hg"g
"                            "  ~~ write that string
 \"f[helloworld]-:D-``\"§R'Hg   ~~ escaped quotes
                              g ~~ output that string

2nd Output:
"f[helloworld]-:D-``"§R'Hg
"                   "      ~~ write that string
 f[helloworld]-:D-``       ~~ string to be written
                     §R    ~~ go to second cell
                       'H  ~~ set it to H charcode
                         g ~~ output that string

3rd output:
f[Helloworld]-:D-``
f                   ~~ turns off safety mode (heck yeah error suppression!)
 [          ]-      ~~ write inside to outer program
  H                 ~~ sort strip
   e                ~~ write e = 2.718281828459045... to the strip
    ll              ~~ writes 1 twice to the cell
      o             ~~ outputs 1
       wo           ~~ apply o backwards through the strip (outputs 1)
         r          ~~ error! tries to access register for modification. nope!
          l         ~~ write 1 to to the current cell
           d        ~~ reverse the strip (NOP)
              :     ~~ removes last char of outer program
               D    ~~ double the current byte (2)
                -   ~~ writes previous char to outer program
                 `` ~~ suppress outer program evaluation and instead output it

Final output:
HelloworlD

Attempt 2, v.0.8+, 21 bytes (UTF-8, I think)
"\"helloworld\"§'Hg"g
"                  "  ~~ write that string
 \"helloworld\"§'Hg   ~~ escaped quotes
                    g ~~ output that string

Output:
"helloworld"§'Hg
"          "     ~~ write that string
 helloworld      ~~ string to be written
            §    ~~ go to first cell
             'H  ~~ set it to H charcode
               g ~~ output that string

Final output:
helloworld

Attempt 1, v.0.7+ 28 26 bytes
I'm not sure if this qualifies for the first bonus…
"BhelloworldB"t[s32S;]'gs;
"            "             ~~ write that string
 BhelloworldB              ~~ the string
              t[     ]     ~~ apply the inner from left to right
                s          ~~ output as character
                 32S       ~~ subtract 32 ("capitalize")
                    ;      ~~ add the current byte's char to the outer program
                      'g;s ~~ add g to the outer program

First output:
"HELLOWORLD"g

The outer program is evaluated at the end of execution (it does it for y; this is what the outer program looks like:
"HELLOWORLD"g
"          "  ~~ write that string
            g ~~ output that string as string characters

Final output:
HELLOWORLD

Is this program eligible for the -50% bonus? It looks like it could be, but you did not post any outputs.

@Ville-ValtteriTiittanen It only runs twice. I am working on bonuses at the moment.

Ruby, 81 - 50% = 40.5
Original code:
_='_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)';puts _%[_,'HELLOWORL'+?D]

Successive outputs:
_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"HELLOWORLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"hELLOWORLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"heLLOWORLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"helLOWORLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"hellOWORLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"helloWORLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"hellowORLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"hellowoRLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"helloworLD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"helloworlD"]).sub(/[[:upper:]]/,&:swapcase)

_="_=%p;puts (_%%[_,%p]).sub(/[[:upper:]]/,&:swapcase)";puts (_%[_,"helloworld"]).sub(/[[:upper:]]/,&:swapcase)

I think this counts as the full 50%? Might be off by one. Also, there's probably a better-scoring non-bonus solution in Ruby.
The original code doesn't contain "helloworld", but it builds a quine that replaces the first capital letter in its source code with the lowercase version. So each successive run of the quine outputs one fewer capitalized letter.
The trick here is to use a format string to interpolate both the string itself, for quining, and the Hello World string, so that it only appears once.

Vyxal, score 8
`kh#`kH+

Try it Online!
Outputs:
kh#Hello, World!

Try it Online!
Outputs:
Hello World

Explained
`kh#`

Push the string "kh#" onto the stack (which, when literally executed, is the constant "Hello World" and a comment)
kH+

Push the string "Hello, World!" onto the stack and concatenate the two strings together. Implicitly print the string.

6 bytes, or 5 bytes with a flag

PHP, 297 - 40% = 178.2 bytes
Not really competitive but it was fun to write
<?ob_start(function($s){$s=substr(str_replace(0,0+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[0]=$h[0]^' ';return "<"."?".$s."?".">".$s.$h;});?>ob_start(function($s){$s=substr(str_replace(0,0+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[0]=$h[0]^' ';return "<"."?".$s."?".">".$s.$h;});

It's a variation of this quine:
<?
ob_start(function($b){ return "<"."?\n$b?".">\n$b"; });?>
ob_start(function($b){ return "<"."?\n$b?".">\n$b"; });

but it also adds "helloworld" to the output and replaces 0 with 0+1 (in the next iteration 1 with 1+1 and so on). Using substr any existing "helloworld" output gets removed before the new "helloworld" gets added.
To get different output, one letter of "helloworld" gets capitalized (determined by the incrementing number). This is the relevant code:
$h=hello.world;$h[0]=$h[0]^' '

A challenge was to not use any numbers except here and for the number replacement
str_replace(0,0+(int)true,$s)

There you already see that +1 is realized as +(int)true.
For the substring arguments I needed 0, 146:
!i, ord(I)+ord(I)

The non-empty string "i" gets coerced to true and negated. false is a valid integer argument and is treated like 0. ord(I) is the ASCII value of "I": 73
Output (1st iteration):
<?ob_start(function($s){$s=substr(str_replace(1,1+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[1]=$h[1]^' ';return "<"."?".$s."?".">".$s.$h;});?>ob_start(function($s){$s=substr(str_replace(1,1+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[1]=$h[1]^' ';return "<"."?".$s."?".">".$s.$h;});Helloworld

Output (2nd iteration):
<?ob_start(function($s){$s=substr(str_replace(2,2+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[2]=$h[2]^' ';return "<"."?".$s."?".">".$s.$h;});?>ob_start(function($s){$s=substr(str_replace(2,2+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[2]=$h[2]^' ';return "<"."?".$s."?".">".$s.$h;});hElloworld

Output (10th iteration):
This is the last valid output but not a valid program anymore
<?ob_start(function($s){$s=substr(str_replace(10,10+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[10]=$h[10]^' ';return "<"."?".$s."?".">".$s.$h?>ob_start(function($s){$s=substr(str_replace(10,10+(int)true,$s),!i,ord(I)+ord(I));$h=hello.world;$h[10]=$h[10]^' ';return "<"."?".$s."?".">".$s.$hhelloworlD

Scroll far to the right to find the "Hello world" strings!

just realized that I can change (int)true to ``!!i` and save 12 bytes. Will try to golf it a bit more later

Pip, 48 - 50% = 24
V Y"`V Y`.RPyRh:ST`helloworld`UCh@<0.h@>0R0o+0"

which evolves as follows:
V Y"`V Y`.RPyRh:ST`helloworld`UCh@<1.h@>1R1o+1"
V Y"`V Y`.RPyRh:ST`Helloworld`UCh@<2.h@>2R2o+2"
V Y"`V Y`.RPyRh:ST`HElloworld`UCh@<3.h@>3R3o+3"
V Y"`V Y`.RPyRh:ST`HELloworld`UCh@<4.h@>4R4o+4"
V Y"`V Y`.RPyRh:ST`HELLoworld`UCh@<5.h@>5R5o+5"
V Y"`V Y`.RPyRh:ST`HELLOworld`UCh@<6.h@>6R6o+6"
V Y"`V Y`.RPyRh:ST`HELLOWorld`UCh@<7.h@>7R7o+7"
V Y"`V Y`.RPyRh:ST`HELLOWOrld`UCh@<8.h@>8R8o+8"
V Y"`V Y`.RPyRh:ST`HELLOWORld`UCh@<9.h@>9R9o+9"
V Y"`V Y`.RPyRh:ST`HELLOWORLd`UCh@<10.h@>10R10o+10"
V Y"`V Y`.RPyRh:ST`HELLOWORLD`UCh@<11.h@>11R11o+11"
V Y"`V Y`.RPyRh:ST`HELLOWORLD`UCh@<12.h@>12R12o+12"

with the last output being invalid because the HELLOWORLD hasn't changed. (Correct me if I haven't done the bonus right.)
Thanks to this question, I just discovered a new quine technique! The base quine is V Y"`V Y`.RPy":
  Y"         "  Yank that string into the variable y
V               Evaluate it as a Pip expression:
          RPy   y wrapped in double quotes (repr)
    `V Y`.      Prepend that regex pattern
                When this is evaluated, it returns a pattern object, which is
                auto-printed--conveniently, without the `` delimiters

Our extra code modifies the string in y, before repr-ing it, as follows:

Replace the current helloworld with one in which the leftmost 0 characters are uppercased;
Replace all occurrences of 0 with o+0 (where o is a builtin variable that equals 1).

The next time around the number in the code is 1 instead of 0, and so forth.

Javascript, 52 bytes
function(){return '("hello world").replace(" ","")'}

Test
=>
<='("hello world").replace(" ","")'
=> eval('("hello world").replace(" ","")')
<= 'helloworld'

///, 23 bytes
/,//\/ \/\/hello, world

Try it online!
First output:
/ //hello world

Second output:
helloworld

BBC BASIC, 56 bytes
I had a crack at this before I realized how late to the game I am.  For what it's worth, here's my version and my first attempt at StackExchange code golf.
Here, V. echoes out the characters given by the ASCII codes in the following comma separated list and P. is shorthand for print.  I make use of the backspace character to overwrite the existing 'helloworld' string.
Input code:
V.80,46,34:P."helloworld";:V.8,68,34,59:P.":V.8,8,76,68"

First Output:
P."helloworlD";:V.8,8,76,68

Second Output:
helloworLD

It can be tested online at https://bbc.godbolt.org/

I have definitely never used BBC BASIC, but how can this be tested? If I paste this into the linked emulator, the last line seems to output "Mistake" for me.

I'll edit my answer for clarity.  It's just the first line that need pasting in.  The second, generated line can be copied and executed in the emulator by using the PCs cursor and 'end' keys.  The third line is allowed to be invalid according to the rules.

Keg, 32 28 23 22 21 bytes
CKQNVNKKDG`(⑨,)`‘H%c¡

Try it online!
This prints:
CKQNVNKKDG(⑨,)HelloWorld

Which prints:
HELLOWORLD

05AB1E, score 15 9
-9 bytes thanks to ovs.
’"Ÿ™ ‚ï"á

Try it online!
Output:
"hello world"á

Second output:
helloworld

’...  # trimmed program
’...  # push "\"hello world\"á"
      # implicit output

"..."á  # trimmed program
     á  # push only letters in...
"..."   # literal
        # implicit output

9 bytes using string compression

Thanks, I would've if I didn't realize that the string hello world didn't need to be in the original program... lol

Vyxal D, 20.5 bytes
`⌐÷:aBk⁋+›bḢ¨£ßN∑kTtp+q‛:Ė+,helloworld`:Ė

Try it Online!
This outputs all 1024 different capitalisations of helloworld.

`                     q‛:Ė+           `:Ė # Quine structure
                           ,              # Eventually print the result
                            helloworld    # Ignored
 ⌐÷                                       # Push the bits before and after the comma
   :a                                     # Check capitalisation
     Bk⁋+›bḢ                              # Binary increment
            ¨£ßN∑                         # Capitalise
                 kTtp                     # Prepend a comma
                     +                    # Append to the rest of the code


text:
Make a 3var interpreter!
3var is a variant of deadfish which uses three variables called A, B and R.
A and B are accumulators, while R is used as a result variable.
In this code-golf challenge, you need to make an interpreter for a stripped-down version of this language.
Required Commands:
i   Increments A
d   Decrements A
s   Squares A
p   Prints A
P   Prints the ASCII character of A
>   Sets A to R
a   Increments B
k   Decrements B
m   Squares B
o   Prints B
O   Prints the ASCII character of B
<   Sets B to R
+   Adds A and B, stores in R
-   Subtracts B from A, stores in R
*   Multiplies A and B, stores in R
/   Divides A by B, stores in R
w   Prints R
@   Resets A to 0
#   Resets B to 0
e   Resets R to 0

Everything else (including whitespaces) is ignored.
Clarifications

o and p should output without anything after it.
Division is integer division.
Numbers above 255 and numbers below 0 are supported.
'w' should output a space or a newline after R
Division by 0 halts without errors. (No output to STDERR)
A, B and R are initially 0

Rules

This is code-golf so the shortest answer wins.
In the event of a tie, the oldest answer wins.
The file will be provided through command line arguments or STDIN.
Any language is allowed.
Eval is allowed.

Test Cases
Hello world! (taken from Esolangs)
iisssaa/>e
maa->e#
aamam->e#
dddddddddddddddddddddddddPiiiiiiiiiiiiiiiiiiiiiiiii
iiiiPiiiiiiiPPiiiP
@#e
iis
aamaaaa
*>P
@#e
iisssaa/>e
maa->e#
aamam->e#
iiiiiiiiiiiiiiiiiiiiiiP
ddddddddP
iiiP
ddddddP
ddddddddP
@#e
iiss
aa*>
iP

Outputs 20spooky22me:
iipois+iis<-<aaaO<OkOOkkkkOP@#iippisa+<m+>PaO

Outputs 9P-1420 100 3Q-1 162 0:
iiispsdPkokmo/w<+w#aaaommO-w@ii*wew

Leaderboards
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
# Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the leaderboard snippet:
# [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=63008,OVERRIDE_USER=45220;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"http://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

Should the output of o be followed by a newline?

@LegionMammal978 No, it outputs the ascii value stored in B as a number.

That would be O.

@LegionMammal978 Yeah, sorry. o prints it as a number, O prints it as a character.

@Sp3000 Speaking of it, I recently helped fix a nested loop bug in the interpreter.

Additional clarifications for people familiar with Deadfish: dddddp results in -5 and iiiissp results in 256 as you'd expect, rather than 0.

In the test Case What dose r do? its not included on your list of valid commands

I have an answer but fail with your example using r command

@Sp3000 Thanks for the extra test case

@edc65 Sp3000 edited the test case so it should work now.

@JimmyJazzx The testcase is now edited, but in the full 3var language r resets everything. It's the same as @#e.

Added clarifications to the post.

@DJgamer98 Deleted my comments - would you mind adding another test case: iiispsdPkokmo/w<+w#aaaommO-w@ii*wew? I also see you added that division by 0 halts without errors - does this mean no output to STDERR, exit code 0 or...?

@Sp3000 No output to STDERR.

(er... test case means posting the expected output/s along with it)

@Sp3000 Whoops. I'm currently on mobile, i'll post it when i get home

Prints A I assume this means print the numerical value of A, right?

@Digital Trauma 1. Prints A means Print the numerical value of A. 2. It's the same thing. I'll edit the post.

You should add test cases for the clarifications

Are A, B, and R initialized to 0 when the interpreter starts?

@TonyEnnis Yes.

It's too bad this language doesn't seem to have any means of accepting input - then you could write a 3var interpreter IN 3var.  (Probably wouldn't be very golfable, but would still be impressive...)

@DarrelHoffman The full language has input.

Which numbers are "about 255"?

@Bakuriu It should have said "above". Edited the post.

05AB1E, 104 103 102 bytes
0©U0Vv“ìÉP@p>akmO#o<+-*/ew“ykDdi…><nS'Xì'U«"Xç?0UX?®U"4ä«Dε„XU„YV‡}«"+-*÷"S„XYì0ª„©\«„®,ª«sè.Vy'/Q®+iq

Try it online or verify all test cases.
Explanation:
0©U0V          # Set variables `X` (A), `Y` (B) and `®` (R) to 0
               # (they are 1, 2, and -1 respectively by default)
v              # Loop over each character `y` of the (implicit) input-string:
 “ìÉP@p>akmO#o<+-*/ew“
               #  Push dictionary string "idsP@p>akmO#o<+-*/ew"
  yk           #  Get the index of `y` in this string
    D          #  Duplicate it
 di            #  If the index is not -1 (thus it's a valid character):
   …><n        #   Push string "><n"
    S          #   Convert it to a list of characters: [">","<","n"]
     'Xì      '#   Prepend an "X" in front of each item: ["X>","X<","Xn"]
        'U«   '#   Append an "U" after each item: ["X>U","XU","XU","XV","Y<V","YnV","Yç?","0V","Y?","®V"]
   "+-*÷"      #   Push string "+-*÷"
    S          #   Convert it to a list of characters: ["+","-","*","÷"]
     „XYì      #   Prepend "XY" in front of each item: ["XY+","XY-","XY*","XY÷"]
   0ª          #   Append a 0: ["XY+","XY-","XY*","XY÷",0]
     „©\«      #   Append "®\" after each item:
               #    ["XY+©\","XY-©\","XY*©\","XY÷©\","0©\"]
   „®,ª        #   Append string "®," to this list:
               #    ["XY+©\","XY-©\","XY*©\","XY÷©\","XY0©\","®,"]
   «           #   Merge the two lists together:
               #    ["X>U","XV","Y<V","YnV","Yç?","0V","Y?","®V",
               #     "XY+©\","XY-©\","XY*©\","XY÷©\","XY0©\","®,"]
    s          #   Swap to get the duplicated index
     è         #   Use it to index into this list of strings
      .V       #   And evaluate/execute it as 05AB1E code
   y'/Q       '#   Check if the current character equals "/"
       ®+      #   Add the value of `®` to it
         i     #   If this is now 1:
               #   (thus the current character is "/" and the value of `®` is 0):
          q    #    Stop the program

Here an overview of all characters translated to 05AB1E code:
i   X>U        # Push `X`; increase it by 1; pop and store it as new `X`
d   X<U        # Push `X`; decrease it by 1; pop and store it as new `X`
s   XnU        # Push `X`; square it; pop and store it as new `X`
P   Xç?        # Push `X`; convert it to a character; pop and print it (without newline)
@   0U         # Push 0; pop and store 0 as new `X`
p   X?         # Push `X`; pop and print it (without newline)
>   ®U         # Push `®`; pop and store `®` as new `X`
a   Y>V        # Push `Y`; increase it by 1; pop and store it as new `Y`
k   Y<V        # Push `Y`; decrease it by 1; pop and store it as new `Y`
m   YnV        # Push `Y`; square it; pop and store it as new `Y`
O   Yç?        # Push `Y`; convert it to a character; pop and print it (without newline)
#   0V         # Push 0; pop and store 0 as new `Y`
o   Y?         # Push `Y`; pop and print it (without newline)
<   ®V         # Push `®`; pop and store `®` as new `Y`
+   XY+©\      # Push `X` and `Y`; add them together; store it in `®` (without popping);
               # and discard it from the stack
-   XY-©\      # Push `X` and `Y`; subtract them from one another; store it in `®`
               # (without popping); and discard it from the stack
*   XY*©\      # Push `X` and `Y`; multiply them together; store it in `®` (without
               # popping); and discard it from the stack
/   XY÷©\      # Push `X` and `Y`; integer-divide them from one another; store it in `®`
               # (without popping); and discard it from the stack
e   0©\        # Push 0; store 0 in `®` (without popping); and discard it from the stack
w   ®,         # Push `®`; pop and print it with trailing newline

See this 05AB1E tip (section How to use the dictionary?) to understand why “ìÉP@p>akmO#o<+-*/ew“ is "idsP@p>akmO#o<+-*/ew".

JavaScript (ES7) 208 213 223 237 241 311
Edit3 Copying each other, I and Dendrobium are collapsing together.
Edit2 Using EcmaScript 7 to save just 2 bytes, joined together handling of A and B
Edit Following the changes of the rules.
Note, I added the r command that is not required in the question, just to run the old example Hello world

V=p=>(o='',[for(c of'@#e'+p)eval('++x,--x,x*=x,x=R,x=0,o+=x,o+=String.fromCharCode(x),R=A+B,R=A-B,R=A*B,R=A/B|0,R=0,o+=R+` `'.replace(/x/g,(k='ids>@pP+-*/ewakm<#oO'.indexOf(c))<13?'A':'B').split`,`[k%13])],o)

// More readable
U=p=>(
  o='',
  [for(c of'@#e'+p)
   eval(
   '++x,--x,x*=x,x=R,x=0,o+=x,o+=String.fromCharCode(x),R=A+B,R=A-B,R=A*B,R=A/B|0,R=0,o+=R+` `'
   .replace(/x/g,(k='ids>@pP+-*/ewakm<#oO'.indexOf(c))<13?'A':'B')
   .split`,`[k%13])]
  ,o
)

// ES6, no array comprehension, 2 bytes more
W=p=>
  [...'@#e'+p].map(c=>
    eval(
    '++x,--x,x*=x,x=R,x=0,o+=x,o+=String.fromCharCode(x),R=A+B,R=A-B,R=A*B,R=A/B|0,R=0,o+=R+` `'
    .replace(/x/g,(k='ids>@pP+-*/ewakm<#oO'.indexOf(c))<13?'A':'B')
    .split`,`[k%13]),
    o=''
  )&&o

// Test
function test()
{
  OUT.innerHTML = V(I.value)
}

test()
textarea { width: 75%; height: 8em }
Test program <button onclick="test()">Run</button>
<textarea id=I>
iisssaa/>e
maa->e#
aamam->e#
dddddddddddddddddddddddddPiiiiiiiiiiiiiiiiiiiiiiiii
iiiiPiiiiiiiPPiiiP
@#e
iis
aamaaaa
*>P
@#e
iisssaa/>e
maa->e#
aamam->e#
iiiiiiiiiiiiiiiiiiiiiiP
ddddddddP
iiiP
ddddddP
ddddddddP
@#e
iiss
aa*>
iP
</textarea>
Output

You could save 2 bytes by removing A=B=R=0, and setting those variables using the actual 3var functions before processing the string, like: [...'@#e'+p].

@insertusernamehere thx, I love this one

GNU Sed (with eval option to evaluate dc expression), 254
Deadfish maps fairly nicely to a subset of dc.  So we use sed to do that mapping:
s/^/@#e/
s/\+/AB+r/g
s/-/AB-r/g
s/\*/AB*r/g
s|/|AB/r|g
s/a/B1+b/g
s/i/A1+a/g
s/d/A1-a/g
s/s/Ad*a/g
s/p/An/g
s/P/AP/g
s/>/Ra/g
s/k/B1-b/g
s/m/Bd*b/g
s/o/Bn/g
s/O/BP/g
s/</Rb/g
s/w/Rn/g
s/@/0a/g
s/#/0b/g
s/e/0r/g
s/[ABR]/l&/g
s/[abr]/s\u&/g
s/.*/dc -e'&'/e

Try it online!

Javascript ES6 ES7, 217 215 213 208 bytes
f=s=>(O='',[for(c of'@#e'+s)eval('v=0,++v,--v,v*=v,O+=v,O+=String.fromCharCode(v),v=R,R=0,R=A+B,R=A-B,R=A*B,R=A/B|0,O+=R+" "'.replace(/v/g,'AB'[(x='@idspP>e+-*/w#akmoO<'.indexOf(c))/13|0]).split`,`[x%13])],O)

Ungolfed
f=s=>(
    O='',                                                                   // initialize output to empty string
    [for(c of'@#e'+s)eval(                                                  // initialize A, B, and R, loop over all chars in input, eval returned function string
        'v=0,++v,--v,v*=v,O+=v,O+=String.fromCharCode(v),v=R,R=0,R=A+B,R=A-B,R=A*B,R=A/B|0,O+=R+" "' // operation list
            .replace(/v/g,'AB'[(x='@idspP>e+-*/w#akmoO<'.indexOf(c))/13|0]) // replace all instances of v with either A or B
            .split`,`[x%13])],                                              // split ops list, select corresponding function string
    O)                                                                      // return output string

+1 Not far from mine, but better. Now I'll have to try something different

You could save 2 bytes by removing A=B=R=0, and setting those variables using the actual 3var functions before processing the string, like: for(c of '@#e'+s).

@insertusernamehere Aha, thats pretty clever, thanks!

Revising your answer, I see that you don't output a newline for command w

@edc65 One of the clarification bullets states "'w' should output a space or a newline after R"

CJam, 112
q{"+-*/dspP>@ikmoO<#awe"_@#\4<"X2 U|{TU :V;}P?"S/f*'T"( _*T cT;V;0)"2/f+":T;"f+_'Tf/'Uf*+"VS 0:V; "S/++=~}%Pa/0=

Try it online
Explanation:
The program builds an array of pieces of code to be executed, and executes the corresponding piece for each character. Dealing with the division by zero is more difficult, because CJam doesn't yet have a "break" operator. Instead, the program pushes π as a marker (since no floating point number can appear otherwise), and at the end it keeps only the output before the first π.
Also, the program uses variables T, U and V instead of A, B and R, because they are preinitialized with 0 in CJam.
q            read the input
{…}%         transform each character
  "…"        push a string with all the 3var commands, in a convenient order
  _@         duplicate the string and bring the current character to the top
  #          find the index of the character in the string (or -1 if not found)
  \          swap with the other string copy
  4<         keep only the first 4 characters ("+-*/")
  "…"        push a string that will be used for implementing those operators
  S/         split by space into ["X2" "U|{TU" ":V;}P?"]
  f*         join with each of '+', '-', '*', '/' -> 4 strings
  'T         push the 'T' character
  "…"        push a string with implementations of commands involving A
  2/         split into pieces of length 2
  f+         prepend 'T' to each piece
  ":T;"f+    append ":T;"to each piece
  _          duplicate the array (containing full A-command implementations)
  'Tf/       split each piece by the 'T' character
  'Uf*       join each split piece using the 'U' character
              practically replacing 'T' with 'U'
              to obtain B-command implementations
  +          concatenate the 2 arrays
  "…"        push a string containing implementations for "w" and "e",
              separated by space; the string also ends with a space
  S/         split by space, obtaining the implementations for "w" and "e"
              and an empty string, for handling unrecognized characters
  ++         concatenate with the A and B command and +-*/ implementations
  =          get the corresponding string implementing the current command
              if the character was not found, -1 will get the empty string (no-op)
  ~          execute it
Pa/          split the array of results by the π separator
0=           get the first piece (before the first π, if any)

The actual command implementations (constructed by the program):
+: X2+U|{TU+:V;}P?    if (1+2)|U != 0, set V=T+U, else push π
-: X2-U|{TU-:V;}P?    if (1-2)|U != 0, set V=T-U, else push π
*: X2*U|{TU*:V;}P?    if (1*2)|U != 0, set V=T*U, else push π
/: X2/U|{TU/:V;}P?    if (1/2)|U != 0, set V=T/U, else push π
d: T( :T;             set T=T-1
s: T_*:T;             set T=T*T
p: TT :T;             push T and set T=T (no-op)
P: TcT:T;             push T converted to character and set T=T (no-op)
>: T;V:T;             push and pop T (no-op) and set T=V
@: T;0:T;             push and pop T (no-op) and set T=0
i: T):T;              set T=T+1
k: U( :U;             set U=U-1
m: U_*:U;             set U=U*U
o: UU :U;             push U and set U=U (no-op)
O: UcU:U;             push U converted to character and set U=U (no-op)
<: U;V:U;             push and pop U (no-op) and set U=V
#: U;0:U;             push and pop U (no-op) and set U=0
a: U):U;              set U=U+1
w: VS                 push V and a space
e: 0:V;               set V=0
(default): (empty)    no-op

APL, 191
{0::→⋄A B R←0⋄{⍵∊G←'aikdms<>':⍎'AB'[1+2|G⍳⍵],'+-*∘'[M],'←','112R'[M←⌈2÷⍨G⍳⍵]⋄⍵∊G←'PpOo':⍞←⎕UCS⍣(2|G⍳⍵)⊢A B[⌈2÷⍨G⍳⍵]⋄⍵∊G←'+-*/':R∘←⌊A(⍎'+-×÷'[G⍳⍵])B⋄⍵∊G←'@#e':⍎'ABR'[G⍳⍵],'∘←0'⋄⍵='w':⍞←R}¨⍵}

This is a function that takes the program as an argument, e.g:
      ∆3var←{0::→⋄A B R←0⋄{⍵∊G←'aikdms<>':⍎'AB'[1+2|G⍳⍵],'+-*∘'[M],'←','112R'[M←⌈2÷⍨G⍳⍵]⋄⍵∊G←'PpOo':⍞←⎕UCS⍣(2|G⍳⍵)⊢A B[⌈2÷⍨G⍳⍵]⋄⍵∊G←'+-*/':R∘←⌊A(⍎'+-×÷'[G⍳⍵])B⋄⍵∊G←'@#e':⍎'ABR'[G⍳⍵],'∘←0'⋄⍵='w':⍞←R}¨⍵}
      ∆3var 'iipois+iis<-<aaaO<OkOOkkkkOP@#iippisa+<m+>PaO'
20spooky22me

It can be used as an anonymous function, I just gave it a name for clarity.
Explanation:

0::→: if an error occurs (say, division by zero), halt without printing the error message
A B R←0: initialize variables
{...}¨⍵: for each command:

⍵∊G←'aikdms<>': If the command is one of the type var ← fn(var, x), find the proper fn and x, substitute them in and then evaluate it:

⍎: evaluate
'AB'[1+2|G⍳⍵: A if the position of ⍵ in 'aikdms<>' is even, B otherwise.
'+-*∘'[M]: add, subtract, power, or nothing, depending on M (defined later)
'←': assign
'112R'[M←⌈2÷⍨G⍳⍵]: 1 (for adding and subtracting), 2 (for power), and R (for nothing, i.e. it just sets the variable to R), depending on M, which is whether the command belongs to the first, second, third or fourth pair.

⍵∊G←'PpOo': output:

⍞←: output
⎕UCS⍣(2|G⍳⍵): ASCII (well, Unicode) or number  depending on whether the command was on an odd or even position in PpOo,
⊢A B[⌈2÷⍨G⍳⍵]: A or B, depending on whether the command was in the first or second half.

⍵∊G←'+-*/: math:

R∘←⌊A(⍎'+-×÷'[G⍳⍵])B: set R to the result of applying the given operator to A and B.

⍵∊G←'@#e': reset:

⍎: evaluate
'ABR'[G⍳⍵]: select the right variable
'∘←0': set to zero

⍵='w':⍞←R: if the command is w, output R.

VBA, 484, 453 380  Bytes
To long to win but A super Simple way of doings things, Nothing Fancy just good old Select Case
Adding in Integer Division and Div 0 Error Handling Ate a lot of Bytes
Removed Error Handling as it seems the normal error handling results in the same functionality.
Fixed Int Division to work as expected. Was also shorter.
Function Y(x)
For Z=1 To Len(x)
w=Mid(x,Z,1)
Select Case w
Case"i":A=A+1
Case"d":A=A-1
Case"s":A=A^2
Case"p":Y=Y &A
Case"P":Y=Y &Chr(A)
Case">":A=R
Case"a":B=B+1
Case"k":B=B-1
Case"m":B=B^2
Case"o":Y=Y &B
Case"O":Y=Y &Chr(B)
Case"<":B=R
Case"+":R=A+B
Case"-":R=A-B
Case"*":R=A*B
Case"/":R=A\B
Case"w":Y=Y &R &vbCrLf
Case"@":A=0
Case"#":B=0
Case"e":R=0
End Select
Next
End Function

Thanks to Henrik Ilgen for saving 31 104 bytes

Not entirely sure if this works in VBA (it does in VB6), but you could save a bunch of bytes by using DefInt A-Z, thereby omitting the need to explicitly declaring A, B and R as Integer: DefInt A-Z:Dim A, B, R. It might as well work to just assign them, without declaration: A=0:B=0:R=0. The calculations  should work on variants, too.

@HenrikIlgen thanks alot, Forgot about DefInt Not Something I use everyday but going to be super useful golfing VBA in the future. Sadly A=0 will just make it act like a double from my tests. There for making iiiaa/w produce a decimal result rather then a whole.

Try \ for integer division ;)

You can condense it down to 405 bytes if you make it a function and use the return value to "build" the result, assuming you don't have to actually print the result :)

C, 253 241 bytes
#define _ c--?c--?c--
k="id@s>ak#m<e+-*/wpoPO",*p;main(c,a,b,r){for(a=b=r=0;~c;c=getchar())c=strchr(k,c),c&&(c-=k,p=&a+c/5,*p=_?_?_?_?_?printf(c?c<3?"%d":"%c":"%d ",c?c%2?a:b:r):a/(b?b:exit()):a*b:a-b:a+b:0:r:b*b:0:b-1:b+1:r:a*a:0:a-1:a+1);}

This code uses the string id@s>ak#m<e+-*/wpoPO as a table of commands. The string is arranged according to the destination of the calculated expression. It just so happens that there are 5 commands that update each of the variables:

id@s> - update a
ak#m< - update b
e+-*/ - update r
wpoPO - update... the memory location after a, b and r. I hope it's not too important :)

So after locating the input character in the string of commands, its index is repeatedly decreased, and depending on when it reaches 0, an expression is chosen.
If it doesn't reach 0 after 15 subtractions, it's a printf with some properly chosen arguments.
Also, when dividing, it avoids division by 0 by calling exit().
This code should be compiled without optimizations, because it assumes that a, b and r are located at adjacent addresses on stack (not in CPU registers).
Also, it should be compiled in 32-bit mode, because it converts pointers to integers and vice-versa.

PHP, 310 bytes
First time in my life using eval:
for($A=$B=$R=0;$c=$argv[1][$i++];)eval([i=>'++$A',d=>'--$A',s=>'$A*=$A',p=>'echo$A',P=>'echo chr($A)','>'=>'$A=$R',a=>'++$B',k=>'--$B',m=>'$B*=$B',o=>'echo$B',O=>'echo chr($B)','<'=>'$B=$R','+'=>'$R=$A+$B','-'=>'$R=$A-$B','*'=>'$R=$A*$B','/'=>'$R=$A/$B',w=>'echo$R','@'=>'$A=0','#'=>'$B=0',e=>'$R=0'][$c].';');

Takes the first command line input:
php 3var.php "iipois+iis<-<aaaO<OkOOkkkkOP@#iippisa+<m+>PaO"

Output from the examples:

Hello world!
20spooky22me

C, 357
Macros FTW!
(Who am I kidding - c will never win this one)
#define X(p,e) case p:e;break;
#define Y(p,a,b,c,d,e,f) X(a,p++)X(b,p--)X(c,p*=p)X(d,printf("%d",p))X(e,printf("%c",p%256))X(f,p=R)
A,B,R;main(int C,char**V){for(;*V[1];)switch(*V[1]++){Y(A,'i','d','s','p','P','>')Y(B,'a','k','m','o','O','<')X('+',R=A+B)X('-',R=A-B)X('*',R=A*B)X('/',R=A/(B?B:exit(0),1))X('w',printf("%d",R))X('@',A=0)X('#',B=0)X('e',R=0)}}

335 bytes

JavaScript (ES6), 293 262 bytes
f=x=>(o="",a=b=r=0,p=String.fromCharCode,[...x].map(c=>{if(eval(`m={i_a++,d_a--,s_a*=a,p_o+=a,P_o+=p(a),">"_a=r,a_b++,k_b--,m_b*=b,o_o+=b,O_o+=p(b),"<"_b=r,"+"_r=a+b,"-"_r=a-b,"*"_r=a*b,"/"_r=a/b|0,w_o+=r,"@"_a=0,"#"_b=0,e_r=0}[c]`.replace(/_/g,":_=>")))m()}),o)

Usage
f(`iisssaa/>e
maa->e#
aamam->e#
dddddddddddddddddddddddddPiiiiiiiiiiiiiiiiiiiiiiiii
iiiiPiiiiiiiPPiiiP
@#e
iis
aamaaaa
*>P
@#e
iisssaa/>e
maa->e#
aamam->e#
iiiiiiiiiiiiiiiiiiiiiiP
ddddddddP
iiiP
ddddddP
ddddddddP
@#e
iiss
aa*>
iP`)

=> "Hello world!"

Explanation
There are a few details of the language that I'm unsure about (integer sizes, handling unrecognised characters, etc) but this solution seems to work sufficiently and ignores whitespace characters like the new-lines in the test case.
f=x=>(
  o="",                           // o = output string
  a=b=r=0,
  p=String.fromCharCode,
  [...x].map(c=>{                 // iterate through each character
    if(                           // if used for NOP characters (whitespace)

      // Functions:
      eval(`m={
        i_a++,
        d_a--,
        s_a*=a,
        p_o+=a,
        P_o+=p(a),
        ">"_a=r,
        a_b++,
        k_b--,
        m_b*=b,
        o_o+=b,
        O_o+=p(b),
        "<"_b=r,
        "+"_r=a+b,
        "-"_r=a-b,
        "*"_r=a*b,
        "/"_r=a/b|0,
        w_o+=r,
        "@"_a=0,
        "#"_b=0,
        e_r=0
      }[c]`.replace(/_/g,":_=>")) // dynamically add common characters

    )m()                          // execute the function
  }),
  o                               // return the output string
)

I think you could save a few bytes by enclosing the dictionary within an eval whilst replacing all :$=> with $, then adding a replace for the string.

Simplex v.0.8, 211 bytes
(UTF-8 encoded.)
h@u]u2ƒ§I]ƒ§M]ƒ§^O]ƒ§o]ƒ§s]ƒ§@]ƒ§Ah]ƒ§Sh]ƒ§Mh]ƒ§Vh]ƒ§&oh]ƒðI]ƒðM]ƒð^O]ƒðo]ƒðs]ƒð@]ƒðAh]ƒðSh]ƒðMh]ƒðVh]ƒð&oh]ƒ§z]ƒðz]ƒuz@]{"idspP>akmoO<+-*/w@#e"RlyG^u·u†vøÏ}

Explanation
Since this is the longest simplex program I have thus far written, I will generally explain how this works in bullet points.

h@u] - defines macro 0. This macro simply writes to the register and makes a lambda return nothing.
u2 - goes to the above strip and sets the current byte to 2; this defines the arity of the lambdas to be defined.
ƒ - begin lambda expression; once completed by ], will push lambda function to the lambda stack. It acts by taking (arity) cells from the pointer into its local strip, and, after completion, will set its local strip to the taken cells, unless the current byte is unwritten. The pointer is not affected. Macro 0 allows for a function to return without modifying anything in the strip.
§ - moves to the first written cell in the current strip i.e. A.
ð - moves to the last written cell in the current strip i.e. B.
… {"idspP>akmoO<+-*/w@#e"RlyG^u·u†vøÏ}

{...Ï} repeat until the input stack is empty
"idspP>akmoO<+-*/w@#e" - the commands
Rly - put the strip into a tuple
G^u - the index of the input in the tuple
· - load the current byteth into the lambda evaluator
uRL - goes to the strip holding A and B (writes A and B if they don't exist)
† - executes lambda (this is the lambda evaluator)
vø - resets below strip

phew I'm impressed. It's long for Simplex, but short for everything else. ;)

Minkolang 0.11, 222 bytes
I'm sure this can be golfed further, but it was fun. Also, first Minkolang interpreter of another language!
>I3&000V$Vod?.45*[di1q=5&]x00wx1i2+kw
idspP>akmoO<+-*/w@#e
vr1+r
vr1-r
vr2;r
v0c1$((dl%"0"+$rl:d)$Ok
v0cO
vrx0cr
v1g1+1G
v1g1-1G
v1g2;1G
v1c1$((dl%"0"+$rl:d)$Ok
v1cO
v1gxd1G
vx$d+
vx$d-
vx$d*
vx$dd?.:
vdN
vrx0r
v1gx01G
vx0

Try it here.
Explanation
>I3&000                    Initializes A, B, and R if they don't already exist.
V$V                        An idiom that ensures no time-travel.
od?.                       Reads in a character and halts if input is empty.
45*[di1q=5&]               Looks through the second row for a matching character.
            x00w           Jumps back to beginning if no match.
                x1i2+kw    Jumps to corresponding line upon match.

The rest of the lines are pretty simple, perhaps with the exception of those with 1$((dl%"0"+$rl:d)$Ok, which is an idiom that prints a number without a trailing space. (I haven't yet implemented the convert-this-number-to-a-string functionality, which will be 1Z.) Oh, yes, they all have a v at the beginning, which takes it back to the beginning.

GNU Sed (with eval option to evaluate dc expression), 289
Inspired by Digital Trauma who sadly failed to realize, that a) illegal characters need to be ignored, b) dc needs the entire converted program in one argument and c) division by 0 must terminate the program without error.
If all these rules wouldn't apply, my solution would only be 235 bytes long ;)
H
$!d
x
s/^/@#e/
s:[^-a><de/+i*k@w#opsmOP]::g
s:[e@#]:0&:g
s:[-*+/pPid]:Q&:g
s:[-kaoO*+/]:H&:g
s:[><w]:Z&:g
s:[diak]:1&:g
s:s:Q2^>:g
s:m:H2^<:g
s:[-+*/]:&e:g
s:[ia]:+&:g
s:[dk]:-&:g
y:Oop:Pnn:
s:w:n32P:g
s:[id>@]:sq:g
s:e:sz:g
s:[#<ka]:sh:g
s:[QHZ]:l\l&:g
s:/:d0=t/:g
s/.*/dc -e'[q]st&'/e

AWK, 311 309
func p(z,f,x){if(c~z)printf"%"f,x}BEGIN{FS=z}{for(i=0;++i<=NF;){c=$i;A=c~/i/?A+1:c~/d/?A-1:c~/s/?A*A:c~/@/?0:c~/>/?R:A;p("p","d",A);p("P","c",A);B=c~/a/?B+1:c~/k/?B-1:c~/m/?B*B:c~/#/?0:c~/</?R:B;p("o","d",B);p("O","c",B);R=c~/+/?A+B:c~/-/?A-B:c~/*/?A*B:c~/e/?0:R;if(c~"/")if(B)R=A/B;else exit;p("w","d ",R)}}

TIL parenthesis were not needed around printf. 2 bytes saved!
Ungolfed version for easier reading:
func p(z,f,x) {
    if(c~z) printf "%"f,x
}

BEGIN {
    FS=z
}

{
    for(i=0;++i<=NF;){
        c=$i;
        A=c~/i/?A+1:c~/d/?A-1:c~/s/?A*A:c~/@/?0:c~/>/?R:A;
        p("p","d",A);
        p("P","c",A);
        B=c~/a/?B+1:c~/k/?B-1:c~/m/?B*B:c~/#/?0:c~/</?R:B;
        p("o","d",B);
        p("O","c",B);
        R=c~/+/?A+B:c~/-/?A-B:c~/*/?A*B:c~/e/?0:R;
        if(c~"/")if(B)R=A/B;else exit;
        p("w","d ",R)
    }
}

Python 2, 272
import sys;a,b,r=0,0,0;exec';'.join(filter(None,map(dict(x.split(':')for x in"a:b+=1|@:a=0|#:b=0|/:r=a/b|d:a-=1|PXchr(a)|i:a+=1|-:r=a-b|k:b-=1|*:r=a*b|m:b*=b|oXb|pXa|s:a*=a|OXchr(b)|wXr|+:r=a+b|e:r=0|<:b=r|>:a=r".replace('X',':print ').split('|')).get,sys.stdin.read())))

This doesn't work. Your print statements include a trailing newline.

Ruby, 199 bytes
a=b=r=0
$<.read.chars{|c|eval %w{a+=1
a-=1
a*=a
$><<<<akmoO<+-*/w@#e".index(c)||-1]}

5 bytes can be saved by removing .read from the second line if you can tolerate a warning being printed to stderr on newer version of Ruby.

Python, 244
import sys;P=sys.stdout.write;A=B=R=0;exec';'.join(filter(None,map(dict(zip('idspP>akmoO<+-*/w@#e','A+=1 A-=1 A**=2 P(`A`) P(chr(A)) A=R B+=1 B-=1 B**=2 P(`B`) P(chr(B)) B=R R=A+B R=A-B R=A*B R=A/B print(R) A=0 B=0 R=0'.split())).get,input())))

Bit late but I wanted to have a go.

Prolog, 759 bytes
Not the shortest program, but at least it's structured and readable.
q(A,B,R,i,X,B,R):-X is A+1.
q(A,B,R,d,X,B,R):-X is A-1.
q(A,B,R,s,X,B,R):-X is A*A.
q(_,B,R,>,R,B,R).
q(A,B,R,a,A,X,R):-X is B+1.
q(A,B,R,k,A,X,R):-X is B-1.
q(A,B,R,m,A,X,R):-X is B*B.
q(A,_,R,<,A,R,R).
q(A,B,_,+,A,B,X):-X is A+B.
q(A,B,_,-,A,B,X):-X is A-B.
q(A,B,_,*,A,B,X):-X is A*B.
q(_,0,_,/,_,_,_):-!,1=2.
q(A,B,_,/,A,B,X):-B>0,X is A/B.
q(_,B,R,@,0,B,R).
q(A,_,R,#,A,0,R).
q(A,B,_,e,A,B,0).
q(A,B,R,p,A,B,R):-write(A).
q(A,B,R,'P',A,B,R):-A>0,format('~c',A).
q(A,B,R,'P',A,B,R):-write(A).
q(A,B,R,o,A,B,R):-write(B).
q(A,B,R,'O',A,B,R):-format('~c',B).
q(A,B,R,'O',A,B,R):-write(B).
q(A,B,R,w,A,B,R):-write(R),nl.
q(A,B,R,_,A,B,R).
f([],_,_,_).
f([H|T],A,B,R):-q(A,B,R,H,X,Y,Z),f(T,X,Y,Z),!.
p(X):-atom_chars(X,Y),f(Y,0,0,0).

Example input
p('iipois+iis<-<aaaO<OkOOkkkkOP@#iippisa+<m+>PaO').

Try it out online here

Perl 5 -Minteger -n0, 274 bytes
s//;/g;s/e/R=0/g;s/\+/R=A+B/g;s/-/R=A-B/g;s/\*/R=A*B/g;s/i/A++/g;s/d/A--/g;s/s/A*=A/g;s/p/printA|0/g;s/P/print chrA/g;s/>/A=R/g;s/a/B++/g;s/k/B--/g;s/m/B*=B/g;s/o/printB|0/g;s/O/print chrB/g;s/</B=R/g;s,/,B||exit;R=A/B,g;s/w/sayR|0/g;s/\@/A=0/g;s/#/B=0/g;s/[ARB]/\$$&/g;eval

Try it online!

source: Stack Exchange

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

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

sort: votes


text:
The Interview: The Front Nine
The Interview: The Front Nine
This is the first of a series of challenges inspired by programming job interview questions.
You walk into the office where your potential future boss sits. "Come on in and sit down", he says. You nervously sit down, making sure your snappy yet professional attire is free of wrinkles. He asks you many questions, about your education, previous work experiences, and so on. You answer them mostly honestly, adding a little embellishment here and there to make yourself sound better. He leans forward and begins to speak again.
"Have you ever heard of code golfing?" Why, yes, you love to golf code, and do it frequently in your free time. "Great. The last part of the interview is a technical examination. You will be tasked with writing code to solve a series of problems..." He hands you a sheet of paper. You quickly glance over it. Easy peasy. Now why did he ask about code golfing?
"You will be graded based on the total size of your solutions to these problems. If you can score lower than all the other candidates, the job is yours." Oh. "Like golf, there are 18 problems, broken up into two sets of 9. Feel free to use any language you like to solve them; we have compilers and interpreters for every language you've heard of, and certainly a few that you haven't. Good luck!"
The Tasks
Task 1: Multiplication Table
Given a number n as input, output a multiplication table for positive integers in the range [1, n]. n will be in the range [1, 12]. All numbers should be left-aligned in the table. Use the character x for the top-left corner.
Examples:
n=4
x   1   2   3   4
1   1   2   3   4
2   2   4   6   8
3   3   6   9   12
4   4   8   12  16

n=10
x   1   2   3   4   5   6   7   8   9   10
1   1   2   3   4   5   6   7   8   9   10
2   2   4   6   8   10  12  14  16  18  20
3   3   6   9   12  15  18  21  24  27  30
4   4   8   12  16  20  24  28  32  36  40
5   5   10  15  20  25  30  35  40  45  50
6   6   12  18  24  30  36  42  48  54  60
7   7   14  21  28  35  42  49  56  63  70
8   8   16  24  32  40  48  56  64  72  80
9   9   18  27  36  45  54  63  72  81  90
10  10  20  30  40  50  60  70  80  90  100

Task 2: Ordinal RMS
Given a string of ASCII characters, output the root-mean-square average of their ASCII ordinals. The string will never contain a NULL byte (ordinal 0).
Examples:
Input: The Interview: The Front Nine
Output: 95.08290393488019

Input: `1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./
Output: 91.38101204135423

Task 3: Projectile Motion
Given the initial velocity and angle with the horizon of a projectile fired from ground level, output the horizontal distance it will travel before landing. The initial velocity will be given in meters per second, the angle will be given in degrees, and the distance shall in meters. Assume Earth gravity (g=9.81 m/s/s), and ignore relativistic effects. For the sake of this problem, you may assume the Earth is flat (you will not need to consider the curvature of the Earth when making your calculations). The given angle will be in the range [0, 90]. Your answer should be accurate to at least two decimal places (rounding is allowed).
Examples:
velocity=50, angle=45
Result: 254.84 (rounded)

velocity=10, angle=60
Result: 8.82798576742547

Task 4: etaoin shrdlu
Given a string of non-null printable ASCII characters (ordinals in the range [32,127]), output the string, with its characters sorted by their frequencies in descending order. In the case of a tie, order by ASCII ordinal, ascending.
Examples:
Input: "Hello, World!"
Output: "llloo !,HWder"

Input: "Programming Puzzles and Code Golf"
Output: "    oooPPaaddeeggllmmnnrrzzCGfisu"

Task 5: Fibonacci Index
Given a number, determine if it is a Fibonacci number, and if it is, output its index (starting from 1) in the sequence. If it is not a Fibonacci number, output 0. In the case of 1, which is in the sequence twice, output the earliest occurrence (index 1).
Examples:
Input: 1
Output: 1

Input: 144
Output: 12

Input: 4
Output: 0

Task 6: Anagrams
Given three strings of lowercase English letters ([a-z]), output a string that uses all the letters in the first string, begins with the second string, and ends with the third string. If such a string cannot be constructed, output an empty string. The input strings will always be at least one letter long. The "middle" of the output string (between the prefix and postfix string) may be empty, if the prefix and postfix strings together use all of the letters in the source string.
Examples:
Input: geobits bi es
Possible output: bigtoes

Input: mariatidaltug digital trauma
Output: digitaltrauma

Input: mego go lf
Output: (empty string)

Task 7: Filling In The Blanks
Given a list of strings and a fill character, output the result of padding all of the strings to the length of the longest string with the fill character, sorted in ascending order by the original lengths of the strings, preserving the original order in the case of a tie. You should be able to handle lists of any finite length, containing strings of any finite length, bounded only by memory constraints.
Examples:
Input: ["hello","world","this","is","a","test"], 'x'
Output: ["axxxx","isxxx","thisx","testx","hello","world"]

Input: ["I'm","a","lumberjack","and","I'm","okay"], '!'
Output: ["a!!!!!!!!!","I'm!!!!!!!","and!!!!!!!","I'm!!!!!!!","okay!!!!!!","lumberjack"]

Task 8: Making Change
Given a number in the range [0.01,0.99], output the number of each of the 4 standard US coins that should be used to represent this value such that the total number of coins is minimized. The input will always have exactly 2 places behind the decimal.
Coin value reference:
Penny: 0.01, Nickel: 0.05, Dime: 0.10, Quarter: 0.25
Examples:
Input: 0.75
Output: [0,0,0,3]

Input: 0.23
Output: 3 pennies, 0 nickels, 2 dimes, 0 quarters

Task 9: Merging Ranges
Given a finite list of 2-tuples containing integers that represent ranges, output the result of merging all overlapping or adjacent ranges. All ranges will be at least of length 1, and the starting value will always be less than the ending value. The order of the output does not matter.
Examples:
Input: (2,3), (4,5), (6,9), (0,7)
Output: (0,9)

Input: (-3,4), (2,5), (-10,-4)
Output (-10,-4), (-3,5)

Input: (2,3), (5,6), (6,8)
Output: (5,8), (2,3)

Rules

This is code-golf, so shortest answer (in bytes) wins.
Your score will be the sum of the byte counts for all of your solutions.
Standard loopholes are forbidden.
Input and output may be performed in whatever manner is considered standard for your language.
You may write full programs or functions for each challenge, and may interchange between the two across challenges.
You must use the same language for all the challenges. If version differences are significant enough for them to be usually considered separate entries in challenges, you must use the same version throughout. For example, if you use Python, you must use either Python 2 or Python 3 for all challenges.
You must solve all of the challenges. Answers that only solve some of the challenges will be considered non-competitive.
You may use language builtins or standard libraries.

Leaderboard
The Stack Snippet at the bottom of this post generates the leaderboard from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:
## [><>](http://esolangs.org/wiki/Fish), 121 bytes

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

Are we allowed to output numbers in scientific notation in task 1?

although i would love to have such an interview i doubt if it ranks people well. eh, whatever. still fun

Do we have to print results or can we return them from functions? If the latter is permissible, for task 1 can we return a matrix or similar?

Task 8 seems to have 2 output formats, can we just use the first one?

@aditsu Those are two example output formats. You may use any format within reason.

@AlexA. You can return results from functions. I'm guessing your matrix question is about #1 - yes, that is acceptable.

This is an awesome challenge!

How add imports to the byte count? Let's say 4 of the tasks need the same import (e.g import math), does it count 4 times? Or can I answer with a single source file with 9 functions for the 9 task with some imports at the beginning counting only once? Same for helper functions that can be used in several tasks.

Is crashing with an error and printing nothing to STDOUT considered "output the empty string" for task 6?

In task 8, can counts be printed in the order quarters, dimes, nickels, pennies?

@nimi The solutions to each of the challenges are considered separate - if you need to import something for multiple tasks, each task's answer must have the import.

@isaacg Re: crashing: No. As per our usual requirements, the only allowed output besides what is specified in the task is anything the compiler/interpreter outputs that cannot be suppressed and color codes. Re: task 8: Yes, but you should mention in your answer what the order is.

@Mego: All right. However, I think  you're wasting  a good golfing opportunity. This way it's just 9 standard tasks, no difference to 9 separate questions, no added value. If we can combine them into a single challenge there's much more room for golfing. Please reconsider this for the next part.

@nimi With the (admittedly few) multiple-holes challenges so far, the requirement has been that the individual answers should be independently-runnable. The point of this challenge was to enforce the one-language requirement - some of these tasks are short in a given language, but the others are much longer. I will keep your suggestion in mind for the Back Nine, though.

For task #1, since you said we can return a matrix, does that matrix need to include the x and ranges, or just the multiplication results?

@mbomb007 You need the headers and the x.

@pppery, this question is older than the link you provided, so I don't think that it applies to this question.

I'm voting to close this question as off-topic because it's a multi-part challenge with insufficient interaction between the parts

Pyth, 155 153 149 142 141 131 130 bytes
4 bytes thanks to @FryAmTheEggman
1, 5 and 4 bytes thanks to @Jakube

24 bytes: J+1SQp\xtjmsm.[`*dk\ 4JJ

Construct the multiplication table from the list [1, 1, 2, 3, ...], which is +1SQ, then print a x and remove its first character.

10 bytes: @.Om^Cd2z2

Straightforward.

18 bytes: c*.t.tyvw7Z*QQ9.81

Uses the formula sin(2 theta) * v^2/a, where theta is the angle, v is the initial velocity and a is 9.81

7 bytes: o_/zNSz

Straightforward.

15 bytes: hxeM.u,eNsNQU2Q

Generate fibonacci pairs, find the index of the input in them, add one.

14 bytes: IqSzSJj.-zsQQJ

Use bagwise subtraction to remove the prefix and suffix from the word, then put the remainder of the word in the middle. If the result of this is not a permutation of the input, don't print it.

8 bytes: C.tolNQz

Sort by length. Filled transpose. Transpose again.

18 bytes: Jsttz/L~%Jd[25T5 1

Output coin counts are in the order [quarters, dimes, nickels, pennies].
Remove first 2 characters of input and cast to int to get cents. Save to J. For each number d in the list [25, 10, 5, 1], post-assign J%d to J, then generate the value /Jd with the original value of J. Print.

16 bytes: C-M.p,JS{srMQhMJ

Turn the tuples into ranges, combine into one list, deduplicate and sort. Save this to J. Form J, hMJ and hMJ, J, where hMJ is J with every element increased by 1. Perform subtraction in both cases. The former is the lower ends of the ranges, the latter is the higher ends. Transpose them into pairs and print.

CJam, 162

25 bytes • qi),0Xt_ff{*s4Se]}N*s0'xt
12 bytes • q_:i:mh\,mq/ (© Dennis)
18 bytes • q~P*90/ms\_**9.81/
12 bytes • q$e`{0=~}$e~ (© Dennis)
16 bytes • 1_{_2$+}99*]qi#)
22 bytes • qS/(1+1$s{1$#Lt}/)@@**
18 bytes • q~{,}$_z,f{W$e]}p;
16 bytes • q2>i25A5]:md]W%p
23 bytes • q~${_0=2$1=>{+$3%}|}*]p

Dennis agreed to join forces :)

CJam, 223 bytes
Task 1, 35 bytes
ri_)_,0Xt2m*::*0'xt:s@s,2+f{Se]}/N*

Try it online.
Task 2, 12 bytes
q_:i:mh\,mq/

Try it online.
Task 3, 27 bytes
rd180/P*_mc\ms]rdf*~4.905/*

Try it online.
Task 4, 12 bytes
q$e`{0=~}$e~

Try it online.
Task 5, 17 bytes
XXri:R{_2$+}*]R#)

Try it online.
Task 6, 25 bytes
re!_rf#:!.*r:S;{N+SN+#)}=

Try it online.
Task 7, 19 bytes
{:C;{,}$_W=,f{Ce]}}

Try it online.
Task 8, 33 bytes
A4m*{:+}$r2>i:R;{[X5A25].*:+R=}=p

Try it online.
Task 9, 43 bytes
{{~1$-,f+}%:|$__,(%a\2ew{:-W<},+e_$2/2,f.+}

Try it online.

Haskell, 650 bytes
Task 1, 88 bytes:
f n="x   "++unlines(map(take 4.(++"   ").show=<<)$[1..n]:map(\a->a:map(a*)[1..n])[1..n])

Task 2, 76 bytes:
g s=sqrt(sum(map(fromIntegral.(^2).fromEnum)s)/sum(s>>[1]))

Task 3, 28 bytes
v?a=v*v/9.81*sin(2*a*pi/180)

Task 4, 60 bytes:
import Data.List
i x=concat$sortOn((0-).length)$group$sort x

Task 5, 64 bytes
j=(%zip[0..]z);x%((i,h):t)|x<h=0|x==h=i|1<2=x%t;z=scanl(+)0(1:z)

Task 6, 93 bytes
import Data.List
k a b c|q b a&&q c a=b++((a\\b)\\c)++c|1<2="";q=(.sort).isSubsequenceOf.sort

Task 7, 81 bytes
import Data.List
s!f=map(take(maximum$map r s).(++cycle[f]))(sortOn r s);r=length

Task 8, 73 bytes
m x=floor(x*100)#[25,10,5,1];x#[]=[];x#(h:t)|(d,m)<-divMod x h=(m#t)++[d]

Task 9, 87 bytes (a shameless copy of @MtnViewMark's answer from a similar challenge)
n i=foldr(&)[]i;p@(a,b)&(q@(c,d):r)|b<c=p:q&r|a>d=q:p&r|1<3=(min a c,max b d)&r;p&_=[p]

Mathematica 10.3, 465 bytes
All of these are anonymous functions. Also, thanks to Martin for help golfing, since I'm a noob at Mathematica.
Task 1, 69 bytes
Grid@Join[{Join[{"x"},r=Range@#]},Flatten/@({r,Outer[1##&,r,r]}\[Transpose])]&

\[Transpose] is the 3 byte "transpose" symbol.
Task 2, 13 bytes
Mean[#^2]^.5&

or
√Mean[#^2]&

(√ is 3 bytes). The RootMeanSquare built-in isn't quite short enough...
Task 3, 18 bytes
Sin[2#2°]#/9.81#&

Task 4, 57 bytes
""<>SortBy[c=Characters@#,{-c~Count~#&,ToCharacterCode}]&

Task 5, 33 bytes
Tr@Position[Fibonacci@Range@#,#]&

or
Tr[Fibonacci@Range@#~Position~#]&

or
Tr[Fibonacci~Array~#~Position~#]&

Task 6, 178 bytes (currently has a bug)
({s,a,b}=Characters@{##};q=If[#2~SubsetQ~#,List@@(Plus@@#-Plus@@#2),{}]&;i=If[#!={},##]&;x=i[q[s,a],{}];y=If[x!={},i[q[x,b],{},Null],Null];Echo[If[y!=Null,""<>Join@{a,y,b},""]])&

Less golfed:
({s,a,b}=Characters@{##};
q=If[#2~SubsetQ~#,List@@(Plus@@#-Plus@@#2),{}]&;
i=If[#!={},##]&;
x=i[q[s,a],{}];
y=If[x!={},i[q[x,b],{},Null],Null];
Echo[If[y!=Null,""<>Join@{a,y,b},""]])&

String manipulation is horrid...
Task 7, 39 bytes
#~SortBy~StringLength~StringPadRight~#1

Task 8, 46 bytes
FrobeniusSolve[{1,5,10,25},100#]~MinimalBy~Tr&

or
{.1,.5,.10,.25}~FrobeniusSolve~#~MinimalBy~Tr&

Task 9, 12 bytes
Interval@##&

Intervals passed to the constructor are automatically union-ed. Beat that.

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


text:
A regexp that does not match itself
Can you think of a regular expression that does not match itself?

a{2}, and many more

Welcome to Protramming Puzzles & Code Golf! I think this question is a bit too broad, there's very many regexpes that doesn't match them self. I would also suggest adding a objective winning criteria, such as code-golf (shortest regexp wins) or popularity contest (answer with the most votes wins).

^$ - Can't think of shorter for now..

This should have been closed as a duplicate of http://codegolf.stackexchange.com/q/22648/194

A few on 2 chars
^$

\s

\d

\n

\t

\r

And many more consisting of a \ and a lowercase character.


text:
Which Ubuntu versions are supported?
Given an input date, your entry will output the full list of supported versions of the Ubuntu Linux distro on that date.
The full list of all releases is as follows:

Version    Code name         Release date  Supported until

4.10       Warty Warthog     2004-10-20    2006-04-30
5.04       Hoary Hedgehog    2005-04-08    2006-10-31
5.10       Breezy Badger     2005-10-13    2007-04-13
6.06 LTS   Dapper Drake      2006-06-01    2009-07-14  2011-06-01 (Server)
6.10       Edgy Eft          2006-10-26    2008-04-25
7.04       Feisty Fawn       2007-04-19    2008-10-19
7.10       Gutsy Gibbon      2007-10-18    2009-04-18
8.04 LTS   Hardy Heron       2008-04-24    2011-05-12  2013-05-09 (Server)
8.10       Intrepid Ibex     2008-10-30    2010-04-30
9.04       Jaunty Jackalope  2009-04-23    2010-10-23
9.10       Karmic Koala      2009-10-29    2011-04-30
10.04 LTS  Lucid Lynx        2010-04-29    2013-05-09  2015-04-30 (Server)
10.10      Maverick Meerkat  2010-10-10    2012-04-10
11.04      Natty Narwhal     2011-04-28    2012-10-28
11.10      Oneiric Ocelot    2011-10-13    2013-05-09
12.04 LTS  Precise Pangolin  2012-04-26    2017-04-26
12.10      Quantal Quetzal   2012-10-18    2014-05-16
13.04      Raring Ringtail   2013-04-25    2014-01-27
13.10      Saucy Salamander  2013-10-17    2014-07-17
14.04 LTS  Trusty Tahr       2014-04-17    2019-04
14.10      Utopic Unicorn    2014-10-23    2015-07-23
15.04      Vivid Vervet      2015-04-23    2016-01
15.10      Wily Werewolf     2015-10-22    2016-07
16.04 LTS  Xenial Xerus      2016-04-21    2021-04

Rules

For each supported version, the exact version string will be output, e.g. 4.10
For LTS (long-term support) versions, LTS will be appended to the version
The three oldest LTS versions come in two flavours - desktop and server.  If both of these LTS versions are supported on the given date, the output will simply be the version string as above.  However if only the server version is supported, then you must append -server to the end of the version string
At the time of writing, 4 of the recent versions only have YYYY-MM in their supported-until dates.  You must treat these dates as if they are the last day of the given month.  e.g. 2019-04 must be treated as 2019-04-30
There will be no output for dates outside of the full date range captured in the table
Input date formats are flexible, but must contain some enumeration of Year, Month and Day.  Number of days or seconds (or other units) from an epoch are not valid input formats.
Output lists may be given in whatever format is convenient for your language
You may use datetime functions from your language
You may assume all inputs are valid

Examples:

Input:        Output:

2000-01-01
2004-10-20    4.10
2005-05-05    4.10, 5.04
2006-06-06    5.04, 5.10, 6.06LTS
2010-10-10    6.06LTS-server, 8.04LTS, 9.04, 9.10, 10.04LTS, 10.10
2021-04-30    16.04LTS
2021-05-01

Breezy Badger...?

Some of your examples are incorrect. 2010-10-10 should return 6.06LTS-server, 8.04LTS, 9.04, 9.10LTS, 10.04LTS, 10.10

@Mwr247 Thanks - I fixed that one.  Do you see any other errors?

@Mwr247 Ah - I forgot to quote the date string when passing to a function.

@DigitalTrauma Whoops! I had removed a grouping in there to save two characters, but didn't realize the effect it had on that aspect of the condition. It's fixed now.

Are we allowed to download the listed dates?

@VoteToClose No - I think that is covered by this standard loophole

@DigitalTrauma That specifies grabbing the output from an http request, not the information. Okaydokay, though. :D

JavaScript (ES6), 552 bytes
d=>(d=d.replace(/^20|-/g,'')*1,[for(r of'41020,60430;50408,61031;51013,70413;-60601,90714,110601;61026,80425;70419,81019;71018,90418;-80424,110512,130509;81030,100430;90423,101023;-91029,110430;-100429,130509,150430;101010,120410;110428,121028;111013,130509;-120426,170426;121018,140516;130425,140127;131017,140717;-140417,190430;141023,150723;150423,160131;151022,160731;-160421,210430'.split`;`.map(a=>a.split`,`))if(d>=(a=Math.abs(f=r[0]))&&((m=d<=r[1])||r[2]&&d<=r[2]))((a+'').slice(-6,-2)/100).toFixed(2)+'LTS'.slice(f)+(m?'':'-server')].join`, `)

Building the data array takes up ~68% of the total size. The rest is input formatting, array lookup, and output string construction.
The data string is split into an array of arrays of either 2 (normal) or 3 (server) length. The dates are reduced to numeric format, with the intial "20" stripped (along with any leading zeroes after that). LTS is denoted by a negative start date. Version numbers can be conveniently derived from all but the last two digits of the positive start date, divided by 100.

Woohoo - first answer!  Sorry - I'm JS novice - can I test ES6 in a browser somehow?  Or what is the easiest way to verify?

@DigitalTrauma Yes, just assign the function to a variable (add F= before the code above) and then just call the function through it (F("2010-10-10")). You can run it in any modern browser developer console (f12 key).

+1 - Looks good now!  (not sure why I put my previous comments against my own question and not your answer - oh well - you got the point :))


text:
Find the results of the poll with the Borda count method
In a preference ballot there are many ways to decide who won. One of which is the Borda count method, where we give everyone point based on their places on the ballot.
For example, in these results:
  10  5  7  2
_____________
1  a  d  a  c
2  b  a  d  b
3  c  c  b  a
4  d  b  c  d

The results are
1: a : 87
2: d : 60
3: b : 55
4: c : 45

Because
4*10 is 40
5*3 is 15
7*4 is 28
2*2 is 4
40 + 15 + 28 + 4 is 87

Or is words:
We give first place 4 points , second 3, third 2, etc.
So a is in first place 17 times, so they get 68 points then they get 15 points for being in second 5 times and 4 points for being in third 2 times for a total of 87 points.
Because this process is a pain, I need you write a program that finds the results for me, but since I have limited space on my PC, your program will have to be as small as possible.
Your Challenge
Write a program or function the takes an input in this format
Number of Ballots : placings, Number of Ballots : placings, Etc...

and will output the results in this format:
1: a: 90
2: b: 80
Etc...

Rules:
This is Code Golf, so the shortest answer that does the task wins
Standard Loopholes Apply
Example:
Input:
3: A B C, 2: C B A, 1: C A B

Output:
1: A: 13
2: C: 12
3: B: 11

This is my first challenge, so please give me all the criticism you so desire, I won't take it offensively.

Could you explain the table format? It's not obvious where e.g. 4*10 comes from.

Are the candidates always A, B, C...? How do we handle ties?

The candidate will always be single letters, but they will not always be A B and C. As for ties just assume there will not be any, just to keep thing simple.

CJam, 78 bytes
q", "%{S%}%_0=,1-:L;{(1<i*}%e_W%L/L{)}%:C;{C.*}%e_$e`$W%C.+{W%{": "}%e_W(<N+}%

Try it Online.
Holy crap! How did I do this?
When I saw that CJam had a run length encode/decode function, I wondered why someone would use it. Today I found out. Essentially, what this program does is create a string containing each letter once for each vote. Then it sorts the string and uses run length encode to find out how many votes each letter got, and then formats the data.

Well, I guess you won, Congratulations!

Python 2, 248 bytes
x={}
for a,b in[y.split(':')for y in raw_input().split(', ')]:
 for d,e in[(c,(len(b)/2-i)*int(a)) for i,c in enumerate(b[1::2])]:x[d]=x.setdefault(d,0)+e
for i,(f,g) in enumerate(sorted(x.items(),key=lambda t:-t[1]),1):print '%d: %s : %d'%(i,f,g)

Reads the from the standard input (for example, echo '3: A B C, 2: C B A, 1: C A B' | python borda.py).

Perl 5, 131 bytes
for(split/, /,$ARGV[0]){($n,@v)=split/:? /;$s{$v[@v-$_]}+=$n*$_ for 1..@v}$,=": ";map{say++$i,"$_ ",$s{$_}}sort{$s{$b}<=>$s{$a}}@v

Use as perl -E'the string above' 'the input string'