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 <string.h>
#include <algorithm>
#include <stack>
using namespace std;

int main(){
	int n,i,j,flag;
	char ch1[100],ch2[100];
	cin >> n;
	fgets(ch1,100,stdin);
	for(i = 0;i < n;i++){
		fgets(ch1,100,stdin);
		fgets(ch2,100,stdin);
		if(strlen(ch1) > 80 || strlen(ch2) > 80){
			cout << "overflow" << endl;
		}
		else {
			stack<int> st1,st2,sum;
			sum.push(0);
			for(j = 0;j < strlen(ch1) - 1;j++) st1.push(ch1[j] - '0');
			for(j = 0;j < strlen(ch2) - 1;j++) st2.push(ch2[j] - '0');
			while(!st1.empty() || !st2.empty()){
				if(st1.empty()) st1.push(0);
				if(st2.empty()) st2.push(0);
				flag = sum.top();
				sum.pop();
				sum.push((st1.top() + st2.top() + flag) % 10);
				sum.push((st1.top() + st2.top() + flag) / 10);
				st1.pop();
				st2.pop();
			}
			if(!sum.top()) sum.pop();
			for(;!sum.empty();) {
				cout << sum.top();
				sum.pop();
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		string a,b,c;
		int d=0,st;
		cin>>a>>b;
		for(int j=a.size();j<81;++j) a="0"+a;
		for(int j=b.size();j<81;++j) b="0"+b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		for(int j=0;j<80;++j){
			c+=((a[j]-'0')+(b[j]-'0')+d)%10+'0';
			d=((a[j]-'0')+(b[j]-'0')+d)/10;
		}
		if(d>0) cout<<"overflow\n";
		else{
			reverse(c.begin(), c.end());
			for(st=0;st<c.size();++st)if(c[st]!='0')break;
			cout<<((st==c.size())?"0\n":c.substr(st,c.size()-st)+"\n");
		}
	}
	return 0;
}

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

using namespace std;

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

    while (n--) {
        string a, b, res;
        cin >> a >> b;

        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());

        int max_size = max(a.size(), b.size());

        for (int i = a.size(); i < max_size; i++) {
            a += '0';
        }
        for (int i = b.size(); i < max_size; i++) {
            b += '0';
        }

        int c = 0;
        for (int i = 0; i < max_size; i++) {
            int lhs = a[i] - '0';
            int rhs = b[i] - '0';
            c = lhs + rhs + c;
            res.push_back(c % 10 + '0');
            c /= 10;
        }

        if (c > 0) {
            res.push_back(c + '0');
        }

        reverse(res.begin(), res.end());

        if (res.size() > 80) {
            cout << "overflow" << endl;
        } else {
            cout << res << endl;
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <cstring>
int func()
{
	char i1[81]="",i2[81]="",res[81]="";
	bool cflag=false;
	std::string tmp;
	std::cin >> tmp;
	if(tmp.size()>80){
		std::cin >> tmp;
		return -1;
	}
	strcpy(i1,tmp.c_str());
	std::cin >> tmp;
	if(tmp.size()>80)
		return -1;
	strcpy(i2,tmp.c_str());
	for(int j=0;j<80;j++){
		char c='0';
		if(cflag)
			c+=1;
		cflag=false;
		if(strlen(i1)>j){
			c+=i1[strlen(i1)-j-1]-'0';
		}
		if(strlen(i2)>j){
			c+=i2[strlen(i2)-j-1]-'0';
		}
		if(c > '9'){
			cflag=true;
			c-=10;
		}
		res[79-j]=c;
	}

	if(cflag)
		return -1;
	char *p = res;
	while(*p++ == '0');
	std::cout << (p-1) << std::endl;

	return 0;
}
int main(void){
	int n;
	std::cin >> n;
	for(int i=0; i<n; i++)
		if(func()==-1)
			std::cout << "overflow" << std::endl;

}

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

string reverse(const string& str) {
	string ret;
	string::const_reverse_iterator it = str.rbegin();
	for (; it != str.rend(); it++) {
		ret.push_back(*it);
	}
	return ret;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string S1;
		string S2;
		int overflow = 0;
		cin >> S1 >> S2;
		if (S1.size() > 80 || S2.size() > 80) {
			cout << "overflow";
		}
		else {
			S1 = reverse(S1);
			S2 = reverse(S2);
			S1.resize(80, '0');
			S2.resize(80, '0');
			int a = 0;
			for (int i = 0; i < 80; i++) {
				S1[i] += S2[i] - '0';
				if (S1[i] > '9') {
					if (i + 1 > 79) {
						cout << "overflow";
						overflow++;
					}
					S1[i + 1] += 1;
					S1[i] -= 10;
				}
				if (S1[i] != '0')
					a = i;
			}
			S1 = reverse(S1);
			if (overflow == 0)
				for (int i = 79 - a; i < 80; i++) {
					cout << S1[i];
				}
		}
		cout << endl;
	}
	return 0;
}