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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef vector<int> vi;

int n;
string s1, s2;
char n1[81], n2[81], sum[81];

int main() {
	scanf("%d", &n);
	rep(i,n) {
		memset(n1, 0, sizeof(n1));
		memset(n2, 0, sizeof(n2));
		memset(sum, 0, sizeof(sum));

		cin>>s1>>s2;
		int l1 = s1.size();
		int l2 = s2.size();
		rep(k,l1) n1[k] = s1[l1-k-1] - '0';
		rep(k,l2) n2[k] = s2[l2-k-1] - '0';

		char a = 0;
		rep(i,80) {
			char c = n1[i] + n2[i] + a;
			a = c / 10;
			sum[i] = c % 10;
		}

		bool start = false;
		repd(i,80,0) {
			if(sum[i] != 0) start = true;
			if(!start && sum[i] == 0) continue;
			printf("%d", sum[i]);
		}
		printf("\n");
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void){
	string s[55][2];
	int ans[100],k,i,p,q;
	bool flag;
	cin >> q;
	for(p=0; p<q; p++){
		cin >> s[p][0];
		cin >> s[p][1];
		fill(ans,ans+100,0);
		if( s[p][0].length()>80 || s[p][1].length()>80 ){
			cout << "overflow" << endl;
			continue;
		}
		for(k=0; k<2; k++){
			reverse(s[p][k].begin(),s[p][k].end());
			for(i=(s[p][k].length()-1); i>=0; i--){
				ans[i] += (s[p][k][i] - '0');
			}
		}
		for(i=0; i<80; i++){
			ans[i+1] += (ans[i]/10);
			ans[i] %= 10;
		}
		flag = true;
		for(i=99; i>79; i--){
			if(ans[i] != 0){
				cout << "overflow" << endl;
				flag = false;
				break;
			}
		}
		if(!flag){
			continue;
		}
		flag = false;
		for(i=79; i>=0; i--){
			if(flag){
				cout << ans[i];
			}else if(ans[i]!=0){
				cout << ans[i];
				flag = true;
			}
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main(){
	int n; cin >> n;
	while (n--) {
		string a, b; cin >> a >> b;
		reverse(all(a));
		reverse(all(b));
		if (a.size() < b.size() ) swap(a, b);
		int u = 0;
		string s;
		rep(i, b.size()) {
			int d = a[i] - '0' + b[i] - '0' + u;
			u = d / 10;
			s += d % 10 + '0';
		}
		REP(i, b.size(), a.size() - 1) {
			int d = a[i] - '0' + u;
			u = d / 10;
			s += d % 10 + '0';
		}
		if(u) s += '1';
		reverse(all(s));
		if(s.size() > 80) cout << "overflow" << endl;
		else cout << s << endl;
		
	}
	return 0;
}