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 <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <string.h>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define REP(i,e) for (int i = 0; i != int(e); i++)
#define FORIT(i, A) for (auto i : A)
#define ISEQ(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << endl
#define SZ(x) ((int)(x).size())

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d", &n);
	REP(i, n)
	{
		char buf1[101], buf2[101];
		memset(buf1, 0, 101);
		memset(buf2, 0, 101);
		char sum[101];
		memset(sum, 0, 101);
		scanf("%s", buf1);
		scanf("%s", buf2);
		int l, l1 = 0, l2 = 0;
		for (l = 0; l < 100; l++)
		{
			if (buf1[l] == '\0' && l1 == 0)
			{
				l1 = l;
			}
			if (buf2[l] == '\0' && l2 == 0)
			{
				l2 = l;
			}
			if (l1 > 0 && l2 > 0) break;
		}
		l1--;
		l2--;
		l = (l1 > l2) ? l1 : l2;
		if (l >= 80)
		{
			printf("overflow\n");
			continue;
		}
		l++;
		bool plus = false;
		for (;l >= 0; l--)
		{
			int v1 = (l1 >= 0) ? buf1[l1] - '0': 0;
			int v2 = (l2 >= 0) ? buf2[l2] - '0': 0;
			int v = v1 + v2 + ((plus) ? 1 : 0);
			if (v > 9) 
			{
				plus = true;
				v -= 10;
			}
			else
			{
				plus = false;
			}
			sum[l] = '0' + v;
			l1--;
			l2--;
			if (l1 < 0 && l2 < 0 && !plus) break;
		}
		if (sum[0] == '\0')
		{
			printf("%s\n", &sum[1]);
		}
		else if (sum[80] != 0)
		{
			printf("overflow\n");
		}
		else
		{
			printf("%s\n", sum);
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;

int n;
string a;
string b;

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		cin >> a;
		cin >> b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());

		if (a.length() > 80 || b.length() > 80) {
			cout << "overflow" << endl;
			continue;
		}

		string ans;
		int alen = a.length();
		int blen = b.length();
		if (alen > blen) {
			for (int i = 0; i < alen - blen; i++) {
				b += '0';
			}
		}
		else {
			for (int i = 0; i < blen - alen; i++) {
				a += '0';
			}
		}

		int k = 0;
		for (int i = 0; i < a.length(); i++) {
			int ai = a[i] - '0';
			int bi = b[i] - '0';
			int ci = ai + bi + k;
			ans += ci % 10 + '0';
			k = ci / 10;
		}
		if (k != 0)ans += k+'0';
	
		if (ans.length() > 80) {
			cout << "overflow" << endl;
			continue;
		}
		reverse(ans.begin(), ans.end());
		for (int i = 0; i < ans.length(); i++) {
			cout << ans[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, j, n;
  int len1, len2;
  char tmp;

  scanf("%d",&n);
  rep(i,n){
    string str1, str2, res;
    cin >> str1;
    cin >> str2;

    vector<int> a(200, 0), b(200, 0);
    len1 = (int)str1.size(); len2 = (int)str2.size();
    rep(j,len1) a[j] = str1[(int)len1-1-j] - '0';
    rep(j,len2) b[j] = str2[(int)len2-1-j] - '0';

    rep(j,200){
      int sum = a[j] + b[j];
      if(sum >= 10){ sum %= 10; a[j+1]++;}
      res += (sum + '0');
    }

    reverse(res.begin(), res.end());
    int f = 0;
    rep(j,res.size()){
      if(res[j] != '0') f = 1;
      if(f && res.size()-j > 80){
        cout << "overflow" << endl;
        return 0;
      }
      if(f) cout << res[j];
    }

    cout << endl;
  }

  return 0;
}