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<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int stoi(string s){
  int size=s.size();
  int num=0;
  rep(i,size){
    num+=((int)s[i]-'0')*pow(10,size-i-1);
  }
  return num;
}

string itos(int num){//this function is used when you want to change variable type from int to string
  int size=0;
  int cnt=1;
  while(num/cnt!=0){//count the digit of num
    size++;
    cnt*=10;
  }
  string s="";
  rep(i,size){//change num from int to string
    s+=(char)((num/(int)pow(10,size-i-1))+'0');
    num-=(int)(num/pow(10,size-i-1))*pow(10,size-i-1);
  }
  return s;
}

int main(){
	int n;
	cin>>n;
	string s[2];
	rep(i,n){
		cin>>s[0]>>s[1];
		if(s[0].size()>=80 || s[1].size()>=80){
			cout<<"overflow"<<endl;
			continue;
		}
		int dis=abs(s[0].size()-s[1].size());
		if(s[0].size()>s[1].size()){
			rep(j,dis){
				s[1].insert(0,"0");
			}
		}else{
			rep(j,dis){
				s[0].insert(0,"0");
			}
		}
		int size=s[0].size();
		int alt=0;
		string ans="";
		int num1,num2;
		for(int a=(size-1);a>=0;a--){
			num1=(int)s[0][a]-'0';
			num2=(int)s[1][a]-'0';
			int result=num1+num2+alt;
			if(result<10){
				if(!result)ans.insert(0,"0");
				else ans.insert(0,itos(result));
				alt=0;
			}else{
				if(!(result%10))ans.insert(0,"0");
				else ans.insert(0,itos(result%10));
				alt=1;
			}
		}
		if(alt)ans.insert(0,"1");
		if(ans.size()>=80)cout<<"overflow"<<endl;
		else cout<<ans<<endl;
	}
	return 0;
}

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

int main(){
	string s1,s2;
	int num;
	cin>>num;
	for(int j=0;j<num;j++){
		cin>>s1;
		cin>>s2;
		int size1=s1.size();
		int size2=s2.size();
		if(size1>80 || size2>80){
			cout<<"overflow"<<endl;
			continue;
		}
		if(size1>size2){
			for(int a=0;a<(size1-size2);a++){
				s2='0'+s2;
			}
		}else if(size1<size2){
			for(int a=0;a<(size2-size1);a++){
				s1='0'+s1;
			}
		}
		string ans="";
		int plus=0;
		for(int i=size1-1;i>=-1;i--){
			if(i==-1){
				if(plus!=0){
					ans=(char)(plus+'0')+ans;
					continue;
				}else{
					continue;
				}
			}
			int alt=(s1[i]-'0')+(s2[i]-'0')+plus;
			if(alt>=10){
				ans=(char)(alt-10+'0')+ans;
				plus=alt/10;
			}else ans=(char)(alt+'0')+ans;
		}
		if(ans.size()>80){
			cout<<"overflow"<<endl;
		}else{
			cout<<ans<<endl;
		}
	}
	return 0;
}

C++: #include <algorithm>
#include <sstream>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string>
#include <queue>
#include <vector>
using namespace std;


stack<int> A;
int y = 0;
int NIL = -1;
int MAX = 80;

vector<int> conv(string s) {
	vector<int> V(MAX, NIL);
	int i;
	for (i = 0; i < s.length(); i++) V[MAX - 1 - i] = s[s.length() - 1 - i] - '0';

	return V;
}

void push(int a, int b) {
	int x = a + b;
	if (y > 0) x += y; y = 0;
	if (x > 9) {
		A.push(x % 10);
		y = 1;
	}
	else {
		A.push(x);
	}
}

