text:
Sum of strings without converting
You have to take 2 string inputs and output the sum of these two strings without converting them to int or using any numeric data type.
ex.
string one = "123";
string two = "456";
string sum = "579";

Assume the strings won't be larger than 10 digits.
This is code golf and shortest answer in characters wins. An edit to the answer in C#  will make me smile :).
Edit:
Converting to int can be defined as anything of this nature
Int.TryParse, (int), Convert.ToInt etc

Can we use numbers elsewhere in our code as long as we are not converting the strings to numbers ?

What is defined as converting them to int, as opposed to interpreting them as int?

What about doing arithmetic with the character codes of the digits? (Provided they remain a character type.)

@Optimizer I'm pretty sure all the array concatenation answers from that question could be trivially applied here.

@Optimizer made an edit to clarify your question...@Martin, that is acceptable

@user15681218 My question was more on can I use something like int a = 10; in my code anywhere ?

@user15681218 I don't think that was Optimizer's question. He asked whether we  could use numbers that aren't conversions of the string. E.g. could we take a character code modulo 10 (where 10 would be a number type used in the code)?

Too cheesy! OK then, I'll think of something nicer for ES6 :P

@Optimizer, sorry yea you could do that

I'm still not entirely clear how much we can do with character codes? Can we subtract character codes? Can we convert individual digits to their character codes?

@Martin, this can be done without character codes

@user15681218 Sure it can. But it's not entirely clear from your rules what exactly we can and cannot do.

The rules are, you can't take the easy way out and say int a = int.TryParse(stringOne);

Are we allowed to use the character numeric type in java?

What does "using any numeric data type" mean? Can we use int i=str.length()?

You might want to add that any kind of evaluating the input or coersion which implicitly converts the strings to number is also not allowed

what about this in js eval((one*+!![])+(two*+!![]));

I don't think that this question is a dupe of Add without addition (or any of the 4 basic arithmetic operators) . In fact, this question is more similar to this multiply without numbers question than the add without addition. The multiply question was also initially considered as a dupe of add without addition.

@user15681218 Can you add the clauses I stated above to the question to clear confusion and prevent entries which implicitly convert string to integers.

@user15681218 Why is a 53 character solution accepted over a 44 character solution ? I am voting to close this question as unclear, since you are not sure of the winning criteria yourself.

80836 Assembly (57 53 bytes)
53 55 89 E5 8B 4D 0C 8B 55 10 B0 0A 30 DB 88 CF 00 C1 00 C2 49 4A 8A 01 8A 22 00 E0 00 D8 2C 30 30 DB 3C 39 7E 04 B3 01 2C 0A 88 01 88 22 38 CF 75 E2 5D 5B C3

This adds, digit by digit, right to left, without converting ascii digits '0'-'9' to the integers 0-9, and carrying over as needed. The bytecode is the code for a function, which may be called in C (see below).
The above bytecode was written by hand, from the following assembly (NASM-style, commented):
; save ebx, ebp
push ebx        ; 53
push ebp        ; 55
; copy esp
mov ebp, esp    ; 8B EC
; load arguments
mov ecx, [ebp+0x0C] ; 8B 4D 0C
mov edx, [ebp+0x10] ; 8B 55 10
; initialize stuff
mov al, 10      ; B0 0A
xor bl, bl      ; 30 DB
mov bh, cl      ; 88 CF
; send edx, ecx to end of string
add cl, al     ; 00 C1
add dl, al     ; 00 C2

; decrement everything
dec ecx         ; 49
dec edx         ; 4A

; get rightmost unprocessed digit of each number
mov al, [ecx]   ; 8A 01
mov ah, [edx]   ; 8A 22

; add two ascii digits
add al, ah      ; 00 E0
; add carry if needed
add al, bl      ; 00 D8
; subtract 0x30 ('0') to get the resulting ascii digit
sub al, 0x30    ; 2C 30

; set bl to 0
xor bl, bl      ; 30 DB

; if greater than '9': must carry over to next place
cmp al, 0x39    ; 3C 39
jle $+6         ; 7E 04
; set bl to 1 if carrying over
mov bl, 1       ; B3 01
; subtract 10 from ascii digit if carrying over
sub al, 0x0A    ; 2C 0A

mov [ecx], al   ; 88 01
mov [edx], ah   ; 88 22

; check if loop has ended
cmp bh, cl      ; 38 CF
jne $-28        ; 75 E2

; restore ebx, ebp
pop ebp         ; 5D
pop ebx         ; 5B
; return
ret             ; C3

To try this in C (gcc, linux, intel processor):

#include <stdio.h>
#include <string.h>
#include <sys/mman.h>

int main(){
    // bytecode from earlier
    char code[] = {
        0x53, 0x55, 0x8B, 0xEC, 0x8B, 0x4D, 0x0C, 0x8B,
        0x55, 0x10, 0x31, 0xC0, 0xB0, 0x09, 0x30, 0xDB,
        0x01, 0xC1, 0x01, 0xC2, 0x40, 0x50, 0x8A, 0x01,
        0x8A, 0x22, 0x00, 0xE0, 0x00, 0xD8, 0x2C, 0x30,
        0x30, 0xDB, 0x3C, 0x39, 0x7E, 0x04, 0xB3, 0x01,
        0x2C, 0x0A, 0x88, 0x01, 0x88, 0x22, 0x58, 0x48,
        0x49, 0x4A, 0x85, 0xC0, 0x75, 0xDF, 0x5D, 0x5B,
        0xC3,
    };
    // allocate executable memory to a function pointer called 'add'
    void __attribute__( (__cdecl__) ) (*add)(char*,char*) = mmap(0,sizeof code,PROT_WRITE|PROT_EXEC,MAP_ANON|MAP_PRIVATE,-1,0);
    memcpy(add, code, sizeof code);

    // test inputs
    char number1[] = "0878295272", number2[] = "8184206821";

    puts(number1);
    puts(number2);

    // call the bytecode as a c function
    add(number1, number2);

    // output is in the first argument
    puts(number1);

    // release allocated memory
    munmap(add, sizeof code);

    return 0;
}

Ruby, 109 71
Cheesy.  If you can't bring Mohammad to the mountain....
j=$*
r=n=d=0
(d+=x=j.count{|v|n.to_s==v}
r+=x*n
n+=1)until d>1
p r.to_s

Algorithm:

Compare an int's string representation to input 1 and input 2.
Add that int to the result per match.
Increment and repeat until you've done it twice.
Vomit on yourself

Changelog
71 shorter as an array.
85 removed method declaration and consolidate calls to n.to_s
92 applied some tips
101 save a char
102 use x for incrementing
109 initial commit

@DigitalTrauma Oh, I think it's a terrible answer, but it certainly meets the criteria.

@DigitalTrauma my even cheesier answer uses succ or prev.... but that's not even fun to golf.

"...without converting them to int or using any numeric data type." In your answer, r, n, d, and x are all numeric. Plus, checking each integer to see if its string representation matches the entered string is essentially just a slow brute-force way to convert to int.

@TreyThomas See OP's comment at http://codegolf.stackexchange.com/questions/41833/sum-of-strings-without-converting/41840#comment97547_41833

@TreyThomas : I think it's impossible to combine two quantities without quantifying them in some way. Any code to answer this question has to do the i+j calculation and know when it has the right answer to stop, so any correct answer is a slow brute-force way to convert to int disguised in some way.

@TessellatingHeckler, I think my answer adds them without quantifying them, so it's possible (but a lot more code). Also, nothing in my answer could really be described as a disguised conversion to int.

@TreyThomas agreed.

sed, 359 bytes (without the fancy formatting)
I'm still not sure if this is a dup of Add without addition (or any of the 4 basic arithmetic operators).  In the meantime, let me cross post my answer for that question.  It's not going to win any golfing, but its a start, and I think easily meets the spec:
                       s/([^ ]+) ([^ ]+)/\1:0::\2:/
                       :d /^([^:]+):\1::([^:]+):/tx
                       s/(:[^:]*)9([_:])/\1_\2/g;td
s/(:[^:]*)8(_*:)/\19\2/g;s/(:[^:]*)7(_*:)/\18\2/g;s/(:[^:]*)6(_*:)/\17\2/g
s/(:[^:]*)5(_*:)/\16\2/g;s/(:[^:]*)4(_*:)/\15\2/g;s/(:[^:]*)3(_*:)/\14\2/g
s/(:[^:]*)2(_*:)/\13\2/g;s/(:[^:]*)1(_*:)/\12\2/g;s/(:[^:]*)0(_*:)/\11\2/g
                       s/:(_+:)/:1\1/g; y/_/0/; # #
                       bd;  :x  s/.*::([^:]+):/\1/;
                       # # # # # # #  # # # # # # #

Input is taken from STDIN in the form "x y".  That is first transformed to "x:0::y:".  Then we increment all numbers that come after ":" characters, until we get "x:x::(x+y):".  Then we finally return (x+y).
Output
$ printf "%s\n" "0 0" "0 1" "1 0" "9 999" "999 9" "12345 67890" "123 1000000000000000000000"  | sed -rf add.sed
0
1
1
1008
1008
80235
1000000000000000000123
$

Note that this only works for the natural numbers.  However (in theory at least) it works for arbitrarily large integers.  Because we are doing x increment operations on y, ordering can make a big difference to speed: x < y will be faster than x > y.

Not sure, but how do you know when to stop incrementing ? Since you cannot read X as an int..

@Optimizer The increment algorithm is based of this: http://codegolf.stackexchange.com/questions/38033/increment-every-number-in-a-string/38087#38087 which is purely regex substitutions and no arithmetic.  We start with a triple {x, 0, y}, then increment elements 2 and 3 until elements 1 and 2 are equal (again regex-tested).  At that point the 3rd element will be the required sum.

Oh! So y is converted to y+1 using just regex ? and no actual addition ? Nice!

