Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

C++: #include<stdio.h>
#include<string.h>
int max(int a,int b){return a>b?a:b;}
int main(){
	int n,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		char a[81];
		char b[81];
		char x[81];
		char y[81];
		char ans[82];
		scanf(" %s",a);
		scanf(" %s",b);
		for(j=0;j<80;j++){
			x[j]='0';
			y[j]='0';
		}
		x[80]='\0';
		y[80]='\0';
		for(j=0;j<strlen(a);j++)x[79-j]=a[strlen(a)-1-j];
		for(j=0;j<strlen(b);j++)y[79-j]=b[strlen(b)-1-j];
		int k=0;
		for(j=80;j>=1;j--){
			int p=0;
			p+=k;
			p+=(x[j-1]-'0')+(y[j-1]-'0');
			k=p/10;
			ans[j]=p%10+'0';
		}
		ans[0]='0';
		ans[81]='\0';
		j=0;
		while(ans[j]=='0')j++;
		if(k!=0)printf("overflow\n");
		else if(j==81)printf("0\n");
		else{
			for(;j<81;j++){
				printf("%c",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include <cstdio>

int myAbs(int num) { return (num > 0) ? num : -num ; }

int countNumberLength(char *data) {
	for (int i = 0;; i++) {
		if (data[i] == '\0')
			return i;
	}
	return 0;
}

void moveNumber(char *data, int diff, int length) {
	int idx = length;
	for (int i = 0; i < length+1; i++) {
		data[idx-i+diff] = data[idx-i];
	}
	for (int i = 0; i < diff; i++) {
		data[i] = '0';
	}
}

int chr2int(char chr) {
	int ret;
	switch (chr) {
	case '1':
		ret = 1;
		break;
	case '2':
		ret = 2;
		break;
	case '3':
		ret = 3;
		break;
	case '4':
		ret = 4;
		break;
	case '5':
		ret = 5;
		break;
	case '6':
		ret = 6;
		break;
	case '7':
		ret = 7;
		break;
	case '8':
		ret = 8;
		break;
	case '9':
		ret = 9;
		break;
	case '0':
		ret = 0;
		break;
	case 'X':
		ret = 10;
		break;
	
	}
	return ret;
}

const char int2chr[11] = {
	'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'X'
};

void makeSumNumber(char *left, char *right, char *sum, int length) {
	sum[length] = '\0';
	for (int i = length-1; i !=-1; i--) {
		int t_sum = chr2int(left[i]) + chr2int(right[i]);
		if (t_sum >= 10) {
			if (i != 0) {
				left[i-1] = int2chr[chr2int(left[i-1])+1];
				t_sum %= 10;
			}
		}
		sum[i] = int2chr[t_sum];
	}
}

int main(int argc, char *argv[]) {
	using namespace std;
	
	int dataN;
	fscanf(stdin, "%d", &dataN);
	
	for (int i = 0; i < dataN; i++) {
		char tmp1[100], tmp2[100], sum[100];
		int cnt1, cnt2, diff, longer;
		fscanf(stdin, "%s", tmp1);
		fscanf(stdin, "%s", tmp2);
		cnt1 = countNumberLength(tmp1);
		cnt2 = countNumberLength(tmp2);
		diff = myAbs(cnt1 - cnt2);
		
		// is Overflow
		if (cnt1 > 80 || cnt2 > 80) {
			puts("overflow");
		}
		else {
			printf("%d:%s\n", cnt1, tmp1);
			printf("%d:%s\n", cnt2, tmp2);
			if (cnt1 > cnt2) {
				longer = cnt1;
				// set tmp
				moveNumber(tmp1, 1, cnt1+1);
				moveNumber(tmp2, diff+1, cnt2+1);
				// get sum
				makeSumNumber(tmp1, tmp2, sum, cnt1+1);
			}
			else if (cnt1 < cnt2) {
				longer = cnt2;
				// set tmp
				moveNumber(tmp2, 1, cnt2+1);
				moveNumber(tmp1, diff+1, cnt1+1);
				// get sum
				makeSumNumber(tmp1, tmp2, sum, cnt2+1);
			}
			else {
				longer = cnt1;
				// set tmp
				moveNumber(tmp1, 1, cnt1+1);
				moveNumber(tmp2, 1, cnt2+1);
				// get sum
				makeSumNumber(tmp1, tmp2, sum, cnt1+1);
			}
			// after calc
			if (sum[0] == '0') {
				for (int i = 1; i < longer+2; i++) {
					sum[i-1] = sum[i];
				}
			}
			else {
				if (cnt1 >= 80 || cnt2 >= 80) {
					puts("overflow");
					continue;
				}
			}
			
			printf("%s\n", sum);
		}
	}
	return 0;
}