Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

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