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 <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

const int BIGINT_UNIT_SIZE = 5;
const int BIGINT_UNIT_MAX = 1e5;

/* read */
int str2int(string s) {
  int r = 0;
  for (int i = 0; i < s.size(); ++i)
    r = r * 10 + int(s[i] - '0');
  return r;
}

struct BigInt {
  bool sign;
  vector<int> body;

  BigInt() : sign(false), body() {}

  BigInt(string s) {
    if (s[0] == '-') {
      sign = false;
      s = s.substr(1, s.size() - 1);
    } else {
      sign = true;
    }
    const int n = s.size();
    for (int idx = n;;) {
      idx -= BIGINT_UNIT_SIZE;
      if (idx >= 0) body.push_back(str2int(s.substr(idx, BIGINT_UNIT_SIZE)));
      else body.push_back(str2int(s.substr(0, idx + BIGINT_UNIT_SIZE)));
      if (idx <= 0) break;
    }
  }

  BigInt(int x) {
    if (x < 0) {
      sign = false;
      x = -x;
    } else {
      sign = true;
    }
    while (x > 0) {
      body.push_back(x % BIGINT_UNIT_MAX);
      x /= BIGINT_UNIT_MAX;
    }
  }

  bool operator>(BigInt);
  bool operator<(BigInt);
  bool operator==(BigInt);
  bool operator!=(BigInt);
  BigInt operator-(void);
  BigInt operator+(BigInt);
  BigInt operator-(BigInt);
  BigInt operator*(BigInt);
};

/* pretty print */
inline string pad(int x) {
  string r = "";
  assert(x >= 0);
  while (x > 0) {
    r = char((x % 10) + '0') + r;
    x /= 10;
  }
  while (r.size() < BIGINT_UNIT_SIZE) r = "0" + r;
  return r;
}
ostream& operator<<(ostream& os, BigInt a) {
  if (a.body.empty()) {
    os << "0";
  } else {
    if (!a.sign) os << '-';
    const int n = a.body.size();
    os << a.body[n-1];
    for (int i = n - 2; i >= 0; --i) os << pad(a.body[i]);
  }
  return os;
}

/* read from stdin */
istream& operator>>(istream& is, BigInt&a) {
  string s; is >> s;
  a = BigInt(s);
  return is;
}

/* comparison */

bool BigInt::operator==(BigInt y) {
  BigInt x = *this;
  if (x.sign != y.sign) return false;
  const int I = x.body.size();
  const int J = y.body.size();
  if (I != J) return false;
  for (int i = 0; i < I; ++i)
    if (x.body[i] != y.body[i]) return false;
  return true;
}

bool BigInt::operator!=(BigInt y) {
  return !(*this == y);
}

bool BigInt::operator<(BigInt y) {
  BigInt x = *this;
  if (x.sign && !y.sign) return false;
  if (!x.sign && y.sign) return true;
  if (!x.sign && !y.sign) return -x > -y;
  const int I = x.body.size();
  const int J = y.body.size();
  if (I < J) return true;
  if (I > J) return false;
  for (int i = I - 1; i >= 0; --i) {
    if (x.body[i] < y.body[i]) return true;
    if (x.body[i] > y.body[i]) return false;
  }
  return false;
}

bool BigInt::operator>(BigInt y) {
  return !(*this == y || *this < y);
}

/* unary */

BigInt BigInt::operator-() {
  BigInt r = *this;
  r.sign ^= true;
  return r;
}

/* binary */

BigInt BigInt::operator+(BigInt x) {
  if (this->sign && !x.sign) {
    return (*this) - -x;
  }
  if (!this->sign && x.sign) {
    return x - -(*this);
  }
  if (!this->sign && !x.sign) {
    return -(-(*this) + -x);
  }

  BigInt y = *this;
  const int I = y.body.size();
  const int J = x.body.size();
  for (int i = 0; i < min(I, J); ++i) {
    y.body[i] += x.body[i];
  }
  for (int i = I; i < J; ++i) {
    y.body.push_back(x.body[i]);
  }
  int carry = 0;
  for (int i = 0; i < y.body.size(); ++i) {
    y.body[i] += carry;
    carry = y.body[i] / BIGINT_UNIT_MAX;
    y.body[i] %= BIGINT_UNIT_MAX;
  }
  if (carry > 0) {
    y.body.push_back(carry);
  }
  return y;
}

BigInt BigInt::operator-(BigInt x) {
  if (this->sign && !x.sign) {
    return (*this) + -x;
  }
  if (!this->sign && x.sign) {
    return -(-(*this) + x);
  }
  if (!this->sign && !x.sign) {
    return -x - -(*this);
  }

  if ((*this) < x) {
    return -(x - *this);
  }

  BigInt y = *this;
  const int I = y.body.size();
  const int J = x.body.size();
  assert(I >= J);
  bool carry = false;
  for (int i = 0; i < I; ++i) {
    y.body[i] -= x.body[i];
    if (carry) {
      y.body[i]--;
      carry = false;
    }
    if (y.body[i] < 0) {
      y.body[i] += BIGINT_UNIT_MAX;
      carry = true;
    }
  }
  assert(!carry);
  while (!y.body.empty() && y.body.back() == 0) y.body.pop_back();
  return y;
}

int main() {

  int n; cin >> n;
  rep (_, n) {
    BigInt x, y;
    cin >> x >> y;
    cout << x + y << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char ans[101];
char n1[101];
char n2[101];
int main(){
	int d;
	int h1,h2,limit;
	for(cin>>d;d>0;d--){
		for(int j=0;j<100;j++)ans[j]='0';
		scanf("%s",n1);
		scanf("%s",n2);
		h1=strlen(n1)-1;
		h2=strlen(n2)-1;
		limit=max(h1,h2);
		int i;
		bool flg=false;
		for( i=0;i<=limit;i++,h1--,h2--){
			flg=false;
			int n1_tmp = 0;
			int n2_tmp = 0;
			if(h1>=0){
				n1_tmp=n1[h1]-'0';
			}
			if(h2>=0){
				n2_tmp=n2[h2]-'0';
			}
			int sum = n1_tmp + n2_tmp;
			if(sum>=10){
				if(i==79){
					i++;
					flg=true;
					break;
				}
				ans[i+1]+=1;
				sum=sum%10;
				flg=true;
			}

			if(ans[i]-'0'+sum > 9){
				if(i==79){
					i++;
					flg=true;
					break;
				}
				ans[i]=ans[i]+(sum-10);
				ans[i+1]+=1;
				flg=true;
			}
			else ans[i]+=sum;
		}
		if(flg){
			i++;
		}
		ans[i]='\0';
		if(i>80)cout<<"overflow"<<endl;
		else{
			for(--i;i>=0;i--){
				if(i>=0)cout<<ans[i];
			}
			cout<<endl;
		}
//		cout<<"size:"<<strlen(ans)<<endl;
	}
	return 0;
}