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<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][10000];
	char ans[100000];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
				in[i][ie[i]]=in[i][ie[i]]-'0';
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if((Min>80)||(Min>79)||(int(in[0][0])+int(in[1][0])>9)){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
				
			}
			max10=0;
			if(in[NMin][ien[NMin]+1]>9){
				in[NMin][ien[NMin]+1]-=10;
				max10=1;
			}
			for(int i=0;i<2;i++){
				for(int j=0;j<ie[i]+1;j++){
					in[i][j]=in[i][j]+'0';
				}
			}
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string.h>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		ie[0]=strlen(in[0])-1;
		ie[1]=strlen(in[1])-1;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]-'0';
				if(in[NMin][ien[NMin]]>9+'0'){
					in[NMin][ien[NMin]]-=10;
					in[NMin][ien[NMin]-1]  +=1;
				}
			}
			max10=0;
			for(;ien[NMin]>-1;ien[NMin]--){
				if(in[NMin][ien[NMin]]>9+'0'){
					in[NMin][ien[NMin]]-=10;
					in[NMin][ien[NMin]-1]+=1;
					max10=1;
				}else{
					max10=0;
				}
			}
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
void addplace(unsigned int *a, unsigned int *last, long long num){
if( a == last ) return;
int carry = ((long long)*a * 10L + num) / 1000000000L;
addplace(a+1, last, carry);
*a = ((long long)*a * 10L + num) % 1000000000L;
}
int trace(unsigned int *a, unsigned int *last){
if( a == last ) return 0;
if( !trace(a+1, last) ){
if( *a > 0 ){
cout << *a;
return 1;
}
}else{
char b[11]={};
sprintf(b,"%d",*a+1000000000);
cout<<b+1;
return 1;
}
return 0;
}
void add(unsigned int *a, unsigned int *alast, unsigned int *b, int num=0){
if( a == alast ) return;
int carry = (*a + *b + num) / 1000000000L;
add(a+1, alast, b+1, carry);
*a = (*a + *b + num) % 1000000000L;
}
int main(){
int n;
cin>>n;
string a,b;
getline(cin, a);
for(;n--;){
getline(cin, a);
getline(cin, b);
unsigned int _a[9]={},_b[9]={};
for(string::iterator it=a.begin();
it!=a.end(); it++){
addplace(_a, _a+9, *it-'0');
}
for(string::iterator it=b.begin();
it!=b.end(); it++){
addplace(_b, _b+9, *it-'0');
}
add(_a, _a+9, _b);
if( _a[8] >= 100000000 ){
cout<<"overflow\n";
}else{
trace(_a, _a+9);
cout<<'\n';
}
}
}

C++: #include<cstdio>
#include<cstring>
#include<cstdlib>

int main(void)
{
	char num1[1000], num2[1000];
	int n, num1_k, num2_k, rec, nnum1, nnum2, k_up, bnum1, bnum2;
	int f1, f2;
	scanf("%d", &n);
	fflush(stdin);
	for(f1 = 0; f1 < n; f1++)
	{
		//初期化
		k_up = 0;
		//入力
		scanf("%s", num1);
		scanf("%s", num2);
		//それぞれの桁数を求める
		num1_k = strlen(num1);
		num2_k = strlen(num2);
		bnum1 = num1_k - 1;
		bnum2 = num2_k - 1;
		//桁数で低いほうの桁数分だけ回す
		rec = (num1_k > num2_k) ? num2_k : num1_k;
		for(f2 = rec - 1; f2 >= 0; f2--)
		{
			//それぞれ現在桁の数を割り出す
			nnum1 = num1[bnum1] - '0';
			nnum2 = num2[bnum2] - '0';
			//桁数の大きいほうへ入れる
			if(num1_k > num2_k)
			{
				num1[bnum1] = ((nnum1 + nnum2 + k_up) % 10) + '0';
			}
			else
			{
				num2[bnum2] = ((nnum1 + nnum2 + k_up) % 10) + '0';
			}
			//桁上がりを求める
			k_up = (nnum1 + nnum2) / 10;
			bnum1--;
			bnum2--;
		}
		//残りの部分を求める
		rec = (bnum1 > bnum2) ? bnum1 : bnum2;
		for(f2 = rec; f2 >= 0; f2--)
		{	
			//桁数の大きいほうへ入れる
			if(num1_k > num2_k)
			{
				nnum1 = num1[f2] - '0';
				num1[f2] = ((k_up + nnum1) % 10) + '0';
				k_up = (k_up + nnum1) / 10;
			}
			else
			{
				nnum2 = num2[f2] - '0';
				num2[f2] = ((k_up + nnum2) % 10) + '0';
				k_up = (k_up + nnum2) / 10;
			}			
		}
		if(num1_k > 80 || num2_k > 80)
		{
			printf("overflow\n");
		}
		else
		{
			if(k_up == 1)
			{
				if(num1_k + 1 > 80 || num2_k + 1 > 80)
				{
					printf("overflow\n");
				}
				else
				{
					printf("%d", k_up);
				}
			}
			if(num1_k > num2_k)
			{
				printf("%s\n", num1);
			}
			else
			{
				printf("%s\n", num2);
			}
		}
	}
	return 0;
}