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, u;
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;
			continue;
		}
		reverse(ALL(s));
		reverse(ALL(t));
		while (s.size() != t.size()){
			if (s.size() > t.size()) t += "0";
			else 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;
			}
		}
		reverse(ALL(ans));
		REP(i, ans.size()){
			u += ans[i];
		}
		if (u.size() > 80)cout << "overflow" << endl;
		else cout << u << endl;
		u = "";
		ans.clear();
	}
}

//int a[110], b[110], ans[110];
//string s, t;
//int n;
//
//int main(){
//	cin >> n;
//	while (n--){
//		cin >> s >> t;
//		if (s.size() > 80 || t.size() > 80){
//			cout << "overflow\n";
//			continue;
//		}
//		REP(i, s.size())a[i] = s[s.size() - 1 - i] - '0';
//		REP(i, t.size())b[i] = t[t.size() - 1 - i] - '0';
//		ll k = 0;
//		REP(i, 101){
//			ans[i] = (a[i] + b[i] + k) % 10;
//			k = (a[i] + b[i] + k) / 10;
//		}
//		if (ans[80] != 0){
//			cout << "overflow\n";
//			continue;
//		}
//		for (int i = max(s.size(), t.size()); i >= 0; i--){
//			if (i == max(s.size(), t.size())){
//				if (ans[i] != 0){
//					cout << ans[i];
//				}
//			}
//			else{
//				cout << ans[i];
//			}
//		}
//		cout << endl;
//		REP(i, 101){
//			ans[i] = 0;
//			a[i] = 0;
//			b[i] = 0;
//		}
//	}
//}

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

int main(){
  int j;
  char s1[102] = {0};
  char tmp[102] = {0};
  char s2[102] = {0};
  char ans[102];
  int  kuri = 0 ;
  memset(ans,0,sizeof(ans));
  cin >> s1 >> s2;
  if(strlen(s1) < strlen(s2)){
    strcpy(tmp,s1);
    strcpy(s1,s2);
    strcpy(s2,tmp);
  }
  for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
  for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
  for(int i=0;i<strlen(s1);i++){
    if((s1[i] + (s2[i]%'0') + kuri) > '9'){
      ans[i] = (s1[i] + (s2[i]%'0') + kuri)-10;
      kuri = 1;
    }
    else {
      ans[i] = (s1[i] + (s2[i]%'0') + kuri);
      kuri = 0;
    }
    if(i == strlen(s1)-1 && kuri == 1) ans[i+1] = '1';
  }
  for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
  cout << endl;
}

C++: #include<algorithm>
#include<iostream>
#include<stdio.h>
#include<string.h>

int n;
char a[256], b[256], c[256];	
int sz = 0;
int carry = 0;

int main()
{
        std::cin >> n;
	
	while( n-- ){
		memset( a, '0', 80 );
		memset( b, '0', 80 );
		std::cin >> a >> b;
		
		int maxlen = std::max( strlen( a ), strlen( b ) );
		
		if( maxlen > 80 ){
		 	goto OVERFLOW;
		}
		
		std::reverse( a, a + strlen( a ) );
		std::reverse( b, b + strlen( b ) );
		
		a[strlen( a )] = '0';
		b[strlen( b )] = '0';
		
		for( int i = 0; i <= maxlen + 1; i++ ){
			int na = a[i] - '0' + carry;
			int nb = b[i] - '0';
			
			if( na + nb >= 10 ){
				na += nb - 10;
				carry = 1;
			}
			else{
				na += nb;
				carry = 0;
			}
			
			c[i] = na + '0';
		}
		
		sz = maxlen;
		
		if( c[sz] >= '1' && c[sz] <= '9' ){
		 	sz++;
		}
		
		if( sz >= 80 ){
	OVERFLOW:
		 	std::cout << "overflow" << std::endl;
		}
		else{
			std::reverse( c, c + sz );
			c[sz] = '\0';
			std::cout << c << std::endl;
		}
		sz = 0;
		carry = 0;
	}

 	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
	int T;
	cin >> T;
	while(T--){
		//char s[100] = "abc";
		string a,b;
		
		cin >> a >> b;
		if(a==b){
			if(a=="0"){
			cout<<"0"<<endl;
				continue;
			}
		}
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		while( a.size() < 100 ) a += "0";
		while( b.size() < 100 ) b += "0";
		string ans = "";
		int carry = 0;
		for(int i = 0 ; i < 100 ; i++){
			int d = (a[i]-'0') + (b[i]-'0') + carry;
			ans += d % 10 + '0';
			carry = d / 10;
		}
		reverse(ans.begin(),ans.end());
		if(ans.find_first_not_of('0')<20){
			cout << "overflow" << endl;
			continue;
		}
		ans = ans.substr(ans.find_first_not_of('0') );
		
		cout << ans << endl;
	}
	
	return 0;
}

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

int main(void){
  int N;
  scanf("%d", &N);

  int i,j,k;
  for(i=0; i<N; ++i){
    int digits[3][81];
    for(j=0; j<3; ++j){
      for(k=0; k<81; ++k){
        digits[j][k] = 0;
      }
    }

    int overflow = 0;
    for(j=0; j<2; ++j){
      char digit[80];
      scanf("%s", digit);
      if(strlen(digit)>80){
        overflow = 1;
        break;
      }
      for(k=0; k<strlen(digit); ++k){
        digits[j][k] = digit[strlen(digit)-1-k]-'0';
      }
    }
    if(overflow){
      printf("overflow\n");
    }else{
      for(j=0; j<80; ++j){
        digits[2][j] += (digits[0][j]+digits[1][j]);
        digits[2][j+1] += digits[2][j]/10;
        digits[2][j] %= 10;
      }

      int flag = 0;
      if(digits[2][80]>0){
        printf("overflow\n");
      }else{
        for(j=80; j>=0; --j){
          if(flag || digits[2][j]!=0){
            flag = 1;
            printf("%d", digits[2][j]);
          }
        }
        printf("\n");
      }
    }
  }
  
  return 0;
}