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 <algorithm>
#include <string>
#include <sstream>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin>>v; return v; }
template<class T> inline string toString(T x){ ostringstream sout; sout<<x; return sout.str(); }

#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x) cerr<<#x<<" = "<<(x)<<"(L"<<__LINE__<<")"<<" "<<__FILE__<<endl;

int main(){
	int N; cin >> N;
	cin.ignore();
	for (int i = 0; i < N; i++) {
		string a, b; cin >> a >> b;
		if (a.size() < b.size()) {
			string tmp;
			for (int j = 0; i < b.size()-a.size(); i++) { tmp += "0"; }
			a = tmp + a;
		} else if (b.size() < a.size()) {
			string tmp;
			for (int j = 0; i < a.size()-b.size(); i++) { tmp += "0"; }
			b = tmp + b;
		}
		
		string res;
		for (int j = 0; j < a.size()+1; j++) res += "0";
		a = "0"+a; b = "0"+b;
		for (int j = res.size()-1; j >= 0; j--) {
			int cur = 0;
			if (res[j] >= '0' && res[j] <= '9') {
				cur = res[j]-'0';
			}
			int ai = a[j]-'0', bi = b[j]-'0';
			int res_tmp = ai+bi+cur;
			if (res_tmp >= 10) { 
				res[j] = '0'+(res_tmp%10);
				res[j-1] = '0'+(res_tmp/10); 
			} else {
				res[j] = '0'+res_tmp;
			}
		}
		int i = 0;
		while (res[i] == '0') { i++; }
		string ans("");
		for (; i < res.size(); i++) ans += res[i];
		
		if (ans.size() > 80) {
			cout << "overflow" << endl;
		} else {
			cout << ans << endl;
		}
	}

	return 0;
}

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

std::string add(std::string,std::string);

int main(){
  std::string n,m;
  int size;
  std::cin>>size;
  std::vector<std::string> sums;
  for(int i=0;i<size;++i){
    std::cin>>n>>m;
    std::string sum = add(n,m);
    if(sum.length()<=80)
      sums.push_back(sum); 
    else
      sums.push_back("overflow"); 
  }

  for(auto s:sums)
    std::cout<<s<<std::endl;

  return 0;
}

std::string add(std::string n,std::string m){
  if(n.length()>m.length()) std::swap(n,m);
  std::reverse(n.begin(),n.end());
  std::reverse(m.begin(),m.end());
  std::string sum;
  char c=0,s,t;
  for(int i=0;i<m.length()||c==1;++i){
    t = (i<n.length()?n[i]-'0':0)+(i<m.length()?m[i]-'0':0)+c;
    s = t%10;
    c = t/10;
    sum.push_back(s+'0');
  }
  
  std::reverse(sum.begin(),sum.end());
  sum.push_back('\0');
  return sum;
}

C++: #include<cstdio>
#include<algorithm>
#include<string.h>
#include<string>

using namespace std;

#define MAX(x,y) ((x>y)? x:y)


int n;//データセットの数

char str[2][85];//	入力される整数文字列
int n_str[2];//長さを収納

char answer[85];

FILE *fp=stdin;

int main()
{
	fscanf(fp,"%d",&n);
	for(int i=0;i<n;i++)
	{
		fscanf(fp,"%s%s",&str[0],&str[1]);
		for(int j=0;j<2;j++)n_str[j]=strlen(str[j]);
		int max =0,min=1;
		if(n_str[1]>n_str[0])
		{
			max=1;
			min=0;
		}
		int s = n_str[max]-n_str[min];
		char cha[85];
		fill(cha,cha+80,'0');
		for(int j=n_str[min];j>=0;j--)
		{
			cha[j+s]=str[min][j];
		}
		strcpy(str[min],cha);
		fill(answer,answer+80,0);
		for(int j=n_str[max]-1;j>=0;j--)
		{
			answer[j]=str[0][j]+str[1][j]-'0';
			if(answer[j]>'9')//繰り上がり時の処理
			{
				answer[j]-=10;
				str[0][j-1]++;
				if(j==0)
				{
					printf("1");
				}
			}
		}
		printf("%s\n",answer);
	}
	fclose(fp);
	return 0;
}

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


