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>
#include<sstream>
#include<iomanip>
using namespace std;
class BigInt{
  unsigned int i[11];
public:
  BigInt(string str){
    i[0]=0;
    for(int j=80;j>0;j-=8){
      if((int)str.size()>j){
	stringstream ss;
	ss << str.substr(str.size()-j,8);
	ss >> i[11-j/8];
      }else if((int)str.size()+8>j){
	stringstream ss;
	ss << str.substr(0,str.size()+8-j);
	ss >> i[11-j/8];
      }else{
	i[11-j/8]=0;
      }
    }
  }
  BigInt():i{0,0,0,0,0,0,0,0,0,0,0}
  {}
  void print(){
    if(i[0]>0)
      cout << "overflow\n";
    else{
      int j=1;
      for(;j<10;j++)
	if(i[j]>0)
	  break;
      cout << i[j++];
      for(;j<11;j++)
	cout << setfill('0') << setw(8) << right << i[j];
      cout << "\n";
    }
  }
  BigInt operator+(const BigInt& rhs){
    BigInt result = rhs;
    for(int j=10;j>0;j--){
      result.i[j] += i[j];
      if(result.i[j]>=100000000){
	result.i[j]-=100000000;
	result.i[j-1]++;
      }
    }
    return result;
  }
};

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    string tmp;
    cin>>tmp;
    BigInt b(tmp);
    cin>>tmp;
    BigInt a(tmp);
    (a+b).print();
  }
}

C++: #include<stdio.h>

int main(){
	char x[100], y[100], z[100];
	int n, xl, yl, zl;
	int i;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",x);
		scanf("%s",y);
		for(xl=0;x[xl]!='\0';xl++) x[xl]-='0';
		for(yl=0;y[yl]!='\0';yl++) y[yl]-='0';
		if(--xl>=80 || --yl>=80){
			printf("overflow\n");
			continue;
		}

		for(zl=0;zl<100;zl++) z[zl]=0;
		for(zl=0;xl>=0 || yl>=0;zl++){
			if(xl>=0) z[zl]+=x[xl--];
			if(yl>=0) z[zl]+=y[yl--];
			if(z[zl]>=10){
				z[zl]-=10;
				z[zl+1]++;
			}
		}

		for(zl=99;z[zl]==0;zl--){}
		if(zl>=80){
			printf("overflow\n");
			continue;
		}
		for(xl=0;zl>=0;zl--) x[xl++]=(z[zl]+'0');
		x[xl] = '\0';
		printf("%s\n",x);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>

int main(){

	int n;
	std::cin >> n;

	for (int i = 0; i < n; i++){
		std::string str, str2, res;
		std::cin >> str >> str2;

		std::reverse(str.begin(), str.end());
		std::reverse(str2.begin(), str2.end());

		bool up = 0;
		for (int i = 0; up || i < std::max(str.size(), str2.size()); i++){

			int a = 0, b = 0;

			if (str.size() > i)a = str[i] - '0';
			if (str2.size() > i)b = str2[i] - '0';

			if (up + a + b >= 10){
				res += (up + a + b - 10 + '0');
				up = 1;
			}
			else{
				res += (up + a + b + '0');
				up = 0;
			}
		}

		std::reverse(res.begin(), res.end());

		if (res.size() > 80)std::cout << "overflow" << std::endl;
		else std::cout << res << std::endl;
	}

	return 0;
}

C++: #include <iostream>
#include<string>
using namespace std;

int main() {
	int n;cin>>n;
	string a,b;for(int j=0;j<n;j++){
	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;
	while(ans[0]=='0')
	{
		ans=ans.substr(1,ans.length()-1);
	}
	if(ans.length()>=80)cout<<"overflow"<<endl;
	else cout<<ans<<endl;}
	return 0;
}

C++: 
#include <iostream>
#include <cstring>
#define N 82

using namespace std;

void shift(char a[N]){
  int ln = strlen(a)-1;
  int i;
  for( i=N-2;i>=0;i-- ){
    if( ln>=0 )
      a[i] = a[ln--]-'0';
    else
      a[i]=0;
  }
}
void pr(char a[N]){
  int i;
  cout << "pr ";
  for( i=0;i<N-1;i++ ){
    cout << (int)a[i];
  }
  cout << endl;
}

int main(){
  int n, lp;
  char a[N],b[N], s[N];
  int i,c;

  cin >> n;
  cin.getline( a,N );
  //  cout << "n="<<n<<endl;
  for( lp=0;lp<n;lp++ ){
    //    cin >> a;
    //    cin >> b;
    cin.getline( a,N );
    cin.getline( b,N );

    //    cout << a << endl;
    //    cout << b << endl;

    shift(a); shift(b);
    //     pr(a);    pr(b);

    c=0;
    for( i=N-2;i>=0;i--){
      s[i]=a[i]+b[i]+c;
      if( s[i]>9 ){
	s[i]-=10;
	c=1;
      }else
	c=0;
    }

    if( s[0]!=0 )
      cout << "overflow" << endl;
    else{
      c=0;
      for( i=0;i<N-1;i++ ){
	if( c==0 && s[i]!=0 )
	  c=1;
	if( c==1 )
	  cout << (int)s[i];
      }
      cout << endl;
    }
  }

  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	int n;scanf("%d",&n);
	rep(i,n){
		string s,t;cin>>s>>t;
		string ans;
		int back=0;
		for(int j=1;j<=min(s.size(),t.size());j++){
			int d=s[s.size()-j]-'0'+t[t.size()-j]-'0'+back;
			ans=(char)(d%10+'0')+ans;
			back=d/10;
		}
		string u;
		if(s.size()>t.size())u=s;
		else u=t;
		for(int j=min(s.size(),t.size())+1;j<=u.size();j++){
			int d=u[u.size()-j]-'0'+back;
			ans=(char)(d%10+'0')+ans;
			back=d/10;
		}
		if(back)ans='1'+ans;
		if(ans.size()>80)puts("overflow");
		cout<<ans<<endl;
	}
}