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

class OverDigit{

public:

	int num_a[9];
	int num_b[9];
	OverDigit(string str_a, string str_b);
	void ChangeDigit(string str,int num[]);
	void Add();
};

OverDigit::OverDigit(string str_a,string str_b){

	ChangeDigit(str_a, num_a); 
	ChangeDigit(str_b, num_b);	
}

void OverDigit::ChangeDigit(string str, int num[]){

	vector <int> num_str(9, 0);
	int loc = 9, k = 8;
	int str_Max, str_rest;

	str_Max = str.length() / 9;//
	str_rest = str.length() % 9;


	for (int j = str.length() - 9; str_Max > 0; j = j-9){
		num_str[k] = stoi(str.substr(j, 9));
		loc = k;
		k--;
		str_Max--;
	}
	//?????????????????????????????????????????\??????
	num_str[loc - 1] = stoi(str.substr(0, str_rest));

	for (int j = 0; j < 9; j++){
	num[j]=num_str[j];
	}
}
//80????????§????¶???????
void OverDigit::Add(){

	int num_ans[9] = {};
	int fat,overflow=0,count=0;

	for (int j = 8; j >=0; j--){
		if (num_a[j] + num_b[j]<=999999999){
			num_ans[j] = num_a[j] + num_b[j];
		}
		else if (num_a[j] + num_b[j] > 999999999 && j!=1){
			fat = (num_a[j] + num_b[j]) - 1000000000;
			num_ans[j] = fat;
			num_a[j - 1]++;		
		}
		else if (num_a[j] + num_b[j] > 999999999 && j ==1 ){
			overflow = 1;
		}
	
	}

	if (overflow == 1){
		cout << "overflow" << endl;
	}
	else {
		for (int j = 0; j < 9; j++){
			if (num_ans[j] != 0){
				count++;
				cout << num_ans[j];

			}
			else if (num_ans[j] == 0 && count >= 1){
				cout << "000000000";
			}

		}cout << endl;
	}

};

int stoi(std::string str){
	int ret;
	std::stringstream ss;
	ss << str;
	ss >> ret;
	return ret;
}

int main(){

	//vector???????????¨??????80???????¨????
	int N;
	string str_a, str_b;

	cin >> N;
	cin.ignore();

	for (int i = 0; i < N; i++){
		getline(cin, str_a);
		getline(cin, str_b);
		OverDigit OverDigit_a(str_a,str_b);//???????????§??????
		OverDigit_a.Add();
	}

	return 0;
}

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

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	char num1[100];
	char num2[100];
	char sum[100];
	char str[100];
	int n;
	int i, j, k;
	
	fgets(buf, sizeof(buf), stdin);
	sscanf(buf, "%d", &n);
	
	for (i=0; i<n; i++) {
		for (j=0; j<100; j++) {
			num1[j] = num2[j] = sum[j] = 0;
		}
		
		// first integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str); j++)  ;
		for (k=0; j>0; k++) {
			j--;
			num1[k] = str[j] - '0';
		}
		
		// second integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str); j++)  ;
		for (k=0; j>0; k++) {
			j--;
			num2[k] = str[j] - '0';
		}
		
		// sum
		for (j=0; j<80; j++) {
			sum[j] += num1[j]+num2[j];
			if (sum[j] >= 10) {
				sum[j+1]++;
				sum[j] = sum[j]%10;
			}
		}
		
		if (sum[80] != 0) {
			printf("overflow\n");
		}
		else {
			for (j=79; sum[j]==0 && j>=1; j--)  ;
			for (; j>=0; j--) {
				printf("%d", sum[j]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, j, n;
  int len1, len2;
  char tmp;

  scanf("%d",&n);
  rep(i,n){
    string str1, str2, res;
    cin >> str1;
    cin >> str2;

    vector<int> a(200, 0), b(200, 0);
    len1 = (int)str1.size(); len2 = (int)str2.size();
    if(len1 > 80){
      cout << "overflow" << endl;
      break;
    }
    if(len2 > 80){
      cout << "overflow" << endl;
      break;
    }
    rep(j,len1) a[j] = str1[(int)len1-1-j] - '0';
    rep(j,len2) b[j] = str2[(int)len2-1-j] - '0';

    rep(j,200){
      int sum = a[j] + b[j];
      if(sum >= 10){ sum %= 10; a[j+1]++;}
      res += (sum + '0');
    }

    reverse(res.begin(), res.end());
    int f = 0;
    string tmp;
    rep(j,res.size()){
      if(res[j] != '0') f = 1;
      if(f) tmp += res[j];
    }

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

  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  cin.ignore();
  while(n--){
    string a,b;
    getline(cin,a);
    int num[200] = {0},tab = 0,i = 0;
    int as = a.size()-1;
    int bs = b.size()-1;
    int nmi = min(a.size(),b.size());
    int nma = max(a.size(),b.size());
    for(int x; i<nma; i++){
      if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;}
      else if(i>as){x = tab+b[bs-i]-'0';}
      else if(i>bs){x = tab+a[as-i]-'0';}
      tab = x/10;
      num[i] = x%10;
    }
    if(tab){num[nma] = tab;i++;}
    if(i>80){cout <<"overflow"<<endl;}
    else{
      for(int x=i-1; x>=0; x--){
	cout <<num[x];
      }
      cout <<endl;
    }
  }
  return 0;
}

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

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[81], b[81], x[81], y[81];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		int LB=strlen(b);
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[81];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(big==81 && carry!=0) printf("overflow\n");
		else{
			if(carry!=0){
				ans[big++]=carry+'0';
				ans[big]='\0';
				//printf("carries\n");
			}	
			
			int LS=strlen(ans);
			char fans[81];
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}	
		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}