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 <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define rep(i,n) for(int i=0;i<(n);i++)
#define tr(it,container) for(typeof(container.begin()) it = container.begin(); \
                             it != container.end(); ++it)
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;

// up right down left
const int dy[] = {-1,0,1,0};
const int dx[] = {0,1,0,-1};

const double EPS = 1e-9;
const int days[]     = {31,28,31,30,31,30,31,31,30,31,30,31};
const int daysleap[] = {31,29,31,30,31,30,31,31,30,31,30,31};

int main(){
    int k;
    cin >> k;
    for(int kk = 0;kk<k;kk++){
        string a,b;
        cin >> a;
        cin >> b;

        string ret;

        int n = max(a.size()+1,b.size()+1);
        {
            stringstream ss;
            ss << setfill('0') << setw(n) << a;
            ss >> a;
        }
        {
            stringstream ss;
            ss << setfill('0') << setw(n) << b;
            ss >> b;
        }
        string c;
        c.resize(n);
        int up = 0;
        for(int i=a.size()-1;i>=0;i--){
            int now = a[i]-'0' + b[i]-'0' + up;
            if(now >= 10){
                up = now / 10;
                now -= 10;
            }else{
                up = 0;
            }
            c[i] = now+'0';
        }
        string s;
        for(int i=0;i<n;i++){
            if(c[i] != '0'){
                for(int j=i;j<n;j++){
                    s += c[j];
                }
                goto end;

            }
        }
    end:
        cout << s << endl;
    }
    return 0;
}

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

string findSum(string str1, string str2)
{
    if (str1.length() > str2.length())
        swap(str1, str2);

    string str = "";

    int n1 = str1.length(), n2 = str2.length();
    int diff = n2 - n1;

    int carry = 0;

    for (int i = n1 - 1; i >= 0; i--)
    {
        int sum = ((str1[i] - '0') +
                   (str2[i + diff] - '0') +
                   carry);
        str.push_back(sum % 10 + '0');
        carry = sum / 10;
    }

    for (int i = n2 - n1 - 1; i >= 0; i--)
    {
        int sum = ((str2[i] - '0') + carry);
        str.push_back(sum % 10 + '0');
        carry = sum / 10;
    }

    if (carry)
        str.push_back(carry + '0');

    string s_str = "";
    for (int i = str.length() - 1; i >= 0; i--)
    {
        s_str.push_back(str[i]);
        str[i] = '\0';
    }

    return s_str;
}

int main(void)
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string a, b;
        cin >> a >> b;
        if (80 < a.length() || 80 < b.length())
        {
            cout << "overflow" << endl;
        }
        else
        {

            string s = findSum(a, b);
            if (80 < s.length())
            {
                cout << "overflow" << endl;
            }
            else
            {
                cout << s << endl;
            }
        }
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
    string a, b;
    vector<int> ans;

    int n, num, ai, bi, c = 0;

    bool flag;

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

	for (int j = 0; j < 100; j++){
	    num = 0;
	    ai = a.size() - j - 1;
	    bi = b.size() - j - 1;
	    if (ai < 0 && bi < 0 && c == 0) break;

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

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