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

int main(){


  string strx,stry;
  int N;

  cin >> N;
  while(N){
    cin >> strx ;
    cin >> stry;
    int x[20] = {0},y[20] = {0};
    int i=0,lenx = strx.size(), leny = stry.size();
    string tmp;
    
    for( i = 0; lenx > 5 ; i++){
      tmp = strx.substr(lenx - 5);
      x[i] = atoi(tmp.c_str());
      strx =  strx.substr(0,lenx - 5);
      lenx -= 5;
    }
    x[i] = atoi(strx.c_str());
    for( i = 0; leny > 5 ; i++){
      tmp = stry.substr(leny - 5);
      y[i] = atoi(tmp.c_str());
      stry =  stry.substr(0,leny - 5);
      leny -= 5;
    }
    y[i] = atoi(stry.c_str());
    
    
    int ans[20] = {0};
    for(i = 0 ; i < 20 ; i++){
      ans[i] += x[i] + y[i];
      if(ans[i] > 99999){
	ans[i+1] += 1;
	ans[i] -= 100000;
      }
    }
    if(ans[16] != 0)
      cout << "overflow"<< endl;
    else{
      for(i = 15; i >= 0 ; i--){
	if(ans[i] != 0)
	  break;
      }
      cout << ans[i];
      for(i = i-1; i >= 0 ; i--){
	if(ans[i] < 10) cout << "0";
	if(ans[i] < 100) cout << "0";
	if(ans[i] < 1000) cout << "0";
	if(ans[i] < 10000) cout << "0";
	cout << ans[i];
      }
      cout << endl;
    }
    N--;
  }
  return 0;
}

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

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
	int n;
    string a, b;
		
	cin>> n;	
	for(int i=0;i<n;i++){
		int x[81]={0}, y[81]={0}, z[81]={0};

		cin >> a;
		cin >> b;
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		
		for(int j=0;j<a.size();j++){
			x[j]=a[j]-'0';
		}
		for(int j=0;j<b.size();j++){
			y[j]=b[j]-'0';
		}
		
		for(int j=0;j<80;j++){
			z[j]+=x[j]+y[j];
			if(z[j]>=10){
				z[j+1]++;
				z[j]-=10;
			}
		}
		
		if(z[80]>0){
			cout << "overflow" <<endl;
		}else{
			bool flag = 0;
			for(int j=79;j>=0;j--){
				if(z[j]==0&& flag==0){
					continue;
				}else{
					flag=1;
				}
				cout<<z[j];
			}
			if(flag==0){
				cout<<0;
			}
			cout<<endl;
			
		}
		
	}
	
	return 0;
}

C++: /*****include*****/
#include <iostream>
#include <fstream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	char number1[81];
	char number2[81];
	int sum[81];
	int digit1;
	int digit2;
	int digit_sum;
	int move_up;
	int i,j;
	int n;
	/*****処理部*****/
	cin >> n;
	for(int loop=0;loop<n;loop++){
		memset(number1,'0',sizeof(number1));
		memset(number2,'0',sizeof(number1));
		digit1 = 0;
		digit2 = 0;
		cin >> number1;
		cin >> number2;
		while(number1[digit1] != '\0')	digit1++;
		while(number2[digit2] != '\0')	digit2++;
		move_up = 0;
		//cout << digit1 << " " << digit2 << endl;
		if(digit1 != digit2){
			if(digit1 > digit2){
				i = digit1;
				j = digit2;
				while(j>=0){
					number2[i] = number2[j];
					number2[j] = '0';
					i--;j--;
				}
			}else{
				i = digit1;
				j = digit2;
				while(i>=0){
					number1[j] = number1[i];
					number1[i] = '0';
					i--;j--;
				}
			}
		}
		/*for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
			cout << number1[i-1];
		}
		cout << endl;
		for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
			cout << number2[i-1];
		}
		cout << endl;*/
		//for(int i=0;i<4;i++)	cout << number2[i] << " " << atoi(&number2[i]) << endl;
		//for(int i=0;i<4;i++)	cout << number1[i] << " " << atoi(&number1[i]) << endl;
		digit_sum = 0;
			for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){
		//cout << atoi(&number1[i-1]) << " " << atoi(&number2[i-1]) << endl;
			sum[digit_sum]
				= number1[i-1] - '0'
					+ number2[i-1] - '0'
			+ move_up;
			if(sum[digit_sum] >= 10){
				move_up = 1;
				sum[digit_sum] = sum[digit_sum] % 10;
			}else{
				move_up = 0;
			}
			digit_sum++;
		}
		if(move_up == 1){
			sum[digit_sum] = move_up;
			digit_sum++;
		}
		//cout << digit_sum << endl;
		if(digit_sum > 79)	cout << "overflow" << endl;
		else{
			for(int k=digit_sum-1;k>=0;k--){
				cout << sum[k];
			}
			cout << endl;
		}
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

