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 <cmath>
#include <cstdlib>
#include <cstdio>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>



int main() {

  std::string a, b;
  long x[100] = {};
  long y[100] = {};
  long N;
  long temp;
  long len;

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> a >> b;
    for(int j = 0; j < 100; ++j) {
      x[j] = y[j] = 0;
    }
    for(int j = 0; j < a.size(); ++j) x[j] = a[ a.size()-j-1 ] - '0';
    for(int j = 0; j < b.size(); ++j) y[j] = b[ b.size()-j-1 ] - '0';

    temp = 0;
    for(int j = 0; j < 100; ++j) {
      temp = x[j] + y[j] + temp;
      x[j] = (temp % 10);
      temp /= 10;
    }

    len = std::max(a.size(), b.size());
    if( x[len] != 0 ) {
      if( len >= 80 ) { 
	std::cout << "overflow" << std::endl;
	continue;
      }
      for(int j = len; j >= 0; --j) {
	std::cout << x[j];
      }
      std::cout << std::endl;
      continue;
    }
    for(int j = len-1; j >= 0; --j) {
      std::cout << x[j];
    }
    std::cout << std::endl;
  }
    
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<numeric>
#include<vector>
#include<cstdio>
#include<climits>
#include<cfloat>
#include<cstring>
#define foreach(t,p) for(t::iterator it=p.begin();it!=p.end();++it)
#define rforeach(t,p) for(t::reverse_iterator it=p.rbegin();it!=p.rend();++it)
#define all(p) p.begin(),p.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define FOREACH(t,p,tit) for(t::iterator tit=p.begin();tit!=p.end();++tit)
using namespace std;
int main()
{
    int n;
    cin>>n;
    rep(k,n)
    {
        string s1,s2,temp;
        cin>>s1; cin>>s2;
        if(s1.size()<s2.size()){temp=s1;s1=s2;s2=temp;}
        int d = s1.size()-s2.size();
        rep(i,d){ s2 = "0" + s2;}
        //cout << s1<<"\n"<<s2<<endl;
        int ku=0;
        for(int i=s1.size()-1;i>-1;i--)
        {
            int next =0;
            if( (int)(s2[i]-'0'+s1[i]-'0')+ku >= 10){next = 1;}
            s1[i] =(( (int)(s2[i]-'0'+s1[i]-'0' ) +ku) % 10 + '0');
            ku = next;
            //cout << s1[i];
        }
        if(ku+s1.size()>80){cout <<"overflow"<<endl;continue;}
        if(ku)cout<<1;
        cout << s1<<endl;

    }
    return 0;
}

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

int main(){
  int n;
  string a,b;
  cin>>n;
  for(int j=0;j<n;j++){
    cin>>a>>b;
    int asize=a.length();
    int bsize=b.length();
    int smax=max(asize,bsize);
    bool flag=false;
    int s;
    stringstream ss;
    for(int i=0;i<smax;i++){
      if(asize-i-1<0) s=strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      else if(bsize-i-1<0) s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0);
      else s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0)+strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      if(flag) s++;
      ss<<s%10;
      if(s>9)
	flag=true;
      else
	flag=false;
    }
    if(flag) cout<<1;
    string ans=ss.str();
    for(string::reverse_iterator rit=ans.rbegin();rit!=ans.rend();rit++)
    cout<<*rit;
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#define x 81
using namespace std;

int main(){
	int n;
	cin >> n;
	cin.ignore();
	for(int i=0;i<n;i++){
		string a,b;
		getline(cin,a);
		getline(cin,b);
		bool c = false;
		if(a.size()>=x) c = true;
		if(b.size()>=x) c = true;
		int p[x];
		int k = 0;
		for(int j=0;j<x;j++){
			p[j] = k;
			int s = a.size()-j-1;
			int t = b.size()-j-1;
			string f;
			string g;
			if(s>=0) f = a.substr(s,1);
			if(t>=0) g = b.substr(t,1);
			if(s>=0) p[j] += atoi(f.c_str());
			if(t>=0) p[j] += atoi(g.c_str());
			if(p[j]>=10){ p[j] -= 10; k = 1; }
			else k = 0;
			if(k*j==79) c = true;
		}
		if(c) cout << "overflow" << endl;
		else{
			int d = x-1;
			while(p[d]==0){ d--; }
			if(d<0) cout << 0 << endl;
			else{
				for(int j=d;j>=0;j--) cout << p[j];
				cout << endl;
			}
		}
	}
}