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<string>
using namespace std;

int main() {
	
	string a,b;cin>>a;while(cin>>a>>b){
	int d=0;
	if(a.length()<b.length())
	{
		int aa=a.length();
		for(int i=0;i<b.length()-aa;i++)a='0'+a;
	}
	else
	{
		int bb=b.length();
		for(int i=0;i<a.length()-bb;i++)b='0'+b;
	}
	string ans="";
	for(int i=a.length()-1;i>=0;i--)
	{
		int aa=a[i]-'0';
		int bb=b[i]-'0';
		ans=char((aa+bb+d)%10+'0')+ans;
		d=(aa+bb+d)/10;
	}
	if(d)ans=char(d+'0')+ans;
	if(ans.length()>=80)cout<<"overflow"<<endl;
	else cout<<ans<<endl;}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stack>
using namespace std;

int add(char *retstr, char *str1, char *str2){

	int str1len=strlen(str1);
	int str2len=strlen(str2);
	char ad,i1,i2;
	char offset1,offset2;
	char c1,c2;
	bool carry=false;

	if(str1len>str2len){
		offset1=0;
		offset2=str1len-str2len;
	}else{
		offset1=str2len-str1len;
		offset2=0;
	}

	for(int i=max(str1len,str2len);i<82;++i){
		retstr[i]=0;
	}

	for(int i=max(str1len,str2len)-1;i>=0;--i){

		if(i-offset1>=0){c1=str1[i-offset1];}else{c1=48;}
		if(i-offset2>=0){c2=str2[i-offset2];}else{c2=48;}
		i1=c1-48;i2=c2-48;//Ascii code to Number

		ad=i1+i2;
		if(carry)++ad;//桁上がり分

		if(ad>=10){ad %= 10; carry=true;}else{carry=false;}
		retstr[i+1]=ad+48;
	}

	if(carry){
		retstr[0]=1+48;
	}else{
		retstr[0]=0+48;
		for(unsigned int i=0;i<strlen(retstr)-1;++i){
			retstr[i]=retstr[i+1];
		}
		retstr[strlen(retstr)-1]=0;
	}

	if(strlen(retstr)>=81)return 1;

	return 0;

}

int main(){

	int n,overflowed;
	char str1[82], str2[82], retstr[82];

	cin>>n;

	for(int i=0;i<n;++i){

		cin>>str1;
		cin>>str2;

		if(strlen(str1)>=81||strlen(str2)>=81){
			cout<<"overflow"<<endl;
		}else{
			overflowed=add(retstr, str1, str2);
			if(overflowed){
				cout<<"overflow"<<endl;
			}else{
				cout<<retstr<<endl;
			}
		}
	}

	return 0;
}

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

int main(void)
{
	char num1[81], num2[81];
	int n, num1_k, num2_k, rec, nnum1, nnum2, k_up, bnum1, bnum2;
	int f1, f2;
	scanf("%d", &n);
	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) % 10 + k_up) + '0';
			}
			else
			{
				num2[bnum2] = ((nnum1 + nnum2) % 10 + k_up) + '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(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;
}

C++: #include <iostream>
#include <string.h>

using namespace std;

int main(void){
	int n;

	cin >> n;
	for(int i=0;i<n;i++){
		int len,mlen=0;
		char val[2][81]={0},tmp[81],crr=0;

		for(int j=0;j<2;j++){
			cin >> tmp;
			len = strlen(tmp);
			mlen = mlen>len?mlen:len;
			for(int k=0;k<len;k++)
				val[j][len-1-k]=tmp[k]-0x30;
		}

		cout << tmp << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
//#define foreach(c,itr) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
//template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, j, n;

  scanf("%d",&n);
  rep(i,n){
    string str1, str2, res;
    cin >> str1;
    cin >> str2;

    vector<int> a(82, 0), b(82, 0);
    rep(j,str1.length()) a[j] = str1[str1.length()-1-j] - '0';
    rep(j,str2.length()) b[j] = str2[str2.length()-1-j] - '0';

    rep(j,81){
      int sum = a[j] + b[j];
      if(sum >= 10){ sum %= 10; a[j+1]++;}
      res += (sum + '0');
    }

    reverse(res.begin(), res.end());
    bool f = false;
    rep(j,res.length()){
      if(res[j] != '0') f = true;
      if(f) cout << res[j];
    }

    cout << endl;
  }

  return 0;
}