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<string>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s1, s2;
		int l1, l2;
		cin >> s1 >> s2;
		l1 = s1.length();
		l2 = s2.length();
		if (l1>80 || l2 > 80)
			cout << "overflow" << endl;	
		else
		{
			int result[100], r = 0, m = max(l1, l2);
			reverse(s1.begin(), s1.end());
			reverse(s2.begin(), s2.end());
			for (int j = 0; j < m; j++)
			{
				s1.resize(m + 1, '0');
				s2.resize(m + 1, '0');
				int t = s1[j] + s2[j] - 48 * 2;
				result[j] = r + t % 10;
				r = t / 10;
			}
			if (r == 1)
				result[m++] = 1;
			if (m>80)
				cout << "overflow" << endl;
			else
				for (int j = m - 1; j >= 0; j--)
					cout << result[j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
 
using namespace std;
 
char calc(char x,char y,char z,bool &C){
  int a = x - '0',b = y - '0',c = z - '0';
  int d = a + b + c;
 
  if(d >= 10){
    C = true;
    d -= 10;
  }
 
  return d + '0';
}
 
string sum(string a,string b){
  string res = "";
 
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
 
  int length;
  if((int)a.size() > (int)b.size()){
    length = (int)a.size();
     
    for(int i = (int)b.size() ; i < length ; i++){
      b += '0';
    }
 
  }
  else{
    length = (int)b.size();
 
    for(int i = (int)a.size() ; i < length ; i++){
      a += '0';
    }
 
  }
 
  for(int i = 0 ; i <= length ; i++)
    res += '0';
 
  for(int i = 0 ; i < length ; i++){
    bool C = false;
    res[i] = calc(a[i],b[i],res[i],C);
    if(C) res[i+1] = ((res[i+1]-'0') + 1) + '0';
  }
 
  for(int i = length ;; i--){
     
    if(res[i] == '0'){
      res.erase(res.begin()+i);
    }
    else{
      break;
    }
     
  }
 
  reverse(res.begin(),res.end()); 
 
  return res;
}

int main(){
  int n;

  cin >> n;
  while(n--){
    string a,b;

    cin >> a >> b;

    if(a == "0" && b == "0"){
      cout << "0" << endl;
      continue;
    }

    string c = sum(a,b);    

    if((int)c.size() > 80) cout << "overflow" << endl;
    else cout << c << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <cstring>
#include <algorithm>
#include <sstream>
using namespace std;

string error = "overflow";

int main(){
	int n;
	cin >> n;
	bool over[n];
	int keta[n];
	string a[n], b[n];
	char c[n][81]; 
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 81; j++){
			c[i][j] = '0';
		}
	}
	for(int i = 0; i < n; i++){
		over[i] = false;
		keta[i] = 0;
		int extra = 0;
		cin >> a[i] >> b[i];
		if(a[i].size() < b[i].size()){
			swap(a[i],b[i]);
		}
		
		for(int j = 0; j < a[i].size(); j++){
			int p, q, num;
			stringstream sa, sb, sc;
			sa << a[i][a[i].size()-j-1];
			sa >> p;
			if(j < b[i].size()){
				sb << b[i][b[i].size()-j-1];
				sb >> q;
			}
			else{
				q = 0;
			}
			if(p+q+extra < 10){
				sc << p+q+extra;
				sc >> c[i][j];
				extra = 0;
			}
			else{
				int kurai;
				kurai = (p+q+extra)%10;
				sc << kurai;
				sc >> c[i][j];
				extra = 1;
				if(j == a[i].size()-1){
					c[i][a[i].size()] = '1';
					keta[i] = 1;
				}
			}
		}
		if(c[i][80] != '0'){
			over[i] = true;
		}
	}
	for(int i = 0; i < n; i++){
		if(over[i] == true){
			cout << error;
		}
		else{
			for(int j = 0; j < a[i].size()+keta[i]; j++){
			cout << c[i][a[i].size()+keta[i]-j-1];
			}
		}
		cout << endl;
	}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

const int MAX_SIZE = 90;

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = 0;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == 0&& r.d[i] == 0){
	if(!updigit)
	  goto end;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i])
	  a = toI(this->d[i]);
	if(r.d[i])
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
  end:
    this->size = tmp;
    return;
  }

  void print()
  {
    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
    puts("");
  }

  int sz()
  {
    return this->size;
  }
};

int main()
{
  int x;
  scanf("%d", &x);
  char s1[MAX_SIZE], s2[MAX_SIZE];  
  for(int i=0;i<x;i++){
    scanf("%s%s",s1, s2);
    /*    Z z1(s1);
    Z z2(s2);
    if(z1.sz() > 80 || z2.sz() > 80){
      puts("overflow");
      continue;
    }
    z1.add(z2);
    z1.print();*/
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>

using namespace std;

void initiate(int* a)
{
	for (int j=0; j<101; j++) a[j] = 0;
}

int main()
{
	int a[101], b[101];
	char buf[101];
	
	int datasets;
	cin >> datasets;
	
	int len;
	
	for (int i=0; i<datasets; i++) {
		initiate(a); initiate(b);
		cin >> buf;
		len = strlen(buf);
		for (int j=0; j<len; j++) a[j] = static_cast<int>(buf[len-j-1] - 48);
		cin >> buf;
		len = strlen(buf);
		for (int j=0; j<len; j++) b[j] = static_cast<int>(buf[len-j-1] - 48);
		
		//test
		//for (int j=0; j<100; j++) cout << a[j];
		//cout << endl;
		//for (int j=0; j<100; j++) cout << b[j];
		//cout << endl;
		
		int carry = 0;
		for (int j=0; j<101; j++) {
			a[j] += b[j] + carry;
			carry = a[j] / 10;
			a[j] -= carry * 10;
		}
		
		bool nonzeroFlg = false;
		for (int j=100; j>=0; j--) {
			if (j>=80 && a[j]>0) {
				cout << "overflow";
				break;
			}
			if (a[j]>0) nonzeroFlg = true;
			if (nonzeroFlg) cout << a[j];
			if (j==0 && !nonzeroFlg) cout << 0;
		}
		
		cout << endl;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

string s1, s2;

string addString(string s, string t){
    if(s.size() < t.size()) swap(s, t);
    char tmp;
    for(int i = s.size() - 1, j = t.size() - 1; i >= 0; i--, j--){
        if(j >= 0) s[i] += t[j] - '0';
        if(s[i] > '9'){
            s[i] -= 10;
            if(i == 0) s = '1' + s;
            else s[i - 1]++;
        }
    }
    return s;
}

signed main(){
    int n;
    cin >> n;
    rep(i, 0, n){
        cin >> s1 >> s2;
        string ans = addString(s1, s2);
        if(ans.size() > 80) cout << "overflow" << endl;
        else cout << ans << endl;
    }
}