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 <bits/stdc++.h>
using namespace std;
int main(){
  char a[200];
  int n,k,l,i;
  cin>>n;
  while(n--){
    string s1,s2;
    cin>>s1>>s2;
    for(i=0;i<200;i++)a[i]='0';
    for(k=0,i=s2.size()-1;i>=0;i--)a[k++]=s2[i];
    for(l=0,i=s1.size()-1;i>=0;i--,l++){
      a[l]+=s1[i]-'0';
      if(a[l]>'9'){a[l+1]++;a[l]-=9;}
    }
    if(k>81||l>81)cout<<"overflow";
    else if(l<k)for(i=k-1;i>=0;i--)cout<<a[i];
    else for(i=l-1;i>=0;i--)cout<<a[i];
    cout<<endl;
  }
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<stack>
#include<set>
#include<cmath>

#define REP(i,s,e) for(int i=int(s);i<int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-6

using namespace std;

int main(){

	int n;
	cin >> n;

	rep(i,n){

	string a,b;
	cin >> a >> b;

	int sa=a.size(); int sb=b.size(); int p=max(sa,sb);
	vector<char>s;

	if(sa>80 || sb>80)
	cout << "overflow" << endl;
	else{

	string z;
	if(sa>sb){
	rep(j,sa-sb)
	z+='0';
	b=z+b;
	}
	if(sb>sa){
	rep(j,sb-sa)
	z+='0';
	a=z+a;
	}

    int c=0;
	rep(j,p){

	c+=(a[p-1-j]-'0')+(b[p-1-j]-'0');

	s.push_back(c%10+'0');
	c=c/10;

	}

    if(c==1) s.push_back(c%10+'0');

    if(s.size()>80)
    cout << "overflow" << endl;
    else
    rep(k,s.size()) cout << s[s.size()-1+k];

	}
	s.clear();

	}

	return 0;
}

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

int main () {
    int n;
    string a, b;
    
    cin >> n;
    for(int i=0;i<n;i++){
        int x[81]={0}, y[81]={0}, z[81]={0};
        
        cin >> a;
        cin >> b;
        
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        
        for(int j=0;j<a.size();j++){
            x[j]=a[j]-'0';
        }
        for(int j=0;j<b.size();j++){
            y[j]=b[j]-'0';
        }
        
        for(int j=0;j<80;j++){
            z[j]+=x[j]+y[j];
            if(z[j]>=10){
                z[j+1]=1;
                z[j]-=10;
            }
        }
        
        if(z[80]>0){
            cout << "overflow" <<endl;
        }else{
            bool flag = 0;
            for(int j=79;j>=0;j--){
                if(z[j]==0 && flag==0){
                    continue;
                }else{
                    flag=1;
                }
                cout<<z[j];
            }
            if(flag==0){
                cout<<0;
            }
            cout<<endl;
            
        }
    }
    return 0;
}

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

using namespace std;

int main() {
	int N, c, tmp;
	cin >> N;
	string ans;
	for (int i = 0; i < N; i++) {
		ans = "";
		c = 0;
		string a, b;
		cin >> a >> b;
		for (int j = 0; j < max(a.length(), b.length()); j++) {
			int A, B;
			A = a.length() - j - 1;
			B = b.length() - j - 1;
			tmp = (A >= 0 ? a[A] - '0' : 0) + (B >= 0 ? b[B] - '0' : 0) + c;
			ans = (char)(tmp % 10 + '0') + ans;
			c = tmp / 10;
		}
		if (c) {
			ans = '1' + ans;
		}
		cout << (ans.length() > 80 ? "overflow" : ans) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main( void )
{
	int n;
	cin >> n;
	for ( int i = 0; i < n; i++ )
	{
		string a;
		string b;
		cin >> a >> b;

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

		string::iterator it_a = a.begin();
		string::iterator it_b = b.begin();

		string kotae;
		int carry = 0;
		while ( it_a != a.end() || it_b != b.end() )
		{
			int an;
			int bn;
			if ( it_a != a.end() )
				an = ((*it_a) - '0');
			else
				an = 0;

			if ( it_b != b.end() )
				bn = ((*it_b) - '0');
			else
				bn = 0;

			int cn = an + bn + carry;
			if ( cn >= 10 )
			{
				carry = 1;
				cn %= 10;
				kotae += ('0' + cn);
			}
			else
			{
				carry = 0;
				kotae += ('0' + cn);
			}

			if ( it_a != a.end() )
				it_a++;
			if ( it_b != b.end() )
				it_b++;
		}

		if ( carry == 1 )
			kotae += '1';

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

		cout << kotae << endl;

	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	ios :: sync_with_stdio(false);
	int t; cin >> t;
	while(t --) {
		int a[120];
		memset(a, 0, sizeof a);
		auto f = [&]() {
			string s; cin >> s;
			reverse(s.begin(), s.end());
			for(int i = 0; i < s.size(); i ++)
				a[i] += s[i] - '0';
		};
		f(); f();
		for(int i = 0; i + 1 < 120; i ++)
			if(a[i] >= 10) {
				a[i + 1] ++;
				a[i] -= 10;
			}
		int s = -1;
		for(int i = 0; i < 120; i ++)
			if(a[i]) s = i;
		if(s == -1)
			cout << 0 << '\n';
		else if(s >= 80)
			cout << "overflow\n";
		else {
			for(int i = s; i >= 0; i --)
				cout << a[i];
			cout << '\n';
		}
	}
	return 0;
}