text:
Counting and spelling up
Write a program that takes as its input a string that outputs a string with the following properties.

If a character in the string is an uppercase letter (ASCII 41-5A), then the character is replaced by a string containing every letter up to and including the original letter in upper case. For example, if the input string is I, then the output would be ABCDEFGHI.
Similarly, if a character is a lowercase letter (ASCII 61-7A), then the character is replaced in the same way. i would be replaced by abcdefghi.
If a character is a number (ASCII 30-39), then the character is replaced by every number starting from 0 and counting up to the number.
If the input contains concatenated individual characters, then the replacement sequences are concatenated together.
All other characters are printed without modification.

Sample inputs (separated by blank lines)
AbC123

pi=3.14159

Hello, World!

Sample outputs
AabABC010120123

abcdefghijklmnopabcdefghi=0123.0101234010123450123456789

ABCDEFGHabcdeabcdefghijklabcdefghijklabcdefghijklmno, ABCDEFGHIJKLMNOPQRSTUVWabcdefghijklmnoabcdefghijklmnopqrabcdefghijklabcd!

This is code golf, fellas. Standard rules apply. Shortest code in bytes wins.

To see the leaderboard, click "Show code snippet", scroll to the bottom and click "► Run code snippet". Snippet made by Optimizer.

/* Configuration */

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

/* App */

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

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

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

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

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

getAnswers();

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

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

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

function process() {
  var valid = [];

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

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

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

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

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

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

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

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

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

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

}
body { text-align: left !important}

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

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

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

<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

Idea for a sequel: undo this transformation.

@ETHproductions Perhaps, though the way here seems better to me because it can take any input; what if in the reverse the input were Hello, World!?

Do we have to support NUL (ascii 0x00) characters in the input string?

@Eridan in such a case, the code should either print an error or, for a fun twist, perform the above transformation. I.e., f(f(input)) == input. I don't believe it is possible for any alphanumerical input to disobey this relation.

@JArkinstall What if the input is abcde? What if this was the string I wanted to encode as aababcabcdabcde? According to your algorithm, the program would print e. While your equality is correct, the program would be unable to differentiate between encoding and decoding for examples such as abcde.

That is entirely true - I make the assumption that "if a string CAN BE the result of the transformation, reverse it. Otherwise, apply the transformation." - it's your challenge, you can specify any rules you choose so long as (a) they're consistent and (b) they are verifiable and don't require an entire new branch of mathematics to solve. Side note: Irradicating (b) would be interesting; you never know when someone will accidently revolutionise computer science by coming up with a polynomial time algorithm for an NP problem - which is actually reasonable on here, so long as it saves 4 bytes.

Pyth, 19 bytes
sXzsJ+rBG1jkUTs._MJ

Try it online: Demonstration or Test Suite
Explanation
sXzsJ+rBG1jkUTs._MJ
      rBG1            the list ["abc...xyz", "ABC...XYZ"]
     +    jkUT        appends the string "0123456789"
    J                 save this list of 3 strings in J
   sJ                 join the strings in J
               ._MJ   create all prefixes of the strings in J
              s       and combine them to one list
 XzsJ         s._MJ   translate the input string, chars from sJ
                      get translated to the correct prefix,
                      chars that don't appear in sJ don't get translated
s                     join all resulting translation strings

Python 2.7, 100 98 96 bytes
a=[]
for c in raw_input():d=ord(c);a+=range(max(d&96|1,48),d)*c.isalnum()+[d]
print bytearray(a)

