Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

C++: #include <iostream>
#include <sstream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){
    os << "{ ";
    for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
        os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", ");
    os << " }";
    return os;
}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define vv(type,w,h,init) vector<vector<type>>(h,vector<type>(w,init))
typedef vector<string> vs;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair

string const resstr[] = {"Impossible","Possible","No","Yes"};

int main(){
    int n; cin >> n;
    rep(i,n){
        string a,b;
        cin >> a >> b;
        reverse(all(a));
        reverse(all(b));
        if(b.size()<a.size())swap(a,b);
        b += "0";
        rep(i,b.size()-1){
            int aa = i < (int)a.size() ? a[i] - '0' : 0;
            int bb = b[i] - '0';
            int cc = aa + bb;
            b[i] = (cc%10) + '0';
            //cout << aa << "+" << bb << "=" << cc << endl;
            if(cc >= 10){
                b[i+1]++;
            }
        }
        if(b[b.size()-1] == '0')
            b = string(b.begin(), b.end()-1);
        reverse(b.begin(), b.end());
        if(b.size() > 80)
            cout << "overflow" << endl;
        else cout << b << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){

  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    string a,b,out,tmp;
    cin >> a;
    cin >> b;
    //int m=max(a.size(),b.size());
    if(a.size()<b.size()){
      tmp=a;
      a=b;
      b=tmp;
    }
    //cout << a << endl;
    int si=-a.size()+b.size();
    for(int j=a.size()-1;j>=0;j--){
      if(j+si>=0){
	//cout << si << endl;
	a[j]+=b[j+si]-'0';
	//cout << a[j] << endl;
      }else{
	a[j]+=0;
	//cout << "!" << endl;
      }
      if(a[j]>'9'&&j!=0){
	a[j-1]++;
	a[j]-=10;
      }else if(a[j]>'9'&&j==0){
	a='1'+a;
	a[1]-=10;
	//for(int i=a.size();i>0;i--)
	//  a[i]=a[i-1];
	//a[1]-=10;
	//a[0]='1';
      }
    }
    if(a.size()>80)
      cout << "overflow" << endl;
    else
      cout << a << endl;
    //a='0';
  }

}

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);j++) if(ch1[j] != '\n') st1.push(ch1[j] - '0');
			for(j = 0;j < strlen(ch2);j++) if(ch2[j] != '\n') 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() == 0) sum.pop();
			if(sum.size() > 80) {
				cout << "overflow" << endl;
				continue;
			}
			while(!sum.empty()) {
				cout << sum.top();
				sum.pop();
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
using namespace std;

/*int main(){
	int n;
	cin>>n;
	rep(i,0,n){
		string s1,s2;
		cin>>s1>>s2;

		if(s1.size()<s2.size()) swap(s1,s2);

		for(int j=s1.size()-1,k=s2.size()-1;j>=0;j--,k--){
			if(k>=0) s1[j]+=s2[k]-'0';
			if(s1[j]>'9'){
				s1[j]-=10;
				if(s2)
			}
			ans[j]=a%10;
			ans[j+1]=a/10;
			//cout<<" "<<j<<" "<<ans[j]<<endl;
		}
		if(ans[80]>0){
			cout<<"overflow"<<endl; return 0;
		}
		bool f=0;
		for(int i=80;i>=0;i--){
			if(f==0 && ans[i]>0){
				f=1; cout<<ans[i];
			}else if(f) cout<<ans[i];
		}
		cout<<endl;
	}
}*/

int main(){
    int n;
    cin>>n;
    rep(i,0,n){
        int ans[85]={},n1[81]={},n2[81]={};
        string s1,s2;
        cin>>s1>>s2;
        int sz1=s1.size(),sz2=s2.size();
 
        rep(j,0,sz1) n1[j]=s1[sz1-1-j]-'0';
        rep(j,0,sz2) n2[j]=s2[sz2-1-j]-'0';
 
        for(int j=0;j<81;j++){
            //cout<<"  "<<j<<" "<<n1[j]<<n2[j]<<endl;
            int a=ans[j]+n1[j]+n2[j];
            ans[j]=a%10;
            ans[j+1]=a/10;
            //cout<<" "<<j<<" "<<ans[j]<<endl;
        }
        if(ans[80]>0){
            cout<<"overflow"<<endl; return 0;
        }
        bool f=0;
        for(int i=80;i>=0;i--){
            if(f==0 && ans[i]>0){
                f=1; cout<<ans[i];
            }else if(f) cout<<ans[i];
        }
        cout<<endl;
    }
}

C++: #include<algorithm>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>

using namespace std;
int main(){
	int n,l,m,c;
	char a[90],b[90];
	cin >> n;
	for(int i=0;i<n;i++){
		char s[90] = {0};
		scanf("%s%s",a,b);
		l = strlen(a);
		m = strlen(b);
		reverse(a,a+l);
		reverse(b,b+m);
		c=0;
		for(int j=0;j<max(l,m);j++){
			int o=c;
			if(j<l)o += a[j]-'0';
			if(j<m)o += b[j]-'0';
			c = o>9;
			s[j] = o%10 + '0';
		}
		l=max(l,m);
		if(c>0)s[l++]='1';
		reverse(s,s+l);
		if(l>80)cout << "overflow" << endl;
		else printf("%s\n",s);//cout << s << endl;
	}
	return 0;
}

C++: import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main(){

    int n;
    readf("%d\n",&n);
    for(int i=0;i<n;i++){
	string s1,s2,res;
	s1 = chomp(readln());
	s2 = chomp(readln());
	res = "";
	int x = to!int(s1.length-1);
	int y = to!int(s2.length-1);
	if( y > x) {
	    swap(s1,s2);
	    swap(x,y);
	}
	int add = 0;
	while(x >= 0 || add > 0){
	    int sum = 0;
	    if(y >= 0)
		sum = to!int(s1[x] - '0') + to!int(s2[y] - '0');
	    else if(x >= 0)
		sum = to!int(s1[x] - '0');
	    else 
		sum = 0;
	    if( sum + add > 9){
		    res = to!string((sum + add)%10) ~ res;
		    add = 1;
	    }else{
		res = to!string(sum + add) ~ res;
		add = 0;
	    }
	    if(x >= 0) x--;
	    if(y >= 0) y--;
	}
	writeln(res);
    }
}