void ctod(char *c, int *d){
	int len = strlen(c);
	char ct[10];
	int h = len / 9;
	int a = len % 9;

	for(int i=0;i<9;++i){
		d[i] = 0;
	}
	if(a != 0){
		memcpy(ct, c, a);
		ct[a] = '\0';
		d[h] = atoi(ct);
	}

	for(int i=0; i<h; ++i){
		memcpy(ct, c + len - 9*(i + 1), 9);
		ct[9] = '\0';
		d[i] = atoi(ct);
	}
}

void dtoc(char *c, int *d){
	char ct[10];
	int m = -1;
	int o = 0;
	for(int i=8; i>=0; --i){
		if(d[i] != 0){
			m = i;
			break;
		}
	}
	if(m == -1){
		c[0] = '0';
		c[1] = '\0';
		return;
	}

	sprintf(ct, "%d", d[m]);
	o = strlen(ct);
	memcpy(c, ct, 9);
	for(int i = m-1; i>=0; --i){
		sprintf(ct, "%09d", d[i]);
		memcpy(c+o, ct, 9);
		o += 9;
	}
	c[o] = '\0';
}

void add(int *d1, int *d2, int *d){
	int s = 0;
	for (int i=0; i<9; ++i){
		d[i] = d1[i] + d2[i] + s;
		s = d[i] / 1000000000;
		d[i] -= 1000000000 * s;
	}
}

int main(void){
	int n = 0;
	char i1[255], i2[255], o[255];
	int d1[9], d2[9], d[9];

	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%s", i1);
		scanf("%s", i2);
		if(strlen(i1) > 80 || strlen(i2) > 80){
			puts("overflow");
			continue;
		}

		for(int j=0; j<9;++j){
			d1[j] = d2[j] = d[j] = 0;
		}
		ctod(i1, d1);
		ctod(i2, d2);
		add(d1, d2, d);
		dtoc(o, d);
		printf("%s\n", o);
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;
string S, T; int n, x[10000], a[10000], b[10000], cnt; char U[11] = "0123456789";
int main() {
	cin >> n;
	for (int times = 0; times < n; times++) {
		cin >> S >> T;
		memset(x, 0, sizeof(x));
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		for (int i = 0; i < S.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == S[i]) {
					a[S.size() - 1 - i] = j;
				}
			}
		}
		for (int i = 0; i < T.size(); i++) {
			for (int j = 0; j < 10; j++) {
				if (U[j] == T[i]) {
					b[T.size() - 1 - i] = j;
				}
			}
		}
		if (S.size() > 80 || T.size() > 80) {
			cout << "overflow" << endl; goto E;
		}
		for (int i = 0; i < 80; i++) {
			x[i] += (a[i] + b[i]) % 10;
			x[i + 1] += (a[i] + b[i]) / 10;
			if (x[i] >= 10) {
				x[i + 1] += x[i] / 10;
				x[i] %= 10;
			}
			if (x[i + 1] >= 10) {
				x[i + 2]++;
				x[i + 1] %= 10;
			}
		}
		cnt = 0;
		if (x[80] > 0) {
			cout << "overflow" << endl;
		}
		else {
			for (int i = 79; i >= 0; i--) {
				if (x[i] > 0 || i == 0) { cnt++; }
				if (cnt) { cout << x[i]; }
			}
			cout << endl;
		}
	E:;
	}
}