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>
using namespace std;

string calc(string s1,string s2){
  int num1=s1.size()-1,num2=s2.size()-1;
  int tmp=0;
  string s;
  while(!(num1==-1&&num2==-1&&tmp==0)){
    if(num1!=-1&&num2!=-1){
      tmp+=int(s1[num1]-'0')+int(s2[num2]-'0');
      num1--;num2--;
    }else if(num1!=-1&&num2==-1){
      tmp+=int(s1[num1]-'0');
      num1--;
    }else if(num1==-1&&num2!=-1){
      tmp+=int(s2[num1]-'0');
      num2--;
    }
    s=to_string(tmp%10)+s;
    tmp/=10;
  }
  if(s.size()>80)s="overflow";
  return s;
}

int main(){
  cin.tie(0);ios::sync_with_stdio(false);
  int n;
  string s1,s2;

  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s1>>s2;
    cout<<calc(s1,s2)<<endl;
  }
  return 0;
}

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

int main(){
	int N;
	cin >> N;
	while(N--){
		string a,b;
		cin >> a >> b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		while(a.size()>b.size())b += '0';
		while(a.size()<b.size())a += '0';
		string r;
		int c = 0; 
			for(int i = 0 ; i < a.size() ; i++){
			int d = a[i] + b[i] + c - 2 * '0';
			if( d >= 10 ) c = 1;
			r += d%10 + '0';
		}
		if(c)r += '0' + c;
		reverse(r.begin(),r.end());
		if( a.size() > 80 or b.size() > 80 or r.size() > 80 ) cout << "overflow" << endl;
		else cout << r << endl;
	}
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    for(int j=0;j<n;j++){
        string a,b;
        cin>>a>>b;
        int numa[100000]={0},numb[100000]={0};
        int flag=0;
        int sum[81]={0};
        if(80<max(a.size(),b.size())){
            puts("overflow");
            goto exit;
        }
        for(int i=a.size()-1,k=0;0<=i;i--,k++)numa[k]=a[i]-'0';
        for(int i=b.size()-1,k=0;0<=i;i--,k++)numb[k]=b[i]-'0';
        for(int i=0;i<max(a.size(),b.size());i++){
            sum[i]+=(numa[i]+numb[i]);
            sum[i+1]=sum[i]/10,sum[i]=sum[i]%10;
            if(sum[80]!=0){
                puts("overflow");
                goto exit;
            }
        }
        for(int i=80;0<=i;i--){
            if(flag==1||sum[i]!=0)flag=1;
            if(flag==1)printf("%d",sum[i]);
        }
        puts("");
exit:
;
        /*
        for(int i=0;i<80;i++)printf("%d",numa[i]);
        puts("");
        for(int i=0;i<80;i++)printf("%d",numb[i]);
        puts("");
        for(int i=0;i<80;i++)printf("%d",sum[i]);
        puts("");
        */
    }
    return 0;
}

C++: #include <iostream>
#include <iostream>
#include <vector>
using namespace std;
string add(string a,string b){

  int numa[1001] = {0},numb[1001] = {0};

  for(int i = a.size()-1 ; i >= 0 ; i-- )numa[a.size()-i-1] = a[i]-'0';
  for(int i = b.size()-1 ; i >= 0 ; i-- )numb[b.size()-i-1] = b[i]-'0';

  vector<int> renum(1001);

  fill(renum.begin(),renum.end(),0);
  int mxsize = max(a.size(),b.size());

  for(int i = 0 ; i < mxsize ; i++ ){
    renum[i+1] = (renum[i] + numa[i] + numb[i])/10;
    renum[i] = (renum[i] + numa[i] + numb[i])%10;
  }

  string srenum = "";
  for(int i = mxsize ; i >= 0 ; i-- ){
    if(i == mxsize && renum[i] == 0)continue;
    srenum += renum[i]+'0';
  }
  return srenum;
}

int main(){
  int n;
  cin >> n;
  while(n--){
    string a,b;
    cin >> a >> b;
    a = add(a,b);
    if(a.size() > 80)cout << "overflow" << endl;
    else cout << a << endl;
  }
  return 0;
}

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

const int MAX_SIZE = 128;

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = -1;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == -1 && r.d[i] == -1){
	if(!updigit)
	  continue;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i] != -1)
	  a = toI(this->d[i]);
	if(r.d[i] != -1)
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
    this->size = tmp;
    return;
  }

  void print()
  {
    puts("overflow");
    /*    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
	puts("");*/
  }

  int sz()
  {
    return this->size;
  }
};

int main()
{
  int d;
  scanf("%d", &d);
  while(d--){
    char s1[128], s2[128];
    scanf("%s",s1);
    scanf("%s",s2);
    Z z1(s1);
    Z z2(s2);
    if(z1.sz() > 80 || z2.sz() > 80){
      puts("overflow");
      continue;
    }
    z1.add(z2);
    z1.print();
  }
  return 0;
}

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

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(c,itr) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, j, n;
  char tmp;

  scanf("%d",&n);
  rep(i,n){
    string str1, str2, res;
    cin >> str1;
    cin >> str2;

    vector<int> a(82, 0), b(82, 0);

    rep(j,81){
      int sum = a[j] + b[j];
      if(sum >= 10){ sum %= 10; a[j+1]++;}
      res += (sum + '0');
    }

    reverse(res.begin(), res.end());
    int f = 0;
    rep(j,res.length()){
      if(res[j] != '0') f = 1;
      if(f) cout << res[j];
    }

    cout << endl;
  }

  return 0;
}

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

int main(){
	int n;
	cin >> n;
	for(int rep=0; rep<n; rep++){
		string str[3];
		cin >> str[0] >> str[1];
		int ml = max(str[0].length(), str[1].length())+1;
		for(int i=0; i<2; i++){
			reverse(str[i].begin(), str[i].end());
			int len = str[i].length();
			for(int j=0; j<ml-len; j++){
				str[i] += "0";
			}
		}
		str[2] = "";
		int c=0;
		for(int i=0; i<ml; i++){
			int n = (str[0][i]-'0')+(str[1][i]-'0')+c;
			if(n>9) c=1;
			else c=0;
			str[2] += n%10 +'0';
		}
		if(str[2].back()=='0') str[2].pop_back();
		reverse(str[2].begin(), str[2].end());
		if(str[2].length() > 80){
			cout << "overflow" << endl;
		}else{
			cout << str[2] << endl;
		}
	}
	return 0;
}