int main()
{
	int n;

	string a, b;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		if (a.length() > 80 || b.length() > 80) {
			cout << "overflow" << endl;
			continue;
		}

		A = stack<int>();
		vector<int> V1 = conv(a);
		vector<int> V2 = conv(b);

		for (int i = MAX - 1; i >= 0; i--) {
			if (V1[i] != NIL && V2[i] != NIL) {
				push(V1[i], V2[i]);
			}
			else if (V1[i] == NIL && V2[i] != NIL) {
				push(V2[i], 0);
			}
			else if (V2[i] == NIL && V1[i] != NIL) {
				push(V1[i], 0);
			}
		}

		if (y == 1) {
			A.push(1);
			y = 0;
		}

		if (A.size() > 80) {
			cout << "overflow";
		}
		else {
			while (A.size() != 0) {
				cout << A.top(); A.pop();
			}
		}

		cout << endl;
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;
typedef vector<ll> V;

/*int k = 0, n;
string s, t;
vector<string> ans;

int main(){
	cin >> n;
	REP(j,n){
		cin >> s >> t;
		k = 0;
		if (s.size() >= 80 || t.size() >= 80)cout << "overflow" << endl;
		reverse(ALL(s));
		reverse(ALL(t));
		int a = max(s.size(), t.size()), b = min(s.size(), t.size());
		if (s.size() > t.size()){
			REP(i, a - b){
				t += "0";
			}
		}
		else{
			REP(i, a - b){
				s += "0";
			}
		}		
		reverse(ALL(s));
		reverse(ALL(t));
		REP(i, s.size()){
			int x = (s[s.size()-1-i] - '0') + (t[s.size()-1-i] - '0');
			string q;
			stringstream ss;
			if (i != s.size() - 1){
				ss << ((x + k) % 10);
			}
			else{
				ss << x + k;
			}
			ss >> q;
			ans.push_back(q);
			if (x + k >= 10){
				k = (x + k) / 10;
			}
			else{
				k = 0;
			}
		}
		if (ans.size() >= 79)cout << "overflow" << endl;
		//cout << ans.size() << endl;
		reverse(ALL(ans));
		REP(i, ans.size()){
			cout << ans[i];
		}
		cout << endl;
		ans.clear();
	}
}*/

int a[110], b[110], ans[110];
string s, t;
int n;

int main(){
	cin >> n;
	while (n--){
		cin >> s >> t;
		REP(i, s.size())a[i] = s[s.size() - 1 - i] - '0';
		REP(i, t.size())b[i] = t[t.size() - 1 - i] - '0';
		ll k = 0;
		REP(i, 101){
			ans[i] = (a[i] + b[i] + k) % 10;
			k = (a[i] + b[i] + k) / 10;
		}
		for (int i = max(s.size(), t.size()); i >= 0; i--){
			if (i == max(s.size(), t.size())){
				if (ans[i] != 0){
					cout << ans[i];
				}
			}
			else{
				cout << ans[i];
			}
		}
		cout << endl;
		REP(i, 101){
			ans[i] = 0;
			a[i] = 0;
			b[i] = 0;
		}
	}
}

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


int main(){
  int n,i,j;
  string a,b;
  int sum[110]={};
  int up = 0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a >> b;
    int sa=a.size(),sb=b.size();
    int flag=0;
    if(sa>=80||sb>=80) flag =1;
    for(j=0;j<max(sa,sb);j++){
      if(sa>j&&sb>j){
	sum[j] = (a[sa-j-1]-'0') + (b[sb-j-1]-'0') + up;
      }else if(sa>j){
	sum[j] = (a[sa-j-1]-'0') + up;
      }else if(sb>j){
	sum[j] = (b[sb-j-1]-'0') + up;
      }
      up=0;
      if(sum[j]>9){
	up=1;
	sum[j]-=10;
      }
    }
    sum[max(sa,sb)]=up;
    int k=110-1;
    while(sum[k]==0&&k>0) k--;
    if(k>=80||flag==1) cout << "overflow";
    else
    for(j=k;j>=0;j--)
      cout << sum[j];
    cout << endl;
  }
}