Ruby - 485 432 265
This seems more in the spirit of what you were looking for in the question.
It basically solves the problem how a human would on paper -- by "memorizing" all single digit addition results, adding each column, and understanding how to "carry the one" when necessary.
This is also using one "numeric data type" (variable i), which is prohibited by the question, but its only for string indexing. I'll try removing this and edit my answer.
def s p
(y=(?0..?9).to_a).product(y).map{|x|/#{x.join}/}.zip((?0..'18').to_a.each_cons(10).to_a.flatten).each{|k,v|return v if k=~p.sort.join}
end
a,b=$*.map{|n|n.rjust(10,?0).reverse}
r=?0
c=''
(0..9).each{|i|d=s [a[i],b[i]]
c=s([d[-1],r])+c
r=d[-2]||?0}
puts r+c

Somewhat ungolfed:
def s p
  y = (?0..?9).to_a
  y.product(y).map{ |x|
    /#{x.join}/
  }.zip(
    (?0..'18').to_a.each_cons(10).to_a.flatten
  ).each{ |k,v|
    return v if k =~ p.sort.join
  }
end

a,b=$*.map{ |n| n.rjust(10,?0).reverse }

r = ?0
c = ''

(0..9).each { |i|
  d = s [ a[i], b[i] ]
  c = s([ d[-1], r ]) + c
  r = d[-2] || '0'
}

puts r+c

EDIT: Used some ideas from the comments to generate the "memorized" mapping table instead of just hardcoding it.

You can probably make your "addition map" calculated somehow... maybe [?1..?9].zip([?1..?9]).map{|x,y| Regex.new(x+y)}.map{/*something based on the order of results*/}

product is better than zip

/#{x+y}/ is shorter than Regexp.new(x+y). ;)

i=-1;(s=(?0..?9).to_a).product(s).map{|x,y|i+=1;/#{x+y}/=>(?0..'18').each_cons(10).to_a[i/10][i%10]} gives you your regex array.

ah... but that uses a numeric (i)... there must be another way around that... maybe just use each_cons(10) as an enumerator and next through the set?

@NotthatCharles good idea -- I found a way to do it without the numeric and updated my answer. I didn't know about each_cons, that's really helpful here.

CJam, 95 92 80 72 70 44 characters
"Ǻᨌ⹝瀶噄頼୅籌◳ॶ騥箄덮庸匕帯標ឭ⹞➻䗧㩱砡࣍㤬醻孹꽬"2G#b127b:c~

which translates to
lW%'0A*+S/zW%{{A,__m*{_1b\saa*~}%\{_saa*~}%+\aa/,(s_,({(@+\}*}%_Wf<s}g

This can definitely be golfed a lot. I really don't know if my approach is optimal or not yet.
UPDATE - Inline the sum matrix creation to save bytes. Due to this, the program now runs 10 times slower, but still a constant time for any kind of input.
Try it online here
Reads the line containing two numbers from STDIN as string and outputs as a array of characters which is a string itself.
For example:
123 4567

The output contains preceding 0. Let me know if that is an issue.

C# - 128 108 104
Thanks to Compass, BMac and Shawn for suggesting improvements.
First try at Code Golf, and using C# seems to be a handicap here...
By using .Compute() you can use the string values and sum them directly.  As a bonus this works for other operators aside from just "+".
Golfed:
static void t(string a,string b){System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,""));}

Ungolfed:
static void t(string a, string b)
{
    System.Console.Write(new System.Data.DataTable().Compute(a+"+"+b,""));
}

Calling t("123","456"); gets you 579.

Nice try, and welcome to PPCG.  In [tag:code-golf], we remove all unnecessary white space and say how many bytes we used.

If you think C# is a handicap, wait until you start fiddling with Java...

This is exactly similar to JavaScript's eval. Thus its invalid as it is implicitly converting string to integer.

@Rodolfo Dias That just makes java funner!

You can save lines by moving a+"+"+b into the compute call and ignoring declaration.

Good catch @Compass

You can save more by not 'using' the namespaces and instead System.Console.WriteLine(new System.Data.DataTable()...

You seriously cannot see that all other answers have really implemented addition, instead of just adding ?

@Optimizer if the OP rules that this answer is invalid I'll be more than happy to delete it.

Nothing says the output needs to end with a newline, consider using Console.Write to save 4 bytes

GNU sed, 266 bytes
Uses a different approach than DigitalTrauma's solution.  As an effect, this one performs even poorer, using O(m+n).  Convert both operands to unary, concatenate, convert back to decimal (all using regex of course—sed doesn't have the concept of an integer).
As a bonus, this program sums up all the natural integers given on stdin (in the first line), meaning you can feed it nothing, one number or ten numbers and it'll do the right thing regardless.
The idea behind this code is vaguely inspired by an old PPCG sed submission of mine, though I don't remember for what question it is an answer.
Here it is, "pretty"-printed for your "convenience", to borrow another idea from DigitalTrauma. :D
                s/9/x8/g;
                s/8/x7/g;
                s/7/x6/g;
                s/6/x5/g;
                s/5/x4/g;
                s/4/x3/g;
  s/3/x2/g;s/2/x1/g;s/1/x0/g;s/0\b//g;;
  :l;s/x0/0xxxxxxxxxx/;/x0/bl;s/[^x]//g
  s/^$/0/;:m;s/x{10}/!/g;s/!\b/&0/;;;;;
  s/0x/1/;s/1x/2/;s/2x/3/;s/3x/4/;;;;;;
  s/4x/5/;s/5x/6/;s/6x/7/;s/7x/8/;;;;;;
                s/8x/9/;;
                s/!/x/g;;
                /x{10}/bm
                /x/!q;;;;
                s/^/0/;bm
                #sum.sed#

(To obtain the 266-byte version, remove trailing semicolons, leading whitespace and the final comment, preferably using sed.)
Borrowing some tests from DigitalTrauma:
% printf "%s\n" "0 0" "0 1" "1 0" "9 999" "999 9" "12345 6789" "123 100" | while read l; do sed -rf /tmp/sum.sed <<<"$l"; done
0
1
1
1008
1008
19134
223

I tweaked the really large tests a bit because of the terrible space (in)efficiency.  Due to the use of q only the first line is processed, hence the while loop in the test.

Java 6 (181 characters)
Not to be outdone by the handicap known as C#, Java in all its glory. So much boilerplate! Usage is providing the arguments separated by a space, i.e. 123 456
import javax.script.*;class T {public static void main(String[] a) throws Exception {System.out.print(new ScriptEngineManager().getEngineByName("JavaScript").eval(a[0]+"+"+a[1]));}}

Ungolfed:
import javax.script.*;

class T {
    public static void main(String[] a) throws Exception {
        System.out.print(new ScriptEngineManager()
                .getEngineByName("JavaScript").eval(a[0] + "+" + a[1]));
    }
}

By using the JavaScript engine available in javax, we can make another language do the work for us, and technically follow the rules of not using any numeric types in the native language, or converting.
Justification for using eval
We have not converted the values to int for JavaScript to eval. We've created a String that is "123+456" which is not a number. JS Engine digests the formula and evaluates the String as number literals, which are not numeric data types. Java cheesy logic! As an aside, this also works for double math.

You're just asking for a bash version like dc -e"$1 $2+p" technically I haven't used a number type in the native bash it's just passing a string to some implementation detail

Perl - 136 119 115 bytes
I'm learning Perl, this seemed like good practice. Tips are appreciated!
Cheesy answer, to get that out of the way:
print$ARGV[0]+$ARGV[1]; #Adding strings

