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>
typedef unsigned int u;using namespace std;typedef string::iterator s;u z=100000000;void p(u*a,u*l,u n){if(a-l)p(a+1,l,(n+=*a*10)/z),*a=n%z;}u t(u*a,u*l){u r=0;char b[11]={};if(a-l)if(!t(a+1,l)){if(*a)cout<<*a,r=1;}else sprintf(b,"%d",*a+z),cout<<b+1,r=1;return r;}void d(u*a,u*l,u*b,u n=0){if(a-l)d(a+1,l,b+1,(n+=(*a+*b))/z),*a=n%z;}int main(){u n;(cin>>n).ignore();string a,b;for(;n--;){getline(cin,a);getline(cin,b);u x[11]={},y[11]={},c=0;for(s i=a.begin();i!=a.end();p(x,x+10,*i++-48))if(++c>80)goto g;c=0;for(s i=b.begin();i!=b.end();p(y,y+10,*i++-48))if(++c>80)goto g;d(x,x+11,y);if(x[10])goto g;else if(!t(x,x+10))cout<<'0';if(0)g:cout<<"overflow";cout<<'\n';}}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;
bool isover(int);
bool isover(int,int);
int main() {
	int n; string ans; bool is_str_use;
	string str, str1; int nexta; int memo, age;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		age = 0; ans = ""; is_str_use = false;
		cin >> str >> str1;
		if (isover(str.size(), str1.size())) {
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < str.size() / 2; ++i) {
			swap(str[i], str[str.size() - 1 - i]);

		}
		for (int i = 0; i < str1.size() / 2; ++i) {
			swap(str1[i], str1[str1.size() - 1 - i]);
		}
		if (str.size() < str1.size()) {
			is_str_use = true;
		}
		for (int i = 0; i < min(str.size(), str1.size()); ++i) {
			memo = (str[i] - '0') + (str1[i] - '0') + age;
			if (memo > 9) {
				age = memo / 10;
				memo -= (memo / 10) * 10;
			}
			ans += memo + '0';
		}
		if (str.size() == str1.size()) {
			ans += age + '0';
		}
		if (isover(ans.size())) {
			cout << "overflow" << endl;
			continue;
		}
		if (is_str_use) {
			swap(str, str1);

		}
		for (int i = min(str.size(), str1.size()); i < str.size(); ++i) {
			memo = (str[i] - '0') + age;
			if (memo > 9) {
				age = memo / 10;
				memo -= (memo / 10) * 10;
			}
			ans += memo + '0';
		}
		if (age != 0)ans += age+'0';
		if (isover(ans.size())) {
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < ans.size() / 2; ++i) {
			swap(ans[i], ans[ans.size() - 1 - i]);
		}
		cout << ans << endl;
	}
	return 0;
}
bool isover(int a) {
	if (a > 80) {
		return true;
	}
	return false;
}
bool isover(int a, int b) {
	if (a > 80 || b > 80) {
		return true;
	}
	return false;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
#define MAX 100
#define temp 85
int main(){
	int x,A[MAX],B[MAX],al,bl,sum[MAX],pre,now;
	char a[MAX],b[MAX];
	cin>>x;
	while(x-->0){
		for(int i=0;i<MAX;i++){
			A[i]=0;
			B[i]=0;
			sum[i]=0;
		}
		cin>>a;
		cin>>b;
		al=strlen(a);
		bl=strlen(b);
		for(int i=0;i<al;i++)
		A[i]=a[al-1-i]-'0';
		for(int i=0;i<bl;i++)
		B[i]=b[bl-1-i]-'0';
		if(al>bl)
		bl=al;
		pre=0;
		for(int i=0;i<=bl;i++){
			if(A[i]+B[i]+pre>9)
				now=1;
			else now=0;
			sum[i]=(A[i]+B[i]+pre)%10;
			pre=now;
		}
		
		if(sum[bl]!=0){
		for(int i=bl;i>=0;i--)
		cout<<sum[i];
		}
		else {
		for(int i=bl-1;i>=0;i--)
		cout<<sum[i];
		}
		
		
		cout<<endl;
		
		
		
	}
	return 0;
}

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

int n;

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++) {
		string s, t;

		cin >> s >> t;

		int v = s.size(), w = t.size();

		if (v < w) {
			string y = s;
			s = t;
			t = y;

			swap(v, w);
		}

		int k = 0;
		string u;

		for (int i = 0; i < v; i++) {
			k += s[v - i - 1] - '0';

			if(i < w)
				k += t[w - i - 1] - '0';

			u = (char)('0' + (k % 10)) + u;
			k /= 10;
		}

		if (k > 0)
			u = '1' + u;

		if (u.size() <= 80)
			cout << u << endl;
		else
			cout << "overflow" << endl;
	}

	return 0;
}