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;
int mx;
void solve(vector<int> a,vector<int> b)
{
  vector<int>ans;
  int t = 0;
  for(int i = 0 ; i < mx ; i++ )
    {
      ans.push_back((a[i] + b[i] + t)%10);
      if(a[i] + b[i] + t >= 10)t = 1;
      else t = 0;
    }
  if(t == 1)ans.push_back(1);
  if(ans.size() > 80){
    cout << "overflow" << endl;
  }else {
    for(int i = ans.size()-1 ; i >= 0 ; i-- ){
      cout << ans[i];
    } 
    cout << endl;
  }
}

int main(){
  int n;
  vector<int>ve1,ve2;
  cin >> n;
  while(n--){
    ve1.clear(),ve2.clear();
    string a,b;
    cin >> a >> b;
    mx = max(a.size(),b.size());
    for(int i = a.size()-1,j = 0 ; j < mx ; i--,j++ ){
      if(i < 0 )ve1.push_back(0);
      else ve1.push_back(a[i]-'0');
    }
    for(int i = b.size()-1,j = 0 ; j < mx ; i--,j++ ){
      if(i < 0 )ve2.push_back(0);
      else ve2.push_back(b[i]-'0');
    } 
    solve(ve1,ve2);
  }
  return 0;
}

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

#define MAX_SIZE 80

int main()
{
    int n;
    cin >> n;

    string n1, n2;

    for(int i=0; i<n; i++)
    {
        cin >> n1 >> n2;
        if( n1.size()>80 || n2.size()>80 ){
                cout << "overflow" << endl;
                continue;
        }

        // 先頭を0で埋めて80桁に合わせる
        char num1[MAX_SIZE], num2[MAX_SIZE];
        for(int i=n1.size(); i<80; i++) n1.insert(0, "0");
        for(int i=n2.size(); i<80; i++) n2.insert(0, "0");

        int c=0; // carry out
        char s=0; // sum
        for(int i=0; i<MAX_SIZE; i++){
            s = n1.at(n1.size()-i-1) + n2.at(n2.size()-i-1) - 2*'0' + c;
            // 桁上がりの有無
            if(s>=10){ 
                c = 1;
                s -= 10;
            }else{
                c = 0;
            }
            n1.at(n1.size()-i-1) = s + '0';
        }
 
        if(c){ 
            cout << "overflow" << endl; 
        }else{
            while(n1.at(0)=='0' && n1.size()>=2 ) n1.erase(0,1); // 先頭の0を除く処理
            cout << n1 << endl;
        }

        n1.clear();
        n2.clear();
    }

    return 0;
}

