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 <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int k = 0, n;
string s, t;
vector<string> ans;

int main(){
	cin >> n;
	REP(j,n){
		cin >> s >> t;
		k = 0;
		if (s.size() > 80 || t.size() > 80)cout << "overflow" << endl;
		reverse(ALL(s));
		reverse(ALL(t));
		int a = max(s.size(), t.size()), b = min(s.size(), t.size());
		if (s.size() > t.size()){
			REP(i, a - b){
				t += "0";
			}
		}
		else{
			REP(i, a - b){
				s += "0";
			}
		}		
		reverse(ALL(s));
		reverse(ALL(t));
		REP(i, s.size()){
			int x = (s[s.size()-1-i] - '0') + (t[s.size()-1-i] - '0');
			string q;
			stringstream ss;
			if (i != s.size() - 1){
				ss << ((x + k) % 10);
			}
			else{
				ss << x + k;
			}
			ss >> q;
			ans.push_back(q);
			if (x + k >= 10){
				k = (x + k) / 10;
			}
			else{
				k = 0;
			}
		}
		if (ans.size() > 79)cout << "overflow" << endl;
		//cout << ans.size() << endl;
		reverse(ALL(ans));
		REP(i, ans.size()){
			cout << ans[i];
		}
		cout << endl;
		ans.clear();
	}
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  int n;
   cin >> n;

   vector<int> V;

   for(int i = 0; i < n; i++){
     string a, b;
     int slength[2];

    
     cin >> a >> b;

     slength[0] = a.length();
     slength[1] = b.length();


     if(a.length() != 1)reverse(a.begin(), a.end());
     if(b.length() != 1)reverse(b.begin(), b.end());

     if(a.length() > b.length()){
       for(int j = 0; j < slength[0] - slength[1]; j++) b+="0";
     }else{
       for(int j = 0; j < slength[1] - slength[0]; j++) a+="0";
     }
     int flag = 0;

     for(int j = 0; j < a.length(); j++){
       if(flag){
	 a[j]++;
	 flag--;
       }
       if((a[j]+b[j]-96)/10 == 0){
	 V.push_back(a[j]+b[j]-96);
       }else{
	 flag++;
	 V.push_back((a[j]+b[j]-96)%10);
       }
     }
 
     if(flag) V.push_back(1);

     for(int j = V.size()-1; j >= 0; j--){
       cout << V[j];
     }
     cout << endl;
     V.clear();
   }  
   return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  string num1,num2,tmp;
  int n;
  cin >> n;
  cin.clear();
  while(n--){
  cin >> num1 >> num2;
  if(num1.size() < num2.size()){
    tmp = num2;
    num2 = num1;
    num1 = tmp;
  }

  for(int i = 0 ; i < num1.size() ; i++ )tmp[i] = num1[i];
  for(int i = num1.size() - 1 ; i >= 0 ; i-- )
    {
      num1[i] = tmp[num1.size() - 1 - i];
    }
  for(int i = 0 ; i < num2.size() ; i++ )tmp[i] = num2[i];

  for(int i = num2.size() - 1  ; i >= 0 ; i-- )
    {
      num2[i] = tmp[num2.size() - 1 - i];
    }
  for(int i = num2.size() ; i < num1.size() ; i++ )num2+='0';
  char tmp2 = '0';
  string ans;
  for(int i = 0 ; i < num1.size() ; i++ ){
    if((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') > 9){
      ans += (((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') - 10) + '0');
      tmp2 = '1';
    } else {
      ans += (((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0')) + '0');
      tmp2 = '0'; 
    }
  }
  
  if((tmp2 - '0') + (num1[num1.size() - 1] - '0') + (num2[num1.size() - 1] - '0') > 9)ans+='1'; 

  for(int i = ans.size() ; i >= 0 ; i-- ){
    cout << ans[i];
  }  
  cout << endl;
}
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

string sum(string& a, string& b){
	int i = a.length() - 1;
	int j = b.length() - 1;
	int carry = 0;
	string temp;

	while(i >= 0 || j >= 0){
		int c = i >= 0 ? a[i] - '0' : 0;
		int d = j >= 0 ? b[j] - '0' : 0;

		temp.push_back((c + d + carry) % 10 + '0');
		carry = (c+d+carry) / 10;

		--i, --j;
	}

	if(carry)
		temp.push_back('1');

	reverse(begin(temp), end(temp));

	return temp;
}

int main(){
	int n;
	cin >> n;

	vector<string> input(n*2);

	for(int i = 0; i < n*2; i++){
		cin >> input[i];
	}

	for(int i = 0; i < n; i++){
		string t = sum(input[2*i], input[2*i+1]);
		if(t.length() <= 80)
			cout << t << endl;
		else
			cout << "overflow" << endl;
	}

	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 (!nonzeroFlg) cout << 0;
		
		cout << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#define N 80

int main(void){
    char buf[N+1];
    int datas;
    int degits;
    int lint1[N], lint2[N], sum[N];
    int cry;
    
    scanf("%d", &datas);
    for (int n=0; n<datas; n++){
        // reset
        for (int i=0; i<N; i++) lint1[i]=lint2[i]=0;
        // input
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint1[degits-i-1]= buf[i]-'0';
        }
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint2[degits-i-1]= buf[i]-'0';
        }
        // calc
        cry=0;
        for (int i=0; i<N; i++){
            sum[i] = lint1[i]+lint2[i] + cry;
            cry = sum[i]>9 ? 1:0;
            if (cry) sum[i] -= 10;
        }
        // output
        if (cry){
            puts("overflow");
        } else {
            bool zero=true;
            if (cry) puts("1");
            for (int i=N-1; i>=0; i--){
                if (zero && sum[i] != 0) zero=false;
                if (!zero) printf("%d", sum[i], i);
            }
            printf("\n");
        }
    }
    
    return 0;
}