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;
    BigInt z = x + y;
    stringstream ss; ss << z;
    if (ss.str().size() > 80) {
      cout << "overflow" << endl;
    } else {
      cout << z << endl;
    }
  }

  return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

int sum(char a[],char b[],int as,int bs,char c[]){
	int cs = (as>bs) ? as + 1 : bs + 1;
	int size = cs;
	while(as >=0 && bs >=0){
		c[cs] += a[as] + b[bs];
		if(c[cs]>9){
			c[cs] -= 10;
			c[cs-1] += 1;
		}
		as--;bs--;cs--;
	}
	while(as >=0){
		c[cs] += a[as];
		if(c[cs]>9){
			c[cs] -= 10;
			c[cs-1] += 1;
		}
		as--;cs--;
	}
	while(bs >=0){
		c[cs] += b[bs--];
		if(c[cs]>9){
			c[cs] -= 10;
			c[cs-1] += 1;
		}
		cs--;
	}
	return (c[0]>0) ? size + 1 : size;
}

int main(){
	char a[256],b[256],c[256];
	bool flag = true;
	int len1,len2,len3,n;
	scanf("%d",&n);
	while(n--){
		scanf("%s",a);
		scanf("%s",b);
		len1 = strlen(a);
		len2 = strlen(b);
		if(len1 > 80 || len2 >80){
			printf("overflow\n");
			continue;
		}
		for(int i=0;i<len1;i++) a[i] -= 0x30;
		for(int i=0;i<len2;i++) b[i] -= 0x30;
		for(int i=0;i<256;i++)  c[i] = 0;
		len3 = sum(a,b,len1-1,len2-1,c);
		if(len3>80){
			printf("overflow\n");
			continue;
		}
		if(c[0]>0) for(int i=0;i<len3;i++) printf("%d",c[i]);
		else for(int i=1;i<=len3;i++) printf("%d",c[i]);
		printf("\n");
	}
	return 0;
}