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 <iterator>
#include <typeinfo>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;++a) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define int_maxvalue numeric_limits<int>::max()
ll mod = 1e9 + 7;
string Addition(string a,string b) {
	string ans = "";
	int bef = 0;
	int be1 = 0;
	for (int i = a.length() - 1; i >= 0; i--) {
		int added = stoi(a.substr(i, 1)) + stoi(b.substr(i, 1))+be1;

		if (added >= 10) {
			bef = 1;
			added -= 10;
		}
		else {
			bef = 0;
		}

		ans = to_string(added)+ans;
		/*
		stringstream ss;
		ss << added;

		ans = ss.str() + ans;*/
		if (i == 0) 
		{
			break;
		}
		be1 = bef;
	}
	if (be1 == 1) {
		ans = "1" + ans;
	}
	return ans;
}
int main() {
	int n;
	cin >> n;
	rep(o1, n) {
		string a, b;
		cin >> a >> b;
		if (a.length() < b.length()) {
			swap(a, b);
		}
		string b1 = b;
		for (int i = 0; i < a.length() - b1.length(); ++i) {
			b = '0' + b;
		}
		string ans = Addition(a, b);
		if (ans.length() > 80) { cout << "overflow" << endl; }
		else {
			cout << ans << endl;
		}
	}
	return 0;
}

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

using namespace std;

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

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> sum(string A, string B);
int main() {
  int n;
  cin>>n;
  string a,b;
  for(int i=0;i<n;i++) {
    cin>>a;
    cin>>b;
    if((int)a.size()>80 || (int)b.size()>80)
      cout<<"overflow\n";
    else{
      vector<int> tmp=sum(a,b);
      if(tmp.size()>80)
	cout<<"overflow\n";
      else {
	string S="";
	for(int i=0;i<(int)tmp.size();i++) {
	 S+=to_string(tmp[i]);
	}
	cout<<S<<endl;
      }
    }
  }   
  return 0;
}
vector<int> sum(string A, string B) {
  int  a_size=A.size()-1;
  int  b_size=B.size()-1;
  int end=-1;
  vector<int> tmp;
  int Dr=0;
  while(true) {
    if(a_size<0 ){
      end=0;
      break;
    }
    if(b_size<0){
      end=1;
      break;
    }
    int a=(int)A[a_size]-(int)'0';
    int b=(int)B[b_size]-(int)'0';
    int n=a+b+Dr;
    if(n>=10){
      tmp.push_back(n-10);
      Dr=1;
    }
    else{
      Dr=0;
      tmp.push_back(n);
    }
    a_size--;
    b_size--;
  }

  if(end==0) {
    for(int i= b_size;i>=0;i--){
      int n=(int)B[b_size]-int('0')+Dr;
      if(n>=10) {
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  else if(end==1){
    for(int i=a_size;i>=0;i--){
      int n=(int)A[a_size]-int('0')+Dr;
      if(n>=10){
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  if(Dr==1)
    tmp.push_back(1);
  reverse(tmp.begin(),tmp.end());
  return tmp;
}

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

int main(void){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		string a,b,ans;
		cin >> a;
		cin >> b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int c=0;
		for(int j=0;j<max(a.size(),b.size())+1;j++){
			string d;
			int e;
			e=c;
			if(a.size()>j)e+=a[j]-'0';
			if(b.size()>j)e+=b[j]-'0';
			c=0;
			if(e>=10)c=1,e-=10;
			d=e+'0';
			ans+=d;
		}
		reverse(ans.begin(),ans.end());
		if(ans.size()<=80)cout << ans << endl;
		else cout << "overflow" << endl;
	}
    return 0;
}