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<iostream>
int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        char moneywrite[2][150];
        int money[2][150];
        int stl[2]={0,0};
        int stlstl;
        int sum[81];
        scanf("%s",moneywrite[0]);
        scanf("%s",moneywrite[1]);
        for(int j=0;moneywrite[0][j]!='\0';j++){
            money[0][j]=moneywrite[0][j]-'0';
            stl[0]++;
        }
        for(int j=0;moneywrite[1][j]!='\0';j++){
            money[1][j]=moneywrite[1][j]-'0';
            stl[1]++;
        }
        if(stl[0]>stl[1]){
            stlstl=stl[0];
            int p;
            p=stl[0]-stl[1];
            for(int j=0;j<stl[0];j++){
                money[1][stl[0]-j]=money[1][stl[0]-j-p];
            }
            for(int k=0;k<p;k++)
                money[1][k]=0;
        }
        else if(stl[1]>stl[0]){
            stlstl=stl[1];
            int p;
            p=stl[1]-stl[0];
            for(int j=0;j<stl[1];j++){
                money[0][stl[1]-j]=money[0][stl[1]-j-p];
            }
            for(int k=0;k<p;k++)
                money[0][k]=0;
        }
        else{
            stlstl=stl[1];
        }
/*
        for(int j=0;j<stlstl;j++)
            printf("[%d][%d]\n",money[0][j],money[1][j]);
*/
        if(80<=stlstl){
            printf("overflow");
            goto exit;
        }
        for(int j=stlstl-1;0<=j;j--){
            sum[j]=money[0][j]+money[1][j];
            if(10<=sum[j]){
                if(stlstl==79){
                    printf("overflow");
                    goto exit;
                }
                else if(j==0){
                    printf("1");
                    sum[j]%=10;
                }
                else{
                    money[0][j-1]++;
                    sum[j]%=10;
                }
            }
        }
        for(int j=0;j<stlstl;j++)
            printf("%d",sum[j]);
exit:
        puts("");
    }
    return 0;
}

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

using namespace std;

int main(void){
	int n;

	cin >> n;
	for(int i=0;i<n;i++){
		int len,mlen=0;
		char val[2][81]={0},tmp[81],crr=0;

		for(int j=0;j<2;j++){
			cin >> tmp;
			len=strlen(tmp);
			mlen=max(mlen,len);
			for(int k=0;k<len;k++)
				val[j][len-1-k]=tmp[k]-0x30;
		}

		for(int j=0;j<mlen;j++){
			val[0][j]+=val[1][j]+crr;
			crr=val[0][j]/10;
			val[0][j]%=10;

			if(j==mlen-1&&crr)
				mlen++;
		}

		if(mlen<=80){
			for(int j=0;j<mlen;j++)
				tmp[j]=val[0][mlen-1-j]+0x30;
			tmp[mlen]='\0';
		}
		else
			strcpy(tmp,"overflow");

		cout << tmp << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    REP(num, N)
    {
        string s1, s2, ans = "";
        cin >> s1 >> s2;

        int len1 = s1.size() - 1;
        int len2 = s2.size() - 1;
        int next = 0;

        int mlen = max(s1.size(), s2.size());

        REP(i, mlen)
        {
            int sum = 0;

            if (0 <= len1)
                sum += s1[len1--] - '0';

            if (0 <= len2)
                sum += s2[len2--] - '0';

            ans = (char)((sum + next) % 10 + '0') + ans;

            if (10 <= sum + next)
                next = 1;
            else
                next = 0;
        }

        if (ans.size() + next <= 80)
            cout << (next == 1 ? "1" : "") << ans << endl;
        else
            cout << "overflow" << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <cmath>

using namespace std;

int string_to_d(const string &s){
	int num = 0;
	if(!s.empty())
	for(int i=s.size()-1;i>=0;--i){
		if('1'<=s[i]&&s[i]<='9') num += (s[i]-'0')*pow(10,s.size()-i-1);
	}
	return num;
}

int main(void){
	int n;
	while(cin >> n){
		for(int a=0;a<n;++a){
			string s1,s2;
			cin >> s1 >> s2;
			int ex1num[10];//8*10=80桁
			int ex2num[10];
			int sum[10] = {0};
			for(int i=s1.size();i<80;++i) s1="0"+s1;
			for(int i=s2.size();i<80;++i) s2="0"+s2;
			for(int i=0;i<10;++i){
				ex1num[i] = string_to_d(s1.substr((10-i-1)*8,8));
				ex2num[i] = string_to_d(s2.substr((10-i-1)*8,8));
			}
			//ここまで正常
			int carry = 0;
			for(int i=0;i<10;++i){
				sum[i] = (ex1num[i]+ex2num[i]+carry)%(int)1e+008;
				carry = floor((ex1num[i]+ex2num[i]+carry)/(int)1e+008);
			}
			if(carry>0){
				cout << "overflow\n";
				continue;
			}
			bool zeroshow = false;
			for(int i=10;0<=i;--i){
				if(zeroshow&&sum[i]!=0) for(int j=0;j<7-(int)log10(sum[i]);j++) cout << "0";
				if(zeroshow&&sum[i]==0) for(int j=0;j<8;j++) cout << "0";
				if(sum[i]!=0) cout << sum[i];
				if(sum[i]>0) zeroshow = true;
			}
			cout << "\n";
		}
	}
	return 0;
}

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

int main(){
  int n;
  string s1,s2,ans;
  cin >> n;
  
  for(int i=0; i<n; i++){
    cin >> s1; 
    cin >> s2;
    ans = "";
    int m = max(s1.size(),s2.size());
    while(m>s1.size()) s1 = '0' + s1;
    while(m>s2.size()) s2 = '0' + s2;

    int carry = 0;
    for(int j=m-1; j>=0; j--){
      char ch = ((s1[j]-'0') + (s2[j]-'0') + carry)%10 + '0';
      carry = ((s1[j]-'0') + (s2[j]-'0') + carry)/10;
      ans += ch; //反転してしまうが…
    }
    if(carry) ans += (carry+'0');
    reverse(ans.begin(),ans.end()); //元通り

    //頭の0を削除していく
    while(ans.size()>1 && ans[0] == '0') ans.erase(ans.begin());
    if(ans.size() > 80) cout << "overflow" << endl;
    else cout << ans << endl;
  }
  return 0;
}

C++: //AOJ 0015

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		string s1, s2;
		cin >> s1;
		cin >> s2;
		reverse(s1.begin(), s1.end());
		reverse(s2.begin(), s2.end());
		
		int max;
		int diff;
		if(s1.size() > s2.size()) {
			max = s1.size();
			diff = s1.size() - s2.size();
			for(int i = 0; i < diff; i++)
				s2 += "0";
		}
		else {
			max = s2.size();
			diff = s2.size() - s1.size();
			for(int i = 0; i < diff; i++) {
				s1 += "0";	
			}
		} 
		//cout << s1 << endl;
		//cout << s2 << endl;
		string s;
		int kuriagari = 0;
		for(int i = 0; i < max; i++) {
			int flag = true;
			if((s1[i]-'0')+(s2[i]-'0') + kuriagari >= 10) flag = false;
			s += ((s1[i]-'0')+(s2[i]-'0')+kuriagari) % 10 + '0';
			if(flag == true) kuriagari = 0;
			else kuriagari = 1;
		}
		if(kuriagari == 1) s += "1";
		reverse(s.begin(), s.end());
		if(s.size() > 80) cout << "overflow" << endl;
		else {
			cout << s << endl;
		}
	} 
	return 0;
}