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 <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,lengthof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

int main() {
	int n;
	cin >> n;
	while (n--){
		string s1, s2;
		cin >> s1 >> s2;
		string ans = "";
		int s1l = s1.length();
		int s2l = s2.length();
		bool up = false;
		REP(i, max(s1l, s2l)){
			int a = up ? 1 : 0;
			if (s1l - i - 1 >= 0)
				a += s1.c_str()[s1l - i - 1] - '0';
			if (s2l - i - 1 >= 0)
				a += s2.c_str()[s2l - i - 1] - '0';
			up = (a >= 10);
			ans = to_string(a % 10) + ans;
			if (max(s1l, s2l) - i-1 == 0 && up)ans = "1" + ans;
		}
		cout<<ans<<endl;
	}
}

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

std::string num_1, num_2;

void solver() {
    std::stack<char>ss_1, ss_2;
    std::stack<int> ss;
    bool flag=false;
    int tmp;
    for (int i=0; i<num_1.length(); i++) {
        ss_1.push(num_1[i]);
    }
    for (int j=0; j<num_2.length(); j++) {
        ss_2.push(num_2[j]);
    }

    while (!ss_1.empty() && !ss_2.empty()) {
        tmp = (ss_1.top() - '0') + (ss_2.top() - '0');
        ss_1.pop();
        ss_2.pop();

        if (flag) {
            tmp += 1;
        }
        ss.push(tmp % 10);

        flag = (tmp > 9) ? true:false;
    }
    if (ss_1.empty() && !ss_2.empty()) {
        while (!ss_2.empty()) {
            tmp = ss_2.top() - '0';
            if (flag) tmp += 1;

            ss.push(tmp % 10);
            ss_2.pop();
            flag = (tmp > 9) ? true:false;
        }
    } else if (ss_2.empty() && !ss_1.empty()) {
        while (!ss_1.empty()) {
            tmp = ss_1.top() - '0';
            if (flag) tmp += 1;

            ss.push(tmp % 10);
            ss_1.pop();
            flag = (tmp > 9) ? true:false;
        }
    }
    if (flag) ss.push(1);
    if (ss.size() > 80) {
        std::cout << "overflow" << std::endl;
    } else {
        while (!ss.empty()) {
            std::cout << ss.top();
            ss.pop();
        }
        std::cout << std::endl;
    }
}

int main(void) {
    int n;

    std::cin >> n;

    for (int i=0; i<n; i++) {
        std::cin >> num_1;
        std::cin >> num_2;
        solver();
    }

    return 0;
}

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

int main(){
	string sa,sb;
	int a[100],b[100],res[100],n;
	cin >> n;
	for(int i=0;i<n;i++){
		fill(a,a+100,0); fill(b,b+100,0); fill(res,res+100,0);
		cin >> sa >> sb;
		int a_len = sa.length(),b_len = sb.length(),res_len=0;
		if(a_len>80 || b_len>80){
			f:
			printf("overflow\n");
			continue;
		}
		for(int j=0;j<a_len;j++)
			a[j] = sa[a_len-1-j]-'0';
		for(int j=0;j<b_len;j++)
			b[j] = sb[b_len-1-j]-'0';
		for(int j=0;j<max(a_len,b_len);j++){
			res[j] += a[j]+b[j];
			res[j+1] = res[j]/10;
			res[j] %=10;
		}
		string s="";bool flag=false;
		for(int j=max(a_len,b_len);j>=0;j--){
			if(!flag && res[j]!=0){
				flag=true;
				if(j >=80) goto f;
			}
			if(flag){
				printf("%d",res[j]);
			}
		}
		printf("\n");
	}
}