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 <bits/stdc++.h>

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    REP(num, N)
    {
        string s1, s2, ans = "";
        cin >> s1 >> s2;

        int len1 = s1.size() - 1;
        int len2 = s2.size() - 1;
        int next = 0;

        int mlen = max(s1.size(), s2.size());

        REP(i, mlen)
        {
            int sum = 0;

            if (0 <= len1)
                sum += s1[len1--] - '0';

            if (0 <= len2)
                sum += s2[len2--] - '0';

            ans = (char)((sum + next) % 10 + '0') + ans;

            if (10 <= sum + next)
                next = 1;
            else
                next = 0;
        }

        if (ans.size() + next <= 80)
            cout << (next == 1 ? "1" : "") << ans << endl;
        else
            cout << "overflow" << endl;
    }

    return 0;
}

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

using namespace std;

int string_to_d(const string &s){
	int num = 0;
	if(!s.empty())
	for(int i=s.size()-1;i>=0;--i){
		if('1'<=s[i]&&s[i]<='9') num += (s[i]-'0')*pow(10,s.size()-i-1);
	}
	return num;
}

int main(void){
	int n;
	while(cin >> n){
		for(int a=0;a<n;++a){
			string s1,s2;
			cin >> s1 >> s2;
			int ex1num[10];//8*10=80桁
			int ex2num[10];
			int sum[10] = {0};
			for(int i=s1.size();i<80;++i) s1="0"+s1;
			for(int i=s2.size();i<80;++i) s2="0"+s2;
			for(int i=0;i<10;++i){
				ex1num[i] = string_to_d(s1.substr((10-i-1)*8,8));
				ex2num[i] = string_to_d(s2.substr((10-i-1)*8,8));
			}
			//ここまで正常
			int carry = 0;
			for(int i=0;i<10;++i){
				sum[i] = (ex1num[i]+ex2num[i]+carry)%(int)1e+008;
				carry = floor((ex1num[i]+ex2num[i]+carry)/(int)1e+008);
			}
			if(carry>0){
				cout << "overflow\n";
				continue;
			}
			bool zeroshow = false;
			for(int i=10;0<=i;--i){
				if(zeroshow&&sum[i]!=0) for(int j=0;j<7-(int)log10(sum[i]);j++) cout << "0";
				if(zeroshow&&sum[i]==0) for(int j=0;j<8;j++) cout << "0";
				if(sum[i]!=0) cout << sum[i];
				if(sum[i]>0) zeroshow = true;
			}
			cout << "\n";
		}
	}
	return 0;
}

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

int main(){
  int n;
  string s1,s2,ans;
  cin >> n;
  
  for(int i=0; i<n; i++){
    cin >> s1; 
    cin >> s2;
    ans = "";
    int m = max(s1.size(),s2.size());
    while(m>s1.size()) s1 = '0' + s1;
    while(m>s2.size()) s2 = '0' + s2;

    int carry = 0;
    for(int j=m-1; j>=0; j--){
      char ch = ((s1[j]-'0') + (s2[j]-'0') + carry)%10 + '0';
      carry = ((s1[j]-'0') + (s2[j]-'0') + carry)/10;
      ans += ch; //反転してしまうが…
    }
    if(carry) ans += (carry+'0');
    reverse(ans.begin(),ans.end()); //元通り

    //頭の0を削除していく
    while(ans.size()>1 && ans[0] == '0') ans.erase(ans.begin());
    if(ans.size() > 80) cout << "overflow" << endl;
    else cout << ans << endl;
  }
  return 0;
}

C++: //AOJ 0015

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		string s1, s2;
		cin >> s1;
		cin >> s2;
		reverse(s1.begin(), s1.end());
		reverse(s2.begin(), s2.end());
		
		int max;
		int diff;
		if(s1.size() > s2.size()) {
			max = s1.size();
			diff = s1.size() - s2.size();
			for(int i = 0; i < diff; i++)
				s2 += "0";
		}
		else {
			max = s2.size();
			diff = s2.size() - s1.size();
			for(int i = 0; i < diff; i++) {
				s1 += "0";	
			}
		} 
		//cout << s1 << endl;
		//cout << s2 << endl;
		string s;
		int kuriagari = 0;
		for(int i = 0; i < max; i++) {
			int flag = true;
			if((s1[i]-'0')+(s2[i]-'0') + kuriagari >= 10) flag = false;
			s += ((s1[i]-'0')+(s2[i]-'0')+kuriagari) % 10 + '0';
			if(flag == true) kuriagari = 0;
			else kuriagari = 1;
		}
		if(kuriagari == 1) s += "1";
		reverse(s.begin(), s.end());
		if(s.size() > 80) cout << "overflow" << endl;
		else {
			cout << s << endl;
		}
	} 
	return 0;
}