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<cstring>

#define MAX 80

int main(){
	int i, j, n, na, nb, flg;
//	long a[10], b[10];
	char a[MAX*10]={'\0'}, b[MAX*10]={'\0'}, tp;

	scanf("%d", &n);
	while(n--){

	scanf("%s", a);
	na=strlen(a);
	for(i=0, j=na; i<na/2; i++, j--){
		tp=a[i]; a[i]=a[j-1]; a[j-1]=tp;
	}
	scanf("%s", b);
	nb=strlen(b);
	for(i=0, j=nb; i<nb/2; i++, j--){
		tp=b[i]; b[i]=b[j-1]; b[j-1]=tp;
	}


	if(na>nb){
 		for(i=0, flg=0; i<nb; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}	
		for(i=nb; i<na; i++){
			flg+=a[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}
	else {
		for(i=0, flg=0; i<na; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}			
		for(i=na; i<nb; i++){
			flg+=b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}


	j=strlen(a);

	if((na>MAX) || (nb>MAX)||(j>MAX))
		printf("overflow\n");
	else{
		for(i=j; i>0; i--) printf("%c",a[i-1]);
		printf("\n");
	}
	}
	return 0;
}

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

string tasu(string& a, string& b) {
    string s = "";
    if (a.size() < b.size()) swap(a, b);
    int prev = 0;
    for (int i = 1; i <= a.size(); i++) {
        int ac, bc, sum;
        ac = a[a.size()-i] - '0';
        if (b.size() < i) {
            bc = 0;
        } else {
            bc = b[b.size() - i] - '0';
        }
        sum = ac + bc + prev;
        prev = 0;
        if (sum >= 10) {
            prev = 1;
            sum -= 10;
        }
        s.push_back(sum + '0');
    }
    if (prev) s.push_back('1');
    reverse(s.begin(), s.end());
    if (s.size() > 80) s = "overflow";
    return s;
}

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        string a, b;
        cin >> a >> b;
        cout << tasu(a, b) << endl;
    }
    return 0;
}

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

#define NUMBER_DIGITS 80

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    char str1[NUMBER_DIGITS + 1];
    char str2[NUMBER_DIGITS + 1];
    char str3[NUMBER_DIGITS / 2 + 1][3];
    char str4[NUMBER_DIGITS / 2 + 1][3];
    int n1[NUMBER_DIGITS / 2 + 1] = {};
    int n2[NUMBER_DIGITS / 2 + 1] = {};
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > NUMBER_DIGITS || m2 > NUMBER_DIGITS)
      cout << "overflow" << endl;
    else if(atoi(str1) <= 2000000000 && atoi(str2) <= 2000000000 && atoi(str1) + atoi(str2) <= 2000000000){
      cout << atoi(str1) + atoi(str2) << endl;
    }else{
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m1 + 1; i += 2, j--){
	if(m1 % 2 == 1 && m1 - i < 0){
	  str3[j][0] = str1[0];
	  str3[j][1] == '\0';
	}else{
	  strncpy(str3[j], &str1[m1 - i], 2);
	  str3[j][2] == '\0';
	}
      }
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m2 + 1; i += 2, j--){
	if(m2 % 2 == 1 && m2 - i < 0){
	  str4[j][0] = str2[0];
	  str4[j][1] == '\0';
	}else{	  
	  strncpy(str4[j], &str2[m2 - i], 2);
	  str4[j][2] == '\0';
	}
      }
      for(int i = NUMBER_DIGITS / 2; i + ((m1 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m1 / 2; i--)
	if(str3[i][0] == '0' && str3[i][1] == '0')
	  n1[i] = 1000;
	else
	  n1[i] = atoi(str3[i]);
      for(int i = NUMBER_DIGITS / 2; i + ((m2 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m2 / 2; i--)
	if(str4[i][0] == '0' && str4[i][1] == '0')
	  n2[i] = 1000;
	else
	  n2[i] = atoi(str4[i]);
      int ans[NUMBER_DIGITS / 2 + 1] = {};
      int i = 0;
      int m = (m1 > m2) ? m1 : m2;
      for(int j = NUMBER_DIGITS / 2; NUMBER_DIGITS / 2 - 1 - m / 2 < ((m % 2) ? j + 1 : j); i++, j--)
	if(n1[j] + n2[j] >= 100)
	  if(n1[j] == 1000 && n2[j] < 10){
	    n1[j - 1] *= 10;
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] < 10){
	    n2[j - 1] *= 10;
	    ans[i] = n1[j];
	  }else if(n1[j] == 1000 && n2[j] == 1000){
	    if(n1[j - 1] % 10 != 0)
	      n1[j - 1] *= 10;
	    ans[i] = 1000;
	  }else if(n1[j] == 1000 && n2[j] >= 10){
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] >= 10){
	    ans[i] = n1[j];
	  }else if(n1[j] + n2[j] < 110){
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] + 900;
	  }else{
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] - 100;
	  }
	else
	  ans[i] = n1[j] + n2[j];
      int k = i;
      for(; i > 0; i--)
	if((i == k) && (ans[i - 1] == 0))
	  ;
	else if(ans[i - 1] == 1000)
	  cout << "00";
	else if(ans[i - 1] > 1000)
	  cout << "0" << ans[i - 1] % 1000;
	else
	  cout << ans[i - 1];
      cout << endl;
    }
  }
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	int N; cin >> N;
	while (N--) {

		string a, b; cin >> a >> b;
		vector<int>v(101);
		for (int i = 0; i < a.size(); ++i) {
			v[101 - a.size() + i] = a[i] - '0';
		}
		for (int i = 0; i < b.size(); ++i) {
			v[101 - b.size() + i] += b[i] - '0';
		}
		for (int i = 100; i >= 0; --i) {
			if (v[i] >= 10) {
				v[i - 1]++;
				v[i] -= 10;
			}
		}
		int num = 0;
		num = find_if(v.begin(), v.end(), [](const int a) {return a; })-v.begin();
		if (num <= 20)cout << "overflow" << endl;
		else {
			for (int i = num; i < 101; ++i) {
				cout << v[i];
			}
			cout << endl;
		}
	}
	return 0;
}

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

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k;
	char fi[10000],se[10000],ans[10000];

	scanf("%d",&N);

	for(i=0;i<N;i++){

		scanf("%s",&fi);
		scanf("%s",&se);

		if(strlen(fi)<=80&&strlen(se)<=80){
		for(j=strlen(fi)-1,k=strlen(se)-1,keta=0,kuri=0;j>=0||k>=0;j--,k--,keta++){
			if(j<0) math1=0;
			else math1=fi[j]-'0';
			if(k<0) math2=0;
			else math2=se[k]-'0';
            ans[keta]=((math1+math2+kuri)%10)+'0';
			kuri=(math1+math2+kuri)/10;
		}
		if(kuri==1) printf("1");
		if(keta-1<=80){
			for(j=keta-1;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		}
		else printf("overflow");
		printf("\n");
	}

	return 0;
}

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

int main(){
	string a, b;
	vector<int> ans;
	int n, num, ai, bi, c=0;
	bool flag;

	cin >> n;
	
	for(int i=0 ; i<n ; i++){
		cin >> a >> b;
		flag = false;
		
		for(int j=0 ; j<100 ; j++){
			num = 0;
			ai = a.size()-j-1;
			bi = b.size()-j-1;
			if( ai<0 && bi<0 && c==0) break;
			
			if(ai>=0)num += a[ ai ] - 48;
			if(bi>=0)num += b[ bi ] - 48;
			ans.push_back( (num+c)%10 );
			if(num+c >= 10) c = 1;
			else c = 0;
		}
		if(ans.size()>80){
			flag = true;
		}
		if(flag){
			printf("overflow");
		}else{
			for(int j=ans.size()-1 ; j>=0 ; --j){
				printf("%d", ans[j]);
			}
		}
		printf("\n");
		ans.clear();
	}
	return 0;
}