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++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int n;
	cin >> n;
	for (; n--; )
	{
		string a, b;
		cin >> a >> b;

		string c;

		int add = 0;
		int len = max(a.length(), b.length());
		for (int i = 0; i < len; i++)
		{
			int a0 = 0, b0 = 0;
			int ai = a.length() - i - 1;
			if (ai >= 0)
			{
				a0 = atoi(a.substr(ai, 1).c_str());
			}
			int bi = b.length() - i - 1;
			if (bi >= 0)
			{
				b0 = atoi(b.substr(bi, 1).c_str());
			}
			
			int c0 = a0 + b0 + add;
			add = (c0 >= 10) ? 1 : 0;

			c += to_string(c0).back();
		}
		if (add == 1)
		{
			c += to_string(1);
		}
		reverse(c.begin(), c.end());

		cout << (c.length() > 80 ? "overflow" : c) << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;
const int N = 80;

vector<int> makeDx(string str){
    reverse(str.begin(), str.end());
    vector<int> ret(N, 0);
    REP(i, str.size()) ret[i] = str[i] - '0';
    return ret;
}

int main(){
    int n; cin >>n;
    REP(z, n){
        string str[2]; cin >>str[0] >>str[1];
        vector<int> dx[2] = {makeDx(str[0]), makeDx(str[1])};
        vector<int> ans(N + 100, 0);
        bool okflg = true;
        REP(i, N){
            int sum = dx[0][i] + dx[1][i];
            ans[i] += sum;
            if(i == N - 1 && ans[i] >= 10){
                cout <<"overflow" <<endl;
                okflg = false;
            }else if(ans[i] >= 10){
                ans[i + 1] = ans[i] / 10;
                ans[i] %= 10;
            }
        }

        if(okflg){
            reverse(ans.begin(), ans.end());
            int s = 0;
            while(ans[s] == 0 && s < (N + 100) - 1) s++;
            FOR(i, s, N + 100) cout <<ans[i];
            cout <<endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#define N 82

using namespace std;

void shift(char a[N]){
  int ln = strlen(a)-1;
  int i;
  for( i=N-2;i>=0;i-- ){
    if( ln>=0 )
      a[i] = a[ln--]-'0';
    else
      a[i]=0;
  }
}
void pr(char a[N]){
  int i;
  for( i=0;i<N-1;i++ ){
    cout << (int)a[i];
  }
  cout << endl;
}

int main(){
  int n, lp;
  char a[N],b[N], s[N];
  int i,c;

  cin >> n;
  for( lp=0;lp<n;lp++ ){
    cin >> a;
    cin >> b;
    //    cout << a << endl;
    //    cout << b << endl;

    shift(a); shift(b);
    //    pr(a);    pr(b);

    c=0;
    for( i=N-2;i>=0;i--){
      s[i]=a[i]+b[i]+c;
      if( s[i]>9 ){
	s[i]-=10;
	c=1;
      }else
	c=0;
    }

    if( s[0]!=0 )
      cout << "overflow" << endl;
    else{
      c=0;
      for( i=0;i<N-1;i++ ){
	if( c==0 && s[i]!=0 )
	  c=1;
	if( c==1 )
	  cout << (int)s[i];
      }
      cout << endl;
    }
  }

  return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        char c1[80],c2[80];
        scanf("%s",&c1);
        scanf("%s",&c2);
        string s1,s2;
        s1=c1, s2=c2;
        if(s1=="0" && s2=="0"){
            printf("0\n");
            continue;
        }
        reverse(s1.begin(),s1.end());
        reverse(s2.begin(),s2.end());
        int n=max(s1.size(),s2.size())+1;
        for(int i=s1.size();i<n;i++){
            s1+='0';
        }
        for(int i=s2.size();i<n;i++){
            s2+='0';
        }
        string res;
        int b=0;
        for(int i=0;i<max(s1.size(),s2.size());i++){
            int u=s1[i]-'0'+s2[i]-'0'+b;
            b=(u>=10); u%=10;
            res+=u+'0';
        }

        reverse(res.begin(),res.end());
        string res2;
        int j=0;
        while(res[j]=='0') j++;
        for(;j<res.size();j++){
            res2+=res[j];
        }

        if(res2.size()>80){
            printf("overflow\n");
        }else{
            printf("%s\n",res2.c_str());
        }
    }
    return 0;
}