C++:     #include <iostream>
    #include <vector>
    #include <string>
    #include <sstream>
     
    class BigInteger {
    	// use 18 digit a element
    	std::vector<uint64_t> splited_num_;
    public:
    	BigInteger(std::string str) {
    		set_data(str);
    	}
    	BigInteger(std::vector<uint64_t>&& splited_num) {
    		splited_num_ = std::move(splited_num);
    	}
    	BigInteger operator+(const BigInteger& rhs) {
    		return BigInteger(plus(splited_num_, rhs.get_data()));
    	}
    	std::vector<uint64_t> get_data() const {return splited_num_;}
    	std::string to_string() const {
    		std::string ret;
    		const int size = splited_num_.size();
    		for (int i = 0; i < size; ++i) {
    			const int& n = splited_num_[size - i - 1];
    			ret += n == 0 ? "000000000000000000" : std::to_string(n);
    		}
    		return ret;
    	}
    private:
    	void set_data(const std::string& str) {
    		std::string sub;
    		int length = str.length();
    		while (length >= 18) {
    			int pos = length - 18;
    			sub = str.substr(pos, 18);
    			splited_num_.push_back(to_uint64(sub));
    			length -= 18;
    		}
    		if (length > 0) {
    			sub = str.substr(0, length);
    			splited_num_.push_back(to_uint64(sub));
    		}
		}
    	std::vector<uint64_t> plus(std::vector<uint64_t> lhs,
    						       std::vector<uint64_t> rhs) const {
    		std::vector<uint64_t> ret;
     		uint64_t carry = 0;
     		
     		const int max = std::max(lhs.size(), rhs.size());
     		const int min = std::min(lhs.size(), rhs.size());
     		// ensure that lhs.sizs() is larger than rhs.size()
     		if (lhs.size() < rhs.size()) {
     			std::swap(lhs, rhs);
     		}
     		// fit container size
     		for (int i = 0; i < (max - min); ++i) {
     			rhs.push_back(0);
     		}
     		
     		for (int i = 0; i < max; ++i) {
     			uint64_t sum = lhs.at(i) + rhs.at(i) + carry;
     			carry = sum / 1000000000000000000;
     			sum = sum % 1000000000000000000;
     			ret.push_back(sum);
     		}
     		if (carry > 0) {
     			ret.push_back(carry);
     		}
     		return ret;
    	}
    	uint64_t to_uint64(const std::string& str) const {
    		std::istringstream iss(str);
    		uint64_t ret = 0;
    		iss >> ret;
    		return ret;
    	}
    };
     
    int main() {
    	std::vector<BigInteger> ans_list;
    	int n;
    	std::cin >> n;
    	for (int i = 0; i < n; ++i) {
    		std::string str1, str2;
    		std::cin >> str1;
    		std::cin >> str2;
    		BigInteger bi1(str1);
    		BigInteger bi2(str2);
    		ans_list.push_back(bi1 + bi2);
    	}
    	
    	for (auto ans : ans_list) {
    		std::cout << ans.to_string() << std::endl;
    	}
    }

C++: #include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
int main(){
    char a[1000],b[1000];
    int c[90];
    int i,j,k,l,m,n;
    scanf("%d",&n);
    // printf("%d\n",n);
    for(i=0; i<n; i++){
        for(j=0; j<90; j++){
            a[j]='0';
            b[j]='0';
            c[j]=0;
        }
        // scanf("%s",a);
        // scanf("%s",b);
        string s;
        cin>>s;
        for(int i=0;i<s.size();i++){
            a[i]=s[i];
        }
        a[s.size()]='\0';
        cin>>s;
        for(int i=0;i<s.size();i++){
            b[i]=s[i];
        }
        b[s.size()]='\0';
        // printf("%s\n",a);
        // printf("%s\n",b);
        for(j=0; j<90; j++){
            if(a[j]=='\0'){
                a[j]='0';
                break;
            }
        }
        for(k=0; k<90; k++){
            if(b[k]=='\0'){
                b[k]='0';
                break;
            }
        }
        if(j>k)l=j;
        else l=k;
        for(m=l; m>0; m--){
         if(j-1>=0)c[m]+=a[j-1]-'0';
         if(k-1>=0)c[m]+=b[k-1]-'0';
         if(c[m]>=10){
             c[m]-=10;
             c[m-1]+=1;
         }
         j--;
         k--;
        }
        if(l>=80&&c[0]!=0)printf("overflow\n");
        else {
            if(c[0]!=0)printf("%d",c[0]);
            for(j=1; j<=l; j++)printf("%d",c[j]);
            printf("\n");
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){

  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    string a,b,out,tmp;
    cin >> a;
    cin >> b;
    //int m=max(a.size(),b.size());
    if(a.size()<b.size()){
      tmp=a;
      a=b;
      b=tmp;
    }
    //cout << a << endl;
    int si=-a.size()+b.size();
    for(int j=a.size()-1;j>=0;j--){
      if(j+si>=0){
	//cout << si << endl;
	a[j]+=b[j+si]-'0';
	//cout << a[j] << endl;
      }else{
	a[j]+=0;
	//cout << "!" << endl;
      }
      if(a[j]>'9'&&j!=0){
	a[j-1]++;
	a[j]-=10;
      }else if(a[j]>'9'&&j==0){
	a='1'+a;
	a[1]-=10;
	//for(int i=a.size();i>0;i--)
	//  a[i]=a[i-1];
	//a[1]-=10;
	//a[0]='1';
      }
    }
    if(a.size()>80)
      cout << "overflow" << endl;
    else
      cout << a << endl;
    //a='0';
  }

}