TeaScript, 24 bytes 26 28
TeaScript is JavaScript for golfing
xl(#(i=lN()1)h(ii(l)+1))

Pretty short
Try it online
Explanation
x.l(#            // Loops through each character of the string

     (i=l.N()1)  // Determines whether a character is alphanumeric
                 // Will return A-Z, a-z or 0-9 depending on result
                 // Assigns to variable i

     .h(         // Get characters up to...
        i.i      // where the character is in "i"
     ) + 1       // Increased by one
)

Ruby, 137 87 82 76 67 55 bytes
Ungolfed, but you can see the pattern.
$><<gets.gsub(/[a-z0-9]/i){[*" 0Aa"[$&.ord/32]..$&]*""}

Edit: golfed down to only one regex.
Edit 2: had a lot of extra spaces.
Edit 3: Thanks to manatwork for golfing 12 bytes!

$><<gets.gsub(/[a-z0-9]/i){[*" 0Aa"[$&.ord/32]..$&]*""}

@manatwork Damn that's clever!

Haskell, 95 91 86 60 bytes
c#(a:o:r)|co=c#r|1<2=[a..c]
c#_=[c]
f=((#"AZaz09")=<<)

Usage example: f "pi=3.14159" -> "abcdefghijklmnopabcdefghi=0123.0101234010123450123456789"
How it works: copy every char c in the input string unless c is in-between any of A/Z, a/z or 0/9 and if so take the list of [<first char in pair> ... <c>].
Edit: @Zgarb saved many many bytes. Thanks!

I think you can define c#_=[c] and skip t entirely.

@Zgarb: Yes indeed and then s is also superfluous. Thanks a lot!

JavaScript (ES6), 143 138 bytes
Uses string comparisons to test which characters to use.
s=>s.replace(/[A-Z0-9]/gi,c=>(a=btoa`Ó]·ã»óÖq×£Y§¢«²Û¯Ã³`,(c>'Z'?a:a.toUpperCase()).split``.filter(x=>x<=c&(x>'9'|c<'A')).join``))

Online demo. Tested in Firefox and Chrome.
Edit: Saved 5 bytes by replacing a='0123456789abcdefghijklmnopqrstuvwxyz' with
a=btoa`Ó]·ã»óÖq×£Y§¢«²Û¯Ã³`

Python 2, 145 140 133 103 102 Bytes
A not-so-sleek anonymous function using list comprehension. I feel like the logic should be much shorter, I'll try and figure something out.
lambda k:''.join([c,`map(chr,range(48+17*(c>'@')+32*(c>'`'),ord(c)+1))`[2::5]][c.isalnum()]for c in k)

Should be given a name to be used, i.e. f=...

@Mego Oh, haha! No worries :)

PHP, 146 bytes
Golfed
function f($n,&$l){for(;$c=$n[$r],$b=0,$d=ord($c);$r++,$b?:$l.=$c)foreach([58=>48,91=>65,123=>97] as $m=>$i)while($d<$m&&$d>=$i)$b=$l.=chr($i++);}

Revision 1: put ord ranges directly into foreach. incremented ord range maxes and changed $d<=$m to $d<$m. using for to iterate chars instead of foreach and str_split. Removed all {} by moving code into for
Ungolfed
function f($input,&$output){
foreach (str_split($input) as $char){
  $ord = ord($char);
  $ords = [57=>48,90=>65,122=>97];
  $b = 0;
  foreach ($ords as $max=>$min){
     while ($ord<=$max&&$ord>=$min){
         $b = $max;
         $output .= chr($min);
         $min++;
     }
  }
  $b ?: $output.=$char;
}
};

$output = NULL;
$input = "pi=3.141592";
f($input,$output);
echo $output;

Explanation:
split string into array. If ascii value falls into a range (for a-z,A-Z,0-9), then increment a counter from the min of the range to the char's ascii value, appending each value until you reach the char's ascii value.
I passed in  &$var so output is done by reference rather than a return

There is no need for variable $z to hold the array of ranges, you can put the array literal directly in foreach.

Tried to use range()? http://pastebin.com/k2tqFEgD

@manatwork, I changed from declaring $z and made some other changes. range() would probably be better. I might try something with range later.

Using range, I got function f($n,&$l){$o=['a'=>'z','A'=>'Z','0'=>'9'];foreach(str_split($n) as $c){$b=0;foreach($o as $m=>$x)!($c>$m&&$c<=$x)?:$b=$l.=implode(range($m,$c));$b?:$l.=$c;}}, which was 166.

Yes, after your rewrite to 146 characters using range() is less beneficial. But that 166 is too long even so: the $o for the array literal is back, there are extra spaces around as keywords, join() is alias for implode(). (Checked the pastebin code I linked earlier? Shows another possibility to store the range endpoints.) Regarding your 146 characters solution, you can move the assignment to $c inside the ord() call: $d=ord($c=$n[$r]).

JavaScript (ES6), 340 258 273 271 bytes
a=s=>{s=s.split``;Q=x=>x.toUpperCase();A="ABCDEFGHIJKLMNOPQRSTUVWXYZ";D="0123456789";f="";for(i=0;i<s.length;i++){j=s[i];c="to"+(Q(j)==j?"Upper":"Lower")+"Case";j=Q(j);if(q=A.search(j)+1)f+=g=A.slice(0,q)[c]();else if(q=D.search(j)+1)f+=g=D.slice(0,q);else f+=j}return f}

You can use a template string `` for split instead of ("") and f=i="" in the for loop. You might be able to save a few more bytes.

@intrepidcoder The first would work. I'm checking on the second.

Python, 143 bytes
lambda s:''.join(map(chr,sum(map(lambda a,r=range:r(65,a+1)if 64<a<97else r(97,a+1)if 96<a<123else r(48,a+1)if 47<a<58else[a],map(ord,s)),[])))

Try it online

You could use z=range to save 4 bytes.

Pretty sure that you can replace the double space indents with a single tab, which would save you a few bytes

Scala, 111 91 bytes
val f=(_:String).flatMap(x=>if(x.isDigit)('0'to x)else if(x.isUpper)('A'to x)else('a'to x))

This fails for pi=3.14159. Could the solution be val f=(_:String).flatMap(x:String=>if(x.isDigit)('0'to x)else if(x.isUpper)('A'to x)else if(x.isLower)('a'to x)else x.toString) for a whopping 128 characters?

Perl 6, 101 bytes
Here is a first pass at it:
sub MAIN($_ is copy){
  s:g/<[0..9]>/{(0..$/).join}/;
  s:g/<[a..z]>/{('a'..~$/).join}/;
  s:g/<[A..Z]>/{('A'..~$/).join}/;
  .say
}

sub MAIN($_ is copy){s:g/<[0..9]>/{(0..$/).join}/;s:g/<[a..z]>/{('a'..~$/).join}/;s:g/<[A..Z]>/{('A'..~$/).join}/;.say}

119

Using .trans on $_to remove is copy.
sub MAIN($_){
  .trans(
    /\d/       => {(0..$/).join},
    /<[a..z]>/ => {('a'..~$/).join},
    /<[A..Z]>/ => {('A'..~$/).join}
  ).say
}

sub MAIN($_){.trans(/\d/=>{(0..$/).join},/<[a..z]>/=>{('a'..~$/).join},/<[A..Z]>/=>{('A'..~$/).join}).say}

106

Act on @*ARGS directly instead of defining a MAIN sub.
(otherwise identical to previous example)
@*ARGS[0].trans(/\d/=>{(0..$/).join},/<[a..z]>/=>{('a'..~$/).join},/<[A..Z]>/=>{('A'..~$/).join}).say

101

PowerShell, 155 Bytes
($args-split''|%{$b=$_;switch([int][char]$_){{$_-in(65..90)}{[char[]](65..$_)}{$_-in(97..122)}{[char[]](97..$_)}{$_-in(48..57)}{0..$b}default{$b}}})-join''

Technically a one-liner, and PowerShell is all about those ;-)
Splits the input, pipes that into a ForEach-Object loop, switches on the integer value of the cast character, then generates new char[] of the appropriate ranges. Note that we have to spend bytes to set a temp variable $b because the act of casting the input $_ in the switch statement means that we can't just keep using $_ or we'll get funky output.
EDIT - I should point out that this will toss off errors since the first object being fed into %{...} is a null object. Since STDERR is ignored by default, this shouldn't be an issue. If it's a problem, change the first bit to be ($args-split''-ne''|... to eliminate the null object.

Julia, 102 98 90 84 bytes
s->join([(i=Int(c);join(map(Char,(64<c<91?65:96<c<123?97:47<c<58?48:i):i)))for c=s])

This creates an unnamed function that accepts a string and returns a string.
Ungolfed:
function f(s::AbstractString)
    # For each character in the input, get the codepoint and construct
    # a range of codepoints from the appropriate starting character to
    # the current character, convert these to characters, and join them
    # into a string
    x = [(i = Int(c);
          join(map(Char, (isupper(c) ? 65 :
                          islower(c) ? 97 :
                          isdigit(c) ? 48 : i):i))
         ) for c in s]

    # Join the array of strings into a single string
    return join(x)
end

Perl 5, 66 61 (51 Bytes + 1) 52
Combining regexes with conditional operators worked out nice in this case.
With a join Using map to combine the ranges into an array.
say map{(/\d/?0:/[A-Z]/?A:/[a-z]/?a:$_)..$_}split//

Test
$ echo "A0C1.a3c_2!" |perl -M5.010 -n count_and_spell_up.pl
A0ABC01.a0123abc_012!

Explanation
say                # print output
  map{             # loop through the array that's at the end of the other mustache.
                   # outputs an array.
     (
        /\d/?0            # if $_ is a digit then 0
          :/[A-Z]/?A      # else, if it's an uppercase character then A
             :/[a-z]/?a   # else, if it's a lowercase character then a
               :$_        # else the current character
     )..$_         # generate a sequenced string of characters
                   # that ends with the magic variable $_
                   # ($_ is currently a character from the array)
  }split//     # split the magic variable $_ (currently the input string)
               # to an array of characters

C (269 bytes)
(line break added for clarity)
#include<stdio.h>
#define F(x,y,z)if(c>=T[0][x]&&c<=T[1][y]){z}
#define L(x,y)for(i=0;i<x;++i){y}
main(){int c,i,n;char o,*T[]={"0Aa","9Zz"};while((c=getchar())!=EOF)
{F(0,2,L(3,F(i,i,o=T[0][i],n=++c-o;L(n,putchar(o++));break;))else putchar(c);)}}

Ungolfed
#include<stdio.h>
int main(void)
{
  int c, i, n;
  char output;
  char *char_table[] = {"0Aa", "9Zz"};

  while ((c = getchar()) != EOF) {
    if (c < '0' || c > 'z') {
      putchar(c);
    } else {
      for (i = 0; i < 3; ++i) {
        if (c >= char_table[0][i] && c <= char_table[1][i]) {
          output = char_table[0][1];
          n = c - output;
          break;
        }
      }
      for (i = 0; i <= n; ++i) {
        putchar(output);
        ++output;
      }
    }
  }
  return(0);
}

Perl 6, 78 77  bytes
@*ARGS[0].trans(/\d/=>{[~] 0..$/},/<:L>/=>{[~] samecase("a",~$/)..~$/}).say

I knew it could be shortened by combining the 'a'..'z' and 'A'..'Z' cases, I should have tried harder.

I recommend adding  just after ## Perl 6 so that it will highlight correctly. ( Change is already pending on this answer )

You can switch {[~](0..$/)} to {[~] 0..$/} which will save one byte.

JavaScript (ES7), 125 bytes
There were already two JS answers focusing on encoding the strings, so I decided to go for a more algorithmic approach using String.fromCharCode():
x=>x.replace(/[^\W_]/g,z=>(c=z.charCodeAt(),f=c<65?48:c<97?65:97,String.fromCharCode(...[for(i of Array(c-f).keys())i+f])+z))

A bonus of using this method is that it takes any amount of char codes, so joining the list is not necessary. This turned out shorter than any other technique, so I'm happy with the result.

MUMPS, 131 bytes
u(l,h) i l'>a,a'>h f j=l:1:a s o=o_$C(j),f=0
    q
t(s) f i=1:1:$L(s) s a=$A(s,i),f=1 d u(48,57),u(65,90),u(97,122) s:f o=o_$C(a)
    q o

I did manage to save a good few bytes here thanks to MUMPS's dynamic scoping. Here's a roughly-equivalent ungolfed version, which I sure would love to syntax highlight, if only support for the MUMPS Prettify module were available.
convert(str) ;
    new asciiCode,flag,i,output
    for i=1:1:$LENGTH(str) do
    . set asciiCode=$ASCII(str,i)
    . set flag=1
    . do helper(48,57)
    . do helper(65,90)
    . do helper(97,122)
    . if 'flag do
    . . set output=output_$CHAR(asciiCode)
    quit
helper(low,high) ;
    if low'>asciiCode,asciiCode'>high do
    . for code=low:1:asciiCode do
    . . set output=output_$CHAR(code)
    . . set flag=0
    quit

CJam, 32 31 bytes
q_'[,_el^A,s+26/ff{_@#)<}:s\.e|

Try it online in the CJam interpreter.
How it works
q_    e# Push two copies of the user input.
'[,   e# Push the string of all ASCII characters up to Z.
_el   e# Push a copy and convert it to lowercase.
^     e# Perform symmetric difference this keeps only letters.
A,s+  e# Append the string "0123456789".
26/   e# Split the result into chunks of length 26.
ff{   e# For each character from input: For each chunk:
  _@  e#   Copy the chunk and rotate the character on top of it.
  #   e#   Push the index of the character in the string (-1 for not found).
  )<  e#   Increment and keep that many characters from the left of the chunk.
      e#   This pushes "" for index -1.
}
:s    e# Flatten the resulting arrays of strings.
      e# The results will be empty strings iff the character wan't alphanumeric.
\     e# Swap the result with the input string.
.e|   e# Perform vectorized logical OR.

Python 2, 135 117 bytes
s=''
for c in raw_input():
 b=ord(c);e=b+1
 if c.isalnum():
  b=max(b&96,47)+1
 for i in range(b,e):s+=chr(i)
print s

Mathematica, 102 bytes
FromCharacterCode@Flatten[Which[64<#<91,65,96<#<123,97,47<#<58,48,1>0,#]~Range~#&/@ToCharacterCode@#]&

Oh well...

PHP - 291 bytes
Pass the string to GET["s"].
<?php $s=$_GET["s"];$m="array_map";echo implode($m(function($v){$i="in_array";$l="implode";$r="range";global$m;$a=ord($v);if($i($a,$r(48,57)))$v=$l($m("chr",$r(48,$a)));if($i($a,$r(65,90)))$v=$l($m("chr",$r(65,$a)));if($i($a,$r(97,122)))$v=$l($m("chr",$r(97,$a)));return$v;},str_split($s)));

C#, 251 201 184 157 154 Bytes
using System;class c{static void Main(string[] i){foreach(var c in i[0])for(var x=c>64&c<91?'A':c>96&c<123?'a':c>47&c<58?'0':c;x<=c;)Console.Write(x++);}}

edit: Strike! Shorter than PowerShell ;)

can you do string[]i?

APL (Dyalog Extended), 37 bytes
(⊃,/){⎕A∊⍨⌈⍵:⍵…⍨'A'××⍵⋄⍵∊⎕D:'0'…⍵⋄⍵}¨

Try it online!
A train that accepts a string as right argument.

05AB1E, 9 bytes
žKD₂ô€η˜‡

Try it online.
Explanation:
žK         # Push "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  D        # Duplicate it
   ₂ô      # Split the copy into parts of size 26: ["abc...xyz","ABC...XYZ","012...789"]
     €     # Map over each inner string:
      η    #  Get a list of its prefixes
       ˜   # Flatten this list of lists of strings
           #  ["a","ab","abc",...,"A","AB","ABC",...,"0","01","012",...,"0123456789"]
        ‡  # Transliterate all characters in the (implicit) input-string from
           # "abc...xyzABC...XYZ012...789" to these prefixes at the same positions
           # (after which the result is output implicitly)


text:
Variant of racetrack with exact finishing point and zero terminal velocity
Introduction
The challenge is a very interesting variant of the game racetrack and those two challenges:

To Vectory! – The Vector Racing Grand Prix
Program a Racing Car

Source of this challenge is here (in German): c't-Racetrack
This challenge is especially interesting (and different from the two abovementioned challenges) because it combines a huge search-space with some exact conditions that have to be met. Because of the huge search-space exhaustive search techniques are hard to use, because of the exact conditions approximate methods are also not easily usable. Because of this unique combination (plus the underlying intuition from physics) the problem is fascinating (and everything in connection with racing cars is fascinating anyway ;-)
Challenge
Have a look at the following racetrack (source):

You have to start at (120,180) and finish exactly at (320,220) ("Ziel" in German) without touching one of the walls.
The car is controlled by acceleration vectors of the form (a_x,a_y) - as an example:
(8,-6)
(10,0)
(1,9)

The first number is the acceleration for the x-vector, the second for the y-vector. They have to be integers because you are only allowed to use the integer points on the grid. Additionally the following condition has to be met:
a_x^2 + a_y^2 <= 100,

which means that acceleration in any direction has to be below or equal to 10.
To see how it works have a look at the following picture (source):

As an example: Starting from (120,180) you accelerate by 8 in x-direction and by -6 in y-direction. For the next step this is your velocity where you add your acceleration (10,0) to get (physically correct) your next resulting movement (to point (146,168). The resulting movement is what counts when it comes to examining whether you touched one of the walls. In the next step you again add your next acceleration vector to your current velocity to get the next movement and so on. So at every step your car has a position and a velocity. (In the illustrative picture above the blue arrows are for the velocity, the orange arrows for acceleration and the dark red arrows for the resulting movement.)
As an additional condition you have to have (0,0) terminal velocity when you are on the finishing point (320,220).
The output has to be a list of acceleration vectors in the abovementioned form.
The winner is the one who provides a program which finds a solution with the fewest acceleration vectors.
Tiebreaker
Additionally it would be great if you can show that this is an optimal solution and whether this is the only optimal solution or whether there are several optimal solutions (and which they are).
It would also be good if you could give a general outline of how your algorithm works and comment the code so that we can understand it.
I have a program which checks whether any given solution is valid and I will give feedback.
Addendum
You can use any programming language but I would be especially delighted if somebody used R because I use it a lot in my day job and somehow got used to it :-)
Addendum II
For the first time I started a bounty - hopefully this get's the ball rolling (or better: get's the car driving :-)

@Mego: Yet... having thought about it: I am not sure whether I should add the program for at least two reasons: Firstly, in the original challenge it was not included either, secondly, it e.g. contains routines that are part of the challenge (e.g. collision detection) so it would spoil part of the fun... I will have to sleep on it...

Does the program actually need to calculate the path, or could I just calculate the optimal path beforehand, and then post something like print "(10,42)\n(62,64)..."?

@Loovjo: No, the program has to calculate the path itself, so the intelligence must be included in the program, not just an output routine.

Python, 24 steps (work in progress)
The idea was to solve the continuous problem first, vastly reducing the search space, and then quantize the result to the grid (by just rounding to the nearest gridpoint and searching the surrounding 8 squares)
I parametrize the path as a sum of trigonometric functions (unlike polynomials, they dont diverge and are easier to keep in check). I also control the velocity directly instead of the acceleration, because its easier to enforce the boundary condition by simply multiplying a weighting function that tends to 0 at the end.
My objective function consists of
-exponential score for acceleration > 10
-polynomial score for euclidean distance between the last point and the target
-high constant score for each intersection with a wall, decreasing towards the edges of the wall
To minimize the score, i throw it all into Nelder-Mead optimization and wait a few seconds. The algorithm always succeeds in getting to the end, stopping there and not exceeding the maximum acceleration, but it has troubles with walls. The path either teleports through corners and gets stuck there, or stops next to a wall with the goal just across (left image)

During testing, i got lucky and found a path that was squiggled in a promising way (right image) and after tweaking the parameters some more i could use it as a starting guess for a successful optimization.
Quantization
After finding a parametric path, it was time to remove the decimal points. Looking at the 3x3 neighborhood reduces the search space from roughly 300^N to 9^N, but its still too big and boring to implement. Before i went down this road, i tried adding a "Snap to Grid" term to the objective function (the commented parts). A hundred more steps of optimization with the updated objective and simply rounding was enough to get the solution.

[(9, -1), (4, 0), (1, 1), (2, 2), (-1, 2), (-3, 4), (-3, 3), (-2, 3), (-2, 2), (
-1, 1), (0, 0), (1, -2), (2, -3), (2, -2), (3, -5), (2, -4), (1, -5), (-2, -3),
(-2, -4), (-3, -9), (-4, -4), (-5, 8), (-4, 8), (5, 8)]

The number of steps was fixed and not part of optimization, but since we have an analytical description of the path, (and since the maximal acceleration is well below 10) we can reuse it as a starting point for further optimization with a smaller number of timesteps
from numpy import *
from scipy.optimize import fmin
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection as LC

walls = array([[[0,0],[500,0]],   # [[x0,y0],[x1,y1]]
        [[500,0],[500,400]],
        [[500,400],[0,400]],
        [[0,400],[0,0]],

        [[200,200],[100,200]],
        [[100,200],[100,100]],
        [[100,100],[200,100]],

        [[250,300],[250,200]],

        [[300,300],[300,100]],
        [[300,200],[400,200]],
        [[300,100],[400,100]],

        [[100,180],[120, 200]], #debug walls
        [[100,120],[120, 100]],
        [[300,220],[320, 200]],
        #[[320,100],[300, 120]],
])

start = array([120,180])
goal = array([320,220])

###################################
# Boring stuff below, scroll down #
###################################
def weightedintersection2D(L1, L2):
    # http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
    p = L1[0]
    q = L2[0]
    r = L1[1]-L1[0]
    s = L2[1]-L2[0]
    d = cross(r,s)
    if d==0: # parallel
        if cross(q-p,r)==0: return 1 # overlap
    else:
        t = cross(q-p,s)*1.0/d
        u = cross(q-p,r)*1.0/d
        if 0<=t<=1 and 0<=u<=1: return 1-0*abs(t-.5)-1*abs(u-.5) # intersect at p+tr=q+us
    return 0

def sinsum(coeff, tt):
    '''input: list of length 2(2k+1),
    first half for X-movement, second for Y-movement.
    Of each, the first k elements are sin-coefficients
    the next k+1 elements are cos-coefficients'''
    N = len(coeff)/2
    XS = [0]+list(coeff[:N][:N/2])
    XC =     coeff[:N][N/2:]
    YS = [0]+list(coeff[N:][:N/2])
    YC =     coeff[N:][N/2:]
    VX = sum([XS[i]*sin(tt*ww[i]) + XC[i]*cos(tt*ww[i]) for i in range(N/2+1)], 0)
    VY = sum([YS[i]*sin(tt*ww[i]) + YC[i]*cos(tt*ww[i]) for i in range(N/2+1)], 0)
    return VX*weightfunc, VY*weightfunc

def makepath(vx, vy):
    # turn coordinates into line segments, to check for intersections
    xx = cumsum(vx)+start[0]
    yy = cumsum(vy)+start[1]
    path = []
    for i in range(1,len(xx)):
        path.append([[xx[i-1], yy[i-1]],[xx[i], yy[i]]])
    return path

def checkpath(path):
    intersections = 0
    for line1 in path[:-1]: # last two elements are equal, and thus wrongly intersect each wall
        for line2 in walls:
            intersections += weightedintersection2D(array(line1), array(line2))
    return intersections

def eval_score(coeff):
    # tweak everything for better convergence
    vx, vy = sinsum(coeff, tt)
    path = makepath(vx, vy)
    score_int = checkpath(path)
    dist = hypot(*(path[-1][1]-goal))
    score_pos = abs(dist)**3
    acc = hypot(diff(vx), diff(vy))
    score_acc = sum(exp(clip(3*(acc-10), -10,20)))
    #score_snap = sum(abs(diff(vx)-diff(vx).round())) + sum(abs(diff(vy)-diff(vy).round()))
    print score_int, score_pos, score_acc#, score_snap
    return score_int*100 + score_pos*.5 + score_acc #+ score_snap

######################################
# Boring stuff above, scroll to here #
######################################
Nw = 4 # <3: paths not squiggly enough, >6: too many dimensions, slow
ww = [1*pi*k for k in range(Nw)]
Nt = 30 # find a solution with tis many steps
tt = linspace(0,1,Nt)
weightfunc = tanh(tt*30)*tanh(30*(1-tt)) # makes sure end velocity is 0

guess = random.random(4*Nw-2)*10-5
guess = array([ 5.72255365, -0.02720178,  8.09631272,  1.88852287, -2.28175362,
        2.915817  ,  8.29529905,  8.46535503,  5.32069444, -1.7422171 ,
       -3.87486437,  1.35836498, -1.28681144,  2.20784655])  # this is a good start...
array([ 10.50877078,  -0.1177561 ,   4.63897574,  -0.79066986,
         3.08680958,  -0.66848585,   4.34140494,   6.80129358,
         5.13853914,  -7.02747384,  -1.80208349,   1.91870184,
        -4.21784737,   0.17727804]) # ...and it returns this solution

optimsettings = dict(
    xtol = 1e-6,
    ftol = 1e-6,
    disp = 1,
    maxiter = 1000, # better restart if not even close after 300
    full_output = 1,
    retall = 1)

plt.ion()
plt.axes().add_collection(LC(walls))
plt.xlim(-10,510)
plt.ylim(-10,410)
path = makepath(*sinsum(guess, tt))
plt.axes().add_collection(LC(path, color='red'))
plt.plot(*start, marker='o')
plt.plot(*goal, marker='o')
plt.show()

optres = fmin(eval_score, guess, **optimsettings)
optcoeff = optres[0]

#for c in optres[-1][::optimsettings['maxiter']/10]:
for c in array(optres[-1])[logspace(1,log10(optimsettings['maxiter']-1), 10).astype(int)]:
    vx, vy = sinsum(c, tt)
    path = makepath(vx,vy)
    plt.axes().add_collection(LC(path, color='green'))
    plt.show()

To Do: GUI that lets you draw an initial path to get a rough sense of direction. Anything is better than randomly sampling from 14-dimensional space

Well done! It seems that 17 steps is the minimum - how would you change your program to find a solution with this additional information?

Oh dear: My program shows that you don't end at (320,220) but at (320,240) - would you please check that

whoops, updated the solution, also resampled it down to 24 steps. Fine tuning by hand is trivially easy by looking at the picture, automating it to work with a general case - not so much

source: Stack Exchange

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

sort: votes


text:
Fit the factors in the field
Given a positive integer below 1000, display all possible rectangles with that area.
Task
Let's say the input is 20. We can make a rectangle 20×1, 10×2, or 5×4, so this is a valid output:
********************

**********
**********

*****
*****
*****
*****

Note that each possible rectangle appears exactly once.
The rectangles may appear in any order, orientation or position, but no two rectangles may overlap or touch, even at the corners. The following is also valid:
********************

            ****
**********  ****
**********  ****
            ****
            ****

Scoring
The bounding-box area (BBA) of an output is the area of the minimum rectangle enclosing all of the rectangles. In the first example output, the size is 20×9, so the BBA is 180. In the second example output, the size is 20×7, so the BBA is just 140.
Find the BBA of the output when the the input is 60, 111, 230, 400, and 480, and add them up. Multiply this sum by the size of your code in bytes. The result is your score; lowest score wins.
Rules

The program (or function) must produce valid output for any positive integer below 1000.
The output must contain just asterisks (*), spaces (), and newlines.
There can be any amount of space between the rectangles, but this counts towards the BBA.
Leading or trailing lines or columns, if they have just spaces, do not count towards the BBA.

Can the special cases be hardcoded?

@Calvin'sHobbies Yes, but I doubt it will help much.

@Calvin'sHobbies The Volkswagen solution.

Ruby, 228 bytes * 21895 =4992060
->n{a=(0..n*2).map{$b=' '*n}
g=0
m=n*2
(n**0.5).to_i.downto(1){|i|n%i<1&&(m=[m,n+h=n/i].min
g+=h+1
g<m+2?(a[g-h-1,1]=(1..h).map{?**i+$b}):(x=(m-h..m).map{|j|r=a[j].rindex(?*);r ?r:0}.max
(m-h+1..m).each{|j|a[j][x+2]=?**i}))}
a}

Several changes from ungolfed code. Biggest one is change of meaning of variable m from the height of the squarest rectangle, to the height of the squarest rectangle plus n.
Trivially, *40 has been changed to *n which means a lot of unnecessary whitespace at the right for large n; and -2 is changed to 0 which means rectangles plotted across the bottom always miss the first two columns (this results in poorer packing for numbers whose only factorization is (n/2)*2)
Explanation
I finally found time to get back to this.
For a given n the smallest field must have enough space for both the longest rectangle 1*n and the squarest rectangle x*y. It should be apparent that the best layout can be achieved if both rectangles have their long sides oriented in the same direction.
Ignoring the requirement for whitespace between the rectangles, we find that the total area is either (n+y)*x = (n+n/x)*x or n*(x+1). Either way, this evaluates to n*x + n. Including the whitespace, we have to include an extra x if we place the rectangles end to end, or n if we place the rectangles side by side. The former is therefore preferable.
This gives the following lowerbounds (n+y+1)*x for the field area:
n     area
60    71*6=426
111  149*3=447
230  254*10=2540
400  421*20=8240
480  505*20=10100

This suggests the following algorithm:
Find the value (n+y+1) which shall be the field height
Iterate from the squarest rectangle to the longest one
  While there is space in the field height, draw each rectangle, one below the other, lined up on the left border.
  When there is no more space in the field height, draw the remaining rectangles, one beside the other, along the bottom border, taking care not to overlap any of the rectangles above.
  (Expand the field rightwards in the rare cases where this is necessary.)

It is actually possible to get all the rectangles for the required test cases within the above mentioned lower bounds, with the exception of 60, which gives the following 71*8=568 output. This can be improved slightly to 60*9=540 by moving the two thinnest rectangles right one square and then up, but the saving is minimal, so it's probably not worth any extra code.
10
12
15
20
30
60
******
******
******
******
******
******
******
******
******
******

*****  *
*****  *
*****  *
*****  *
*****  *
*****  *
*****  *
*****  *
*****  *
*****  *
*****  *
*****  *
       *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
****   *
       *
***    *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
*** ** *
    ** *
    ** *
    ** *
    ** *
    ** *
    ** *
    ** *
    ** *
    ** *
    ** *
    ** *

This gives a total area of 21895.
Ungolfed code
f=->n{
  a=(0..n*2).map{' '*40}                                      #Fill an array with strings of 40 spaces
  g=0                                                         #Total height of all rectangles
  m=n                                                         #Height of squarest rectangle (first guess is n)
  (n**0.5).to_i.downto(1){|i|n%i<1&&(puts n/i                 #iterate through widths. Valid ones have n%i=0. Puts outputs heights for debugging.
    m=[m,h=n/i].min                                           #Calculate height of rectangle. On first calculation, m will be set to height of squarest rectangle.
    g+=h+1                                                    #Increment g
    g<n+m+2?                                                  #if the rectangle will fit beneath the last one, against the left margin
      (a[g-h-1,1]=(1..h).map{'*'*i+' '*40})                      #fill the region of the array with stars
    :                                                         #else
      (x=(n+m-h..n+m).map{|j|r=a[j].rindex('* ');r ?r:-2}.max    #find the first clear column
      (n+m-h+1..n+m).each{|j|a[j][x+2]='*'*i}                    #and plot the rectangle along the bottom margin
    )
  )}
a}                                                            #return the array

puts f[gets.to_i]

CJam, 90385 * 31 bytes = 2801935
q~:FmQ,:){F\%!},{F\/F'**/N*NN}/

Test it here. Use this script to calculate the BBAs.
This is just the naive solution to get things started.

Ruby, 56 bytes
90385*56=5061560 assuming output the same as Martin's (I believe it is.)
->n{1.upto(n){|i|i*i<=n&&n%i==0&&puts([?**(n/i)]*i,'')}}

Here's another useful function, in a useful test program
f=->n{1.upto(n){|i|i*i<=n&&n%i==0&&print(n/i,"*",i,"\n")};puts}

f[60];f[111];f[230];f[400];f[480]

Which gives the following output, for reference:
60*1
30*2
20*3
15*4
12*5
10*6

111*1
37*3

230*1
115*2
46*5
23*10

400*1
200*2
100*4
80*5
50*8
40*10
25*16
20*20

480*1
240*2
160*3
120*4
96*5
80*6
60*8
48*10
40*12
32*15
30*16
24*20

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


text:
Which language is shortest?
Create a program that find the latest 50 challenges with the code-golf-tag that have at least 20 answers. Then, extract the scores for each language in each of the challenges. If there are more than one answer using the same language, count all scores. Thereafter, take the top 20 most common languages and output a list with the language names, the number of answers, the average byte counts and the median byte counts. The list should be sorted by number of answers, in descending order.
You must account for variations in capitalization (for instance: Matlab = MATLAB).
In languages with many different version numbers (e.g. Python), count them as unique languages, so: Python != Python 2 != Python 2.7 != Python 3.x
Example output (output format is optional):
cJam,       66,  12.4,  8.5
Pyth,       58,   15.2,  19
Ruby,       44,   19.2,  22.5
Python,     34,   29.3,  32
Python 2.7, 22,   31.2,  40
...
...
Java,       11,   115.5, 94.5

Header formats that must be supported:

Starts with # Language name, or #Language name
Ends with xx bytes, xx Bytes or just xx
There can be a lot of garbage between the first comma and the last number.
If the language name is a link ([Name](link)), it can be skipped

If the answer has another header format, you may choose to skip it (or include it if your code can handle it).
As an example, all of the below headers must be supported:
# Language Name, N bytes
# Ruby, <s>104</s> <s>101</s> 96 bytes
# Perl, 43 + 2 (-p flag) = 45 Bytes
# MATLAB, 5

Rules:

It's OK to use API or just the website-url

The following can be extracted from the byte count (nothing else), so no need to use a url-shortener (Maximum 44 bytes):

https:// (or http://)
codegolf
.stackexchange.com
/questions

The program can take input. The input will be included in the byte count.

Other than that, standard rules apply.

I could tell you it's Pyth without having to do this challenge at all.

is the " bytes" suffix common, let alone universal, enough to require it?

@StewieGriffin I think Sparr is saying that, while it is common, it's not always used.

As far as I can see, xx bytes is very common on recent challenges (at least since the leaderboard snippet was created).

I've seen many cases where the user omits the comma, and even a few times, 103 <s>108</s> <s>110</s> bytes is used instead of left-to-right. Do we need to support these?

@ETHproductions, 103 <s>108</s>  doesn't have to be counted. I couldn't find a "rule" for cases where the comma was omitted because cases like Python 2  3 + 12 = 14 could be hard to handle. I didn't want to specify 100 different formats that must be supported, since that's just too cumbersome and there are a lot of corner cases (for instance score in parentheses, Pyth (5)). So no, you don't have to support headers without the comma (but you can if you want to).

I usually use "chars" or "characters" instead of "bytes"

Define latest: Is it creation date? Last activity?

Cretion date...

Is it necessary to preserve the capitalization of the language name? If so, which one should I preserve?

@AlexA. You're wrong. Again. It's APL. :P

R, 821 - 44 = 777 bytes
Updated results: please see the edit history to make sense of all the comments below.
           language num_answers avg_count median_count
1              RUBY          49  49.97959         30.0
2              CJAM          48  32.64583         22.0
3              PYTH          48  21.02083         14.0
4          PYTHON 2          46  86.78261         77.0
5             JULIA          43  58.90698         45.0
6           HASKELL          41  74.65854         56.0
7               PHP          40  73.52500         48.0
8              PERL          36  53.30556         34.0
9          PYTHON 3          34  90.91176         90.5
10       POWERSHELL          33  60.24242         44.0
11                C          32 221.84375         79.5
12                R          32  77.40625         62.5
13             JAVA          29 170.68966        158.0
14 JAVASCRIPT (ES6)          29  90.79310         83.0
15       JAVASCRIPT          28  68.39286         61.0
16               C#          25 193.92000        130.0
17      MATHEMATICA          23  56.04348         47.0
18           MATLAB          22  67.45455         55.0
19         TI-BASIC          19  47.05263         37.0
20              APL          18  16.55556         15.0

The code, which I could shorten a bit more:
W=library;W(XML);W(plyr)
X=xpathSApply;Y=xmlValue;D=data.frame;H=htmlParse;S=sprintf
Z="http://codegolf.stackexchange.com/"
R=function(FUN,...)do.call(rbind,Map(FUN,...))
G=function(url){d=H(url)
a=as.double(sub(".*?(\\d+)a.*","\\1",X(d,"//div[starts-with(@class,'status')]",Y)))
u=paste0(Z,X(d,"//*[contains(@class,'question-hyperlink')]",xmlGetAttr,"href"))
D(u,a)}
u=S("%s/questions/tagged/code-golf?page=%i",Z,1:50)
q=R(G,u)
u=with(q,head(u[a>20],50))
A=function(url){u=S("%s?page=%i",url,1:10)
f=function(u){d=H(u)
h=X(d, "//div[@class='post-text']//h1",Y)
p="^(.*?),.*? (\\d+)( [Bb]ytes)?$"
k=grep(p,h,v=T)
l=toupper(sub(p,"\\1",k))
c=as.double(sub(p,"\\2",k))
D(l,c)}
R(f,u)}
a=R(A,u)
L=names(tail(sort(table(a$l)),20))
x=subset(a,l%in%L)
arrange(ddply(x, "l",summarise,n=length(c),a=mean(c),m=quantile(c,0.5)),-n)

De-golfed:
library(XML)
library(plyr)
LoopBind <- function(FUN, ...) do.call(rbind, Map(FUN, ...))
GetQuestions <- function(url) {
  d = htmlParse(url)
  a=as.double(sub(".*?(\\d+)a.*","\\1",xpathSApply(d, "//div[starts-with(@class, 'status')]", xmlValue)))
  u=paste0("http://codegolf.stackexchange.com/",xpathSApply(d, "//*[contains(@class, 'question-hyperlink')]", xmlGetAttr, "href"))
  data.frame(u, a)
}
u <- sprintf("http://codegolf.stackexchange.com/questions/tagged/code-golf?page=%i", 1:50)
q <- do.call(rbind, Map(GetQuestions, u))
u <- with(q, head(u[a > 20], 50))

GetAnswers <- function(url) {
  u=sprintf("%s?page=%i",url,1:10)
  f=function(u) {
    d = htmlParse(u)
    h = xpathSApply(d, "//div[@class='post-text']//h1", xmlValue)
    p = "^(.*?),.*? (\\d+)( [Bb]ytes)?$"
    k = grep(p,h,v=T)
    l = toupper(sub(p,"\\1",k))
    c = as.double(sub(p,"\\2",k))
    data.frame(language=l,c)
  }
LoopBind(f,u)
}
a=LoopBind(GetAnswers, u)
L=names(tail(sort(table(a$l)),20))
x=subset(a,language%in%L)
arrange(ddply(x, "language", summarise, num_answers = length(c), avg_count = mean(c), median_count = quantile(c,0.5)),
        -num_answers)

How is the average length for C# over 6000 bytes?

@SuperJedi224 - There might be some extremely long submissions that are skewing the average. That's why median is a useful statistic because it is resistant to outliers.

I read somewhere that C# is the least golfable language. Now I know why...

@ev3commander - C# pales in comparison to Unary...

@Comintern: Eek...

Now golfed, with updated results. Apparently the C# outlier has dropped. I have stored the full results in a csv at https://drive.google.com/open?id=0BwaTHVmeEmT-RUNablBLZ0FyTDg if you want to have a look at the data, maybe to explain differences with @ppperry. (I am not claiming my code is exempt free of errors...)

Does your code handle questions with more than one page of answers?

Yes. Up to 10 pages.

JAVASCRIPT (ES6): 83.0, JAVASCRIPT: 61.0 Seriously? Well, I guess that's because we're more likely to use ES6 on challenges that need more golfing.

Python 2, 934 - 44 (url stuff) = 890 bytes
Using the API:
from urllib2 import urlopen as u
from gzip import GzipFile as f
from StringIO import StringIO as s;x="https://api.stackexchange.com/2.2%s&site=codegolf"
import re;j=u(x%'/search/advanced?pagesize=50&order=desc&sort=creation&answers=20&tagged=code-golf');q=s(j.read());g=f(fileobj=q);true=1;false=0;l=';'.join(str(a['question_id'])for a in eval(g.read())['items']);w=[]
def r(p):
 j=u(x%('/questions/%s/answers?page=%s&filter=!9YdnSMlgz&pagesize=100'%(l,p)));g.seek(0);q.truncate();q.write(j.read());q.seek(0);k=eval(g.read());w.extend(a['body_markdown']for a in k['items'])
 if k['has_more']:r(p+1)
r(1);x={};s=sorted
for m in w:
 try:
  l,n=re.match("(.*?),.*?([0-9]+)[^0-9]*$",m.splitlines()[0]).groups();l=re.subn("# ?","",l,1)[0].upper()
  if l not in x:x[l]=[]
  x[l]+=[(l,int(n))]
 except:pass
for l in s(x,cmp,lambda a:len(x[a]),1)[:20]:
 v=s(x[l])
 print l,len(v),sum(map(lambda a:a[1],v))/len(v),v[len(v)/2][1]

Note that this code does not pay attention to the API throttling.
Output:
RUBY 60 430 32
PYTH 57 426 16
CJAM 56 35 23
C 52 170 76
PYTHON 2 51 88 79
JULIA 42 63 48
HASKELL 42 81 63
JAVASCRIPT (ES6) 41 96 83
PERL 40 44 27
PYTHON 3 37 91 89
PHP 36 98 59
JAVASCRIPT 36 743 65
POWERSHELL 35 86 44
JAVA 32 188 171
R 30 73 48
MATLAB 25 73 51
MATHEMATICA 24 57 47
APL 22 14 13
SCALA 21 204 59
TI-BASIC 21 42 24

@StewieGriffin Interestingly, I had to add one extra slash to the second recursive query to qualify for the /questions reduction.

The differences are because @flodel disallows suffixes other than bytes, while mine will handle other suffixes like chars.

Is it possible that your code combines C, C# and possibly C++? It seems unlikely that there are 73 C-answers.

No, I don't think so. I end the language name on the first comma.

Ok, but it is quite strange don't you think? Especially since it is such a big mismatch between your and flodel's answer. In his answer, there are 32 C-answers, 25 C# answers, and C++ is not listed. In your list, C# is not on the list, and there are 73 C-answers.

I don't know which answer is most right though, might be yours. And I'm wondering where the extremely long Pyth and Ruby answers are =P There must be one answer in each language that completely messes up the average.

Maybe C programmers use suffixes other than bytes alot.

Might be, but still very unlikely that there are 73 C-answers on 50 questions...?

Looks like l=re.sub("# ?|,","",l) is what replaces C# with C.

@flodel Now recognized c and c# as seperate.


text:
An elementary challenge
This challenge is inspired by this Oliver Sacks quote:

“At 11, I could say ‘I am sodium’ (Element 11), and now at 79, I am
  gold.” ― Oliver Sacks

I want you you find numbers in a string and replace them with their corresponding elements' symbols. (1 is H, 2 is He, 3 is Li, etc.) There are a few rules to follow:

Single and double digits get replaced with their corresponding
elements as normal. Ignore 0s at the start of numbers. If there are just 0s in a number, ignore it. E.g. 1 01 10 0 00 becomes H H Ne 0 00
More than 2 digits together get divided into groups of 2. An odd
number of digits should have the extra single digit at the end. E.g. 0153 5301 153 would become HI IH PLi Because of this rule, you will only need to know the elements from 1 to 99
Numbers shall be treated the same no matter what characters surround
them and commas and decimal points are not parts of numbers. P90X
42,800 3.14159 would become PThX Mo,Hg0 Li.SiPF

Example Inputs/Outputs (I/O):
I: 32289216
O: GeNiUS

I: J08017 5811
O: JOHN CeNa

I: M18227 0592tt10r
O: MArTiN BUttNer

I: De072816
O: DeNNiS

I: D088r1907085
O: DOOrKNOB

I: 13ex A.
O: Alex A.

Input will be in the closest format to a string that your language has.
A periodic table for reference:

This is code-golf, so your program will be scored in bytes.

John Cena is a moderator at PPCG? ;-)

Please give a warm welcome to our new moderator JOHN CENA music and airhorns start blaring

instantcena.com

Mathematica, 96 94 89 bytes
StringReplace[#,n:DigitCharacter~Repeated~2/;(d=FromDigits@n)>0:>d~ElementData~"Symbol"]&

Mma has several datasets...

Well of course a built-in dataset will beat a 139-byte compressed string. ;)

@ETHproductions I'm just surprised that this has been the shortest answer for 9 hours. Usually, this place is reserved for CJam and Pyth :D

Well, let's see: to beat 89 bytes, one would either need to super-condense the 184 necessary alphabetic characters—AND create a program to decode it—in under 89 bytes (very very unlikely), OR find another language which has a built-in dataset of the proper elements (neither CJam or Pyth). So this will likely end up being the winner.

JavaScript (ES6), 202 bytes
x=>x.replace(/\d\d?/g,y=>+y?btoa`(139 bytes; see hexdump below)`.match(/[A-Z][a-z]?/g)[+y]:y)

The omitted string contains unprintable characters, so here is a (hopefully reversible) hexdump:
00000000: 0071 de2e 205e 0423 4e14 d78d 68c8 0095 288f  .qÞ. ^.#N.×.hÈ..(.
00000012: 4829 40ac a09a 49c4 e254 2acc 9c57 82a0 d882  H)@¬ .IÄâT*Ì.W. Ø.
00000024: b999 c668 6780 b127 81ac aad1 6d2a d866 b35b  ¹.Æhg.±'.¬ªÑm*Øf³[
00000036: 3284 dc46 e461 3dd0 2009 d227 4a74 9b4d e217  2.ÜFäa=Ð .Ò'Jt.Mâ.
00000048: 782b 0168 b682 78fa cd74 f992 984b 8675 36c3  x+.h¶.xúÍtù..K.u6Ã
0000005a: c87a 04ad 3998 6cbb 877d 3696 45e3 ac22 b3ed  Èz..9.l».}6.Eã¬"³í
0000006c: 02e1 e04e 53db 0623 e802 d467 16b4 5a01 c4e1  .áàNSÛ.#è.Ôg.´Z.Äá
0000007e: 3da5 0da4 fb80 9829 8190 27c4 b0              =¥.¤û..)..'Ä°

