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

#define MAX_DIGITS 80
#define RESULT_OVERFLOW "overflow"

int main()
{
    using namespace std;
    string num1, num2, result;
    vector<string> results;
    int count;
    cin >> count;
    for (int i = 0; i < count; ++i) {
        cin >> num1 >> num2;
        if (num1.size() > MAX_DIGITS || num2.size() > MAX_DIGITS) {
            result = RESULT_OVERFLOW;
        }
        else {
            int co = 0; // carryover
            reverse(num1.begin(), num1.end());
            reverse(num2.begin(), num2.end());
            size_t digits = min((int)max(num1.size(), num2.size())+1, MAX_DIGITS);
            result.resize(digits);
            for (int j = 0; j < digits; ++j) {
                string digit1, digit2;
                digit1 = j < num1.size() ? num1.substr(j, 1) : "0";
                digit2 = j < num2.size() ? num2.substr(j, 1) : "0";
                int tmp = atoi(digit1.c_str()) + atoi(digit2.c_str()) + co;
                co = tmp/10;
                // "integer to numeric character" conversion. see ascii table.
                result[j] = char(48 + tmp - co*10);
            }
            if (co == 1) result = RESULT_OVERFLOW;
            else {
                reverse(result.begin(), result.end());
                if (result[0] == '0') result = result.substr(1);
            }
        }
        results.push_back(result);
    }
    for (vector<string>::iterator itr = results.begin();
         itr != results.end(); ++itr) {
        cout << *itr << endl;
    }
}

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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int n;
	cin >> n;
	while(n--) {
		char a[84], b[84];
		int x[84], y[84], s[84], max;
		cin >> a >> b;
		int i = 0, j = 0;
		for(; a[i] != '\0'; ++i) {
			x[i] = a[i] - '0';
		}
		for(; b[j] != '\0'; ++j) {
			y[j] = b[j] - '0';
		}
		if(i > 80 || j > 80) {
			cout << "overflow" << endl;
			break;
		}
		if(i > j) {
			for(int k = j - 1; k >= 0; k--) {
				y[i-j+k] = y[k];
			}
			rep(k,i-j) {
				y[k] = 0;
			}
			max = i;
		} else if(i < j) {
			for(int k = i - 1; k >= 0; k--) {
				x[j-i+k] = x[k];
			}
			rep(k,j-i) {
				x[k] = 0;
			}
			max = j;
		}
		bool f = 0;
		for(int k = max - 1; k >= 0; k--) {
			int c = x[k] + y[k];
			if(f) c++;
			if(c >= 10) {
				f = 1, c -= 10;
			} else f = 0;
			s[k] = c;
		}
		if(f) {
			max++;
		}
		if(max > 80) cout << "overflow" << endl;
		else {
			if(f) {
				cout << 1;
				max--;
			}
			rep(k,max) {
				cout << s[k];
			}
			cout << endl;
		}
	}
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	while( n-- ){
		string num1, num2;
		cin >> num1 >> num2;
		char sum[101];
		int degit = 0;
		/*for( int i = 0; i < min(num1.size(), num2.size()); i++ ){
			int now = degit+(int)(num1[num1.size()-i-1]-'0')+(int)(num2[num2.size()-i-1]-'0');
			sum[i] = (char)(now%10);
			if( now >= 10 ) degit = 1;
			else degit = 0;
		}*/
		for( int i = 0; i < sizeof(sum); i++ ) sum[i] = '0';
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] += (int)(num1[num1.size()-i-1]-'0');
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now;
			if( i < num2.size() ){
				now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
			}else{
				now = (int)(sum[100-i]-'0') + degit;
			}
			//sum[100-i] = sum[100-i] + num2[num2.size()-i-1]-'0';
			sum[100-i] = (char)(now%10+'0');
			if( now >= 10 ) degit = 1;
			else degit = 0;
			//cout << "now" << now << endl;
			d = i;
		}
		for( int i = 100-d; i < 101; i++ ) cout << sum[i];
		cout << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    string a,b,c;
    int x = 0,y = 0;
    cin >>a>>b;
    int as = a.size(),bs = b.size();
    for(int i=0; i<as || i<bs; i++){
      if(i<as && i<bs) x = a[as-i-1]+b[bs-i-1]+y-'0'*2;
      else if(i<as) x = a[as-i-1]+y-'0';
      else if(i<bs) x = b[bs-i-1]+y-'0';
      y = x/10;
      x%=10;
      c+=x+'0';
    }
    if(y == 1) c+='1';
    if(c.size() > 80) cout <<"overflow"<<endl;
    else{
      for(int i=c.size()-1; i>=0; i--) cout <<c[i];
      cout <<endl;
    }
  }
  return 0;
}