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 <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define PI 3.141592653

int main(){
    string A,B;
    int n,Ak,Bk,ans[81];
    
    scanf("%d",&n);
    
    for(int i=0;i<n;i++){
        
        for(int j=0;j<80;j++){
            ans[j]=0;
        }
        
        cin >> A >> B;
        
        if(A==B && A=="0"){
            printf("0\n");
            continue;
        }
        
        Ak=(int)A.size();
        Bk=(int)B.size();
        
        if(Ak>80 || Bk>80){
            puts("overflow");
            continue;
        }
        
        for(int j=0;j<max(Ak,Bk);j++){
            if(j<min(Ak,Bk))
                ans[79-j]+=(A[Ak-1-j]-'0')+(B[Bk-1-j]-'0');
            else if(j<Ak)
                ans[79-j]+=A[Ak-1-j]-'0';
            else if(j<Bk)
                ans[79-j]+=B[Bk-1-j]-'0';
            
            if(ans[79-j]>=10){
                if(j==79){
                    break;
                }
                ans[79-j-1]++;
                ans[79-j]-=10;
            }
        }
        
        if(ans[79]>=10){
            puts("overflow");
        }else{
            bool f = false;
            for(int j=0;j<80;j++){
                if(ans[j]>0 || f){
                    printf("%1d",ans[j]);
                    f = true;
                }
            }
            printf("\n");
        }
    }
    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
 
using namespace std;
 
char calc(char x,char y,char z,bool &C){
  int a = x - '0',b = y - '0',c = z - '0';
  int d = a + b + c;
 
  if(d >= 10){
    C = true;
    d -= 10;
  }
 
  return d + '0';
}
 
string sum(string a,string b){
  string res = "";
 
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
 
  int length;
  if((int)a.size() > (int)b.size()){
    length = (int)a.size();
     
    for(int i = (int)b.size() ; i < length ; i++){
      b += '0';
    }
 
  }
  else{
    length = (int)b.size();
 
    for(int i = (int)a.size() ; i < length ; i++){
      a += '0';
    }
 
  }
 
  for(int i = 0 ; i <= length ; i++)
    res += '0';
 
  for(int i = 0 ; i < length ; i++){
    bool C = false;
    res[i] = calc(a[i],b[i],res[i],C);
    if(C) res[i+1] = ((res[i+1]-'0') + 1) + '0';
  }
 
  for(int i = length ;; i--){
     
    if(res[i] == '0'){
      res.erase(res.begin()+i);
    }
    else{
      break;
    }
     
  }
 
  reverse(res.begin(),res.end()); 
 
  return res;
}

int main(){
  int n;

  cin >> n;
  while(n--){
    string a,b;

    cin >> a >> b;
    string c = sum(a,b);
    
    if((int)c.size() > 80) cout << "overflow" << endl;
    else cout << c << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  int n, maxlen;
  char a[10001], b[10001];

  cin >> n;
  for(int ii = 0 ; ii < n ; ii++){
    string ans = "";
    scanf("%s %s", a, b);
    
    maxlen = max(strlen(a), strlen(b));

    reverse(a, a+strlen(a));
    reverse(b, b+strlen(b));
    
    for(int i = strlen(a) ; i < 10001 ; i++){
      a[i] = '0';
    }
    for(int i = strlen(b) ; i < 10001 ; i++){
      b[i] = '0';
    }

    int tmp, tmp2 = 0;

    for(int i = 0 ; i < maxlen ; i++){
      tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
      
      if(i == maxlen - 1){
	if(tmp >= 10){
	  tmp2 = 1;
	  tmp -= 10;
	  ans += tmp + '0';
	  ans += '1';
	}
	else ans += tmp + '0';
      }

      else if(tmp >= 10){
	tmp2 = 1;
	tmp -= 10;
	ans += tmp + '0';
      }
      else if(tmp <= 9){
	ans += tmp + '0';
	tmp2 = 0;
      }
    }

    reverse(ans.begin(), ans.end());

    int size = ans.size();

    if(size > 80 || maxlen > 80) cout << "overflow" << endl;
    else cout << ans << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	string a,b;
	int c[100]={0};
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(a.size()>80||b.size()>80)
			cout<<"overflow"<<endl;
		else{
			int t;
			if(a.size()>=b.size())
				t=a.size();
			if(a.size()<b.size())
				t=b.size();
			for(int j=0;j<t;j++){
				if(j<a.size())
					c[j]+=a[a.size()-j-1]-'0';
				if(j<b.size())
					c[j]+=b[b.size()-j-1]-'0';
				if(c[j]>=10){
					c[j]-=10;
					c[j+1]=1;
				}
			}
			bool h=true;
			if(c[t]==1){
				if(t==80){
					cout<<"overflow"<<endl;
					h=false;
				}
				else
				    cout<<"1";
			}
			if(h==true){
			for(int j=t-1;j>=0;j--)
				cout<<c[j];
			cout<<endl;
			}
		}
	}
	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
//?¶????????????????????????????????????§??????????????????????¢????????????????
constexpr int INF = 2000000000;
const double PI = acos(-1);

string sum_string(string a, string b) {
	int al = a.size(), bl = b.size();
	reverse(a.begin(), a.end());
	reverse(b.begin(), b.end());
	string ret;
	int tmp = 0;
	for (int i = 0; i < al || i < bl || tmp; i++) {
		tmp += (i < al ? a[i] - '0' : 0) + (i < bl ? b[i] - '0' : 0);
		ret.push_back('0' + tmp % 10);
		tmp /= 10;
	}
	reverse(ret.begin(), ret.end());
	return ret;
}

int main() {
	int n;
	cin>>n;
	string a, b;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		string ans = sum_string(a, b);
		cout << (ans.size() > 80 ? string("overflow") : ans) << endl;
	}
}

C++: #include <iostream>
#include <string>
#include <fstream>

using namespace std;

#define MAX_INT_LENGTH 80

//large integer upto 80 digits
struct largeInt{
    int vals[MAX_INT_LENGTH]; // MAX_INT_LENGTH digits
};

void toLargeInt(string str, largeInt &lv){
    int start = MAX_INT_LENGTH-str.length();
    for (int i = 0; i < MAX_INT_LENGTH; i++){
        if (i >= start)
            lv.vals[i] = (str[i-start] - '0');
        else
            lv.vals[i] = 0;
    }
}

largeInt addLargeInt(const largeInt &lv1, const largeInt &lv2){
    largeInt sum;
    int carry = 0;
    for (int i = MAX_INT_LENGTH-1; i >= 0; i--){
        int sub_sum = lv1.vals[i] + lv2.vals[i] + carry;
        sum.vals[i] = sub_sum % 10;
        carry = sub_sum / 10;
    }
    return sum;
}

string toString(const largeInt &v){
    string str(MAX_INT_LENGTH,'0');
    for (int i = 0; i < MAX_INT_LENGTH; i++)
        str[i] = v.vals[i] + '0';
    return str;
}

int main()
{
    //ifstream cin("input.txt");
    
    // input data
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){
        string v1,v2;
        cin >> v1 >> v2;
        largeInt lv1, lv2;
        toLargeInt(v1,lv1);
        toLargeInt(v2,lv2);
        largeInt sum = addLargeInt(lv1,lv2);
        cout << toString(sum) << endl;
    }
   return 0;
}