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<stdio.h>
#include <algorithm>
#include<string.h>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		ie[0]=strlen(in[0])-1;
		ie[1]=strlen(in[1])-1;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;ien[!NMin]+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]-'0';
				if(in[NMin][ien[NMin]]>9+'0'){
					in[NMin][ien[NMin]]-=10;
					in[NMin][ien[NMin]-1]  +=1;
				}
			}
			max10=0;
			for(;ien[NMin]>-1;ien[NMin]--){
				if(in[NMin][ien[NMin]]>9+'0'){
					in[NMin][ien[NMin]]-=10;
					in[NMin][ien[NMin]-1]+=1;
					max10=1;
				}else{
					max10=0;
				}
			}
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

void solve() {
	int n;
	cin >> n;
	rep(i, n) {
		vector<ll> v1(11), v2(11);
		string s1, s2;
		cin >> s1 >> s2;
		rep(j, 10) {
			if (s1.size() > 10 * j) v1[j] = stoi(s1.substr(10 * j, (s1.size() - 10 * j >= 10 ? 10 : s1.size() - 10 * j)));
			if (s2.size() > 10 * j) v2[j] = stoi(s2.substr(10 * j, (s2.size() - 10 * j >= 10 ? 10 : s2.size() - 10 * j)));
		}
		rep(j, 11) {
			v1[j] += v2[j];
			if (v1[j] >= 1e10) {
				v1[j] -= 1e10;
				v2[j]++;
			}
		}
		if (v1[8] || v1[9] || v1[10]) cout << "overflow" << endl;
		else {
			rep(j, 11) if (v1[10 - j] != 0) cout << v1[10 - j];
			cout << endl;
		}
	}

}




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


	solve();
	//system("PAUSE");
	return 0;
}

C++: #include <iostream>
#define MAX 80

#include <string>

using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int counter = 0; counter < n; counter++){
		string a, b;
		cin >> a >> b;
		if (a.length() > MAX || b.length() > MAX){
			cout << "overflow" << endl;
			continue;
		}
		int inta[MAX + 2], intb[MAX + 2], sum[MAX + 2];
		fill(inta, inta + MAX + 2, 0);
		fill(intb, intb + MAX + 2, 0);
		fill(sum, sum + MAX + 2, 0);
		for (int i = 0; i < (signed)a.length(); i++){
			inta[i] = a[a.length() - i - 1] - '0';
		}
		for (int i = 0; i < (signed)b.length(); i++){
			intb[i] = b[b.length() - i - 1] - '0';
		}
		
		int over = 0;
		for (int i = 0; i < MAX + 2; i++){
			sum[i] = inta[i] + intb[i] + over;
			if (sum[i] >= 10){
				sum[i] -= 10;
				over = 1;
			}
			else{
				over = 0;
			}
		}

		for (int i = MAX + 1;; i--){
			if (sum[i] != 0){
				if (i >= MAX){
					cout << "overflow" << endl;
					break;
				}
				for (int j = i; j >= 0; j--){
					cout << sum[j];
				}
				cout << endl;
				break;
			}
		}
	}
	return 0;
}

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

constexpr int MAX_DIGIT = 80;
constexpr int OVERFLOW = 20;

int main()
{
    int data_num;
    cin >> data_num;

    while (data_num--) {
        string in01_str, in02_str;
        cin >> in01_str >> in02_str;

        vector<int> in01(MAX_DIGIT + OVERFLOW, 0), in02(MAX_DIGIT + OVERFLOW, 0);
        for (unsigned i = 0; i < in01_str.size(); i++) {
            in01.at(i) = in01_str.at(in01_str.size() - 1 - i) - '0';
        }
        for (unsigned i = 0; i < in02_str.size(); i++) {
            in02.at(i) = in02_str.at(in02_str.size() - 1 - i) - '0';
        }

        if (in01.at(MAX_DIGIT) != 0 || in02.at(MAX_DIGIT) != 0) {
            cout << "overflow" << endl;
        }

        vector<int> out(MAX_DIGIT + OVERFLOW, 0);
        for (unsigned i = 0; i < MAX_DIGIT; i++) {
            out.at(i) += in01.at(i) + in02.at(i);
            if (out.at(i) / 10 != 0) {
                out.at(i) -= 10;
                out.at(i + 1)++;
            }
        }

        if (out.at(MAX_DIGIT) != 0) {
            cout << "overflow" << endl;
            continue;
        }

        while (out.at(out.size() - 1) == 0 && out.size() != 1) {
            out.erase(out.end() - 1);
        }

        for (unsigned i = 0; i < out.size(); i++) {
            cout << out.at(out.size() - 1 - i);
        }
        cout << endl;
    }
}