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 <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <string>
#include <climits>

#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define PRINT(STR) cout << (STR) << endl

typedef long long ll;
using namespace std;

double nextDouble() {
	double d = -1;
	cin >> d;
	return d;
}

int nextInt() {
	int n = -1;
	cin >> n;
	return n;
}

string nextString() {
	string str;
	cin >> str;
	return str;
}

string reverse(string str) {
	string t = str;
	for (int i = 0; i < str.size(); i++) {
		t[i] = str[str.size() - i - 1];
	}
	return t;
}

int main() {
	cin.tie(0); //対話型には使えない
	int n = nextInt();
	while (n--) {
		string str1 = nextString();
		string str2 = nextString();
		str1 = reverse(str1);
		str2 = reverse(str2);
		char ans[81];
		int m = max(str1.size(), str2.size());
		if (m >= 80) {
			cout << "overflow" << endl;
			continue;
		}
		int k = 0;
		int i;
		for (i = 0; i < m; i++) {
			int t = 0;
			if (i < str1.size()) {
				t += str1[i] - '0';
			}
			if (i < str2.size()) {
				t += str2[i] - '0';
			}
			t += k;
			ans[i] = (t % 10) + '0';
			k = t / 10;
		}
		if (k != 0) {
			if (i >= 80) {
				cout << "overflow" << endl;
				continue;
			}
			ans[i] = k + '0';
			ans[i + 1] = '\0';
		} else {
			ans[i] = '\0';
		}
		cout << reverse(ans) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int k = 0, n;
string s, t, u;
vector<string> ans;

int main(){
	cin >> n;
	REP(j, n){
		cin >> s >> t;
		k = 0;
		if (s.size() > 80 || t.size() > 80){
			cout << "overflow" << endl;
			continue;
		}
		reverse(ALL(s));
		reverse(ALL(t));
		while (s.size() != t.size()){
			if (s.size() > t.size()) t += "0";
			else s += "0";
		}
		reverse(ALL(s));
		reverse(ALL(t));
		REP(i, s.size()){
			int x = (s[s.size() - 1 - i] - '0') + (t[s.size() - 1 - i] - '0');
			string q;
			stringstream ss;
			if (i != s.size() - 1){
				ss << ((x + k) % 10);
			}
			else{
				ss << x + k;
			}
			ss >> q;
			ans.push_back(q);
			if (x + k >= 10){
				k = (x + k) / 10;
			}
			else{
				k = 0;
			}
		}
		reverse(ALL(ans));
		REP(i, ans.size()){
			u += ans[i];
		}
		if (u.size() > 80)cout << "overflow" << endl;
		else cout << u << endl;
		u = "";
		ans.clear();
	}
}

//int a[110], b[110], ans[110];
//string s, t;
//int n;
//
//int main(){
//	cin >> n;
//	while (n--){
//		cin >> s >> t;
//		if (s.size() > 80 || t.size() > 80){
//			cout << "overflow\n";
//			continue;
//		}
//		REP(i, s.size())a[i] = s[s.size() - 1 - i] - '0';
//		REP(i, t.size())b[i] = t[t.size() - 1 - i] - '0';
//		ll k = 0;
//		REP(i, 101){
//			ans[i] = (a[i] + b[i] + k) % 10;
//			k = (a[i] + b[i] + k) / 10;
//		}
//		if (ans[80] != 0){
//			cout << "overflow\n";
//			continue;
//		}
//		for (int i = max(s.size(), t.size()); i >= 0; i--){
//			if (i == max(s.size(), t.size())){
//				if (ans[i] != 0){
//					cout << ans[i];
//				}
//			}
//			else{
//				cout << ans[i];
//			}
//		}
//		cout << endl;
//		REP(i, 101){
//			ans[i] = 0;
//			a[i] = 0;
//			b[i] = 0;
//		}
//	}
//}

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

int main(){
  int j;
  char s1[102] = {0};
  char tmp[102] = {0};
  char s2[102] = {0};
  char ans[102];
  int  kuri = 0 ;
  memset(ans,0,sizeof(ans));
  cin >> s1 >> s2;
  if(strlen(s1) < strlen(s2)){
    strcpy(tmp,s1);
    strcpy(s1,s2);
    strcpy(s2,tmp);
  }
  for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
  for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
  for(int i=0;i<strlen(s1);i++){
    if((s1[i] + (s2[i]%'0') + kuri) > '9'){
      ans[i] = (s1[i] + (s2[i]%'0') + kuri)-10;
      kuri = 1;
    }
    else {
      ans[i] = (s1[i] + (s2[i]%'0') + kuri);
      kuri = 0;
    }
    if(i == strlen(s1)-1 && kuri == 1) ans[i+1] = '1';
  }
  for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
  cout << endl;
}