Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>

#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)

int f(int x){
	return x*x;
}

int main(){
	string a, b;
	vector<int> m, n, s;
	int set;

	m.resize(81, 0);
	n.resize(81, 0);
	s.resize(81, 0);

	cin >> set;
	while(set-- > 0){
		cin >> a >> b;
		for(int i = 0; i < 81; i++){
			m[i] = n[i] = s[i] = 0;
		}		
		if(a.size() > 80 || a.size() > 80){
			cout << "overflow" << endl;
		}else{
			reverse(a.begin(), a.end());
			reverse(b.begin(), b.end());
			for(int i = 0; i < a.size(); i++){
				m[i] = a[i] - '0';
			}
			for(int i = 0; i < b.size(); i++){
				n[i] = b[i] - '0';
			}
			for(int i = 0; i < 80; i++){
				s[i] += m[i] + n[i];
				if(s[i] >= 10){
					s[i+1]++;
					s[i]-=10;
				}
			}
			int digit = 81;
			while(--digit > 0){
				if(s[digit] != 0)break;
			}
			if(digit >= 79){
				cout << "overflow" << endl;
			}else{
				for(int i = digit; i >= 0; i--){
					cout << s[i];
				}
				cout << endl;
			}
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	string a,b,c;
	int n;
	cin>>n;
	for(int fjal=0;fjal<n;fjal++){
	cin>>a>>b;
	c.clear();
	if(a.size()<b.size())swap(a,b);
	int as=a.size();
	while(as!=b.size())b="0"+b;
	//cout<<a<<" "<<b;
	bool kuri=false;
	for(int i=as-1;i>=0;i--){
		int _a=a[i]-'0',_b=b[i]-'0',ans=_a+_b;
		if(kuri)ans++;
		if(ans>=10){
			kuri=true;
			ans-=10;
		}
		else {kuri=false;}
		//cout<<ans<<" "<<i;
		c.push_back(ans+'0');
	}
		if(kuri)c.push_back('1');
		string ans;
		if(c.size()<80){for(int i=c.size()-1;i>=0;i--)ans.push_back(c[i]);
		cout<<ans<<endl;
		}
		else cout<<"overflow"<<endl;
	}
	return 0;
}

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;
}