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 <string>
#include <algorithm>
using namespace std;
int main(){
	int n,m;
	string aindex, bindex, ans;
	cin >> m;
	n = 0;
	string a,b;
	for(int j = 0; j < m; j++){
		cin >> a >> b;
		if(a.size()>80||b.size()>80){
			cout << "overflow" << endl;
		}else{
			for(int i = 0; i< max(a.size(),b.size()); i++){
				if(a.size()-i > 0){
					aindex = a[a.size()-i];
				}else{
					aindex = "0";
				}
				if(b.size()-i > 0){
					bindex = b[b.size()-i];
				}else{
					bindex = "0";
				}
				n = stoi(aindex) + stoi(bindex) + (n-n%10==10);
				aindex = to_string(n%10);
				ans = aindex + ans;
			}
			if(ans.size()>80){
				cout << "overflow" << endl;
			}else{
				cout << ans << endl;
			}	
		}
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <string>
using namespace std;

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

int main(){
    int n;
    cin >> n;
    for(int i=0; i < n; i++){
        string ans;
        string p, q;
        cin >> p >> q;
        if(p.size() < q.size()) swap(p, q);
        int diff = p.size()-q.size();
        for(int i=0; i < diff; i++){
            q = '0' + q;
        }
        p = '0' + p; q = '0' + q;
        int up = 0;
        for(int i=p.size()-1; 0 <= i || up != 0; i--){
            int m = atoi(p.substr(i,1).c_str()) + atoi(q.substr(i, 1).c_str());
            ans = IntToString((m+up)%10) + ans;
            up = (m+up)/10;
        }
        if(ans[0] == '0') ans = ans.substr(1, ans.size()-1);
        cout << ans << endl;
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    int n;
    cin >> n;
    REP(i, n){
    	string s1, s2;
    	cin >> s1 >> s2;
    	int len1 = s1.length(), len2 = s2.length();
    	if (len1 > 80 || len2 > 80) {
    		cout << "overflow" << endl;
    	} else {
    		int num1[100] = {0}, num2[100] = {0}, ans[100] = {0};
    		REP(j, len1){
    			num1[j] = s1[len1-1-j] - '0';
    		}
    		REP(j, len2){
    			num2[j] = s2[len2-1-j] - '0';
    		}
    		int ll = len1 > len2 ? len1 : len2;
    		REP(j, ll){
    			ans[j] += num1[j] + num2[j];
    			if (ans[j]/10 > 0) {
    				ans[j+1]++;
    				ans[j] -= 10;
    			}
    		}
    		if (ans[80] > 0){
    			cout << "overflow" << endl;
    		} else {
    			if (ans[ll] > 0) cout << ans[ll];
    			REP(j, ll){
    				cout << ans[ll-1-j];
    			}
    			cout << endl;
    		}
    	}
    }
}

C++: #include <iostream>
#include <sstream>
#include <cstring>

using namespace std;

int main()
{
	stringstream ss;
	string str;
	int n;
	long num;
	
	cin >> n;
	while (n != 0){
		int sum = 0;
		for (int i = 0; i < 2; i++){
			cin >> str;
			ss.clear();
			ss.str("");
			ss << str;
			ss >> num;
			sum += num;
		}
		ss.clear();
		ss.str("");
		ss << sum;
		ss >> str;
		
		if (str.size() > 80){
				cout << "overflow" << endl;
				break;
		}
		else{
			cout << str << endl;
		}
		n--;
	}
	return (0);
}

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

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::cin >> i1;
		std::cin >> i2;
		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){
			std::cout << "overflow" << std::endl;
		}else{
			char *p = res;
			while(*p++ == '0');
			std::cout << (p-1) << std::endl;
		}
	}
	return 0;
}