Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}

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

int get_length(char *data) {
	for (int i = 0;; i++) {
		if (data[i] == '\0') {
			return i;
		}
	}
	return 0;
}

bool is_more_ten(char *d) {
	if (d[0] == 'X' || d[0] == 'A' || d[0] == 'B' || d[0] == 'C' ||
		d[0] == 'D' || d[0] == 'E' || d[0] == 'F' || d[0] == 'G' ||
		d[0] == 'H') {
		return true;
	}
	return false;
}

void shift(char *data, int length) {
	for (int i = length; i != -1; i--) {
		data[i+1] = data[i];
	}
}

int main(int argc, char *argv[]) {
	int dataN;
	
	map<char, int> chr2int;
	chr2int.insert(map<char, int>::value_type('0',0));
	chr2int.insert(map<char, int>::value_type('1',1));
	chr2int.insert(map<char, int>::value_type('2',2));
	chr2int.insert(map<char, int>::value_type('3',3));
	chr2int.insert(map<char, int>::value_type('4',4));
	chr2int.insert(map<char, int>::value_type('5',5));
	chr2int.insert(map<char, int>::value_type('6',6));
	chr2int.insert(map<char, int>::value_type('7',7));
	chr2int.insert(map<char, int>::value_type('8',8));
	chr2int.insert(map<char, int>::value_type('9',9));
	chr2int.insert(map<char, int>::value_type('X',10));
	chr2int.insert(map<char, int>::value_type('A',11));
	chr2int.insert(map<char, int>::value_type('B',12));
	chr2int.insert(map<char, int>::value_type('C',13));
	chr2int.insert(map<char, int>::value_type('D',14));
	chr2int.insert(map<char, int>::value_type('E',15));
	chr2int.insert(map<char, int>::value_type('F',16));
	chr2int.insert(map<char, int>::value_type('G',17));
	chr2int.insert(map<char, int>::value_type('H',18));
	chr2int.insert(map<char, int>::value_type('I',19));
	
	map<char, int> end_chr2int;
	end_chr2int.insert(map<char, int>::value_type('X',0));
	end_chr2int.insert(map<char, int>::value_type('A',1));
	end_chr2int.insert(map<char, int>::value_type('B',2));
	end_chr2int.insert(map<char, int>::value_type('C',3));
	end_chr2int.insert(map<char, int>::value_type('D',4));
	end_chr2int.insert(map<char, int>::value_type('E',5));
	end_chr2int.insert(map<char, int>::value_type('F',6));
	end_chr2int.insert(map<char, int>::value_type('G',7));
	end_chr2int.insert(map<char, int>::value_type('H',8));
	end_chr2int.insert(map<char, int>::value_type('I',9));

	
	const char int2chr[] = {
		'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 
		'X', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'
	};
	
	fscanf(stdin, "%d", &dataN);
	for (int i = 0; i < dataN; i++) {
		char buf1[100], buf2[100], sum[100];
		int buf1_cnt, buf2_cnt, longer;
		// scan
		fscanf(stdin, "%s", buf1);
		fscanf(stdin, "%s", buf2);
		buf1_cnt = get_length(buf1);
		buf2_cnt = get_length(buf2);
		// is overflow ?
		if (buf1_cnt > 80 || buf2_cnt > 80) {
			puts("overflow");
			continue;
		}
		
		if (buf1_cnt > buf2_cnt) {
			sum[buf1_cnt] = '\0';
			longer = buf1_cnt;
			int idx = buf1_cnt-1;
			int diff = buf1_cnt - buf2_cnt;
			for (int i = buf2_cnt-1; i != -1 ; i--) {
				int t_sum = chr2int[buf1[idx]] + chr2int[buf2[i]];
				if (t_sum > 9) {
					buf1[idx-1] = int2chr[chr2int[buf1[idx-1]]+1];
					t_sum %= 10;
				}
				sum[idx] = int2chr[t_sum];
				idx--;
			}
			for (int i = diff-1; i != -1; i--) {
				int t_sum = chr2int[buf1[i]];
				if (i != 0) {
					if (t_sum > 9) {
						buf1[i-1] = int2chr[chr2int[buf1[i-1]]+1];
						t_sum %= 10;
					}
				}
				sum[i] = int2chr[t_sum];
			}
		}
		else if (buf1_cnt < buf2_cnt) {
			longer = buf2_cnt;
			sum[buf2_cnt] = '\0';
			int idx = buf2_cnt-1;
			int diff = buf2_cnt - buf1_cnt;
			for (int i = buf1_cnt-1; i != -1 ; i--) {
				int t_sum = chr2int[buf1[idx]] + chr2int[buf2[i]];
				if (t_sum > 9) {
					buf2[idx-1] = int2chr[chr2int[buf2[idx-1]]+1];
					t_sum %= 10;
				}
				sum[idx] = int2chr[t_sum];
				idx--;
			}
			for (int i = diff-1; i != -1; i--) {
				int t_sum = chr2int[buf2[i]];
				if (i != 0) {
					if (t_sum > 9) {
						buf2[i-1] = int2chr[chr2int[buf2[i-1]]+1];
						t_sum %= 10;
					}
				}
				sum[i] = int2chr[t_sum];
			}
		}
		else {
			longer = buf1_cnt;
			sum[buf2_cnt] = '\0';
			int idx = buf2_cnt-1;
			int diff = buf2_cnt - buf1_cnt;
			for (int i = buf1_cnt-1; i != -1 ; i--) {
				int t_sum = chr2int[buf1[idx]] + chr2int[buf2[i]];
				if (t_sum > 9) {
					if (i != 0) {
						buf2[idx-1] = int2chr[chr2int[buf2[idx-1]]+1];
						t_sum %= 10;
					}
				}
				sum[idx] = int2chr[t_sum];
				idx--;
			}
		}
		// check most left number
		if (is_more_ten(sum)) {
			if (buf1_cnt == 80 || buf2_cnt == 80) {
				puts("overflow");
				continue;
			}
			shift(sum, longer);
			sum[0] = '1';
			sum[1] = int2chr[end_chr2int[sum[1]]];
		}
		printf("%s\n", sum);
	}
	
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int a[81];
	int b[81];
	int ans[81];
	int n;
	cin>>n;
	rep(j,n){
		rep(i,81){
			a[i]=b[i]=ans[i]=0;
		}
		string s[2];
		cin>>s[0];
		int cnt=80;
		for(int i=s[0].size()-1;i>=0;i--){
			a[cnt]=s[0][i]-'0';
			cnt--;
		}
		cin>>s[1];
		if(s[0].size()>80 || s[1].size()>80){
			cout<<"overflow"<<endl;
			continue;
		}
		cnt=80;
		for(int i=s[1].size()-1;i>=0;i--){
			b[cnt]=s[1][i]-'0';
			cnt--;
		}
		bool check=true;
		for(int i=80;i>=0;i--){
			ans[i]=a[i]+b[i];
			if(ans[i]>=10){
				if(i==0){
					check=false;
					cout<<"overflow"<<endl;
				}else{
					a[i-1]++;
					ans[i]%=10;
				}
			}
		}
		int ite=0;
		rep(i,81){
			if(ans[i]!=0){
				ite=i;
				break;
			}
		}
		if(check){
			for(int i=ite;i<81;i++){
				cout<<ans[i];
			}
			cout<<endl;
		}
	}
	return 0;
}

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

