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>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i, 0, n)
using namespace std;
int a[81], b[81];
int main()
{
    int n; cin >> n;
    while (n--) {
        rep(i, 81) a[i] = b[i] = 0;
        string s, t;
        cin >> s >> t;
        rep(i, s.size()) a[i] = s[s.size()-i-1]-'0';
        rep(i, t.size()) b[i] = t[t.size()-i-1]-'0';

        int c = 0;
        rep(i, 81) {
            a[i] = a[i] + b[i] + c;
            if (a[i] >= 10) { a[i] -= 10; c = 1; }
            else c = 0;
        }
        if (a[80] != 0)
            cout << "overflow" << endl;
        else {
            int k = 80; while (k > 0 && a[k] == 0) k--;
            for (int i = k; i >= 0; --i) cout << a[i];
            cout << endl;
        }
    }
    return 0;
}

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

int main(){
	string s1, s2;
	stack<int> sum;
	int tmp, carry, n, len1, len2;

	cin>>n;
	while(n--){
		tmp = carry = 0;
		while(!sum.empty())sum.pop();
		cin>>s1>>s2;
		len1 = s1.length()-1;
		len2 = s2.length()-1;
		reverse(s1.begin(), s1.end());
		reverse(s2.begin(), s2.end());

		for(int i=0; i<81; i++){
			tmp = carry;
			if(i<=len1) tmp += s1[i]-'0';
			if(i<=len2) tmp += s2[i]-'0';
			sum.push(tmp%10);
			carry = tmp/10;
		}
		if(sum.top() != 0)cout<<"overflow\n";
		else{
			for(int i=0; i<80; i++){
				if(sum.top()==0)sum.pop();
				else break;
			}
			while(!sum.empty()){cout<<sum.top(); sum.pop();}
			cout<<"\n";
		}
	}	
	return 0;
}

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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    while (N--) {
        string s1, s2;
        cin >> s1;
        cin >> s2;
        if (s1.size() > 80) {
            cout << "overflow" << endl;
            continue;
        }
        if (s2.size() > 80) {
            cout << "overflow" << endl;
            continue;
        }
        vector<int> n1, n2, res;
        for (int i = s1.size(); i--;) {
            n1.push_back((int)(s1[i] - '0'));
        }
        for (int i = s2.size(); i--;) {
            n2.push_back((int)(s2[i] - '0'));
        }
        if (n1.size() < n2.size()) {
            for (int i = n1.size(); i < n2.size(); i++) {
                n1.push_back(0);
            }
        } else if (n2.size() < n1.size()) {
            for (int i = n2.size(); i < n1.size(); i++) {
                n2.push_back(0);
            }
        }
        int s, c = 0;
        for (int i = 0; i < n1.size(); i++) {
            s = n1[i] + n2[i] + c;
            res.push_back(s % 10);
            c = s / 10;
        }
        if (c != 0) {
            res.push_back(c);
        }
        int size = res.size();
        while (size > 0 && res[size - 1] == 0) {
            size--;
        }
        if (size > 80) {
            cout << "overflow" << endl;
        } else {
            int i = size;
            while (i--) {
                cout << res[i];
            }
            cout << endl;
        }
    }
    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<string.h>

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k;
	char fi[100],se[100],ans[100];

	scanf("%d",&N);

	for(i=0;i<N;i++){

		scanf("%s",&fi);
		scanf("%s",&se);

		if(strlen(fi)<=80&&strlen(se)<=80){
		for(j=strlen(fi)-1,k=strlen(se)-1,keta=0,kuri=0;j>=0||k>=0;j--,k--,keta++){
			if(j<0) math1=0;
			else math1=fi[j]-'0';
			if(k<0) math2=0;
			else math2=se[k]-'0';
            /*ans[keta]=((math1+math2+kuri)%10)+'0';*/
			kuri=(math1+math2+kuri)/10;
		}
		if(kuri==1) printf("1");
		if(keta-1<=80){
			for(j=keta-1;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		}
		else printf("overflow");
		printf("\n");
	}

	return 0;
}