Actual answer:
($x,$y)=@ARGV;while($x.$y.$s){$s-=48-ord$&if$x=~s/.$//;$s-=48-ord$&if$y=~s/.$//;$r=chr($s%10+48).$r;$s=$s>9;}print$r;

Uncompressed:
($x,$y)=@ARGV;
while($x.$y.$s){
$s-=48-ord$&if$x=~s/.$//;
$s-=48-ord$&if$y=~s/.$//;
$r=chr($s%10+48).$r;
$s=$s>9;
}
print$r;

Nice.  You might investigate these tips to cut down your numbers a bit.  At a glance, replacing your first line with ($x,$y)=@ARGV and using say instead of print will shave off a few characters.

Thanks! I did that and took out some parens (I love Perl's approach to punctuation). I couldn't get say to work though.

Ah.  say is a Perl 6 thing (or you could use it in Perl 5 with these instructions, but that would be too long).  Instead of say, use warn to shave a character.  That will output to STDERR instead of STDOUT, but that's not against the rules of this one. :-)

APL (61)
I think this falls within the rules.
{⎕D[1+{∨/T←9<Z←0,⍵:∇T↓⍨~×⊃T←(1⌽T)+Z-10×T⋄⍵}+⌿⌽↑⌽¨¯1+⎕D∘⍳¨⍺⍵]}

This is a function that takes two string arguments, and returns a string:
      '123'{⎕D[1+{∨/T←9<Z←0,⍵:∇T↓⍨~×⊃T←(1⌽T)+Z-10×T⋄⍵}+⌿⌽↑⌽¨¯1+⎕D∘⍳¨⍺⍵]}'456'
579
      ⍝ show dimensions (if it was a number, this would give the empty list)
      ⍴'123'{⎕D[1+{∨/T←9<Z←0,⍵:∇T↓⍨~×⊃T←(1⌽T)+Z-10×T⋄⍵}+⌿⌽↑⌽¨¯1+⎕D∘⍳¨⍺⍵]}'456'
3

It's reasonably fast too, it adds the number formed by 999999 9s to itself in an instant.
It finds the index of each character in ⎕D (which is the string '0123456789'), then does grade school addition on each index separately, carrying as needed, then looks up the resulting digits in ⎕D. (I think the ⎕D lookup falls within the rules, it's basically just doing 'x'-48).
Explanation:

⎕D∘⍳¨⍺⍵: look up the indices in ⎕D for each character in both strings.
¯1+: subtract 1 from each, because the arrays are 1-based by default.
⌽↑⌽¨: reverse both, turn into a matrix (filling empty squares with zeroes), then reverse the matrix.
+⌿: sum the columns of the matrix
{...}: carry over:

∨/T←9<Z←0,⍵: add an extra 0 in front of the list. Find out which 'digits' are higher than 9, and store this in T. If any digits were higher than 10:

Z-10×T: subtract 10 from each position that is higher than 10,
T←(1⌽T)+: add 1 to each position next to each position that was higher than 10, and store in T.
T↓⍨~×⊃T: if T starts with a zero, remove it,
∇: apply the carry function to the result.

⋄⍵: otherwise, return the value unchanged

1+: add one to each position (because the array is 1-indexed)
⎕D[...]: use the result as indices into ⎕D.

Java - 257 Characters
as everyone knows java there is no better language for golfing than java
    class A{public static void main(String[]s){char[]a=s[0].toCharArray();char[]b=s[1].toCharArray();int c=a.length;int d=b.length;int e=0;String f="";for(int i=0;i<Math.max(c,d);i++){f=f+(((i<c?a[i]-48:0)+(i<d?b[i]-48:0)+e)%10);e/=10;}System.out.println(f);}}

this is ungolfed solution
public static void main(String[] args) {
        char[] aa = args[0].toCharArray();
        char[] bb = args[1].toCharArray();
        int aal = aa.length;
        int bbl = bb.length;

        int reminder = 0;
        String result ="";
        for(int i=0;i<Math.max(aal,bbl);i++){
            result=result+(((i<aal?aa[i]-48:0)+(i<bbl?bb[i]-48:0)+reminder)%10);
            reminder/=10;
        }
        System.out.println(result);
    }

Java 7, Score = 252
Uses no integers, longs, bytes, shorts, doubles, floats, or any built in library functions for adding. Wrap in a class body and call with t(String1,String2). Please pad strings with 0's so that they have equal length.
t("123","234") returns "0357".
Golfed:
char c,d,e,f,g,k;String t(String a,String b){g++;char[]h=a.toCharArray(),i=b.toCharArray(),j=new char[h.length + 1];for(d=(char)h.length;d>f;)j[--d+1]=(c=(e=(char)(h[d]+i[d]-'0'+c))>'9'?g:f)==g?(char)(e-'\n'):e;j[0]=(char)('0'+c);return new String(j);}

Golfed Expanded with class:
public class T{

    public static void main(String[] args){
        System.out.println(new T().t(args[0],args[1]));
    }

    char c,d,e,f,g,k;
    String t(String a,String b){
        g++;
        char[]h=a.toCharArray(),i=b.toCharArray(),j=new char[h.length + 1];
        for(d=(char)h.length;d>f;)
            j[--d+1]=(c=(e=(char)(h[d]+i[d]-'0'+c))>'9'?g:f)==g?(char)(e-'\n'):e;
        j[0]=(char)('0'+c);
        return new String(j);
    }
}

Partially golfed expanded:
public class TrickSum{

    public static void main(String[] args){
        System.out.println(new TrickSum().trickSum(args[0], args[1]));
    }

    char carry, i, aSum,nullChar,oneChar;
    public String trickSum(String a, String b){
        oneChar++;
        char[] number1 = toCharArray(a), number2 = toCharArray(b), sum = new char[number1.length + 1];
        for (i = (char) number1.length; i > nullChar;)
            sum[--i + 1] = (carry = (aSum = (char) (number1[i] + number2[i] - '0' + carry)) > '9' ? oneChar : nullChar) == oneChar ? (char) (aSum - '\n') : aSum;
        sum[0] = (char)('0' + carry);
        return new String(sum);
    }

    char[] toCharArray(String string){
        return string.toCharArray();
    }
}

100% Expanded:
public class TrickSum{

    public static void main(String[] args){
        System.out.println(trickSum(args[0], args[1]));
    }

    public static String trickSum(String a, String b){
        char[] number1 = a.toCharArray();
        char[] number2 = b.toCharArray();
        char[] sum = new char[number1.length + 1];
        char carry = '\u0000';
        for (char i = (char)(number1.length - 1); i != '\uFFFF'; i--){
            char aSum = (char) (number1[i] + number2[i] - '0' + carry);
            carry = aSum > '9' ? '\u0001' : '\u0000';
            aSum = (carry == '\u0001') ? (char) (aSum - '\n') : aSum;
            sum[i + 1] = aSum;
        }
        sum[0] = (char)('0' + carry);
        return new String(sum);
    }
}

Technically, java char is a numeric data type ._.

@Compass Internally it is. But if I convert the char \u0030 to a string, I get "0" not "48".

Haskell - 98 94 bytes
main=do
 a<-getLine
 b<-getLine
 let c d=last$takeWhile(\e->d/=(show$e-1))[0..]
 print$c a+c b

JavaScript (ES6), 55 66 59*
 f=x=>{for(i=0;i+[]!=x;i++);return i};f((p=prompt)())+f(p())

*This makes a few assumptions:

We're in an ES6 REPL environment (ex. FireFox 33.1 browser console)
Performance does not matter (seriously, '9999999999','9999999999' took about 20 minutes to return)
Converting from Integer to String is allowed
Input is defined in variables a and b, ex: var a='123',b=321';  Changed to getting input from prompt (+11).
Input has no leading zeros.

@Optimizer Fair enough, updated to pull from prompt

You can use ES6 to bring down those chars a lot!

I do bellieve that 'or using any numeric data type' means you arent even allowed to use for loops.

@CSharpie OP commented that numbers in the code are fine

Python 2.7, 196 137 chars
version 2 (shorter by initialising the dictionary with code):
n={}
for i in range(10):n[`i`]=i*' '
def q(a,b):f=lambda x:''.join([10**p*n[s] for p,s in enumerate(reversed(x))]);return len(f(a)+f(b))

Previous version 1 (196 chars):
def q(a,b):n,f={0:'','1':' ','2':'  ','3':'   ','4':4*' ','5':5*' ','6':6*' ','7':7*' ','8':8*' ','9':9*' '}, lambda x:''.join(
    [10**p*n[s] for p,s in enumerate(reversed(x))]);return len(f(a)+f(b))

e.g.
>>> print q('123','111')
234

The dictionary keys are strings, the dictionary values only include number constants to shorten the code, and the calculation is done by concatenating two strings and getting the resulting length, so I hope it counts as "not converting them to ints".
Python small-print rule-cheat version
class z(int):0
def s(a,b): return z(a)+z(b)

Note:
>>> type(z('4'))
<class '__main__.z'>

Type z is a custom type I define as: definitely not a numeric type by whatever definition the questioner uses, but behaves close enough to a numeric type to be useful in limited circumstances. Type z behaviours are only partially implemented in this code sample, and if the CPython interpreter uses 'int' to implement z, that's an merely an implementation detail and not related to the problem at hand.


text:
12 Days of Golfmas
Challenge
On each of the 12 days of Christmas, output the appropriate verse of "12 days of Christmas", according to the date, otherwise output the chorus of "I Wish It Could Be Christmas Everyday".
Leading and/or trailing newlines (\n) and trailing spaces are permitted. You may not read from any external sources.
Basically what you have to do is read the system date and output the according verse of the "12 days of Christmas".
12 Days of Christmas
The Twelve Days of Christmas is the festive Christian season, beginning on Christmas Day (25 December) and ending on the 5th of January.
Examples
If the date is the 25th of December (print out the shortest/first verse):
On the first day of Christmas
my true love sent to me:
a Partridge in a Pear Tree

If the date is the 31st of December (print the seventh verse):
On the seventh day of Christmas
my true love sent to me:
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and a Partridge in a Pear Tree

If the date is the 5th of January (print out the longest/last/12th verse):
On the twelth day of Christmas
my true love sent to me:
12 Drummers Drumming
11 Pipers Piping
10 Lords a Leaping
9 Ladies Dancing
8 Maids a Milking
7 Swans a Swimming
6 Geese a Laying
5 Golden Rings
4 Calling Birds
3 French Hens
2 Turtle Doves
and a Partridge in a Pear Tree

If the date is not within the range of 25th December to 5th January inclusive:
Well I wish it could be Christmas every day
When the kids start singing and the band begins to play
Oh I wish it could be Christmas every day
So let the bells ring out for Christmas

Happy Christmas!

So we have to write a program which reads system date and print accordingly ? Your questions seems incomplete, not specifying so many details.

Yet another plaintext compression challenge? Not a fan.

Java people is not amused, but will try to comply.

Duplicate? http://codegolf.stackexchange.com/questions/4191/12-days-of-christmas-lyrics

This is not a duplicate.  That program was a simple kolmogrov-complexity challenge - this includes reading the date and outputting based on that reading.

CJam, 557 550 530 528 522 519 bytes
et3<(;" Christmas":P;:(31b7+372%_C<{"On the ""first second third"S/"four fif six seven eigh nin ten eleven twelf"S/"th"f++@:X=" day of"P"
my true love sent to me:
""and a Partridge in a Pear Tree."a[D,2>Sm*"Turtle Dove
French Hen
Calling Bird
Golden Ring
Geese a Lay
Swans a Swimm
Maids a Milk
Ladies Danc
Lords a Leap
Pipers Pip
Drummers Drumm"N/'s4*"ing"a7*+]z+X)<W%N*X!{4>}*}{;"Well"" I wish it could be"P" every day
"++_"When the kids start singing and the band begins to play
Oh"\"So let the bells ring out for"P}?

Test it here. To try out different dates, replace et3<(; with something like [12 25].
There's probably still room for improvement.
et                    "Read the current datetime as an array [year month day hour ...].":
  3<                  "Discard hours, minutes etc.";
    (;                "Discard year.";
      " Christmas":P; "Store the string in P and discard.";

:(                    "Decrement month and day.";
  31b                 "Interpret as base-31 digits. So on [12 25] we get 365 (what a coincidence).
                       On [12 31] we get 371. On [1 1] we get 0. On [1 5] we get 4.";
     7+               "Add 7.";
       372%           "Take modulo 372. Now the 12 days result in 0 to 11, others are greater.";
           _C<        "Duplicate and check if it's less than 12.";

{...}{...}?           "Run the first block for the 12 days, the second block otherwise.";

"On the 12 days:";
"On the "             "Push the string.";
"first ... third"S/   "Push first to third. Split by spaces.";
"four ... telf"S/     "Push other ordinal numbers, split by spaces.";
"th"f+                "Add th to each.";
+                     "Append to get first to twelfth.";
@:X                   "Pull day number to the top. Store in X.";
=                     "Select ordinal number.";
" day of"P            "Push ` day of Christmas`.";
"\nmy true...\n"      "Push that string, too".;
"and a Part..."a      "Push day 1 string and wrap in array.";
[                     "Remember beginning of array.";
D,2>                  "Push range [2 3 ... 12].";
Sm*                   "Append a space to each.";
"Turtle..."N/         "Push all the gifts. Split into lines.";
's4*                  "Push `ssss`.";
"ing"a7*              "Push an array with 7 copies of `ing`.";
+                     "Add the two.";
]                     "Close array, containing numbers, gifts and endings.";
z                     "Zip/transpose the array.";
+                     "Add day-1 line.";
X)                    "Push day and decrement.";
<                     "Slice off unwanted days.";
W%                    "Reverse array.";
N*                    "Join lines with line breaks.";
X!                    "Logical not of day, is 1 on day 1 and 0 on all other days.";
{4>}*                 "On day 1, remove first 4 characters (`and `).";

"On all days:";
;                     "Discard day from stack.";
"Well"                "Push the string.";
" I..."P"...day\n"    "Push the rest of the line in 3 strings.";
++_                   "Join those three into one, and duplicate.";
"When...\nOh"         "Push next line and `Oh`.";
\                     "Swap with duplicate line.";
"So ... for"P         "Push final line.";

5 Golden R(ing) not acceptable? Damn! is there any way you could apply both the -ing ending and the -s  ending to the number 5?

Python 2, 681 676 673 670 667 bytes
import time
N=time.localtime();D,M=N.tm_mday,N.tm_mon
Q=((D<6>M<2)*(31+D)+(M>11)*D)-24
print["Well%sWhen the kids start singing and the band begins to play\nOh%sSo let the bells ring out for~"%((" I wish it could be~ every day\n",)*2),"On the %s day of~\nmy true love sent to me:\n"%("twel first second third four fif six seven eigh nin ten eleven".split()[Q%12]+"th"*(Q>3))+"\n".join("%d %s"%(i,"Turtle Doves$French Hens$Calling Birds$Golden Rings$Geese a Lay$Swans a Swimm$Maids a Milk$Ladies Danc$Lords a Leap$Pipers Pip$Drummers Drumm".split("$")[i-2]+"ing"*(i>5))for i in range(Q,1,-1))+"\nand "*(Q>1)+"a Partridge in a Pear Tree"][Q>0].replace("~"," Christmas")

I tried competing against CJam... and failed as expected. Maybe if I could figure out how to zlib, but I dunno...
(Thanks to @FryAmTheEggman for suggestions via chat)

It's big! It's mean! It's ugly! It's...
Java: 894 887 883 882 bytes
Golfed:
class C{public static void main(String[]a){java.util.Calendar d=java.util.Calendar.getInstance();String p="a Partridge in a Pear Tree\n",t="Well Z\nWhen the kids start singing and the band begins to play\nOh Z\nSo let the bells ring out for X".replaceAll("Z","I wish it could be X every day"),r="";String[]s=(" day of X\nMy true love gave to me:\nçfirstçsecondçthirdçfourthçfifthçsixthçseventhçeighthçninthçtenthçeleventhçtwelfthç Turtle Doves\nç French Hens\nç Calling Birds\nç Golden Rings\nç Geese a LayY\nç Swans a SwimmY\nç Maids a MilkY\nç Ladies DancY\nç Lords a LeapY\nç Pipers PipY\nç Drummers DrummY\n").replaceAll("Y","ing").split("ç");int n=d.get(d.DAY_OF_YEAR),o=(n>358)?(n-358):(n<6)?(n+7):-1,j;if(o==-1)r=t;else{r+=("On the "+s[o]+s[0]);for(j=o+11;j-->12;r+=(j-11+s[j]));r+=(o!=1)?"and "+p:p;}System.out.print(r.replaceAll("X","Christmas"));}}

Ungolfed:
class C {

    public static void main(String[] a) {
        java.util.Calendar d = java.util.Calendar.getInstance();
        String p = "a Partridge in a Pear Tree\n", t = "Well Z\nWhen the kids start singing and the band begins to play\nOh Z\nSo let the bells ring out for X".replaceAll("Z", "I wish it could be X every day"), r = "";
        String[] s = (" day of X\nMy true love gave to me:\nçfirstçsecondçthirdçfourthçfifthçsixthçseventhçeighthçninthçtenthçeleventhçtwelfthç Turtle Doves\nç French Hens\nç Calling Birds\nç Golden Rings\nç Geese a LayY\nç Swans a SwimmY\nç Maids a MilkY\nç Ladies DancY\nç Lords a LeapY\nç Pipers PipY\nç Drummers DrummY\n").replaceAll("Y", "ing").split("ç");
        int n = d.get(d.DAY_OF_YEAR), o = (n > 358) ? (n - 358) : (n < 6) ? (n + 7) : -1, j;
        if (o == -1) {
            r = t;
        } else {
            r += ("On the " + s[o] + s[0]);
            for (j = o + 11; j-- > 12; r += (j - 11 + s[j]));
            r += (o != 1) ? "and " + p : p;
        }
        System.out.print(r.replaceAll("X", "Christmas"));
    }
}

After messing with it a lot and gaining 14 bytes, I think I'll stop fiddling with it.
And yes, I know that, on leap years, my idea may have a bit of an issue, but... it was my way to cut a few bytes off the code. Oh well.

You're too hard on Java...

@BetaDecay Perhaps, I am. And perhaps I should try to golf in something other than Java :P

Do you think you can put code syntax highlighting on your code? I prefer colourful code over black and white code. It helps distract me from the fact that all code represents machine code in some form.

@TheBestOne I'd gladly do it... if I figured out how to activate it.

Try <!-- language: lang-java --> before a code block. Use <!-- language-all: lang-java --> for all code blocks in your document. For more information look at http://codegolf.stackexchange.com/editing-help

@TheBestOne Done, hope it's a bit clearer now :)

@RodolfoDias I think you mean to ping TheBestOne, not me

@BetaDecay Whoops, sorry 'bout that. It's 7AM here, still half-asleep :/

@RodolfoDias Haha same for me ;)

Erlang, 748 bytes
A 7-bit clean version without gzip-9 is 748 bytes:
f()->[maps:get(C,#{$N=>"ing",$x=>10,$q=>"th",$z=>" Christmas"},C)||C<-s(t(calendar:local_time()))].
t({{_,1,D},_})->D+7;t({{_,12,D},_})->D-24;t(_)->1.
s(X)when X<1;X>12->L=" I wish it could bez every dayx","Well"++L++"When qe kids start sNN and qe band begins to playxOh"++L++"So let qe bells rN out forz";
s(I)->"On qe "++element(I,{"first","second","qird","fourq","fifq","sixq","sevenq","eighq","ninq","tenq","elevenq","twelq"})++" day ofzxmy true love sent to me:x"++r(I).
r(0)->"";r(I)->element(I,{"a Partridge in a Pear Tree","2 Turtle Dovesxand ","3 French Hensx","4 CallN Birdsx","5 Golden RNsx","6 Geese a LayNx","7 Swans a SwimmNx","8 Maids a MilkNx","9 Ladies DancNx","10 Lords a LeapNx","11 Pipers PipNx","12 Drummers DrummNx"})++r(I-1).

A gzip-9+base64 solution is 750 bytes long:
f()->s(t(calendar:local_time())).
t({{_,1,D},_})->D+8;t({{_,12,D},_})->D-23;t(_)->1.
s(I)->try element(I,binary_to_term(base64:decode("g1AAAAkQeNrdlF9OGzEQxsNrJF44wXeEhtK/jyUqRQoCARLPTnYSW+u1oxlv0jz3BL1C71D1Cj1C79BDtOOQhQqpCKv0D5VW8u5a883vmxnbbte9jxfkPQ6xdGLhEiax9RXGhH3LTlJjBLQgXqEyq/6FpYBkCbWrBJIMJ4gLM31gQrXeGueXMek/QYqYe407tnfNcBbhKV0KKZiAs3ZsE6aRryPq3unxJcnUsaQcijj9QbHfrJC4Jfi4IAiFlGEaetk3OFFsdtWM4AL0kwzjnInqHm1EhSZRXdxU/bnoLs5bTp4w1B3p5xLcloc3eZJ1XJLmMV4zhYnFGwpSmvRdV7GoUbYg6x72jfe5D68UV36N4v1V36ZFEE9wEH2l43eqIHK/TB+6tru3RUxPcUAkpGIjs1KW3wr56Wo2F4pQgvkMZ0ujp9Ho6pomg/5R8s8bcnIzWwT+HEcmXzQGR87XGfNvW/mysRJcWQteKFzlSDA0YZIh/z1rX7s7qXC6Bo8wiry2MiIzz5gPwO23biZ98XEaDHDi5sSSl8z5ICuwtdP1e0m+zP8uhtw2Ta7A+mVdg/+hKN8Bkz8M5Q==")))catch _:_->s(1)end.

An UTF-8 encoded Erlang function is 421 characters (935 bytes).
f()->s(t(calendar:local_time())).
t({{_,1,D},_})->D+8;t({{_,12,D},_})->D-23;t(_)->1.
s(I)->try element(I,binary_to_term(<<<<(C-$㐀):14>>||C<-"哔㐀㐤䑸檷䵅焸伱㠱怶悑券摝汈佊玏㵊塐專㔒染孡㵯徵峆䫽㳳欄捐拵㟔㸽䒻焄䋓垐啂庐嚯栏奕挮浫柍濦斝憻䮽埅牃栺整䲸䔢仇椕斡㯜愹䙣㔭㘅溄暫玡乘㖐㶵廁㴠撞㰋䃟䨄㻗刚淥朞壽㖊娞泓拙母倅戒奴㸩娠㼷䶰䞦填显彻己㵲克㪐傊䈿䠛㭾悐戉压咀㲅夘䖧彤欸䡛㭭䨳吂焤擎䉲㷪㮛䡈䢙䕝欕䏛宠拎䫓巣㝐凩淄應东歹墝䧉㾘敞䃡䲜䡬㹒媽㧕勆屑憈䊱濚䇷扃滱䕝犍沿䥝犙㤐䟜㔇檗坷庈㬫焰厺憮潴䤱䍱䐉㹆㲎杒妷撯宥帶㧢夈㿤䁧䛨湽㮣庚㶠珥㯋䌛傜圵怓爜䗉姳䐙㯎槆匶煯液恄姅堭刨䬹䢃㓑喒㱿柖慾漻幜㾠丼撊挭圢㳏䎘㟰䋛冸婽灜䖠旃囦攤嵼柤含怭儿䧭㶾朿曨佰橍徰䎦䥶㟿届䇰㩌猌浀㐀㐀㐀">>))catch _:_->s(1)end.

C# In Linqpad - 866 bytes
Well, at least it beat Java ;) Leap years are handled inside the code.

Unformated:
void Main(){var w=DateTime.Now;int y=w.Year%4,d=w.DayOfYear,c=0,p=0;string t="Well Z\nWhen the kids start singing and the band begins to play\nOh Z\nSo let the bells ring out for X".Replace("Z","I wish it could be X every day").Replace("X","Christmas"),o="On the ",x=" day of Christmas\nmy true love sent to me:\n";string[]z={"first","second","third","forth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelth"},b={"a Partridge in a Pear Tree\n","and ","2 Turtle Doves\n","3 French Hens\n","4 Calling Birds\n","5 Golden Rings\n","6 Geese a Laying\n","7 Swans a Swimming\n","8 Maids a Milking\n","9 Ladies Dancing\n","10 Lords a Leaping\n","11 Pipers Piping\n","12 Drummers Drumming\n"};if(y==0){p=1;}if(d>358){c=d-358-p;}else if(d<6){c=d+7;}else{t.Dump();return;}if(c==1){o+=z[0]+x+b[0];}else{o+=z[c-1]+x;for(int i=c;i>=0;i--){o+=b[i];}}o.Dump();}

Formatted:
void Main()
{
var w=DateTime.Now;
int y=w.Year%4,d=w.DayOfYear,c=0,p=0;
string t="Well Z\nWhen the kids start singing and the band begins to play\nOh Z\nSo let the bells ring out for X".Replace("Z","I wish it could be X every day").Replace("X","Christmas"),
o="On the ",x=" day of Christmas\nmy true love sent to me:\n";

string[]z={"first","second","third","forth","fifth","sixth","seventh","eighth","ninth","tenth","eleventh","twelth"},

b={"a Partridge in a Pear Tree\n","and ","2 Turtle Doves\n","3 French Hens\n","4 Calling Birds\n","5 Golden Rings\n","6 Geese a Laying\n",
"7 Swans a Swimming\n","8 Maids a Milking\n","9 Ladies Dancing\n","10 Lords a Leaping\n","11 Pipers Piping\n","12 Drummers Drumming\n"};

if(y==0)
{
    p=1;
}

if(d>358)
{
    c=d-358-p;
}
else if(d<6)
{
    c=d+7;
}
else
{
    t.Dump();
    return;
}

if(c==1)
{
    o+=z[0]+x+b[0];
}
else
{
    o+=z[c-1]+x;
    for(int i=c;i>=0;i--)
    {
        o+=b[i];
    }
}
o.Dump();
}

How does this handle leap years?

@BetaDecay At the start, I use a modulus on the year
int y=w.Year%4. If the modulo y is 0, I add one to c with the help of p.

Javascript (665)
__=new Date("12/31");M=_.getMonth();D=_.getDate();d=M?(M==11)*(D-24):D+7;if(!d||d>12)s="Well K\nWhen the kids start singing and the bands begin to play\nOh K\nSo let the bells ring out for Christmas".replace(/K/g,"I wish it could be Christmas every day");else{for(s="On the "+"0first0second0third0fourth0fifth0sixth0seventh0eight0ninth0tenth0elevent0twelth".split(0)[d]+" day of Chirstmas\nmy true love sent to me:";--d;)s+="\n"+(d+1)+" "+"0Turtle Doves0French Hens0CallZ Birds0Golden RZs0Geese a LayZ0Swans a SwimmZ0Maids a MilkZ0Ladies DancZ0Lords a LeapZ0Pipers PipZ0Drummers DrummZ".split(0)[d].replace("Z","ing");s+="\n"+(D!=25?"and ":"")+"a Partridge in a Pear Tree"}alert(s)

You can test it by adding parentheses to the first new Date i.e. change:
_=new Date;M=_...

to
_=new Date("1/5");M=_...

Here it is beautified:
_ = new Date("12/31");
M = _.getMonth();
D = _.getDate();
d = M ? (M == 11) * (D - 24) : D + 7;
if (!d || d > 12) s = "Well K\nWhen the kids start singing and the bands begin to play\nOh K\nSo let the bells ring out for Christmas".replace(/K/g, "I wish it could be Christmas every day");
else {
    for (s = "On the " + "0first0second0third0fourth0fifth0sixth0seventh0eight0ninth0tenth0elevent0twelth".split(0)[d] + " day of Chirstmas\nmy true love sent to me:"; --d;) s += "\n" + (d + 1) + " " + "0Turtle Doves0French Hens0CallZ Birds0Golden RZs0Geese a LayZ0Swans a SwimmZ0Maids a MilkZ0Ladies DancZ0Lords a LeapZ0Pipers PipZ0Drummers DrummZ".split(0)[d].replace("Z", "ing");
    s += "\n" + (D != 25 ? "and " : "") + "a Partridge in a Pear Tree"
}
alert(s)

source: Stack Exchange

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

sort: votes


text:
Tips for Golfing in Go
What general tips do you have for golfing in Go? I'm new to Code Golfing and looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Go.
Please keep to one tip per answer.

We might want to create the Go tag, but then, is Go even being used for golfing here ?

@Optimizer I used to

Should rename the title to "Tips for Go-lfing"

Inspired by @EMBLEM's answer here.
You can put a package's functions in the global namespace when you import them like so:
package main

import ."fmt"

func main() {
    Printf("Hello World!")
}

Named return values can save a few bytes. For example:
func x()string{
r:="" //Do stuff
return r}

You can save 3 bytes with
func x()(r string){
//Do stuff
return}

It's more useful if you need to declare multiple variables at the start of your function.

You can name packages whatever you like when you import them.
package main

import f "fmt"

func main() {
    f.Printf("Hello World\n")
}

Learned this here.

You can also do import ."fmt" and then Println and the rest of fmt's functions are in the global namespace. Also, you don't need semicolons. Ever, unless you have multiple statements on a line

Note that in Golang, braces must go on the same line, because of automatic semicolon insertion. More info: https://golang.org/doc/faq#semicolons.

If you need to compare many different values to a single one, it may be more space-efficient to use a switch with a single case.
if x==1||x==2||x==3||x==4{}
switch x{case 1,2,3,4:}

Go compiler has predefined print and println functions that don't require importing fmt, so instead of this.
package main
import."fmt"
func main(){Printf(`Hello World
`)}

You can write this.
package main
func main(){print(`Hello World
`)}

Note that this outputs to STDERR.

Go has different operator precedence for bit operations, <<, >>, &, etc. usually have lower precedence than + and - in most languages, but in Go they have the same precedence as * and /.
Precedence    Operator
5             *  /  %  <<  >>  &  &^
4             +  -  |  ^
3             ==  !=  <  <=  >  >=
2             &&
1             ||

This could be used to save some parentheses.
Most languages:
(a&b)*c

Go:
a&b*c

A lot of stuff in the for range loop is optional.
Standard version:
for i,v:=range a{
// Do stuff
}

If i, v has already been defined and can be overwritten:
for i,v=range a{
// Do stuff
}

If you don't care about value:
for i:=range a{
// Do stuff
}

If you don't care about value and i has already been defined:
for i=range a{
// Do stuff
}

If you don't care about index or value:
for range a{
// Do stuff
}

If you want an infinite loop:
for{
// Do stuff
}

Need a string to contain a newline? Don't write \n, create a raw string with backquotes and put a literal newline in it.
s:="\n" // 7 bytes
s:=`
` // 6 bytes

Declaring Multiple Variables:
i,s:=0,""

var(i int;s string)

Int From String Conversion: (limited but sometimes helpful)
n:=byte("9"[0])-48 // actual type is uint8

n,_:=strconv.Atoi("9")

And Vice Versa
s:=string(9+48)

s:=strconv.Itoa(9)

fmt.Sprint is likely to save bytes over strconv.Atoi, because you've likely imported fmt already.

@EMBLEM I think strconv was there just to show what the golf-code would be in normal code.

Assuming fmt is already imported, n:=0;Sscan("9",&n) also works and is not limited to one digit numbers.

When looping a constant n times, for-range is shorter up to n <= 5
If you need to loop a constant number of times, a for range"..."{} loop (where ... is n characters) is shorter than a 3-part for loop up to n <= 5 iterations.
The two loop forms are equivalent at n == 5:
for range`|||||`{}
for i:=0;i<5;i++{}

Past n > 5, use a 3-part loop.

You can put any number of opening braces on one line, but a line that contains opening braces may contain at most one closing brace.
Correct:
func main(){if true{switch{case 1==1:for{break
}}}}

Also correct:
func main(){if true{switch{case 1==1:for{break}
}}}

Also correct:
func main(){if true{switch{case 1==1:for{
break}}}}

Incorrect:
func main() {
    if true{for{break}}
}

Since an allowable output format is writing to reference arguments, it may save bytes to pass a pointer instead of returning a value.
func f(a,b string)string{if g(a)>g(b){return a};return b}
func f(a,b string, s*string){s=&b;if g(a)>g(b){s=&a}}

Or func f(a,b string)string{if g(a)>g(b){b=a};return b}

If you're using a C-style 3-part for-loop, if your loop variable isn't dependent on something outside of its scope for its initialization, declare it with your other variable declarations to save a byte.
In these examples, i is initialized independently of a
func f(){a:=3;for i:=0;i<a;i++{}}
// vs
func f(){a,i:=3,0;for;i<a;i++{}}

When taking a single character substring from a string and want to keep it as a string, use string slices to not get a rune:
string(s[0]) // 12 bytes
s[:1]        // 4 bytes

string(s[10]) // 13 bytes
s[10:11]      // 8 bytes

string(s[100]) // 14 bytes
s[100:101]     // 10 bytes

string(s[1000]) // 15 bytes
s[1000:1001]    // 12 bytes

string(s[10000]) // 16 bytes
s[10000:10001]   // 14 bytes

This method is shorter than string(s[index]) up to getting from index 100000 and above, but indexing strings of that size are rare.

I suppose s[index:][:1] would work too.

Don't declare variables in the for's init statement:
for i:=0;i<n;i++{...}

By declaring it outside you may save a byte when you need a variable outside of it beacause you can now assign to it (=) instead of declaring it (:=):
i:=0
for;i<n;i++{...}
i=0
for;i<n;i++{...}

You might even save a byte if you're not using the for's post-statement by removing the semicolons

Make full use of Go's first-class functions by assigning long library function names to one-letter variables.
import."strings"
r:=Replace

Use min and max to clamp values (Go 1.21+)
Say you have 2 comparables l and h, where you must satisfy l <= h. It is 1 byte shorter to use the builtins than an if-statement.
// assuming
l,h := n, 0

if h<l{h=l}
h=max(h,l)

if l>h{l=h}
l=min(h,l)

// and the opposite
l,h := 0, n

if h>l{h=l}
h=min(h,l)

if l<h{l=h}
l=max(h,l)

Shuffle elements with rand.Perm
I discovered math/rand.Perm the other day, which returns a slice of integers from 0 to n, shuffled.
For strings
Given an input string k, and you need to return a string, and we have that string as a named return, Perm is shorter because you don't need to real with the boilerplate for Shuffle or the swapping:
Shuffle(len(k),func(i,j int){k[i],k[j]=k[j],k[i]}) // 48 bytes
for i:=range k{j:=Intn(i);k[i],k[j]=k[j],k[i]}     // 44 bytes, -4, no separate string needed
for i:=range Perm(len(k)){e+=k[i:i+1]}             // 36 bytes, -12

For slices
Assuming the same conditions as above but with a slice, it is still shorter:
Shuffle(len(k),func(i,j int){k[i],k[j]=k[j],k[i]}) // 48 bytes
for i:=range k{j:=Intn(i);k[i],k[j]=k[j],k[i]}     // 44 bytes, -4, no separate slice needed
for i:=range Perm(len(k)){e=append(e,k[i])}        // 41 bytes, -7

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

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


text:
Look-and-say: Conway revisited
You should all be familiar with the Conway sequence (a.k.a. 'look-and-say'-sequence) by now:
     1
    11
    21
  1211
111221
312211
etc

You can also start by any arbitrary number as starting point. Let f(s) be the next element of the sequence. Now for every given swe can find f(s). The reverse is not as trivial: it is not for every y possible to find the predecessor s such that f(s) = y. E.g. for y = 1 we cannot find a predecessor. But if y has an even length you can divide it into pairs of digits which describe each one part of a predecessor:
513211 divides in 51,32,11
so: 51 comes from 11111
    32 comes from 222
    11 comes from 1
put together: 111112221

So this way there we can define an unique predecessor for every y of even length.
Note: The 'predecessor' s defined this way does generally NOT satisfy f(s) = y.
Goal
Write a function / program snippet that accepts a string of digits as input that

calculates the next element of the Conway sequence if the length of the input string is odd
calculates the predecessor of the input string as defined above if the input string length is even.

Shortest code in bytes wins.
Recent Questions based on the look-and-say sequences:

Look and say sequence
Point-free look and say sequence
Quickly find length of n-th term of the look-and-say sequence

I'm confused. Can you explain how 513111 divides into 51, 32 and 11?

I feel like this is a combined duplicate of some look and say sequence challenge and a run-length decoding challenge (I'm sure we had those).

What would the predecessor of 11111111111111 be? According to your spec, it would be 1111111. You should modify your specification to define a reasonable answer for this.

@TheBestOne 11111111111111 simply has no predecessor. It's an illegal input.

@TheBestOne Yes this is correct, I defined an arbitrary rule for the predecessor that does not always match a 'real' predecessor.

CJam, 46 45 44 43 42 bytes
l_,2%{0\{@)@@_2$=!{0\0}*;}*\)\}{2/{(~*}%}?

Test it here. It takes the number on STDIN and prints the result to STDOUT.

si -> ~ = 45

@Optimizer Thanks, I forget you can eval a character.

Ruby, 125 120 119 101 bytes
f=->n{c=n.chars;(n.size%2>0?c.chunk{|x|x}.map{|a,b|[b.size,a]}:c.each_slice(2).map{|a,b|b*a.hex})*''}

String input taken through function f:
f['111221']    # => "1211"
f['513211']    # => "111112221"
f['111112221'] # => "513211"

Expanded with notes:
# define lambda that takes one arg
f = -> (n) {
  # store digits in c
  c = n.chars

  # n is of odd length
  if n.size % 2 > 0
    # group identical numbers
    c.chunk{ |x| x }.map do |a, b|
      # array of [digit count, digit value]
      [b.size, a]
    end
  else
    # slice array into groups of two elements
    c.each_slice(2).map do |a, b|
      # repeat the second digit in a pair
      # the first digit-times.
      b * a.hex
    end
  end * '' # join array
}

Prolog - 170 bytes
[]/[].
T/R:-0*_*T*R.
C*X*[X|T]*R:-(C+1)*X*T*R.
C*X*T*Y:-10*C+X+Y+R,T/R.
N+R+A:-N=:=0,A=R;D is N mod 10,N//10+R+[D|A].
F-C-R:-C/N,(N=F,R=C;F-N-R).
[1]-[1,1]. S-T:-S-[1]-T.

This snipped defines the function (-)/2. You can invoke it like
?- [1,1,1,3,2,1,3,2,1,1]-T.
T = [1, 3, 1, 1, 2, 2, 2, 1] .

?- [1]-T.
T = [1, 1] .

There seems to be only one lengths in this sequence with an odd parity: the initial [1].
wr_len :- wr_len(1, [1]).
wr_len(N, Cur) :-
    length(Cur, Len),
    TrailingZeroes is lsb(Len),
    (TrailingZeroes > 0 -> Par = 'even'; Par = 'odd'),
    writef('%t\t%t\t%t\t%t\n', [N, Len, Par, TrailingZeroes]),
    get_next(Cur, Next),
    succ(N, O),
    !, wr_len(O, Next).

% index, length, parity of length, num of trailing 0 in bin presentation of length
?- wr_len.
1       1       odd     0
2       2       even    1
3       2       even    1
4       4       even    2
5       6       even    1
6       6       even    1
7       8       even    3
8       10      even    1
9       14      even    1
10      20      even    2
11      26      even    1
12      34      even    1
13      46      even    1
14      62      even    1
15      78      even    1
16      102     even    1
17      134     even    1
18      176     even    4
19      226     even    1
20      302     even    1
21      408     even    3
22      528     even    4
23      678     even    1
24      904     even    3
25      1182    even    1
26      1540    even    2
27      2012    even    2
28      2606    even    1
29      3410    even    1
30      4462    even    1
31      5808    even    4
32      7586    even    1
33      9898    even    1
34      12884   even    2
35      16774   even    1
36      21890   even    1
37      28528   even    4
38      37158   even    1
39      48410   even    1
40      63138   even    1
41      82350   even    1
42      107312  even    4
43      139984  even    4
44      182376  even    3
45      237746  even    1
46      310036  even    2
47      403966  even    1
48      526646  even    1
49      686646  even    1
50      894810  even    1
51      1166642 even    1
52      1520986 even    1
53      1982710 even    1
54      2584304 even    4
55      3369156 even    2
56      4391702 even    1
57      5724486 even    1
58      7462860 even    2
59      9727930 even    1
ERROR: Out of global stack
% I added a few "strategic" cuts (`!`) to get so far.

Readable:
get_next([], []).
get_next(Current, Next) :-
    get_next_sub(0, _, Current, Next).

get_next_sub(Length, Digit, [Digit|Tail], Result) :-
    get_next_sub(Length+1, Digit, Tail, Result).
get_next_sub(Length, Digit, Further, Result) :-
    number_to_list(10*Length+Digit, Result, ResultTail),
    get_next(Further, ResultTail).

number_to_list(Number, Result, Accumulator) :-
    0 is Number -> Result = Accumulator;
    Digit is Number mod 10,
    number_to_list(Number // 10, Result, [Digit|Accumulator]).

get_previous(Stop, Current, Result) :-
    get_next(Current, Next),
    (   Next = Stop
    ->  Result = Current
    ;   get_previous(Stop, Next, Result)
    ).

get_prev_or_next(Input, Result) :-
    length(Input, Length),
    (   1 is Length mod 2
    ->  get_next(Input, Result)
    ;   get_previous(Input, [1], Result)
    ).

Python: 139 chars
import re
f=lambda s:''.join(['len(b)'+a for a,b in re.findall(r'((\d)\2*)',s)] if len(s)%2 else map(lambda a,b:b*int(a),s[::2],s[1::2]))

single test case
print f('1111122221111222112')
>>> 514241322112
print f('514241322112')
>>> 1111122221111222112

You can remove the space from s)] if to s)]if.

You can also remove the space in between 2 else

Haskell, 134 128 115
n=length
l x=x#mod(n x)2
(a:b:c)#0=replicate(read[a])b++c#0
(a:b)#1=(\(c,d)->show(1+n c)++a:d#1)$span(==a)b
_#_=[]

If it needs to be from stdin/stdout, add main=interact l for 150 144 131 total chars.  The function is called l.
*Main> putStr . unlines $ map (\x->x++":\t"++l x) ([replicate n '1'|n<-[5..10]]++map show [0,6..30]++map show [n*n+n|n<-[2..10]])
11111:  51
111111: 111
1111111:    71
11111111:   1111
111111111:  91
1111111111: 11111
0:  10
6:  16
12: 2
18: 8
24: 44
30: 000
6:  16
12: 2
20: 00
30: 000
42: 2222
56: 66666
72: 2222222
90: 000000000
110:    2110

Could you please provide usage example? While I got l "11" to work, I get an exception with l "111" or l "1111111111111"

@PaulGuyot, Seems like fixing that cut a few chars off my score.  Thanks :-)

Perl - 98 bytes
The size of all these control statements bugs me, but I'm pretty happy with how the regexes worked out.
($_)=@ARGV;if(length()%2){$\=$&,s/^$&+//,print length$&while/^./}else{print$2x$1while s/^(.)(.)//}

Uncompressed:
($_)=@ARGV;
if(length()%2)
{
$\=$&, #Assigning the character to $\ causes it to be appended to the print (thanks, tips thread!)
s/^$&+//, #Extract the string of characters
print length$& #Print its length
while/^./ #Get next character into $&
}else{
print$2x$1
while s/^(.)(.)//
}

Java 7, Score = 252 235 bytes
Yep, it's java again; the worst golfing language in the world. This approach uses strings. Arbitrarily large integers are supported in java but would take much more room to code in.
Call with f(intputString). Returns the corresponding string.
Golfed:
String f(String a){char[]b=a.toCharArray();a="";int i=0,j=0,d=0,e=b.length;if(e%2==0)for(;i<e;i+=2)for(j=0;j<b[i]-48;j++)a+=b[i+1];else{for(;i<e;i++)d=d==0?(j=b[i]-48)*0+1:b[i]-48!=j?(a+=d+""+j).length()*--i*0:d+1;a+=d;a+=j;}return a;}

Golfed Expanded with structure code:
public class LookAndSayExpandedGolfed{

    public static void main(String[] args){
        System.out.println(new LookAndSayExpandedGolfed().f(args[0]));
    }

    String f(String a){
        char[]b=a.toCharArray();
        a="";
        int i=0,j=0,d=0,e=b.length;
        if(e%2==0)
            for(;i<e;i+=2)
                for(j=0;j<b[i]-48;j++)
                    a+=b[i+1];
        else{
            for(;i<e;i++)
                d=d==0?(j=b[i]-48)*0+1:b[i]-48!=j?(a+=d+""+j).length()*--i*0:d+1;
            a+=d;
            a+=j;
        }
        return a;
    }

}

Partially Golfed:
public class LookAndSayPartiallyGolfed{

    public static void main(String[] args){
        System.out.println(new LookAndSayPartiallyGolfed().f(args[0]));
    }

    String f(String a){
        char[] number = a.toCharArray();
        String answer = "";
        int i, j, longestStreakLength = 0;
        if (number.length % 2 == 0){
            for (i = 0; i < number.length; i += 2)
                for (j = 0; j < number[i] - 48; j++)
                    answer += number[i+1];
        } else{
            j = 0;
            for (i = 0; i < number.length; i++)
                longestStreakLength = longestStreakLength == 0 ? (j = number[i] - 48) * 0 + 1 : number[i] - 48 != j ? (answer += longestStreakLength + "" + j).length()*--i*0 : longestStreakLength + 1;
            answer += longestStreakLength;
            answer += j;
        }
        return answer;
    }

}

Completely expanded:
public class LookAndSay{

    public static void main(String[] args){
        System.out.println(new LookAndSay().function(args[0]));
    }

    String function(String a){
        char[] number = a.toCharArray();
        if (number.length % 2 == 0){
            String answer = "";
            for (int i = 0; i < number.length; i += 2){
                for (int j = 0; j < number[i] - '0'; j++){
                    answer += number[i+1];
                }
            }
            return answer;
        }
        String answer = "";
        int longestStreakLength = 0;
        int longestStreakNum = 0;
        for (int i = 0; i < number.length; i++){
            if (longestStreakLength == 0){
                longestStreakNum = number[i] - '0';
                longestStreakLength = 1;
                continue;
            }
            if (number[i] - '0' != longestStreakNum){
                answer += longestStreakLength;
                answer += longestStreakNum;
                longestStreakLength = 0;
                i--;
            } else {
                longestStreakLength++;
            }
        }
        answer += longestStreakLength;
        answer += longestStreakNum;
        return answer;
    }

}

To run, first compile the second entry with: javac LookAndSayExpandedGolfed.java
Then run with: java LookAndSayExpandedGolfed
Edit: Fixed error.

Doesn't work for me, Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 4  at java.lang.String.charAt(String.java:658)

@KenzieTogami Fixed.

I don't think so, is --1 supposed to be --i?

@KenzieTogamie Yes, it is. It's fixed now.

Cool, that works. The reverser fails, however. 513211 -> 11111.

As soon as you fix that (or if I do while I try to golf this more) I compressed the current one to 233.

@KenzieTogami Fixed

Let us continue this discussion in chat.

Erlang, 205
f(L)->g(L,L,[]).
g([A,B|T],L,C)->g(T,L,lists:duplicate(A-$0,B)++C);g([],_,R)->R;g(_,L,_)->i(L,[]).
h([A|T],A,N,B)->h(T,A,N+1,B);h(L,B,N,C)->i(L,integer_to_list(N)++[B|C]).
i([H|T],A)->h(T,H,1,A);i(_,R)->R.

Main function is f, taking the input as an Erlang string and returning the output as a string as well.
f("11"). % returns "1"
f("111"). % returns "31"
f("1111111111111"). % returns "131"

The function can be made 15 bytes shorter (190) by dropping the more than 9 identical characters case requirement. f calls g which computes the predecessor recursively, and if the number of characters is odd (found at when computation ends), it calls function i which, paired with h, computes the next element.

Haskell, 105
import Data.List
l=length
c r|odd$l r=group r>>=(l>>=(.take 1).shows)|x:y:z<-r=[y|_<-['1'..x]]++c z|0<1=r

I think it's nice it turned out not using any helper functions :-).

|x:y:z<-r - I totally did not know you could do that. That's so cool!

@Flonk Its called "pattern guards". It used to be an extension and in one of the versions of Haskell it was added :-)

This makes a lot of things so much easier. You learn something new every day! :)

APL (45)
∊{2|⍴⍵:(⊃,⍨⍕∘⍴)¨⍵⊂⍨1,2≠/⍵⋄/⍨∘⍎/¨⌽¨⍵⊂⍨1 0⍴⍨⍴⍵}

Yes, that's a valid function definition, even with the ∊ on the outside.
      ∊{2|⍴⍵:(⊃,⍨⍕∘⍴)¨⍵⊂⍨1,2≠/⍵⋄/⍨∘⍎/¨⌽¨⍵⊂⍨1 0⍴⍨⍴⍵}'513211'
111112221
      ∊{2|⍴⍵:(⊃,⍨⍕∘⍴)¨⍵⊂⍨1,2≠/⍵⋄/⍨∘⍎/¨⌽¨⍵⊂⍨1 0⍴⍨⍴⍵}'111112221'
513211
      f←∊{2|⍴⍵:(⊃,⍨⍕∘⍴)¨⍵⊂⍨1,2≠/⍵⋄/⍨∘⍎/¨⌽¨⍵⊂⍨1 0⍴⍨⍴⍵}
      f ¨ '513211' '111112221'
┌─────────┬──────┐
│111112221│513211│
└─────────┴──────┘

Javascript (in-browser, ES5, IE8+), 152
var s=prompt(),r='',n=r,c=r,i=0;do{c!=s[i]?(r+=n+c,n=1,c=s[i]):n++;i++}while(c)n='';i=0;while(s[i]){n+=Array(1*s[i]+1).join(c=s[i+1]);i+=2}alert(c?n:r)

Can be shortened by 4 chars if you skip var, or a few more chars with other intermediate unvarred globals too, but let's pretend we are not bad programmers for a minute.
Switching to ES6 short-syntax function with argument and return value instead of using prompt, alert for IO can save more.
JSFiddle here: http://jsfiddle.net/86L1w6Lk/

Don't worry about those vars... we're all "bad programmers" here. ;)

Python 3 - 159 bytes
import re;l=input();x=len;print(''.join([str(x(i))+j for i,j in re.findall('((.)\2*)',l)]if x(l)%2 else[j*int(i)for i,j in[l[i:i+2]for i in range(0,x(l),2)]]))

Cobra - 217
(186 if I can assume a use statement for System.Text.RegularExpressions exists elsewhere)
do(s='')=if((l=s.length)%2,System.Text.RegularExpressions.Regex.replace(s,(for x in 10 get'[x]+|').join(''),do(m=Match())="['[m]'.length]"+'[m]'[:1]),(for x in 0:l:2get'[s[x+1]]'.repeat(int.parse('[s[x]]'))).join(''))

JavaScript (ES6) 85
Using regular expression replace with function. Different regexp and different function depending on input length being even or odd.
F=s=>s.replace((i=s.length&1)?/(.)(\1*)/g:/../g,x=>i?x.length+x[0]:x[1].repeat(x[0]))

Ruby, 78 bytes
->s{s.size%2<1?s.gsub(/(.)(.)/){$2*$1.to_i}:s.gsub(/(.)\1*/){$&.size.to_s+$1}}

Attempt This Online!

05AB1E, 18 (or 17?) bytes
S2ôø`s×IÅγs.ι‚JIgè

Try it online or verify some more test cases.
Since the challenge asks for a string input, which by default allows for a list of characters, it would be 1 byte less by removing the leading S:
Try it online or verify some more test cases.
Explanation:
S        # Convert the (implicit) input to a list of digits
 2ô      # Split it into parts of size 2
   ø     # Zip/transpose; swapping rows/columns
    `    # Pop and push both lists separately to the stack
     s   # Swap the two lists on the stack
         # (or swap it with the implicit input if the input was a single digit number)
      ×  # Repeat the digits the numbers amount of times (at the same positions of the
         # lists)
I        # Push the input again
 Åγ      # Run-length encode it, pushing the list of digits and list of lengths
         # separately to the stack
   s     # Swap those two lists on the stack
    .ι   # Interleave the two lists into one:
         #  [a,b,c,...] and [d,e,f,...] → [a,d,b,e,c,f,...]
‚        # Pair the two lists together
 J       # Join both inner lists to a number
  I      # Push the input yet again
   g     # Pop and push its length
    è    # Modular 0-based index it into the pair
         # (after which the result is output implicitly)


text:
Play Wythoff's Nim perfectly
Your goal is to write a perfect player for the game of Wythoff's Nim.
Rules of Wythoff's Nim
Wythoff's Nim is a deterministic two-player game played with two piles of identical counters. Players alternate turns, in which they do one of these:

Remove one or more counters from the first pile
Remove one or more counters from the second pile
Remove an equal number of counters (one or more), from both the first pile and the second pile.

Of course, piles can't go negative, but they can to 0. Whichever player removes the last counter overall wins the game.
For the more geometrically-minded, here is an equivalent formulation of the game that you can play on this applet. A single queen starts on some square of a quarter-infinite chessboard whose corner is in the bottom-left. Players alternate moving the queen, which moves like a chess queen but restricted to three directions:

Down
Left
Diagonally down and left

Whoever moves the queen to the corner wins.
Associating the queen's coordinates (with corner (0,0)) to the sizes of the respective piles, it's easy to see both games are the same.
Perfect play
(You can skip this if familiar with the notions of perfect play and winning moves.)
Since Wythoff's Nim is a finite and deterministic game, it has a notion of perfect play. A perfect player is a strategy that will always win from a theoretically won position, meaning a position in which there exists a strategy that guarantees a win.
To be a winning strategy, it suffices to move to always move to a theoretical winning position for the player who just moved, and thus the player not going next. The first of these winning positions (also called cold positions) are (0,0), (1,2), (2,1), (3,5), (5,3). See the Wikipedia article for an explanation of an algorithm to find a winning strategy for Wythoff's Nim, as well as a formula to generate win positions.
Program requirements
Write a program or function takes a position as input and outputs a winning move in the form of the position after that move. Fewest bytes wins.
If no winning move exists, i.e., the position is a theoretical loss, your program should indicate so and forfeit.
Your program must run within a reasonable amount of time. So, an exponential recursive game tree search will not suffice. If you want to precompute and hard-code a strategy, that's fine.
Input
A pair (i,j) of non-negative numbers representing pile sizes, each at most 99. This can be two numbers, a tuple, a list, or whatever container you prefer.
Output
Print or output the position after your move, again as two numbers or a container thereof. This must be a legal move to a winning position. If there's multiple such moves, any one is fine, but only one.
If there's no winning move, you must indicate this in the output. Any output like False, None, 0, or (-1,-1) will do, as long as it's not a legal position, and is the same for every losing input.
Example runs
f(5,0)   = (0,0)
f(2,2)   = (1,2)   # Or (2,1) or (0,0)
f(1,2)   = False
f(13,9)  = (13,8)  # Or (10,6)
f(10,6)  = False
f(5,10)  = (5,3)
f(25,30) = (8,13)

+1, partly because I like the idea of a quarter of infinity.

define "reasonable amount of time". Is several seconds for (100,50) a reasonable amount of time?

Oh. Wait. the input is bounded by... 30??? That's a bit low, isn't it?

@JanDvorak You're right, it might allow cheap shortcuts. Changed to 99 -- I think that suffices? Apologies for editing specs after posting.

@PeterTaylor Thanks, fixed.

@JanDvorak Several seconds is fine.

Can I print all of the winning moves? i.e. f(2,2) -> [(1,2),(2,1),(0,0)]

@FryAmTheEggman Nope, just one.

Haskell, 167 165 characters
c p=o p:c(o p:p)
o p=[(a,b)|a<-[0..],b<-[0..a],(a,b)?p==[]]!!0
(a,b)?p=[y|y@(c,d)<-p,c==a||c==b||d==b||a+d==b+c]
f x@(a,b)|a<b=f(b,a)|x?c[]!!0==x=(0,-1)|1>0=x?c[]!!0

The algorithm is inefficient, but it still runs within a second (though not in the interactive console) for inputs < 100.
Explanation:
c p=o p:c(o p:p)

The list of cold positions given a set of previous cold positions is one cold position followed by the list of cold positions given this position and the previous ones (Inefficiency: this position is generated twice)
o p=[(a,b)|a<-[0..],b<-[0..a],(a,b)?p==[]]!!0

One cold position is the first pair such that there are no cold positions reachable from that pair (Inefficiency: we should search from the previous pair instead)
(a,b)?p=[y|y@(c,d)<-p,c==a||c==b||d==b||a+d==b+c]

Positions reachable from a pair are those such that their first elements match, their second elements match, their difference matches, or the smaller heap before removal is the larger heap after removal.
f x@(a,b)|a<b=f(b,a)
         |x?c[]!!0==x=(0,-1)
         |1>0=x?c[]!!0

(main method) If the heaps are in the wrong order, swap them. Else, if the first cold position reachable from a position is the position itself, indicate failure (ideally, one would return Maybe (Int,Int) instead). Else return that cold position (Inefficiency: said pair is looked up twice. Worse, the list of cold positions is generated twice)

Seems that "So, an exponential recursive game tree search will not suffice" was optimistic, because what you describe sounds exactly like that.

@PeterTaylor this is O(n^4). Each cold pair takes O(n^3) time to find and there are O(n) of them. Optimising the generation would bring it to O(n^2) (if I read the sequence correctly). An exponential-time algorithm would be much slower. Should I run some tests?

It's ok, I believe you.

you can remove the x@ from x@(a,b)?p=...

Not sure how it got there. Fixing, thanks.

GolfScript (63 57 bytes)
{\]zip{~-}%0|$(!*,1=}+1,4*{..,,^[(.@,2/+.2$]+}38*2/?0]0=`

Expects input from stdin in the form [a b], and leaves output on stdout in that form or 0 if it's a losing position. Online demo
Overview
,4*{..,,^[(.@,2/+.2$]+}38*2/

computes a list of cold positions (including the flipped version [b a] for each cold position [a b]) using the Beatty sequence property.
Then ? searches for the first cold position satisfying the block created by
{\]zip{~-}%0|$(!*,1=}+

which basically checks that the position is reachable from the input position by computing the vector difference and then verifying that it's either [0 x], [x 0], or [x x] for some x > 0. IMO that test is the cleverest bit: 0|$ forces any array in one of those formats into the form [0 x] while mapping [0 0] to [0], [a b] where neither a nor b is 0 to a three-element array, and [-x 0] or [-x -x] to [-x 0]. Then (!*,1= checks that we have [0 x].
Finally 0]0=` does the fallback case and formatting for output.

Pyth 57 58 61 62
K1.618Jm,s*dKs*d*KKU39M<smf|}TJ}_TJm,-Ghb-Hebt^,0hk2U99 1