The technique here was to put all the element abbreviations in one string, separated by nothing—that's what the second regex /[A-Z][a-z]?/g is for; it matches each capital letter, optionally followed by a lowercase letter. The first regex, /\d\d?/g, matches each set of 2 (or 1) digits in the input, so this replaces each set of digits N with the element at index N in the decompressed, matched string.
Here's the original string, if anyone else would like to use it: (the A's at the ends are fillers)
AHHeLiBeBCNOFNeNaMgAlSiPSClArKCaScTiVCrMnFeCoNiCuZnGaGeAsSeBrKrRbSrYZrNbMoTcRuRhPdAgCdInSnSbTeIXeCsBaLaCePrNdPmSmEuGdTbDyHoErTmYbLuHfTaWReOsIrPtAuHgTlPbBiPoAtRnFrRaAcThPaUNpPuAmCmBkCfEsA

Questions and suggestions welcome!

What about Uus and Uuo?

@CᴏɴᴏʀO'Bʀɪᴇɴ - The question only requires up to element 99, which is Einsteinium (Es), so the unconfirmed elements (which therefore don't have final names, and are written with three characters) don't factor in at all.

Nice. I think you don't need the check +y?...:... as you are replacing digit groups

@edc65 Thanks. One of the rules is that any 00's in the input need to be unchanged, so that check is necessary.

