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<vector>
using namespace std;

int main() {
	int n,x1,x2,y1,y2,p,q,a=0,b=0;
	vector<int> E,F;
	vector<long long int> S, T;
	vector<vector<long long int>> I,J;
	string s, t;
	vector<string> U;
	vector<vector<string>> UU;

	cin >> n;
	for (int k = 0; k < n; k++) {
		cin >> s >> t;
		int f = 0;
		if (s.size() > 80 || t.size() > 80) {
			f = 1;
			F.push_back(f);
		}
		else F.push_back(0);
		x1 = s.size() % 10; y1 = (s.size()+9) / 10;p = 8 - y1;
		for (int i = 0; i < p; i++)S.push_back(0);
		if (x1 == 0) for (int i = 0; i < y1; i++)S.push_back(stoll(s.substr(i * 10, 10)));
		else {
			S.push_back(stoll(s.substr(0, x1)));
			for (int i = 1; i < y1; i++)S.push_back(stoll(s.substr(x1 + (i-1) * 10, 10)));
		}

		x2 = t.size() % 10; y2 = (t.size()+9) / 10;q = 8 - y2;
		for (int i = 0; i < q; i++)T.push_back(0);
		if (x2 == 0) for (int i = 0; i < y2; i++)T.push_back(stoll(t.substr(i * 10, 10)));
		else {
			T.push_back(stoll(t.substr(0, x2)));
			for (int i = 1; i < y2; i++)T.push_back(stoll(t.substr(x2 + (i-1) * 10, 10)));
		}
		I.push_back(S); S.clear();
		J.push_back(T); T.clear();
	}
	for (int k = 0; k < I.size(); k++) {
		for (int i = 0; i < 8; i++) U.push_back(to_string(I[k][i] + J[k][i]));
		UU.push_back(U); U.clear();
	}
	
	for (int k = 0; k < I.size(); k++) {
		for (int i = 7; i >= 0; i--) {
			UU[k][i] = to_string(stoll(UU[k][i]) + b);
			if (UU[k][i].size() == 11 && i == 0) {
				UU[k][i] = "a";
				b = 1;
			}
			else if (UU[k][i].size() == 11) {
				UU[k][i] = UU[k][i].substr(1, 10);
				b = 1;
			}
			else if (UU[k][i].size() < 10) {
				for (int j = 0; j < 10 - UU[k][i].size()+j; j++) UU[k][i] = "0" + UU[k][i];
				b = 0;
			}
			else b = 0;
		}
		b = 0;
	}

	for (int k = 0; k < UU.size(); k++) {
		int e = 0;
		for (int i = 0; i < UU[k].size(); i++) {
			if (UU[k][i] == "a") {
				e = 100;
				E.push_back(e);
				break;
			}
			else if (stoll(UU[k][i]) == 0);
			else {
				e = i;
				E.push_back(e);
				break;
			}
		}
	}

		for(int k=0;k<UU.size();k++){
			if (E[k] == 100)cout << "overflow";
			else if (F[k] == 1)cout << "overflow";
			else {
				cout << stoll(UU[k][E[k]]);
				for (int i = E[k]+1; i < UU[k].size(); i++) cout << UU[k][i];
			}
			cout << 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(itr,c) 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, n;
  vector<int> ans;
  int num,ai,bi, c =0;
  bool f;
  string a, b;

  cin >> n;
  while(n--){
    cin >> a >> b;
    f = false;

    rep(i,100){
      num = 0;
      ai = a.size()-i-1;
      bi = b.size()-i-1;
      if(ai < 0 && bi < 0 && c == 0 ) break;

      if(ai >= 0) num += a[ai] - '0';
      if(bi >= 0) num += b[bi] - '0';
      ans.push_back((num + c) % 10);
      if(num+c >= 10) c = 1;
      else c = 0;
    }

    if(ans.size() > 80){
      f = true;
    }
    if(f) printf("overflow");
    else{
      for(int j = ans.size()-1; j >= 0; j--){
        printf("%d",ans[j]);
      }
    }
    printf("\n");
  }

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<sstream>
#include<string>
using namespace std;
int main(){
	int n;
	for(cin>>n;n--;){
		string a,b;
		cin>>a;
		cin>>b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		while(a.size()<b.size())a+='0';
		while(b.size()<a.size())b+='0';
		int f=0;
		for(int i=0;i<a.size();i++){
			if(a[i]+(b[i]-'0')+f>'9'){
				a[i]+=+(b[i]-'0')+f-10;
				f=1;
			}else{
				a[i]+=+(b[i]-'0')+f;
				f=0;
			}
		}
		reverse(a.begin(),a.end());
		if(f)a="1"+a;
		if(a.size()>80){
			cout<<"overflow"<<endl;
		}else{
			for(int i=0;i<a.size();i++){
				if(a[i]!=0)
				cout<<a[i];
			}
			cout<<endl;
		}
	}
	return 0;
}