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<iostream>
#include<vector>
#include<algorithm>
using namespace std;

class BigInt{
public:
  vector<int> value;
  int sign;

  void set(int n){
    value.clear();
    if(n==0){
      sign = 0;
      value.push_back(0);
    }else if(n<0){
      sign = -1;
      n *= -1;
    }else{
      sign = 1;
    }
    while(n){
      value.push_back(n%10);
      n/=10;
    }
  }

  void set(string str){
    value.clear();
    if(str[0]=='-')sign = -1;
    else if(str[0]=='0')sign = 0;
    else sign = 1;
    int a = 0;
    if(sign<0)a = 1; 
    for(int i=str.size()-1;i>=a;i--){
      value.push_back(str[i]-'0');
    }
  }

  void print(void){
    if(sign<0)cout << '-';
    for(int i=value.size()-1;i>=0;i--)cout << value[i];
    cout << endl;
  }

  BigInt add(BigInt x){
    int max,min;
    BigInt ans;

    if(sign == 0)return x;
    if(x.sign == 0)return *this;
       
    ans.sign = 1;
    ans.value.clear();
    if(value.size()>x.value.size()){
      max = value.size();
      min = x.value.size();
      for(int i=0;i<min;i++)ans.value.push_back(value[i]+x.value[i]);
      for(int i=min;i<max;i++)ans.value.push_back(value[i]);
    }else{
      max = x.value.size();
      min = value.size();
      for(int i=0;i<min;i++)ans.value.push_back(value[i]+x.value[i]);
      for(int i=min;i<max;i++)ans.value.push_back(x.value[i]);
    }
    for(int i=0;i<(int)ans.value.size()-1;i++){
      while(ans.value[i]>=10){
	ans.value[i]-=10;
	ans.value[i+1]++;
      }
    }
    if(ans.value[ans.value.size()-1]>=10){
      ans.value[ans.value.size()-1]-=10;
      ans.value.push_back(1);
    }
    return ans;
  }

};

int main(){
  int n;
  string n1,n2;
  BigInt a1,a2,res;

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> n1;
    cin >> n2;

    a1.set(n1);
    a2.set(n2);

    res = a1.add(a2);

    if(res.value.size()>80)cout << "overflow" << endl;
    else res.print();
  }
}

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

using namespace std;


int main(){

	int n;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		string a, b;
		cin >> a;
		cin >> b;

		if(b.size() > a.size()){
			string temp;
			temp = a;
			a = b;
			b = temp;
		}
		if( (a[0] + b[0] - '0') > '9' ){
			string A;
			A += '0';
			A += a;
			a = A;
		}
		if(a.size() > 80){
			cout << "overflow" << endl;
		}else{
			for(int j=0 ; j<b.size() ; j++){
				a[a.size()-1-j] = a[a.size()-1-j] + b[b.size()-1-j] -'0';
				if(a[a.size()-1-j] > '9'){
					a[a.size()-1-j] -= 10;
					for(int l=0 ; l<a.size()-1 ; l++){
						a[a.size()-2-l] ++;
						if(a[a.size()-2-l] > '9'){
							a[a.size()-2-l] -= 10;
						}else break;
					}
				}
			}
		}
		cout << a << endl;

		}

	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
int n,i,j,k,l,m,u,v,c;
string s,t,w;
cin>>n;
for(k=0;k<n;k++){
cin>>s>>t;
l=s.size();if(l>80){cout<<"overflow"<<endl;continue;}
m=t.size();if(m>80){cout<<"overflow"<<endl;continue;}
if(l<m){w=s;s=t;t=w;c=l;l=m;m=c;}
for(c=0,i=l-1,j=m-1;j>=0;i--,j--){
u=s[i]-48;v=t[j]-48;
u+=(v+c);
if(c=(u>9))u-=10;
s[i]=u+48;
}
for(;i>=0;i--){
u=s[i]-48;
u+=c;
if(c=(u>9))u-=10;
s[i]=u+48;
}
if(l>=80&&c==1){cout<<"overflow"<<endl;continue;}
if(c==1)cout<<"1";cout<<s<<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;
	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){
			sum[i] = 0;
			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=9;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,m;
	string aindex, bindex, ans;
	cin >> m;
	n = 0;
	string a,b;
	for(int j = 0; j < m; j++){
		cin >> a >> b;
		if(a.size()>80||b.size()>80){
			cout << "overflow" << endl;
		}else{
			for(int i = 0; i< max(a.size(),b.size()); i++){
				if(a.size()-i > 0){
					aindex = a[a.size()-i];
				}else{
					aindex = "0";
				}
				if(b.size()-i > 0){
					bindex = b[b.size()-i];
				}else{
					bindex = "0";
				}
				n = stoi(aindex) + stoi(bindex) + (n-n%10==10);
				aindex = to_string(n%10);
				ans = aindex + ans;
			}
			if(ans.size()>80){
				cout << "overflow" << endl;
			}else{
				cout << ans << endl;
			}	
		}
	}
}

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

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

int main(){
    int n;
    cin >> n;
    for(int i=0; i < n; i++){
        string ans;
        string p, q;
        cin >> p >> q;
        if(p.size() < q.size()) swap(p, q);
        int diff = p.size()-q.size();
        for(int i=0; i < diff; i++){
            q = '0' + q;
        }
        p = '0' + p; q = '0' + q;
        int up = 0;
        for(int i=p.size()-1; 0 <= i || up != 0; i--){
            int m = atoi(p.substr(i,1).c_str()) + atoi(q.substr(i, 1).c_str());
            ans = IntToString((m+up)%10) + ans;
            up = (m+up)/10;
        }
        if(ans[0] == '0') ans = ans.substr(1, ans.size()-1);
        cout << ans << endl;
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    int n;
    cin >> n;
    REP(i, n){
    	string s1, s2;
    	cin >> s1 >> s2;
    	int len1 = s1.length(), len2 = s2.length();
    	if (len1 > 80 || len2 > 80) {
    		cout << "overflow" << endl;
    	} else {
    		int num1[100] = {0}, num2[100] = {0}, ans[100] = {0};
    		REP(j, len1){
    			num1[j] = s1[len1-1-j] - '0';
    		}
    		REP(j, len2){
    			num2[j] = s2[len2-1-j] - '0';
    		}
    		int ll = len1 > len2 ? len1 : len2;
    		REP(j, ll){
    			ans[j] += num1[j] + num2[j];
    			if (ans[j]/10 > 0) {
    				ans[j+1]++;
    				ans[j] -= 10;
    			}
    		}
    		if (ans[80] > 0){
    			cout << "overflow" << endl;
    		} else {
    			if (ans[ll] > 0) cout << ans[ll];
    			REP(j, ll){
    				cout << ans[ll-1-j];
    			}
    			cout << endl;
    		}
    	}
    }
}