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 <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int DIGIT=9;

int main() {
  int n;
  char buf[81];
  int l, x[2], y, z;
  char buf_part[DIGIT+1];
  int a[2][9];
  int b[9];

  cin >> n;
  while (n--) {
    for (int i=0; i<2; i++) {
      cin >> buf;
      l = strlen(buf);
      x[i] = (l+DIGIT-1)/DIGIT;
      y = (l-1)%DIGIT+1;
      for (int j=0; j<9; j++) {
        a[i][j] = 0;
      }
      for (int j=0; j<x[i]; j++) {
        if (!j) {
          memcpy(buf_part, buf, y);
          buf_part[y] = '\0';
        }
        else {
          memcpy(buf_part, &buf[y+DIGIT*(j-1)], DIGIT);
          buf_part[DIGIT] = '\0';
        }
        a[i][x[i]-j-1] = atoi(buf_part);
      }
    }

    for (int i=0; i<9; i++) b[i] = 0;
    z = (x[0] > x[1]) ? x[0] : x[1];
    for (int i=0; i<z; i++) {
      b[i] = a[0][i] + a[1][i];
      if (b[i] >= 1000000000) {
        a[0][i+1]++;
        b[i] -= 1000000000;
      }
    }
    if (z<9 && a[0][z]) {
      b[z] = a[0][z]+a[1][z];
      ++z;
    }
    if (b[8] >= 100000000) {
      cout << "overflow" << endl;
    } else {
      cout << b[z-1];
      for (int i=z-2; i>=0; i--) {
        cout.fill('0');
        cout.width(DIGIT);
        cout << b[i];
      }
      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(); p++, i++) {
    if (i >= max_digit)
      throw runtime_error("overflow");
    rhs[i] = *p - '0';
  }
  return is;
}

int main(int argc, char **argv)
{
  int n;
  bignum a, b;
  string s;
  ostringstream os(s);

  cin >> n;
  try {
    while (n--) {
      cin >> a >> b;
      os << (a + b) << endl;
    }
    cout << os.str();
  } catch (runtime_error& re) {
    cout << re.what() << endl;
  }
  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 <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;
		}
		cout << keta << endl;
		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<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

int main(void)
{
int N,j,k=0;
cin >> N;
char strA[300],strB[300];
while(1){
k++;
if(k==N+1){
break;
}
cin >> strA >> strB;
int ans[81]={0};
ans[0]=11111;
if(strlen(strA)>80||strlen(strB)>80){
cout << "overflow" << endl;
continue;
}
int a[81]={0},b[81]={0};
j=strlen(strA)-1;
for(int i=80 ; j>=0 ; i--){
a[i]=(int)strA[j]-48;
j--;
}
j=strlen(strB)-1;
for(int i=80 ; j>=0 ; i--){
b[i]=(int)strB[j]-48;
j--;
}
for(int i=80 ; i!=0 ; i--){
ans[i]=ans[i]+a[i]+b[i];
if(ans[i]>=10){
ans[i]=ans[i]-10;
ans[i-1]++;
}
}
if(ans[0]!=11111){
cout << "overflow" << endl;
continue;
}
for(int i=1 ; i<81 ; i++){
if(ans[i]!=0){
j=i;
break;
}
}
char c[3];
for(int i=j ; i<81 ; i++){
printf("%c",ans[i]+48);
}
cout << '\n';
}
return 0;
}

C++: //56
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int N;
  cin>>N;
  while(N--){
    string s[2];
    for(int i=0;i<2;i++){
      cin>>s[i];
      reverse(s[i].begin(),s[i].end());
    }
    if(s[0].size()<s[1].size()){
      swap(s[0],s[1]);
    }
    string ans;
    int c=0;
    for(int i=0;i<s[0].size();i++){
      char d=(i<s[1].size())?s[1][i]:'0';
      d+=-'0'+s[0][i]+c;
      c=d>'9';
      if(d>'9'){
	d-=10;
      }
      ans+=d;
    }
    if(c){
      ans+='1';
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
  }
  return 0;
}