now I see. Still you can use [y] instead of [+y] and save 1 byte

@edc65 Thanks again, but this time, numbers in the range 01-09 become undefined.

Python 3, 278 285 bytes
import re;f=lambda a:re.sub('(?!00)\d\d?',lambda m:'0HHLBBCNOFNNMASPSCAKCSTVCMFCNCZGGASBKRSYZNMTRRPACISSTIXCBLCPNPSEGTDHETYLHTWROIPAHTPBPARFRATPUNPACBCE  eie     eagli  lr aci rneoiunaeserrbr rbocuhdgdnnbe esaaerdmmudbyormbufa esrtuglbiotnracha pummkfs'[int(m.group())::100].strip(),a)

Test cases:
>>> f('32289216')
'GeNiUS'
>>> f('J08017 5811')
'JOHN CeNa'
>>> f('M18227 0592tt10r')
'MArTiN BUttNer'
>>> f('De072816')
'DeNNiS'
>>> f('D088r1907085')
'DOOrKNOB'
>>> f('13ex A.')
'Alex A.'
>>> f('P90X 42,800 3.14159')
'PThX Mo,Hg0 Li.SiPF'
>>> f('1 01 10 0 00')
'H H Ne 0 00'

f('P90X 42,800 3.14159') returns 'PThX Mo,Hgs Li.SiPF' instead of 'PThX Mo,Hg0 Li.SiPF' and f('1 01 10 0 00') returns 'H H Ne s s' instead of 'H H Ne 0 00'. By the way, I just used your extended slicing approach in my Python 2 solution. Thanks!

