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 <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char* add(const char* a, const char* b)
{
    int sizeA, sizeB, sizeX;
    int A, B, C;
    char* x;
    char* t;
    const char* ap;
    const char* bp;
    char* xp;
    C = 0;
    sizeA = strlen(a);
    sizeB = strlen(b);
    sizeX = (sizeA > sizeB ? sizeA : sizeB)+1;
    x = (char*)malloc(sizeX);
    ap = a + sizeA-1;
    bp = b + sizeB-1;
    xp = x + sizeX-1;
    
    while(xp >= x){
        A = ap < a ? 0 : *ap - '0';
        B = bp < b ? 0 : *bp - '0';
        *xp = '0' + (A + B + C) % 10;
        C = (A + B + C) / 10;
        ap--;
        bp--;
        xp--;
    }
    if (*x == '0'){
        t = (char*)malloc(sizeX - 1);
        strcpy(t, x + 1);
        free(x);
        return t;
    }
    return x;
}
int main()
{
    int i;
    int N;
    scanf("%d", &N);
    for(i = 0; i < N; ++i){
        char first[101];
        char second[101];
        scanf("%s", first);
        scanf("%s", second);
        if(strlen(first) > 80
        || strlen(second) > 80){
            printf("overflow\n");
            continue;
        }
        char* result = add(first, second);
        if(strlen(result) <= 80){
            printf("%s\n", result);
            free(result);
        }else{
            printf("overflow\n");
        }
    }
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int A[150] = {},B[150] = {},C[150] = {};
		string inA,inB;
		cin >> inA >> inB;
		for (int j = 0; j < inA.size(); ++j)
			A[inA.size()-j] = (int)(inA[j]-'0');
		for (int j = 0; j < inB.size(); ++j)
			B[inB.size()-j] = (int)(inB[j]-'0');
		int keta = 0;
		for (int j = 1; j < 150; ++j)
		{
			C[j] += A[j] + B[j];
			if(C[j] >= 10)
			{
				C[j+1] += C[j]/10;
				C[j] = C[j]%10;
			}
			if(C[j] != 0)
				keta = j;
		}
		if(keta > 80)
			cout << "overflow" << endl;
		else
		{
			bool haji = 0;
			for (int j = 149; j > 0; --j)
			{
				if(C[j] != 0)
					haji = 1;
				if(haji)
				{
					cout << C[j];
				}
			}
			cout << endl;
		}
	}
}

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(itr,c) 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;
  int len1, len2;
  char tmp;

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

    vector<int> a(200, 0), b(200, 0);
    len1 = (int)str1.size(); len2 = (int)str2.size();
    if(len1 > 80){
      cout << "overflow" << endl;
      continue;
    }
    if(len2 > 80){
      cout << "overflow" << endl;
      continue;
    }
    rep(j,len1) a[j] = str1[(int)len1-1-j] - '0';
    rep(j,len2) b[j] = str2[(int)len2-1-j] - '0';

    rep(j,200){
      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;
    string tmp;
    rep(j,res.size()){
      if(res[j] != '0') f = 1;
      if(f) tmp += res[j];
    }

    if((int)tmp.size() > 80) cout << "overflow" << endl;
    else cout << tmp << endl;
  }

  return 0;
}

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

int main(){
  string s,t, u;
  int n;
  char ch;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> s >> t;

    //    cout << "\ns=" << s << endl << "t=" <<  t << endl;

    if( s.length()>80 || t.length()>80 ){
      cout << "overflow" << endl;
      continue;
    }

    while( s.length()>t.length() )
      t = "0" + t;
    while( t.length()>s.length() )
      s = "0" + s;

    //    cout << "s=" << s << endl << "t=" <<  t << endl;

    u="";
    int c=0;
    for( int i=s.length();i>=0;--i ){
      int a = s[i]-'0';
      int b = t[i]-'0';
      int sum = a + b + c;
      if( sum>=10 ){
	sum-=10; c=1;
      }else
	c=0;
      ch = sum + '0';
      u = ch + u;
    }
    if( c==1 )
      u = "1" + u;
    if( u.length()>80 )
      cout << "overflow" << endl;
    else
      cout << u << endl;
  }
}

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];

	ctod("0", d);
	dtoc(o, d);
	return 0;

	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;
}