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<cstdio>
#include<cstring>
#include<iostream>

#define N(c) (c-'0')

using namespace std;
 /*
	N	:整数文字列ペアの数
	ar[3][100]	:文字配列

 */



int main(){
	int i, j, k, n, s;
	char  ar[3][100], c;

  cin >> n;
  while(n--){
	  scanf("%s %s",ar[0],ar[1]);

	  for(i=0; i<2; i++){
		  j=strlen(ar[i]);
		  for(k=0; k<j/2; k++){
			  c=ar[i][k]; ar[i][k]=ar[i][j-k-1]; ar[i][j-k-1]=c;
		  }
	  }

    if(strlen(ar[0])<strlen(ar[1])){
      strcpy(ar[2], ar[1]); strcpy(ar[1], ar[0]); strcpy(ar[0], ar[2]);
    }

    i=strlen(ar[0]);
    j=strlen(ar[1]);
    for(k=0,s=0; k<j; k++){
      s += N(ar[0][k]) + N(ar[1][k]);
      ar[2][k]=(s%10)+'0';
      s=s/10;
    }

    for( ; k<i; k++){
      if(ar[0][k]=='\0')  ar[2][k]=s+'0';
      else{
        s += N(ar[0][j]);
        ar[2][k]=(s%10)+'0';         
        s=s/10;
      }
    }

    if(0==s)  ar[2][k]='\0';
    else {
      ar[2][k]=s+'0';
      ar[2][k+1]='\0';
    }

// printf("%s\n%s\n%s\n",ar[0],ar[1],ar[2]);


	  i=2;
		  j=strlen(ar[i]);
		  for(k=0; k<j/2; k++){
			  c=ar[i][k]; ar[i][k]=ar[i][j-k-1]; ar[i][j-k-1]=c;
		  }

  if(80<strlen(ar[2]))  	printf("overflow\n");
  else printf("%s\n",ar[2]);
	}
    return 0;
}

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