Try it online.
Pretty similar to other answers, but that wikipedia page didn't give much else to go on ;) The magic number 39 is the number of cold positions with values < 99.
Defines a function g that you can call like g 30 25. Returns [] for failure, [(13,8)] on success.
Explanation
K1.618                            : K=phi (close enough for first 39 values)
      Jm,s*dKs*d*KKU39            : J=cold positions with the form (small,big)
M<s                              1: Define g(G,H) to return this slice: [:1] of the list below
   mf|}TJ}_TJ                     : map(filter: T or reversed(T) in J, where T is each member of..
             m,-Ghb-Hebt^,0hk2    : [(G H) - (0 x+1),(x+1 0) and (x+1 x+1)]
                              U99 : for each x from 0 - 98

s is cast to int - saves a few characters over /____1. rZ39 can be replaced by U39, using unary range. Likewise, you can replace r99) with U99.

@isaacg Thanks! I totally forgot about U. I should really update the explanation :P

@isaacg Just a thought about Pyth, I think you could make @ perform set intersection if its second argument is a list now. It's a bit awkwardly left out since a was changed :P

That's a good idea - I've implemented it. I also changed the intersection code to allow a few tricks that weren't possible before, including taking the intersection of two lists of lists.

Javascript ES6 - 280 bytes
Minified
r=x=>~~(x*1.618);g=(y,x)=>y(x)?g(y,x+1):x;s=A=>A?[A[1],A[0]]:A;f=(a,b)=>j([a,b])||j([a,b],1);j=(A,F)=>l(A,F)||s(l(s(A),F));l=(A,F)=>([a,b]=A,c=(F&&a+b>=r(b)&&(e=g(x=>a+b-2*x-r(b-x),0))?[a-e,b-e]:(e=g(x=>r(a+x)-2*a-x,0))+a<b?[a,a+e]:(e=r(b)-b)<a?[e,b]:0),c&&r(c[1]-c[0])==c[0]?c:0)