void fun(double a,double b){
    double num = a+b;
    for(int i = 1;i < 80;i++){
        num /= 10;
    }
    if((int)num != 0) cout<<"overflow"<<endl;
    else printf("%.0lf\n",a+b);
}

int main(){
    int n;
    cin>>n;
    while(n--){
        double a,b;
        cin>>a>>b;
        fun(a,b);
    }
    return 0;
}

C++: #include <cstdio>
#include <bitset>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <stack>

#define EPS 1e-6

using namespace std;
typedef complex<double> coor;

double cross(coor a, coor b)
{
  return a.real() * b.imag() - a.imag() * b.real();
}

double dot(coor a, coor b)
{
  return a.real() * b.real() + a.imag() * b.imag();
}

int main()
{
  int N;
  scanf(" %d ", &N);
  for (int i = 0; i < N; i++) {
    long long a, b;
    scanf(" %lld %lld ", &a, &b);
    if ((a + b) / 1e79 != 0) {
      printf("overflow\n");
      goto next;
    }
    printf("%lld\n", a + b);
  next:;
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>
int func()
{
	char i1[81]="",i2[81]="",res[81]="";
	bool cflag=false;
	std::string tmp;
	std::cin >> tmp;
	if(tmp.size()>80){
		std::cin >> tmp;
		return -1;
	}
	strcpy(i1,tmp.c_str());
	std::cin >> tmp;
	if(tmp.size()>80)
		return -1;
	strcpy(i2,tmp.c_str());
	for(int j=0;j<80;j++){
		char c='0';
		if(cflag)
			c+=1;
		cflag=false;
		if(strlen(i1)>j){
			c+=i1[strlen(i1)-j-1]-'0';
		}
		if(strlen(i2)>j){
			c+=i2[strlen(i2)-j-1]-'0';
		}
		if(c > '9'){
			cflag=true;
			c-=10;
		}
		res[79-j]=c;
	}

	if(cflag)
		return -1;
	char *p = res;
	while(*p++ == '0' && (p-res)<80);
	std::cout << (p-1) << std::endl;

	return 0;
}
int main(void){
	int n;
	std::cin >> n;
	for(int i=0; i<n; i++)
		if(func()==-1)
			std::cout << "overflow" << std::endl;

}