int getValue(string str, int i){
	int endp,startp;

	endp = str.length() - 8 * i;
	startp = str.length() - 8 - 8 * i;
	if( endp <= 0 )
		return 0;
	else if( startp <= 0 ) {
		return atoi( str.substr(0,endp).c_str() );					
	}
	else {
		return atoi( str.substr(startp,8).c_str() );					
	}
	return -1;
}


int main()
{
	int num,i,j,startp,endp;
	string str1, str2;
	long v1,v2;
	int v[10];
	cin >> num;
	for(i = 0; i < num; i++ ) {
		cin >> str1;
		cin >> str2;
		if( str1.length() > 80 || str2.length() > 80 ){
			
		}
		//8桁ずつ分けて計算
		int flg = 0;
		for( j = 0; j < 10; j++ ) {
			v1 = getValue( str1, j );
			v2 = getValue( str2, j );
			
			v[j] = v1 + v2 + flg;
			if( v[j] >= 100000000 ) {
				flg = 1;
				v[j] -= 100000000;
			}
			else {
				flg = 0;
			}
		}
		if( flg == 1 )
			printf("overflow\n");
		else {
			flg = 0;
			for( i = 9 ; i >= 0; i-- ) {
				if( v[i] > 0 ){
					printf("%d",v[i] );
					flg = 1;
				}
				else if( flg == 1 ) {
					printf("%08d",v[i] );
				}
				
			}
			printf("\n");	
		}
	}




	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  string num1,num2,tmp;
  int n;

  cin >> n;
  while(n--){

    cin >> num1 >> num2;

    if((int)num1.size() < (int)num2.size()){
      tmp = num2;
      num2 = num1;
      num1 = tmp;
    }

    if(num1.size() > 80){
      cout << "overflow" << endl;
      continue;
    }

    for(int i = 0 ; i < (int)num1.size() ; i++ )tmp[i] = num1[i];

    for(int i = (int)num1.size() - 1 ; i >= 0 ; i-- )
      {
	num1[i] = tmp[(int)num1.size() - 1 - i];
      }
    for(int i = 0 ; i < (int)num2.size() ; i++ )tmp[i] = num2[i];

    for(int i = (int)num2.size() - 1  ; i >= 0 ; i-- )
      {
	num2[i] = tmp[(int)num2.size() - 1 - i];
      }

    for(int i = (int)num2.size() ; i < (int)num1.size() ; i++ )num2+='0';

    char tmp2 = '0';
    string ans;

    for(int i = 0 ; i < num1.size() ; i++ ){
      if((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') > 9){
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') - 10) + '0');
	tmp2 = '1';
      } else {
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0')) + '0');
	tmp2 = '0'; 
      }
    }
  
    if((int)((tmp2 - '0') + (num1[num1.size() - 1] - '0') + (num2[num1.size() - 1] - '0')) > 9)ans+='1'; 
    if(ans.size() > 80){
      cout << "overflow" << endl;
    }else{

      for(int i = (int)ans.size() ; i >= 0 ; i-- ){
	cout << ans[i];
      }  
      cout << endl;
    }
  }

  return 0;
}

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

#define REP(i,s,e) for(int i=int(s);i<int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-6

using namespace std;

int main(){

	int n;
	cin >> n;

	rep(i,n){

	string a,b;
	cin >> a >> b;

	int sa=a.size(); int sb=b.size(); int p=max(sa,sb);
	vector<char>s;

	if(sa>80 || sb>80)
	cout << "overflow" << endl;
	else{

	string z;
	if(sa>sb){
	rep(j,sa-sb)
	z+='0';
	b=z+b;
	}
	if(sb>sa){
	rep(j,sb-sa)
	z+='0';
	a=z+a;
	}

    int c=0;
	rep(j,p){

	c+=(a[p-1-j]-'0')+(b[p-1-j]-'0');

	s.push_back(c%10+'0');
	c=c/10;

	}

    if(c==1) s.push_back(c%10+'0');

    if(s.size()>80)
    cout << "overflow" << endl;
    else
    rep(k,s.size()) cout << s[s.size()-1-k];

	}

	cout << endl;
	s.clear();

	}

	return 0;
}