@cr3: Fixed 0 and 00.

nice, you beat me by 19 bytes!

Python 2, 312 304 bytes
import re
f=lambda a:''.join([j or'0HHLBBCNOFNNMASPSCAKCSTVCMFCNCZGGASBKRSYZNMTRRPACISSTIXCBLCPNPSEGTDHETYLHTWROIPAHTPBPARFRATPUNPACBCE0 eie     eagli  lr aci rneoiunaeserrbr rbocuhdgdnnbe esaaerdmmudbyormbufa esrtuglbiotnracha pummkfs'[int(i)::100].strip() for i,j in re.findall('(\d\d|[1-9])|(.)',a)])

This one creates a function f which takes a string of numbers as argument and returns the corresponding string with element symbols replaced.
The function iterates over strings of one to two digits ('1', '01', '10', '00' but not '0') or one character ('a', '0' but not '1'). In the case of digits, the string is converted to an integer and looked up in a concatenated string of element symbols where each symbol is padded to two characters. In the case of characters, the string is simply used without lookup.
The tests for each example in the question all pass:
assert f('P90X 42,800 3.14159') == 'PThX Mo,Hg0 Li.SiPF'
assert f('1 01 10 0 00') == 'H H Ne 0 00'
assert f('0153 5301 153') == 'HI IH PLi'
assert f('32289216') == 'GeNiUS'
assert f('J08017 5811') == 'JOHN CeNa'
assert f('M18227 0592tt10r') == 'MArTiN BUttNer'
assert f('De072816') == 'DeNNiS'
assert f('D088r1907085') == 'DOOrKNOB'
assert f('13ex A.') == 'Alex A.'


text:
Circular Blues
Write a program or function that takes in a positive integer N and recreates this pattern of circles scaled to fit an N×N pixel image:

This image is a valid output example for N = 946.
In case it's not clear, all the small light-blue circles have the same radius and are positioned in the four dark-blue circles in the same way. The dark-blue circles have double that radius and are similarly positioned in the large light-blue circle.

Any two visually distinct colors may be used in place of the two shades of blue.
The background square does need to be colored.
Anti-aliasing is optional.
Save the image to a file, display it, or pipe the raw image data to stdout.
Any common image file format is allowed.

The shortest code in bytes wins.
Brownie points if you extend the recursive aspects of this circle pattern into further levels. (Keep this distinct from your challenge entry.)

What do you mean by "The background square does need to be colored"? If the background has a certain color by default, can I just use it as one of the 2 colors without explicitly filling it?

I mean the bg can't be a third different color

CJam, 83 bytes
"P1"li___,.5f+2.@/f*1fm2m*{[3{_~mh1<[[VX][ZmqV]]_Wff*+@2f*f.+{~mh}$0=}*;0]0#2%}%]S*

Try it online
CJam does not have dedicated image output functionality. My code generates an image in PBM ASCII. For posting, I converted that image to a PNG using GIMP.
Note that no circle drawing functionality, or anything like that, it used. The image is calculated pixel by pixel.

Higher degrees of the subdivision can easily be created by increasing the constant 3 around the middle of the code.
The degree 4 and 5 images look like this:

The overall sequence of the code is:

Generate the coordinates of all pixels, normalized to range [-1.0, 1.0].
Loop over all pixels.
Loop over degrees of subdivision.
For each subdivision, check if the pixel is inside/outside, and keep the result. The scale/translate the pixel coordinates to the coordinate systems centered at one of the 4 sub-circles. Pick the one where the transformed coordinates are closest to the center.
From the binary inside/outside results of each degree, find the first 0, corresponding to the first degree where the pixel was outside, and take its modulo 2 to determine the color of the pixel.

Explanation:
"P1"    Start of header for PBM ASCII file.
li      Get input n.
__      Two copies for the width/height of the image in the PBM header.
_,      Generate [0 .. n - 1].
.5f+    Add 0.5 to each list entry, since we want to test the pixel centers.
2.@/    Calculate 2.0 / n, which is the distance between two pixels.
f*      Multiply the unscaled pixel coordinates with the pixel distance.
        We now have coordinates in the range [0.0, 2.0].
1fm     Subtract one from each, giving coordinates in range [-1.0, 1.0].
2m*     Cartesian power to calculate all y/x pairs.
{       Start loop over all pixel coordinates.
  [       Start wrapping the inside/outside results for all degrees.
  3{      Start loop over degrees.
    _~mh    Calculate distance from center.
    1<      Compare with 1. This gives inside/outside result for degree.
    [       Start building list of centers for 4 sub-circles.
    [VX]    One is at [0 1]. Note that coordinate order is y/x.
    [ZmqV]  Next one is at [sqrt(3) 0].
    ]       Wrap these two...
    _       ... and copy them.
    Wff*    Mirror all coordinates by multiplying with -1.
    +       Concatenate, giving the centers of all 4 sub-circles.
    @       Get current coordinates to top.
    2f*     Multiply them by 2. Note that the coordinates need to be scaled up by
            a factor 2 to give a circle with half the radius when we test the distance
            to the origin against 1.0.
    f.+     Add the current coordinates to the centers of all 4 sub-circles.
            For each sub-circle, this puts the current coordinates in a coordinate
            space with the origin at the center, and with a radius of 1.0
    {~mh}$  Sort them by distance to the origin...
    0=      ... and take the first one. This picks the sub-circle which has its
            center closest to the current coordinates.
            We now have one coordinate pair, for the closest sub-circle, and are
            ready for the next loop iteration, which tests the next degree of the
            subdivision.
  }*      End loop over degrees.
  ;       Have remaining coordinate pair on stack, pop it.
  0       Add a sentinel for find operation before, so that a 0 is always found.
  ]       End wrapping the inside/outside results for all degrees.
  0#      Find the first 0 (outside) degree.
  2%      Modulo 2 to determine color.
}%      End loop over all pixel coordinates.
]       Wrap the pieces of the PBM header and the pixel list.
S*      Join them with spaces, to produce the necessary spaces for the header.

Python 2 + PIL, 262 bytes

This approach determines the color of each individual pixel coordinate using recursive function c. c(x,y,0) renders a circle; c(x,y,1) renders a circle with four circles cut out of it; c(x,y,2) renders the image in the OP. Anything larger than 2 earns me brownie points.
import PIL.Image as I
d=3**.5/2
c=lambda x,y,l=0:c(x,y)&~any(c((x+i)*2,(y+j)*2,l-1)for i,j in[(.5,0),(-.5,0),(0,d),(0,-d)])if l else x*x+y*y<1
z=input()
f=lambda s:2.*s/z-1
I.frombytes("L",(z,z),"".join(" ~"[c(f(i%z),f(i/z),2)]for i in range(z*z))).save("p.png")

Non-golfed version:
from PIL import Image
import math
def in_shape(x,y, level=0):
    d = math.sqrt(3)/2
    if level == 0:
        return x**2 + y**2 <= 1
    else:
        t = True
        for dx,dy in [(0.5, 0), (-0.5, 0), (0, d), (0,-d)]:
            if in_shape((x+dx)*2, (y+dy)*2, level-1):
                t = False
        return in_shape(x,y) and t

f = lambda s: ((2*s / float(size))-1)

size = input()
img = Image.new("RGB", (size, size))
pix = img.load()
for i in range(size):
    for j in range(size):
        if in_shape(f(i), f(j), 2):
            pix[i,j] = (0,0,0)
        else:
            pix[i,j] = (255,255,255)
img.save("output.png")

Bonus extra-recursive image:

Instead of .save("p.png") just use .show()

PostScript, 335 bytes.
%!
/D{def}def/B{bind D}D/E{exch}B/A{add}D/c{3 copy 3 -1 roll A E moveto 0 360 arc}B/f{5 dict begin/d E D/r E D/y E D/x E D gsave x y r c clip d 2 mod setgray x y r c fill d 0 gt{/h 3 sqrt 2 div r mul D/r r 2 div D/d d 1 sub D x r A y r d f x r sub y r d f x y h A r d f x y h sub r d f}if grestore end}B 512 2 div dup dup 2 f showpage

