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++: /*
 * Problem     : AOJ0015
 * Title       : Integral
 * Author      : mizo0203
 * Status      : Accepted
 * Date        : Sun Jun 24 20:50:52
 * Copyright   : Your copyright free
 * Description : 文字列・多倍長演算
 */

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;

int N, f;
char str1[81], str2[81];
int sum[80];

void init() {
  scanf("%d", &N);
}

bool input() {
  char c;

  if (!N)
    return false;
  N--;

  f = 0;
  scanf("%80s", str1);
  scanf("%c", &c);
  if ('0' <= c && c <= '9') {
    f = 1;
    return true;
  }
  scanf("%80s", str2);
  scanf("%c", &c);
  if ('0' <= c && c <= '9') {
    f = 1;
    return true;
  }

  return true;
}

int main() {
  int i;

  init();
  while (input()) {
    if (f) {
      printf("overflow\n");
      continue;
    }
    fill(sum, sum + 80, 0);
    for (i = 0; i < (int) strlen(str1); i++) {
      sum[i] = str1[strlen(str1) - i - 1] - '0';
    }
    f = 0;
    for (i = 0; i < (int) strlen(str2); i++) {
      sum[i] += str2[strlen(str2) - i - 1] - '0' + f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    for (; i < 80; i++) {
      sum[i] += f;
      f = 0;
      if (sum[i] > 9) {
        sum[i] -= 10;
        f = 1;
      }
    }
    if (f) {
      printf("overflow\n");
      continue;
    }
    for (i = 0; i < 79; i++) {
      if (sum[79 - i] != 0)
        break;
    }
    for (; i < 80; i++) {
      printf("%d", sum[79 - i]);
    }
    printf("\n");
  }

  return 0;
}

C++: #include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		string a, b;
		cin >> a;
		cin >> b;
		string result(80, '0');
		int over = 0;
		int j = a.length() - 1;
		int k = b.length() - 1;
		int l = 79;
		for (; l >= 0; --j, --k, --l) {
			int numa = j < 0 ? '0' : a[j];
			int numb = k < 0 ? '0' : b[k];
			int sum = numa + numb - '0' * 2 + over;
			if (sum >= 10) {
				over = 1;
				sum -= 10;
			} else {
				over = 0;
			}
			result[l] = sum + '0';
		}
		if (over == 1) {
			cout << "overflow" << endl;
		} else {
			int j = 0;
			for (; j < result.length() && result[j] == '0'; ++j);
			for (; j < result.length(); ++j) cout << result[j];
			cout << endl;
		}
	}

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cctype>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <stdexcept>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const double PI = 3.141592653589793238462643383279502884L;
const int LARGE_INT = 1000000007;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i,a,cont,next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i,a,b,s) repfn(i,a,i<b,i+s)
#define repab(i,a,b) repby(i,a,b,1)
#define rep(i,b) repab(i,0,b)
#define pb push_back
#define sz(c) int((c).size())

typedef vector<int> bignum;
const int max_digit = 80;

bignum operator+(const bignum& lhs, const bignum& rhs)
{
  int tmp, carry = 0;
  bignum res(max_digit, 0);
  for (int i = 0; i < max_digit; i++) {
    tmp = lhs[i] + rhs[i] + carry;
    if (tmp > 9) {
      carry = 1;
      res[i] = tmp % 10;
    } else {
      carry = 0;
      res[i] = tmp;
    }
  }
  if (carry)
    throw runtime_error("overflow");
  return res;
}

ostream& operator<<(ostream& os, const bignum& rhs)
{
  bool skip = true;
  rtr(rhs, i) {
    if (*i == 0 && skip)
      continue;

    skip = false;
    os << *i;
  }
  return os;
}

istream& operator>>(istream& is, bignum& rhs)
{
  string s;
  int i = 0;
  is >> s;
  rhs.assign(max_digit, 0);
  for (auto p = s.rbegin(); p != s.rend() && i <= max_digit; p++, i++) {
    rhs[i] = *p - '0';
  }
  if (sz(rhs) > max_digit)
    throw runtime_error("overflow");
  return is;
}

int main(int argc, char **argv)
{
  int n;
  bignum a, b;

  cin >> n;
    while (n--) {
      try {
        cin >> a >> b;
        cout << (a + b) << endl;
      } catch (runtime_error& re) {
        cout << re.what() << endl;
      }
    }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
	int N;
	cin >> N;

	string A, B;
	for (int i = 0; i < N; i++) {
		cin >> A >> B;
		int nl, ml;
		nl = A.size();
		ml = B.size();
		string a, b;
		if (nl >= ml) {
			a = A;
			b = B;
		}
		else {
			a = B;
			b = A;
		}
		//cout << "a:" << a << ' ' << "b:" << b << endl;

		int f = 0, of = 0;
		int as = a.size(),
			bs = b.size();
		int AL = as;
		as--;
		bs--;
		while (1) {
			int n = (int)a.at(as) - '0',
				m = (int)b.at(bs) - '0';
			as--;
			bs--;
			//cout << n << ' ' << m << endl;

			int r = n + m;
			if (f) {
				r++;
				f = 0;
			}
			a.at(as + 1) = (char)r%10 + 48;

			if (r > 9) {
				f = 1;

				if (as < 0 && bs < 0) {
					of = 1;
					AL++;
					break;
				}
				else if (as >= 0 && bs < 0) {
					for (int j = as; j >= 0; j--) {
						int n2 = (int)a.at(j) - '0';
						if (f) {
							n2++;
							f = 0;
						}
						a.at(j) = (char)n2 % 10 + 48;
						
						if (n2 > 9) {
							f = 1;
							if (!j) {
								of = 1;
								AL++;
								break;
							}
						}
					}
				}
			}

			if (bs < 0) break;
		}

		if (AL > 80) {
			cout << "overflow" << endl;
		}
		else {
			if (of) cout << 1;
			cout << a << endl;
		}
	}
}