Expanded
r = x => ~~(x*1.618);
g = (y,x) => y(x) ? g(y,x+1) : x;
s = A =>A ? [A[1],A[0]] : A;
f = (a,b) => j([a,b]) || j([a,b],1);
j = (A,F) => l(A,F) || s(l(s(A),F));
l = (A,F) => (
    [a,b] = A,
    c = (
        F && a+b >= r(b) && (e = g( x => a+b - 2*x - r(b - x), 0 )) ? [a-e,b-e] :
        (e = g( x => r(a+x) - 2*a - x, 0)) + a < b ? [a,a+e] :
        (e = r(b) - b) < a ? [e,b] : 0
    ),
    c && r(c[1] - c[0]) == c[0] ? c : 0
);

Nice and quick algorithm. Runs in O(n), but would run in constant time if not for a byte-saving loop. The loop is implemented as a recursive incrementer, hence the script will eventually fail with a recursion error for n in the hundreds or thousands. Uses the same Beatty sequence property that Mr. Taylor mentions, but rather than computing the sequence, it simply steps up to the correct term(s).
Runs properly on all of the test inputs and many dozens besides that I tested.
The function to invoke is f. It returns an array on success and a 0 upon giving up.

Wait, outputting an array is ok?

@JanDvorak: xnor has a tuple listed in the list of valid outputs, hence I figured so. Maybe he can clarify the matter. It's a trivial fix, at any rate.

