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(){
	int n,l1,l2,i;
	string a, b;
	char *ans;
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80){
			cout<<"overflow"<<endl;
			exit(0);
		}
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
				exit(0);
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		ans=new char[l1+1];
		for(i=0;i<l1;i++)ans[i]='0';
		for(i=1;i<l2+1;i++){
			ia=(int)a[l1-i]-(int)'0';
			ib=(int)b[l2-i]-(int)'0';
			sum=ia+ib;
			ans[l1-i]+=sum;
		}
		for(i=l2+1;i<l1+1;i++){
			ans[l1-i]=a[l1-i];
		}
		for(i=0;i<l1;i++){
			if(ans[i]-'0'>9){
				ans[i]=ans[i]-10;
				ans[i-1]+=1;
			}
		}
		for(i=0;i<l1;i++){
			cout<<(int)ans[i]-'0';
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
  string s,t, u;
  int n;
  char ch;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> s >> t;

    //    cout << "\ns=" << s << endl << "t=" <<  t << endl;

    if( s.length()>80 || t.length()>80 ){
      cout << "overflow" << endl;
      continue;
    }

    while( s.length()>t.length() )
      t = "0" + t;
    while( t.length()>s.length() )
      s = "0" + s;
    /*
    cout << "s=" << s << " len=" << s.length() << endl;
    cout << "t=" << t << " len=" << t.length() << endl;
    */
    u="";
    int c=0;
    for( int i=s.length()-1;i>=0;--i ){
      int a = s[i]-'0';
      int b = t[i]-'0';
      int sum = a + b + c;
      if( sum>=10 ){
	sum-=10; c=1;
      }else
	c=0;
      ch = sum + '0';
      u = ch + u;
    }
    if( c==1 )
      u = "1" + u;

    if( u.length()>80 )
      cout << "overflow" << endl;
    else
      cout << u << endl;
  }
  return 0;
}

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


string F(string a,string b)
{
    int i=0,CF=0,JG=0,loop=0;
    string c;
    char *pa,*pb;
    if (a.length()>b.length())
    {
        b.insert(b.begin(),a.length()-b.length(),0x30);
    }
    else
    {
        a.insert(a.begin(),b.length()-a.length(),0x30);
    }
    pb=(char*)a.c_str()+a.length()-1;
    pa=(char*)b.c_str()+b.length()-1;
    for (i=0;i<a.length() || i<b.length();i++)
    {
        JG=(*pa--)+(*pb--)+CF-0x60;
        CF=JG/10;
        JG%=10;
        c.insert(c.begin(),1,JG+0x30);
    }
    if (CF)
    {
        if (i<a.length())
        {
            JG=*pa+CF-0x30;
            CF=JG/10;
            JG%=10;
            c.insert(c.begin(),1,JG+0x30);
        }
        else
        {
            c.insert(c.begin(),1,CF+0x30);
        }
    }
    return c;
}
int main()
{
    int N,i;
    cin>>N;
    string a,b,sum;
    for (i=1;i<=N;i++)
    {
        cin>>a>>b;
        sum=F(a,b);
        if(sum.length()>80)
            cout<<"overflow"<<endl;
        else
            cout<<sum<<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	int n;
	cin >> n;
	for(int j=0;j<n;j++)
	{
		string s1,s2;
		vector<int> ans;
		cin >> s1;
		cin >> s2;
		reverse(s1.begin(),s1.end());
		reverse(s2.begin(),s2.end());
		int k=0;
		int p=max(s1.size(),s2.size());
		int len1=s1.size(),len2=s2.size();
		s1.resize(p+2);
		s2.resize(p+2);
		for(int i=len1;i<p+2;i++)
		{
			s1[i]='0';
		}
		for(int i=len2;i<p+2;i++)
		{
			s2[i]='0';
		}
		ans.resize(p+2);
		for(int i=0;i<p+2;i++)
		{
			ans[i]=((s1[i]-'0')+(s2[i]-'0')+k)%10;
			if((s1[i]-'0')+(s2[i]-'0')+k>=10)k=1;
			else k=0;
		}
		vector<int>::iterator it=ans.end();
		it--;
		int r=0;
		while(*it==0)
		{
			ans.erase(it);
			r++;
			it--;
		}
		ans.resize(p+2-r);
		reverse(ans.begin(),ans.end());
		for(int i=0;i<ans.size();i++)
		{
			cout << ans[i];
		}
		cout << endl;
	}
	return 0;
}