Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

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

int main(){
	
	int n;
	for(cin>>n;n--;){
		string a,b;
		cin>>a>>b;
		if(a.size()<b.size())swap(a,b);
		while(a.size()>b.size())b="0"+b;
		int f=0;
		for(int i=a.size()-1;i>=0;i--){
			a[i]+=(f+b[i]-'0');
			if(a[i]>'9'){
				f=1;
				a[i]-=10;
			}
			else f=0;
		}
		if(f)a="1"+a;
		if(a.size()>80){
			cout<<"overflow"<<endl;
			continue;
		}
		cout<<a<<endl;
		
		
	}
	
	return 0;
}

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;
}