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 <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;
  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,str1.size()) a[j] = str1[(int)str1.size()-1-j] - '0';
    rep(j,str2.size()) b[j] = str2[(int)str2.size()-1-j] - '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.size()){
      if(res[j] != '0') f = 1;
      if(f) cout << res[j];
    }

    cout << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	string a,b;
	vector<int> ans;
	int n,tmp,carry,num;
	bool flag = true;
	cin >> n;
	for(int i=0; i<n; i++){
		ans.clear();
		cin >> a >> b;
		int ai = a.size()-1;
		int bi = b.size()-1;
		carry=0;
		if(a.size() > 80 || b.size() > 80){
			cout << "overflow" << endl;
			flag = false;
		}
		while(ai >= 0 || bi >= 0){
			tmp=0;
			if(ai >= 0) tmp += a[ai] - '0';
			if(bi >= 0) tmp += b[bi] - '0';
			ans.push_back((tmp+carry)%10);
			carry = (tmp+carry)/10;
			ai--; bi--;
		}
		if(carry != 0) ans.push_back(carry);
		if(ans.size() > 80 && flag == true){
			cout << "overflow" << endl;
			flag = false;
		}
		if(flag == true){
			for(int j=ans.size()-1; j>=0; j--)
				cout << ans[j];
			cout << endl;
		}
	}
	return 0;
}

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

#define NUMBER_DIGITS 80

int main()
{
  int N;
  char str1[NUMBER_DIGITS + 1];
  char str2[NUMBER_DIGITS + 1];
  char str3[NUMBER_DIGITS / 2 + 1][3];
  char str4[NUMBER_DIGITS / 2 + 1][3];
  int n1[NUMBER_DIGITS / 2 + 1] = {};
  int n2[NUMBER_DIGITS / 2 + 1] = {};
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > NUMBER_DIGITS || m2 > NUMBER_DIGITS)
      cout << "overflow" << endl;
    else if(atoi(str1) <= 2000000000 && atoi(str2) <= 2000000000 && atoi(str1) + atoi(str2) <= 2000000000){
      cout << atoi(str1) + atoi(str2) << endl;
      break;
    }else{
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m1 + 1; i += 2, j--){
	if(m1 % 2 == 1 && m1 - i < 0){
	  str3[j][0] = str1[0];
	  str3[j][1] == '\0';
	}else{
	  strncpy(str3[j], &str1[m1 - i], 2);
	  str3[j][2] == '\0';
	}
      }
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m2 + 1; i += 2, j--){
	if(m2 % 2 == 1 && m2 - i < 0){
	  str4[j][0] = str2[0];
	  str4[j][1] == '\0';
	}else{	  
	  strncpy(str4[j], &str2[m2 - i], 2);
	  str4[j][2] == '\0';
	}
      }
      for(int i = NUMBER_DIGITS / 2; i + ((m1 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m1 / 2; i--)
	if(str3[i][0] == '0' && str3[i][1] == '0')
	  n1[i] = 1000;
	else
	  n1[i] = atoi(str3[i]);
      for(int i = NUMBER_DIGITS / 2; i + ((m2 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m2 / 2; i--)
	if(str4[i][0] == '0' && str4[i][1] == '0')
	  n2[i] = 1000;
	else
	  n2[i] = atoi(str4[i]);
      int ans[NUMBER_DIGITS / 2 + 1] = {};
      int i = 0;
      int m = (m1 > m2) ? m1 : m2;
      for(int j = NUMBER_DIGITS / 2; NUMBER_DIGITS / 2 - 1 - m / 2 < ((m % 2) ? j + 1 : j); i++, j--)
	if(n1[j] + n2[j] >= 100)
	  if(n1[j] == 1000 && n2[j] < 10){
	    n1[j - 1] *= 10;
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] < 10){
	    n2[j - 1] *= 10;
	    ans[i] = n1[j];
	  }else if(n1[j] == 1000 && n2[j] == 1000){
	    if(n1[j - 1] % 10 != 0)
	      n1[j - 1] *= 10;
	    ans[i] = 1000;
	  }else if(n1[j] == 1000 && n2[j] >= 10){
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] >= 10){
	    ans[i] = n1[j];
	  }else if(n1[j] + n2[j] < 110){
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] + 900;
	  }else{
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] - 100;
	  }
	else
	  ans[i] = n1[j] + n2[j];
      int k = i;
      for(; i > 0; i--)
	if((i == k) && (ans[i - 1] == 0))
	  ;
	else if(ans[i - 1] == 1000)
	  cout << "00";
	else if(ans[i - 1] > 1000)
	  cout << "0" << ans[i - 1] % 1000;
	else
	  cout << ans[i - 1];
      cout << endl;
    }
  }
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k,l;
    bool check;

    cin >> n;
    rep(i,n){
        char c1[81], c2[81];
        int i1[81] = {0}, i2[81] = {0};
        int ans[82] = {0};
        check = false;
        k = 0; l = 0;
        cin >> c1 >> c2;
/*      for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k] = c1[j] - '0';
                k++;
            }
            if(j <= strlen(c2) - 1){
                i2[l] = c2[j] - '0';
                l++;
            }
        }*/
        rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[80] != 0){
            cout << "overflow";
        }else{
            for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }
        }
        cout << endl;
    }
}