int main(){
	string a, b;
	vector<int> ans;
	int n, num, ai, bi, c=0;
	bool flag;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		cin >> a >> b;
		flag = false;
		for(int j=0 ; j<100 ; j++){
			num = 0;
			ai = a.size()-j-1;
			bi = b.size()-j-1;
			if( ai<0 && bi<0 && c==0) break;

			if(ai>=0)num += a[ ai ] - 48;
			if(bi>=0)num += b[ bi ] - 48;
			ans.push_back( (num+c)%10 );
			if(num+c >= 10) c = 1;
			else c = 0;
		}
		if(ans.size()>80){
			printf("overflow");
		}else{
			for(int j=ans.size()-1 ; j>=0 ; --j){
				printf("%d", ans[j]);
			}
		}
		printf("\n");
		ans.clear();
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

const int N = 85;

char a[N], b[N];

void reverse(char a[]) {
	int len = strlen(a);
	for (int i=0, j=len-1; i<j; ++i, --j) {
		char tmp = a[i];
		a[i] = a[j];
		a[j] = tmp;
	}
}

void add(char a[], char b[]) {
	int lenA = strlen(a);
	int lenB = strlen(b);
	int i, j, tmp, jin = 0;
	for (i=0; i<lenA && i<lenB; ++i) {
		tmp = (a[i] - '0') + (b[i] - '0') + jin;
		a[i] = tmp % 10 + '0';
		jin = tmp / 10;  
	}
	if (!a[i] && !b[i] && jin) {
		a[lenA] = jin + '0';
		a[lenA + 1] = '\0';
	}
	else if (a[i] && !b[i] && jin) {
		for (; i<lenA; ++i) {
			tmp = a[i] - '0' + jin;
			a[i] = tmp % 10 + '0';
			jin = tmp / 10;
		}
		if (jin) {
			a[lenA] = jin + '0';
			a[lenA + 1] = '\0';
		} 
	}
	else if (!a[i] && b[i] && jin) {
		for (; i<lenB; ++i) {
			tmp = b[i] - '0' + jin;
			a[i] = tmp % 10 + '0';
			jin = tmp / 10;
		}
		if (jin) {
			a[lenB] = jin + '0';
			a[lenB + 1] = '\0';
		}
		else a[lenB] = '\0';
	}
}

int main() {
	int t;
	scanf ("%d", &t);
	while (t--) {
		scanf ("%s%s", a, b);
		if (strlen(a) > 80 || strlen(b) > 80) printf ("overflow\n");
		else {
			reverse(a);
			reverse(b);
			add(a, b);
			if (strlen(a) > 80) printf ("overflow\n");
			else reverse(a), printf ("%s\n", a);
		}
	}
	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 s1, s2;
        int l1, l2;
        cin >> s1 >> s2;
        l1 = s1.length();
        l2 = s2.length();
        if (l1>80 || l2 > 80)
            cout << "overflow";
        else
        {
            int result[100], r = 0, m = max(l1, l2), t;
            reverse(s1.begin(), s1.end());
            reverse(s2.begin(), s2.end());
            s1.resize(m + 1, '0');
            s2.resize(m + 1, '0');
            for (int j = 0; j < m; j++)
            {
                t = r + s1[j] + s2[j] - 48 * 2;
                result[j] = t % 10;
                r = t / 10;
            }
            if (r == 1)
                result[m++] = 1;
            if (m>80)
                cout << "overflow";
            else
                for (int j = m - 1; j >= 0; j--)
                    cout << result[j];
        }
        cout << endl;
    }
    return 0;
}

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

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		string s, t;
		cin >> s >> t;
		if(s.size() < t.size())
		{
			string temp = s;
			s = t;
			t = temp;
		}
		reverse(s.begin(), s.end());
		reverse(t.begin(), t.end());
		string ans = "";
		string buf = "0";
		for(int i = 0; i < t.size(); ++i)
		{
			int a = s[i] - '0' + t[i] - '0' + buf[0] - '0';
			if(a >= 10)
			{
				buf = "1";
			}
			else
			{
				buf = "0";
			}
			ans += (char)(a % 10 + '0');
		}
		for(int i = t.size(); i < s.size(); ++i)
		{
			int a = s[i] - '0' + buf[0] - '0';
			if(a >= 10)
			{
				buf = "1";
			}
			else
			{
				buf = "0";
			}
			ans += (char)(a % 10 + '0');
		}
		if(buf != "0")
		{
			ans += buf[0];
		}
		reverse(ans.begin(), ans.end());
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		string num1, num2;
		cin >> num1 >> num2;
		char sum[101];
		int degit = 0;
		for( int i = 0; i < 101; i++ ) sum[i] = '0';
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] = num1[num1.size()-i-1];
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now;
			if( i < num2.size() ){
				now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
			}else{
				now = (int)(sum[100-i]-'0') + degit;
			}
			sum[100-i] = (char)(now%10)+'0';
			if( now >= 10 ) degit = 1;
			else degit = 0;
			d = i;
		}
		if( d < 80 ){
			for( int i = 100-d; i < 101; i++ ) cout << sum[i];
			cout << endl;
		}else{
			cout << "overflow" << endl;
		}
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		string a,b,c;
		int d=0,st;
		cin>>a>>b;
		for(int j=a.size();j<81;++j) a="0"+a;
		for(int j=b.size();j<81;++j) b="0"+b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		for(int j=0;j<79;++j){
			c+=((a[j]-'0')+(b[j]-'0')+d)%10+'0';
			d=((a[j]-'0')+(b[j]-'0')+d)/10;
		}
		if(d) cout<<"overflow\n";
		else{
			reverse(c.begin(), c.end());
			for(st=0;st<c.size();++st)if(c[st]!='0')break;
			cout<<((st==c.size())?"0":c.substr(st,c.size()-st))<<"\n";
		}
	}
	return 0;
}