An array or a singleton array of the pair is fine; multiple winning moves are not.

Perl 5 - 109 (with 2 flags)
#!perl -pl
for$a(@v=0..99){for$b(@v){$c=$a;$d=$b;${$:="$a $b"}||
map{$$_||=$:for++$c.$".++$d,"$a $d","$c $b"}@v}}$_=$$_

Usage:
$ perl wyt.pl <<<'3 5'

$ perl wyt.pl <<<'4 5'
1 2

Simply calculates solution for each possible input then just does a single lookup.


text:
Mobius inversion
Your goal is to implement Möbius inversion, a linear operation on a sequence of numbers that is used in combinatorics and number theory. Fewest bytes wins.
What is Möbius inversion?
Given a (finite) integer sequence f_1, f_2, ..., f_N, we can compute its divisor-partial-sum g, whose nth element g_n is the sum of all terms f_d whose index d is a divisor of n.
g_n = sum_(d with d|n) [f_d]

g_1 = f_1
g_2 = f_1 + f_2
g_3 = f_1 + f_3
g_4 = f_1 + f_2 + f_ 4
g_5 = f_1 + f_5
g_6 = f_1 + f_2 + f_3 + f_6
...

The sequence g has the same length as f.
Möbius inversion is the process of inverting this operation -- recovering f from g. This inverse is unique and produces an integer sequence. A explicit but complicated way to compute it is the Möbius inversion formula, which expresses f_n as a weighted sum over divisors d of n:
f_n = sum_(d with d|n) [μ(d) * g_(n/d)]

and μ is the Möbius function:
μ(n) = 1 if n is a square-free positive integer with an even number of prime factors.
μ(n) = −1 if n is a square-free positive integer with an odd number of prime factors.
μ(n) = 0 if n has a squared prime factor.

Program requirements
Write a function or program to perform Möbius inversion. Fewest bytes wins. Built-in methods to perform Möbius inversion, do sequence convolution, compute the Möbius function (or related thing like checking squarefreeness), or solve systems of equations are not allowed.
Input
A sequence of integers of length at least 1. Can be any format that represents an ordered sequence: array, list, stack, token-separated string, etc. Unordered maps from the index to the element like dictionaries and functions are not OK. You're not given the length of the input sequence separately.
Output
Return or print the output sequence in any format, with same restrictions as input. It should be the same length as the input sequence.
Test cases
Input: [1, 2, 2, 3, 2, 4, 2, 4, 3, 4, 2, 6, 2, 4, 4, 5, 2, 6, 2, 6]
Output:[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

Input: [0, -3, 6, 5, 1, 7, 5, 0, 4, 0]
Output: [0, -3, 6, 8, 1, 4, 5, -5, -2, 2]

Input: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Output: [1, -1, -1, 0, -1, 1, -1, 0, 0, 1, -1, 0, -1]

I think solving a linear system with inbuilt functions should be prohibited completely.

@Optimizer Using built-ins to solve linear systems is already banned; what more do you mean? Prohibiting inverting matrices? In any case, I'm not going to make changes at this point. I agree that matrix-based solutions are hard to beat, which I hadn't foreseen, so please consider it a separate league if it makes you feel better.

See the J answer. Aolving Ax=B for a matrix is equivalent to solving system of equations only.

J - 13 char
Anonymous function Mobius-inverting a sequence.
(%.0=#\|~/#\)

Here's what's going on:

#\ gets indices from 1 to the length of the input list, inclusive.
|~/ makes a table of indices modulo themselves.
0= checks for equality to zero, 1 for true, 0 for false. On the table of moduli, this checks divisibility, returning a matrix like
1 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0
1 0 1 0 0 0 0 0
1 1 0 1 0 0 0 0
1 0 0 0 1 0 0 0
1 1 1 0 0 1 0 0
1 0 0 0 0 0 1 0
1 1 0 1 0 0 0 1

Finally, %. takes the input sequence and this matrix, and solves it as a linear system: x equal to b %. A is the solution to Ax=b if it exists. Our b is the input sequence and A is this divisibility matrix above.

In use: (Note that J spells its negative sign _)
   (%.0=#\|~/#\) 1 2 2 3 2 4 2 4 3 4 2 6 2 4 4 5 2 6 2 6
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
   (%.0=#\|~/#\) 0 _3 6 5 1 7 5 0 4 0
0 _3 6 8 1 4 5 _5 _2 2
   (%.0=#\|~/#\) 1 0 0 0 0 0 0 0 0 0 0 0 0
1 _1 _1 0 _1 1 _1 0 0 1 _1 0 _1

Sorry, but you're not allowed to use methods that solve linear systems. You can perform matrix operations though (or is that what your code is already doing?).

@xnor Yes, it's only matrix inversion. It states in the the documentation that b%.A is shorthand for (%.A) mp b where mp is the matrix product, and %.A is matrix inversion on A.

Matlab/Octave (56)(53)(51)
51 chars:
i=input('');x=1:numel(i);disp(i/~bsxfun(@mod,x,x'))

53 chars:
i=input('');x=meshgrid(1:numel(i));disp(i/~mod(x,x'))

I basically set up system of linear equations in matrix form where the matrix looks like this (depending on the length, here the length is 6:
1 0 0 0 0 0
1 1 0 0 0 0
1 0 1 0 0 0
1 1 0 1 0 0
1 0 0 0 1 0
1 1 1 0 0 1

Then I just solve the corresponding system of equations.
The command meshgrid(x) is primarly inteded for producing matrices like
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4

and
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4

which can then be used as e.g. x and y coordinates for plotting 2d functions. I just use one of them for ceating a matrix with where the k-th column has is 0 every k-th element via elementwise remainder division (modulo). ~ as the logical not which replaces nonzero values with zeros and vice versa, which then results in the matrix above.

How is this solving the system of equations? If it's just using the built-in CAS solver, that's not allowed, but if you're inverting the matrix, that's fine. My apologies that I edited in that restriction after posting the question, so you might not have seen it.

It is using a built in numerical solver (you can assume it is the gauss algorithm), Matlab/Octave are numerical computing languages that do not allow algebraic manipulations - so is this still ok?

I think I need to understand what (i/~mod(x,x') is doing. Could you please explain?

´i´ is the input vector (as a row vector). / is divides the vector by the matrix and ~mod(x,x') represents the matrix. (I'll write more in my answer, just noticed the comment is too short.)

OK, that's totally fine. The code expresses an explicit solution to the matrix equation; it's not being implicitly solved.

Ok thanks, I really liked this crisp short challenge just before going to bed=)

Python, 99 chars
def I(g):
 f,e=[],enumerate
 for n,v in e(g):f+=[v-sum(x for i,x in e(f)if(n+1)%(i+1)<1)]
 return f

Computes f from g incrementally, so we can use the fs we've already calculated to compute larger fs.

CJam, 67 bytes
This can be golfed further, but given that so many languages can solve linear equations with 1 character, I don't see a point in answering with any non-maths oriented language.
l~:F,,{):N,:){N\%!},{__mF{W=1>},,{;0}{_mF,\1=m2%W1?}?N@/(F=*}%:+}%p

This is the exact implementation of the Möbius inversion formula.
Try it online here
Takes input from STDIN in the following format:
[1 0 0 0 0 0 0 0 0 0 0 0 0]

and gives output line
[1 -1 -1 0 -1 1 -1 0 0 1 -1 0 -1]

Haskell, 61
h g=[v-sum[h g!!n|n<-[0..i-2],rem i(n+1)<1]|(i,v)<-zip[1..]g]

this solves the equations one at a time using the already known values of f, using laziness.
this is inefficient in space and time complexity because it recomputes the result several times ( it's like the difference between fix f=f(fix f) and fix f=r where r=f r). a simple fix:
h g=r where [v-sum[r!!n|n<-[0..i-2],rem i(n+1)<1]|(i,v)<-zip[1..]g]

Python 2, 84 chars
g=input()
i=1
for _ in g:g[i-1]-=sum(g[j-1]*(i%j<1)for j in range(1,i));i+=1
print g

Iterates through the entries, making each one what it needs to be for the sum to work out. Modifies the input list directly rather than making a new list.