PostScript isn't just a graphics file format with both vector and bitmap capabilities, it's actually an object-based Turing-complete programing language. The code above is a fairly straight-forward recursive function implementation. All PostScript operators are functions, and it's commonplace to redefine them to condense code. Note that PostScript uses Reverse Polish notation (aka postfix notation).
PostScript interpreters generally read metadata (like page size and title)  from special comments at the start of the file; obviously I've removed all but the bare essential PostScript signature comment %! from my entry, but it should still display ok in any standard PostScript interpreter, eg GhostScript or Okular. It can also be viewed using the display utility that comes with ImageMagick / GraphicsMagick.
Note that the file should end in a newline (which I've included in my byte count), or the interpreter may get upset.
The size parameter N for this code is 512; it's divided by 2 and duplicated twice to create the parameters for the initial call of the recursive function f. The recursion depth is 2, which is given just before the f in 512 2 div dup dup 2 f. To keep the size small the output is black & white. Although you can set any reasonable non-negative integer recursion depth this version only looks good with even depths.
This image is a vector graphic, so it can be displayed in any resolution without pixelization, depending on the quality & settings of the PostScript interpreter / printer used. (FWIW, PostScript uses Bézier cubic curves to draw circular arcs, with enough splines used to ensure that the error is always less than one pixel in device space). To view it using ImageMagick's display in reasonably high quality you can do:
display -density 300 -geometry 512x512 -page 512x512

the same parameters are also good if you wish to use ImageMagick's convert to convert it to another format. Eg, here's a 640x640 version of the above PostScript code converted to PNG:

Here's a slightly larger version that handles RGB color and odd recursion depths:
%!PS-Adobe-3.0
/D{def}def/N 512 D/d 2 D/B{bind D}D/E{exch}B/A{add}D/c{3 copy 3 -1 roll A E moveto 0 360 arc}B/k{2 mod 0 eq{.3 .6 .9}{0 .2 .5}ifelse setrgbcolor}B d 1 A k 0 0 N N rectfill/f{5 dict begin/d E D/r E D/y E D/x E D gsave x y r c clip d k x y r c fill d 0 gt{/h 3 sqrt 2 div r mul D/r r 2 div D/d d 1 sub D x r A y r d f x r sub y r d f x y h A r d f x y h sub r d f}if grestore end}B N 2 div dup dup d f showpage

It also allows you to set the size parameter N and the recursion depth d near the top of the script.

Finally, here's the more readable form of the code. (Unfortunately, the syntax highlighting used here for PostScript leaves a lot to be desired, but I guess it's better than nothing...). Smart PostScript interpreters will read the page geometry from the %%BoundingBox: special comment.
%!PS-Adobe-3.0
%%BoundingBox: 0 0 640 640
%%Title: Circle fractal
%%Creator: PM 2Ring
%%Creationdate: (Oct 29 2015)
%%Pages: 1 1
%%EndComments

% for http://codegolf.stackexchange.com/questions/61989/circular-blues

% ----------------------------------------------------------------------

16 dict begin

%Total image width & height in points / pixels
/N 640 def

%Maximum recursion depth
/Depth 4 def

% ----------------------------------------------------------------------

%Draw a circle centred at (x,y), radius r. x y r circle -
/circle{
    3 copy      % x y r  x y r
    3 -1 roll   % x y r  y r x
    add exch    % x y r  x+r y
    moveto
    0 360 arc
}bind def

% ----------------------------------------------------------------------

%Select 1st color if n is even, select 2nd color if n is odd. n color -
/color{
    2 mod 0 eq
    {.36 .6 .9}
    {0 .25 .5}
    ifelse
    setrgbcolor
}bind def

%Do background square
Depth 1 add color
0 0 N N rectfill

/Q 3 sqrt 2 div def

%Recursive circle pattern. x y r Depth cfrac -
/cfrac{
    5 dict begin
    /Depth exch def
    /r exch def
    /y exch def
    /x exch def

    gsave
    x y r circle clip
    Depth color
    x y r circle fill

    Depth 0 gt
    {
        /dy Q r mul def
        /r r 2 div def
        /Depth Depth 1 sub def

        x r add y r Depth cfrac
        x r sub y r Depth cfrac
        x y dy add r Depth cfrac
        x y dy sub r Depth cfrac
    }if
    grestore
    end
}bind def

%Call it!
N 2 div dup dup Depth cfrac

showpage

% ----------------------------------------------------------------------

%%Trailer
end
%%EOF

And here's the depth==4 output in PNG format, once again created using convert (and optimized with optipng):

Python 2 + PIL, 361 bytes
import PIL.Image as p,PIL.ImageDraw as d
W=input()
q=W/4
h=2*q
t=3*q
e=W/8
o=int(q*3**.5)
I,J=[p.new("1",(s,s),s>h)for s in[W,h]]
Q=lambda i,x,y,s=q,c=0:d.Draw(i).ellipse((x,y,x+s,y+s),fill=c)
Q(I,0,0,W)
Q(J,0,0,h,1)
[Q(J,k,e)for k in[0,q]]
[Q(J,e,e+k/2)for k in[-o,o]]
[I.paste(1,k,J)for k in[(0,q,h,t),(h,q,4*q,t),(q,q-o,t,t-o),(q,q+o,t,t+o)]]
I.save("c.png")

Saves the image in black & white to the file c.png:

I basically generate one of the half-sized circles in the image J. I then use itself as a mask to paint the shape onto image I, which has the main circle.
It could be shortened using I.show() at the end instead of I.save("c.png"), but I didn't get it working on Python 2. If someone can confirm it works on Python 2 I'll change to that.
The following program generates the image as in the question (419 bytes):
import PIL.Image as p,PIL.ImageDraw as d
W=int(input())
q=W/4
h=2*q
t=3*q
e=W/8
o=int(q*3**.5)
I,J=[p.new(["1","RGB"][s>h],(s,s),s>h and"rgb(13,55,125)")for s in[W,h]]
Q=lambda i,x,y,s=q,c=0:d.Draw(i).ellipse((x,y,x+s,y+s),fill=c)
Q(I,0,0,W,"rgb(97,140,224)")
Q(J,0,0,h,1)
[Q(J,k,e)for k in[0,q]]
[Q(J,e,e+k/2)for k in[-o,o]]
[I.paste("rgb(13,55,125)",k,J)for k in[(0,q,h,t),(h,q,4*q,t),(q,q-o,t,t-o),(q,q+o,t,t+o)]]
I.save("c.png")

-1 not as pretty as Calvin's image ;)

I can confirm that .show() works

Ok, thanks, I'll use that instead of save.

SVG (1249 characters)
Yeah, lots of characters. But it’s static and renders at any size, so that gives it some bonus.
<svg xmlns="http://www.w3.org/2000/svg"><path d="M15,33c-2.5,0-4.6,1.9-4.9,4.3c2.8,1.6,6.1,2.6,9.5,2.6c0.3-0.6,0.4-1.3,0.4-2C20,35.2,17.8,33,15,33zM15,7c2.8,0,5-2.2,5-5c0-0.7-0.1-1.4-0.4-2c-3.5,0.1-6.7,1-9.5,2.6C10.4,5.1,12.5,7,15,7zM25,33c-2.8,0-5,2.2-5,5c0,0.7,0.1,1.4,0.4,2c3.5-0.1,6.7-1,9.5-2.6C29.6,34.9,27.5,33,25,33zM25,7c2.5,0,4.6-1.9,4.9-4.3C27.1,1,23.9,0.1,20.4,0C20.1,0.6,20,1.3,20,2C20,4.7,22.2,7,25,7zM35,28.7C34.8,26,32.6,24,30,24s-4.8,2.1-5,4.7c-3-1.7-5-5-5-8.7c0,3.7-2,6.9-5,8.7C14.8,26,12.6,24,10,24S5.2,26,5,28.7c-3-1.7-5-5-5-8.7c0,7.4,4,13.9,10,17.3c0.1-1.2,0.4-2.4,0.8-3.4c0.9-1.9,2.3-3.5,4.1-4.5c0,0,0,0,0.1,0c0.2,2.6,2.3,4.7,5,4.7s4.8-2.1,5-4.7c0,0,0,0,0.1,0c1.8,1,3.2,2.6,4.1,4.5c0.5,1.1,0.8,2.2,0.8,3.4c6-3.5,10-9.9,10-17.3C40,23.7,38,26.9,35,28.7zM5,11.3c0.2,2.6,2.3,4.7,5,4.7s4.8-2.1,5-4.7c3,1.7,5,5,5,8.7c0-3.7,2-6.9,5-8.7c0.2,2.6,2.3,4.7,5,4.7s4.8-2.1,5-4.7c3,1.7,5,5,5,8.7c0-7.4-4-13.9-10-17.3c-0.1,1.2-0.4,2.4-0.8,3.4C28.3,8,26.8,9.6,25,10.6c0,0,0,0-0.1,0C24.8,8,22.6,6,20,6s-4.8,2.1-5,4.7c0,0,0,0-0.1,0c-1.8-1-3.2-2.6-4.1-4.5C10.4,5,10.1,3.9,10,2.6C4,6.1,0,12.6,0,20C0,16.3,2,13,5,11.3z"/><circle cx="15" cy="20" r="5"/><circle cx="5" cy="20" r="5"/><circle cx="35" cy="20" r="5"/><circle cx="25" cy="20" r="5"/></svg>

Viewable snippet:

svg { fill: #9FD7FF; background: #2176AA; }
<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400" viewBox="0 0 40 40">
  <path d="M15,33c-2.5,0-4.6,1.9-4.9,4.3c2.8,1.6,6.1,2.6,9.5,2.6c0.3-0.6,0.4-1.3,0.4-2C20,35.2,17.8,33,15,33zM15,7c2.8,0,5-2.2,5-5c0-0.7-0.1-1.4-0.4-2c-3.5,0.1-6.7,1-9.5,2.6C10.4,5.1,12.5,7,15,7zM25,33c-2.8,0-5,2.2-5,5c0,0.7,0.1,1.4,0.4,2c3.5-0.1,6.7-1,9.5-2.6C29.6,34.9,27.5,33,25,33zM25,7c2.5,0,4.6-1.9,4.9-4.3C27.1,1,23.9,0.1,20.4,0C20.1,0.6,20,1.3,20,2C20,4.7,22.2,7,25,7zM35,28.7C34.8,26,32.6,24,30,24s-4.8,2.1-5,4.7c-3-1.7-5-5-5-8.7c0,3.7-2,6.9-5,8.7C14.8,26,12.6,24,10,24S5.2,26,5,28.7c-3-1.7-5-5-5-8.7c0,7.4,4,13.9,10,17.3c0.1-1.2,0.4-2.4,0.8-3.4c0.9-1.9,2.3-3.5,4.1-4.5c0,0,0,0,0.1,0c0.2,2.6,2.3,4.7,5,4.7s4.8-2.1,5-4.7c0,0,0,0,0.1,0c1.8,1,3.2,2.6,4.1,4.5c0.5,1.1,0.8,2.2,0.8,3.4c6-3.5,10-9.9,10-17.3C40,23.7,38,26.9,35,28.7zM5,11.3c0.2,2.6,2.3,4.7,5,4.7s4.8-2.1,5-4.7c3,1.7,5,5,5,8.7c0-3.7,2-6.9,5-8.7c0.2,2.6,2.3,4.7,5,4.7s4.8-2.1,5-4.7c3,1.7,5,5,5,8.7c0-7.4-4-13.9-10-17.3c-0.1,1.2-0.4,2.4-0.8,3.4C28.3,8,26.8,9.6,25,10.6c0,0,0,0-0.1,0C24.8,8,22.6,6,20,6s-4.8,2.1-5,4.7c0,0,0,0-0.1,0c-1.8-1-3.2-2.6-4.1-4.5C10.4,5,10.1,3.9,10,2.6C4,6.1,0,12.6,0,20C0,16.3,2,13,5,11.3z"/>
  <circle cx="15" cy="20" r="5"/>
  <circle cx="5" cy="20" r="5"/>
  <circle cx="35" cy="20" r="5"/>
  <circle cx="25" cy="20" r="5"/>
</svg>

Note that, as Mego said, SVG does not satisfy our criteria to qualify as a programming language. However, the OP may choose to allow this answer anyway; it's up to him.

SVG is fine in this case.

Can you omit the leading 0 in floating point constants? For example, replace 0.4 by .4? In most languages, that's valid. And a very quick look of the SVG spec suggests that it should probably work their as well.

@RetoKoradi Yeah, and you can probably crunch a few more numbers by rounding efficiently, or by changing the size in a way that you need less decimals, but tbh. the resulting paths are just too complicated for this to make a huge difference. But I may try another solution using masks later.

Mathematica 336 359 bytes
The principal graphics objects are regions defined through logical combinations of equations.
r=Red;i=ImplicitRegion;m=i[-2<x<2&&-2<y<2,{x,y}];n=Input[];
t[a_,b_,c_]:=i[(x+a)^2+(y+b)^2<=c,{x,y}];
a_~f~b_:={t[a,b,1],t[-.5+a,b,1/4],t[.5+a,b,1/4],t[a,b-.865,1/4],t[a,b+.865, 1/4]}
g@d_:=RegionIntersection[m,BooleanRegion[#1&&!#2&&!#3&&!#4&&!#5&,d]]
RegionPlot[{m,t[0,0,4],g@f[1,0],g@f[-1,0],g@f[0,1.75],
g@f[0, -1.75]},ImageSize->n,PlotStyle->{r,Blue,r,r,r,r}]

Java, 550
import javafx.application.*;import javafx.scene.*;import javafx.scene.layout.*;import javafx.scene.shape.*;import javafx.stage.*;public
class C extends Application{static long n;Shape d(float m,float k,float x,float y){float h=m/2;Shape
s=new Circle(x+h,y+h,h);return k>0?s.subtract(s,s.union(s.union(s.union(d(h,k-1,x,y+m/4),d(h,k-1,x+h,y+m/4)),d(h,k-1,x+m/4,y-m*.183f)),d(h,k-1,x+m/4,y+m*.683f))):s;}public
void start(Stage s){s.setScene(new Scene(new Pane(d(n,2,0,0))));s.show();}public
static void main(String[]a){n=Long.valueOf(a[0]);launch();}}

Mostly just experimenting with JavaFX.
Screenshot:

For brownie points, change the 2 in the code (d(n,2,0,0)) to a different number.
Old version, 810
import javafx.application.*;import javafx.scene.*;import javafx.scene.canvas.*;import javafx.scene.effect.*;import javafx.scene.layout.*;import javafx.scene.paint.*;import javafx.stage.*;public
class C extends Application{static long n;Canvas c;GraphicsContext g;void
d(float m,float k,float x,float y){if(k>0){float
h=m/2;g.save();g.beginPath();g.arc(x+h,y+h,h,h,0,360);g.clip();g.fillRect(x,y,m,m);d(h,k-1,x,y+m/4);d(h,k-1,x+h,y+m/4);d(h,k-1,x+m/4,y-m*.183f);d(h,k-1,x+m/4,y+m*.683f);g.restore();}}public
void start(Stage s){c=new Canvas(n,n);g=c.getGraphicsContext2D();g.setGlobalBlendMode(BlendMode.DIFFERENCE);g.setFill(Color.TAN);g.fillRect(0,0,n,n);d(n,3,0,0);Pane
p=new Pane();p.getChildren().add(c);s.setScene(new Scene(p));s.show();}public
static void main(String[]a){n=Long.valueOf(a[0]);launch();}}

It leaves some undesired edges as you can see in this screenshot.

JavaScript (ES6), 279
Recursively create canvases and add the child canvas four times to its parent canvas. At the bottom layer, the canvas is a single circle; that canvas gets stamped four times onto a parent canvas, and then that canvas is stamped four times onto the final master canvas.
(n,o=0)=>(r=o-2&&f(n/2,o+1),c=document.createElement`canvas`,X=c.getContext`2d`,d=(x,Q)=>(X.drawImage(r,x,k+Q*k*Math.sqrt(3)),d),c.width=c.height=n,m=n/2,k=n/4,X.fillStyle=o%2||"red",X.fill(X.clip(X.arc(m,m,m,0,7))),r&&d(0,0)(m,0)(k,-1)(k,1),o?c:location=c.toDataURL`image/jpeg`)

Runnable demo:

f = function (n) {var o = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1];return r = o - 2 && f(n / 2, o + 1), c = document.createElement("canvas"), X = c.getContext("2d"), d = function (x, y) {return X.drawImage(r, x, y || k), d;}, c.width = c.height = n, m = n / 2, k = n / 4, q = k * Math.sqrt(3), X.fillStyle = o % 2 || "red", X.arc(m, m, m, 0, 7),X.clip(),X.fill(), r && d(0)(m)(k, k - q)(k, k + q), o || (location = c.toDataURL("image/jpeg")), c;};f(400)

With whitespace, comments, and mildly ungolfed:
f=(n,o=0)=>(
    // recursively create another canvas if we're not at the deepest layer
    var r;
    if(o < 2) { r = f(n/2,o+1); }

    // create this canvas
    c=document.createElement("canvas"),
    c.width=c.height=n,
    X=c.getContext("2d"),

    // helpful postions
    m=n/2, k=n/4, q=k*Math.sqrt(3),

    // draw a circle and clip future draws within this circle
    // either fills red (the shortest color name) or a non-color that defaults to black
    X.fillStyle= o%2 || "red",
    X.arc(m,m,m,0,7),
    X.clip(),
    X.fill(),

    // define a chainable `drawImage` alias (the `d` function returns itself)
    d=(x,y)=>(X.drawImage(r,x,y),d)

    // if we have a recursive canvas, draw it four times by chaining `d`
    if(r) { d(0,k)(m,k)(k,k-q)(k,k+q); }

    // if this is the top-layer (o==0), show the final jpeg
    if(o == 0) { location = c.toDataURL("image/jpeg"); }

    // return this canvas, to be used recursively
    c
)

This can easily produce deeper layers of recursion by changing the initial o-2 or any larger o-z value.
Note that this will submission only run in Firefox, due to the use of ES6 features and inconsistency in the canvas API for fill and clip arguments.


text:
Where'd that germ go?
Introduction
You are a biologist studying the movement patterns of bacteria.
Your research team has a bunch of them in a petri dish, and you are recording their activity.
Unfortunately, you are seriously underfunded, and can't afford a video camera, so you just take a picture of the dish at regular intervals.
Your task is to make a program that traces the movements of the germs from these pictures.
Input
Your inputs are two 2D arrays of characters in any reasonable format, representing consecutive pictures of the petri dish.
In both arrays, the character . represents empty space, and O represents a germ (you can choose any two distinct characters if you want).
Also, the "after" array is obtained from the "before" array by moving some germs one step in one of the four cardinal directions; in particular, the arrays have the same shape.
The germs move simultaneously, so one of them may move to a space that already contained another germ, if it moves out of the way.
It is guaranteed that the borders of the "before" array contain only empty spaces, and that there is at least one germ.
Thus, the following is a valid pair of inputs:
Before  After
......  ......
.O..O.  ....O.
.OO.O.  .OO.O.
......  ..O...

Output
Your output is a single 2D array of characters in the same format as the inputs.
It is obtained from the "before" array by replacing those germs that have moved with one of >^<v, depending on the direction of movement (you can also use any 4 distinct characters here).
There may be several possible outputs, but you shall give only one of them.
In the above example, one possible correct output is
......
.v..O.
.>v.O.
......

Unnecessary movement is allowed in the output and germs can swap places, so the following is also valid:
......
.v..v.
.>v.^.
......

Rules and scoring
You can write a full program or a function.
The lowest byte count wins, and standard loopholes are disallowed.
I'm interested in relatively efficient algorithms, but I don't want to ban brute forcing entirely.
For this reason, there's a bonus of -75% for solving the last test case within 10 minutes on a modern CPU (I'm unable to test most solutions, so I'll just trust you here). Disclaimer: I know that a fast algorithm exists (search for "disjoint paths problem"), but I haven't implemented it myself.
Additional test cases
Before
......
.O..O.
..OO..
......
After
......
..O...
...OO.
..O...
Possible output
......
.>..v.
..vO..
......

Before
.......
.OOOOO.
.O..OO.
.OO..O.
.OOOOO.
.......
After
.......
..OOOOO
.O...O.
.O...O.
.OOOOOO
....O..
Possible output
.......
.>>>>>.
.O..>v.
.Ov..v.
.O>>v>.
.......

Before
..........
.OOO..OOO.
.OOOOOOOO.
.OOO..OOO.
..........
After
..O.......
.OOO..O.O.
..OOOOOOOO
.O.O..OOO.
.......O..
Possible output
..........
.>^O..O>v.
.^O>>>vO>.
.O>^..>vO.
..........

Before
............
.OO..OOOOOO.
.OO......OO.
...OOOOOO...
.O.OOOOOO.O.
...OOOOOO...
.OOOOOOOOOO.
............
After
..........O.
.OO..OOOOO..
.O...O...O..
.O.OOOOOOO..
.O.OOOOOO..O
...OO..OO...
....OOOOOOOO
.OOO........
Possible output
............
.OO..v<<<<^.
.v<......^<.
...OOO>>>...
.O.OOO^OO.>.
...OOv^OO...
.vvvO>>>>>>.
............

Before
................
.OOOOOO.OOOOOOO.
..OO..OOOOOOOOO.
.OOO..OOOO..OOO.
..OOOOOOOO..OOO.
.OOOOOOOOOOOOOO.
................
After
................
..OOOOO.OOOOOOOO
..OO..OOOOOOOOO.
..OO..OOOO..OOOO
..OOOOOOOO..OOO.
..OOOOOOOOOOOOOO
................
Possible output
................
.>>>>>v.>>>>>>>.
..OO..>>^>>>>>v.
.>>v..OOO^..OO>.
..O>>>>>>^..OOO.
.>>>>>>>>>>>>>>.
................

Before
..............................
.OOO.O.O.....O.....O.O.O..O...
..OOO.O...O..OO..O..O.O.......
.....O......O..O.....O....O...
.O.OOOOO......O...O..O....O...
.OO..O..OO.O..OO..O..O....O...
..O.O.O......OO.OO..O..OO.....
..O....O..O.OO...OOO.OOO...O..
.....O..OO......O..O...OO.OO..
........O..O........OO.O.O....
..O.....OO.....OO.OO.......O..
.O.....O.O..OO.OO....O......O.
..O..OOOO..O....OO..........O.
.O..O...O.O....O..O....O...OO.
....O...OO..O.......O.O..OO...
........O.O....O.O....O.......
.OO.......O.OO..O.......O..O..
....O....O.O.O...OOO..O.O.OO..
.OO..OO...O.O.O.O.O...OO...O..
..............................
After
..............................
.OOOOO.......OO.....O..O......
...OO..O...O...O....OO....O...
....O.O......O..OO...OO...O...
.OO.OOOO......OO..O..O........
O.O.OO..O..O..O..OO...O...OO..
.OO.....O....OO.O..O.OO.O.....
......O.....O.....OOO.OO...O..
....O..OOOO..O..O..O.O.O.OO...
..O......O.O........O...O.O...
.O.....OOO.....OO.OO...O...O..
.......OOO..O.O.O...........O.
.O...O.....O...OOOO..O.O....O.
.O..O.O..O.....O......O....OO.
....O..O..O.O......O.....O....
........OOO....O......O..O....
.OO......O..OO..OOO.....O..O..
..O.O....OO..O...OO...O...OO..
.O..OO....O..O...O.O.O.OO.....
..............O............O..
Possible output
..............................
.OOO.O.v.....>.....>.v.O..v...
..>>^.v...>..^>..v..O.v.......
.....<......>..>.....O....O...
.O.<O><O......O...O..O....v...
.<O..O..v<.O..O^..O..>....>...
..<.^.v......OO.O^..>..<O.....
..^....v..v.Ov...>>^.<OO...O..
.....<..OO......O..O...Ov.v<..
........>..O........O^.v.^....
..^.....Ov.....OO.OO.......O..
.^.....^.^..O>.vO....v......O.
..<..Ov^^..O....><..........O.
.O..O...>.v....O..^....^...OO.
....O...<v..O.......<.^..v<...
........O.O....O.v....O.......
.OO.......<.Ov..O.......O..O..
....O....O.<.^...O^v..O.v.OO..
.O^..<<...O.>.v.>.^...<O...v..
..............................

Just to be sure, germs can only move by one or zero cells, right?

@JacqueGoupil Yes, that's correct. Each of >^<v corresponds to a movement of exactly one step in the respective direction.

I didn't try solving it yet, but here's a tool to build more test cases :) https://jsfiddle.net/xd2xns64/embedded/result/

Oh, careful, there's a chance the script will loop forever if it tries to move all cells against an edge but then the edge cells have nowhere to go.

Octave, 494 496 bytes - 372 byte bonus = 124 bytes
function o=G(b,a)
y='.O<^v>';s=(b>46)+0;t=a>46;v=t;f=s;t(:,2:end,2)=t(:,1:end-1);t(2:end,:,3)=t(1:end-1,:,1);t(1:end-1,:,4)=t(2:end,:,1);t(:,1:end-1,5)=t(:,2:end,1);t=reshape(t,[],5);m=size(s,1);p=[0 -m -1 1 m];
function z(n)
f(n+p(s(n)))--;q=find(t(n,:));w=n+p(q);d=min(f(w));q=q(f(w)==d);j=randi(numel(q));s(n)=q(j);f(n+p(q(j)))++;end
for g=find(s)' z(g);end
while any((f~=v)(:)) L=find(s);k=zeros(size(s));for h=L' k(h)=f(h+p(s(h)));end;c=find(k>1);g=c(randi(numel(c)));z(g);end
o = y(s+1);end

There's still a lot of golfing to be done on this answer, but I wanted to get the ungolfed explanation in.
I saw this as a Constraint Satisfaction Problem, so I went with my favorite local search heuristic, Min-conflicts. The idea is, given a starting placement with each germ in a reachable destination, select a random germ that occupies the same destination cell as one or more other germs and move it to a valid cell that has a minimum of other germs already there. Repeat as necessary until the placement matches the goal.
Interestingly, this algorithm is not guaranteed to terminate (if the goal is unreachable it will continue indefinitely, for instance) but if it does terminate it is guaranteed to produce a valid solution.
Here's the code:
function output = germs(before, after)

%before = ['......';'.O..O.';'.OO.O.';'......'];
%after = ['......';'....O.';'.OO.O.';'..O...'];

symbs = '.O<^v>';
start = (before > 46) + 0;                   %should be called current_board
target = after > 46;                         %destinations on current cell == O
goal = target;
conflicts = start;
target(:, 2:end,2) = target(:, 1:end-1);     %destinations on cell to left
target(2:end, :,3) = target(1:end-1, :,1);   %destinations on cell above
target(1:end-1, :,4) = target(2:end, :,1);   %destinations on cell below
target(:, 1:end-1,5) = target(:, 2:end,1);   %destinations on cell to right
target=reshape(target,[],5);
m = size(start,1);                           %number of rows = offset to previous/next column
offsets = [0 -m -1 1 m];                     %offsets of neighbors from current index

function moveGerm(n)
   conflicts(n+offsets(start(n)))--;         %take germ off board
   move = find(target(n, :));                %get valid moves for this germ
   neighbors = n + offsets(move);            %valid neighbors = current position + offsets
   minVal = min(conflicts(neighbors));       %minimum number of conflicts for valid moves
   move = move(conflicts(neighbors)==minVal);
   mi = randi(numel(move));                  %choose a random move with minimum conflicts
   start(n) = move(mi);                      %add move type to board
   conflicts(n + offsets(move(mi)))++;       %add a conflict on the cell we move to
end

% Generate an initial placement
for g = find(start)'
   moveGerm(g);                              %make sure all germs are moved to valid cells
end

% Repeat until board matches goal
while any((conflicts ~= goal)(:))
   germList = find(start);                   %list of all our germs
   cost = zeros(size(start));                %calculate conflicts for each germ
   for h = germList'
      cost(h) = conflicts(h + offsets(start(h)));
   end
   conflicted = find(cost > 1);              %find those germs that occupy the same cell as another
   g = conflicted(randi(numel(conflicted))); %choose a random germ to move
   moveGerm(g);
end

output = symbs(start+1);                     %use moves as indices into symbol array for output

end

Output for the last test case:
>> gtest
ans =

..............................
.OO>.O.v.....>.....>.v.O..v...
..>^O.v...>..^>..v..O.v.......
.....v......>..>.....O....O...
.O.<^<OO......>...O..O....v...
.<O..O..v<.O..^<..O..>....>...
..<.^.v......OO.O^..<..<O.....
..^....v..v.Ov...>>>.^OO...O..
.....<..OO......O..O...Ov.<<..
........>..O........O^.v.>....
..^.....OO.....OO.OO.......O..
.^.....^.O..O>.vO....v......O.
..<..Ov^^..O....OO..........O.
.O..O...>.v....O..^....^...OO.
....O...<v..O.......<.^..v<...
........O.O....O.v....O.......
.OO.......<.OO..O.......O..O..
....O....O.<.O...O^<..O.v.OO..
.O^..<<...O.>.v.>.>...<O...v..
..............................

Elapsed time is 0.681691 seconds.

The average elapsed time was less than 9 seconds 1 second* on a 5 year old Core i5, qualifying for the bonus.
I'm trying to get this working on ideone, but I'm having what I believe to be scoping issues with the way it handles nested functions. (Here's the non-working ideone link for reference: http://ideone.com/mQSwgZ)
The code on ideone is now working. I had to force all of the variables to global, which was unnecessary running it locally.
*I had a note in my ungolfed version that one of the steps was inefficient, so I tried it to see if I could speed up execution and for 2 added bytes the execution time is now down to under a second. Code and sample output has been updated and the input on ideone has been changed to the last test case.

Python, 1171 bytes - 878.25 byte bonus = 292.75 bytes
from itertools import *;from random import *;R=range;L=len;O=choice;G='O'
def A(a,b):a.append(b)
def D(y,z):
 a=[];b=[];c=[]
 for i in R(L(y)):
  A(c,[])
  for j in R(L(y[0])):
   k=[(i,j),y[i][j]==G,z[i][j]==G,[],0];A(c[i],k)
   for l,m in [(0,1),(1,0)]:
    try:
     n=c[i-l][j-m]
     if k[2]&n[1]:A(n[3],k)
     if k[1]&n[2]:A(k[3],n)
    except:pass
   if k[1]&~k[2]:A(a,k)
   elif k[2]&~k[1]:A(b,k)
 d={}
 for i in a:
  j=[[i]]
  while j:
   k=j.pop();l=[e[0] for e in k]
   while True:
    m=k[-1];n=[o for o in m[3] if o[0] not in l]
    if not n:
     if m in b:A(d.setdefault(i[0],[]),k)
     break
    for o in n[1:]:p=k[:];A(p,o);A(j,p)
    A(k,n[0]);A(l,n[0][0])
 e={}
 for i in a:e[i[0]]=O(d[i[0]])
 def E():return sum(any(k in j for k in i) for i,j in combinations(e.values(),2))
 f=E()
 for i in count():
  t=3**-i/L(a);j=O(a);k=e[j[0]];e[j[0]]=O(d[j[0]]);l=E()
  if not l:break
  else:
   if l>f and random()>t:e[j[0]]=k
   else:f=l
 for i in e.values():
  for j in R(L(i)-1):i[j][4]=i[j+1]
 for i in c:
  for j in R(L(i)):
   k=i[j]
   if 1&~k[1]:i[j]='.'
   elif not k[4]:i[j]=G
   else:l,m=k[0];n,o=k[4][0];i[j]='v>^<'[abs((l-n+1)+2*(m-o))]
 return c

Ideone link: http://ideone.com/0Ylmwq
Takes anywhere from 1 - 8 seconds on the last test case on average, qualifying for the bonus.
This is my first code-golf submission, so it's probably not the best-golfed program out there.  Nevertheless, it was an interesting challenge and I quite enjoyed it.  @Beaker deserves a mention for reminding me that heuristic-based searches are a thing.  Before he posted his solution and inspired me to redo mine, my brute force search was waaaay too long to qualify for the bonus on the last test case (it was on the order of 69! iterations, which is a 99-digit number...).
I didn't want to straight-up copy Beaker's solution, so I decided to use simulated annealing for my search heuristic.  It seems slower than min-conflict for this problem (likely because it's an optimization algorithm rather than a constraint-satisfaction one), but it's still well within the 10-minute mark.  It also had the benefit of being fairly small, code-wise.  I spent a lot more bytes on transforming the problem than I did on finding a solution to it.
Explanation
My solution is probably fairly inefficient byte-wise, but I had trouble conceptualizing how to solve the problem as-is and so I ended up having to transform it into a different problem that was easier for me to understand.  I realized that there are four possiblities for each cell on the grid:

It had no germ before or after, which means we can ignore it
It had a germ before but not after, which means we have to find a move for it.
It had no germ before but one after, which also means we have to find a move for it.
It had a germ before and after, which means we might have to find a move for it, but then again maybe not.

After decomposing the data into those classes, I was able to further transform the problem.  It was immediately obvious to me that I had to find a way to supply a germ from the "before but not after" set to a cell in the "after but not before" set.  Further, germs can only move one space, so the only way for them to affect further-away cells is by "pushing" an unbroken path of germs into that cell.  That meant the problem became finding X vertex-disjoint paths on a graph, where each cell with a germ was a vertex in said graph, and the edges represented adjacent cells.
I solved that problem that by first building the graph explained above.  I then enumerated every possible path from each cell in Before and each cell in After, then randomly assigned each cell in Before one of its possible paths.  Finally, I used simulated annealing to semi-randomly mutate the potential solution until I eventually find a solution that has no conflicts for any of the paths.
Annotated version
from itertools import *;from random import *;

# redefine some built-in functions to be shorter
R=range;L=len;O=choice;G='O'
def A(a,b):a.append(b)

# The function itself.  Input is in the form of two 2d arrays of characters, one each for before and after.
def D(y,z):
 # Declare the Before-but-not-after set, the After-but-not-before set, and a temp cell array
 # (the cells are temporarily stored in a 2d array because I need to be able to locate neighbors)
 a=[];b=[];c=[]

 # Build the graph
 for i in R(L(y)):
  # Append a row to the 2d temp array
  A(c,[])

  for j in R(L(y[0])):
   # Define the interesting information about the cell, then add it to the temp array
   # The cell looks like this: [position, does it have a germ before?, does it have a germ after?, list of neighbors with germs, final move]
   k=[(i,j),y[i][j]==G,z[i][j]==G,[],0];A(c[i],k)
   for l,m in [(0,1),(1,0)]:
    # Fill up the neighbors by checking the above and left cell, then mutually assigning edges
    try:
     n=c[i-l][j-m]
     if k[2]&n[1]:A(n[3],k)
     if k[1]&n[2]:A(k[3],n)
    except:pass

   # Decide if it belongs in the Before or After set
   if k[1]&~k[2]:A(a,k)
   elif k[2]&~k[1]:A(b,k)

 # For each cell in the before set, define ALL possible paths from it (this is a big number of paths if the grid is dense with germs)
 # This uses a bastard form of depth-first search where different paths can cross each other, but no path will cross itself
 d={}
 for i in a:
  j=[[i]]  # Define the initial stack of incomplete paths as the starting node.
  while j:
   # While the stack is not empty, pop an incomplete path of the stack and finish it
   k=j.pop();l=[e[0] for e in k]
   while True:
    # Set the list of next possible moves to the neighbors of the current cell,
    # ignoring any that are already in the current path.
    m=k[-1];n=[o for o in m[3] if o[0] not in l]

    # If there are no more moves, save the path if it ends in an After cell and break the loop
    if not n:
     if m in b:A(d.setdefault(i[0],[]),k)
     break

    # Otherwise, set the next move in this path to be the first move,
    # then split off new paths and add them to the stack for every other move
    for o in n[1:]:p=k[:];A(p,o);A(j,p)
    A(k,n[0]);A(l,n[0][0])

 # Perform simulated annealing to calculate the solution
 e={}
 for i in a:e[i[0]]=O(d[i[0]])  # Randomly assign paths for the first potential solution

 # Define a function for calculating the number of conflicts between all paths, then do the initial calculation for the initial potential solution
 def E():return sum(any(k in j for k in i) for i,j in combinations(e.values(),2))
 f=E()

 # Do the annealing
 for i in count():
  # The "temperature" for simulated annealing is calculated as 3^-i/len(Before set).
  # 3 was chosen as an integer approximation of e, and the function e^(-i/len) itself was chosen because
  # it exponentially decays, and does so slower for larger problem sets
  t=3**-i/L(a)

  j=O(a)              # Pick a random Before cell to change
  k=e[j[0]]           # Save it's current path
  e[j[0]]=O(d[j[0]])  # Replace the current path with a new one, randomly chosen
  l=E()               # Recalculate the number of conflicts

  if not l:break  # If there are no conflicts, we have a valid solution and can terminate
  else:           # Otherwise check the temperature to see if we keep the new move
   if l>f and random()>t:e[j[0]]=k  # Always keep the move if it's better, and undo it with probability 1 - T if it's worse
   else:f=l                         # If we don't undo, remember the new conflict count

 # Set each of the cells' final moves based on the paths
 for i in e.values():
  for j in R(L(i)-1):i[j][4]=i[j+1]

 # Build the output in the form of a 2d array of characters
 # Reuse the temp 2d array from step since its the right size
 for i in c:
  for j in R(L(i)):
   k=i[j]
   # Cells that are empty in the before array are always empty in the output
   if 1&~k[1]:i[j]='.'
   # Cells that aren't empty and don't have a move are always germs in the output
   elif not k[4]:i[j]=G
   # Otherwise draw the move
   else:l,m=k[0];n,o=k[4][0];i[j]='v>^<'[abs((l-n+1)+2*(m-o))]
 return c