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 <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#define INF 100000000
#define rep(i,a) for(int i=0;i<(a);i++)

using namespace std;
typedef long long ll;


int main(){
    int n;
    cin>>n;
    
    rep(i,n){
        int x[100]={},y[100]={};
        string a,b;
        cin>>a>>b;
        for(int i=a.size()-1;i>=0;i--){
            x[a.size()-1-i]=a[i]-'0';
        }
        for(int i=b.size()-1;i>=0;i--){
            y[b.size()-1-i]=b[i]-'0';
        }
        int ans[100]={};
        for(int i=0;i<80;i++){
            ans[i]+=x[i]+y[i];
            ans[i+1]+=ans[i]/10;
            ans[i]-=ans[i]/10*10;
        }
        if(ans[80]!=0)cout<<"overflow"<<endl;
        else{
            bool flag=false;
            for(int i=79;i>=0;i--){
                if(ans[i]!=0)flag=true;
                if(flag||i==0)cout<<ans[i];
            }
        }
        cout<<endl;
        
    }
    return 0;
}

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

int main(){
    
    int n;
    string str1,str2;
    stack<int> st;
    
    cin >> n;
    while(n--){
        cin >> str1 >> str2;
        int i,j,num1,num2,kuri,sum;
        i = str1.size()-1;
        j = str2.size()-1;
        kuri = 0;
        while(i>=0 || j>=0){
            num1 = 0;
            num2 = 0;
            if(i >= 0) num1 = str1[i]-'0';
            if(j >= 0) num2 = str2[j]-'0';
            sum = num1+num2+kuri;
            st.push(sum%10);
            kuri = 0;
            if(sum >= 10) kuri = 1;
            i--;
            j--;
        }
        if(st.size()+kuri > 80){
            cout << "overflow" << endl;
            while(!st.empty()) st.pop();
            continue;
        }
        if(kuri == 1) cout << 1;
        while(!st.empty()){
            cout << st.top();
            st.pop();
        }
        cout << endl;
    }
    
    return(0);
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  char a[200];
  int n,k,l,i;
  cin>>n;
  while(n--){
    string s1,s2;
    cin>>s1>>s2;
    for(i=0;i<200;i++)a[i]='0';
    for(k=0,i=s2.size()-1;i>=0;i--)a[k++]=s2[i];
    for(l=0,i=s1.size()-1;i>=0;i--,l++){
      a[l]+=s1[i]-'0';
      if(a[l]>'9'){a[l+1]++;a[l]-=9;}
    }
    if(k>79||l>79)cout<<"overflow";
    else if(l<k)for(i=k-1;i>=0;i--)cout<<a[i];
    else for(i=l-1;i>=0;i--)cout<<a[i];
    cout<<endl;
  }
}

C++: #include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;

int main()
{
	
	
	int t;
	scanf("%d",&t);
	for(int i=0;i<t;i++){
		string a;
		string b;

		cin >> a;
		cin >> b;	
		string res;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int carry = 0;
		int idx;
		for(int j=0;j<min(a.size(),b.size());j++){
			int lhs = a[j] - '0';
			int rhs = b[j] - '0';
			res.push_back((carry + lhs + rhs) % 10 + '0');
			carry = (carry + lhs + rhs) / 10 ? 1 : 0;
			idx =j;
		}

		for(int j=idx+1;j<max(a.size(),b.size());j++){
			if(a.size() > b.size()){
				int lhs = a[j] - '0';
				res.push_back((carry + lhs) % 10 + '0');
				carry = (carry + lhs) / 10 ? 1 : 0;
			}
			else{
				int rhs = b[j] - '0';
				res.push_back((carry + rhs) % 10 + '0');
				carry = (carry + rhs) / 10 ? 1 : 0;
			}
		}
		carry ? res.push_back(carry+'0') : "";
		reverse(res.begin(),res.end());
		cout << res << endl;
	}	
}

C++: #include <iostream>
#include <vector>
#include<string>
#include<sstream>

#define CAPACITY 9

 
namespace stoi{
 
    int stoi(std::string str){
        int ret;
        std:: stringstream ss;
        ss << str;
        ss >> ret;
        return ret;
    }
 
}
class OverDigit
{
public:
    int num_a[CAPACITY];
    int num_b[CAPACITY];
    OverDigit(std::string str_a, std::string str_b);
    void ChangeDigit(std::string str,int num[]);
    void Add();
};
 
OverDigit::OverDigit(std::string str_a,std::string str_b)
{
    ChangeDigit(str_a, num_a); 
    ChangeDigit(str_b, num_b);
}

void OverDigit::ChangeDigit(std::string str, int num[])
{
	std::vector <int> num_str(CAPACITY, 0);
    int loc = CAPACITY, k = 8;
    int str_Max, str_rest;

    str_Max = str.length() / CAPACITY;//
    str_rest = str.length() % CAPACITY;


/*
	for (int j = str.length() - CAPACITY; str_Max > 0; j = j-CAPACITY)
	{
        num_str[k] = stoi::stoi(str.substr(j, CAPACITY));
        loc = k;
        k--;
        str_Max--;
    }
*/

    if(str_rest!=0)
	{
		num_str[loc - 1] = stoi::stoi(str.substr(0, str_rest));
	}
 
    for (int j = 0; j < CAPACITY; j++)
	{
		num[j]=num_str[j];
    }
}

void OverDigit::Add()
{
    int num_ans[CAPACITY] = {};
    int fat,overflow=0,count=0;
 
    for (int j = CAPACITY-1; j >0; j--)
	{
        if (num_a[j] + num_b[j]<=999999999)
		{
            num_ans[j] = num_a[j] + num_b[j];
        }
        else
		 if (num_a[j] + num_b[j] > 999999999)
		{
            fat = (num_a[j] + num_b[j]) - 1000000000;
            num_ans[j] = fat;
            num_a[j - 1]++;     
        }
    }

    if (num_a[0] + num_b[0] > 99999999)
	{
        overflow = 1;
    }
    else
	{
		 num_ans[0]= num_a[0] + num_b[0];
    }
 
    if (overflow == 1)
	{
        std::cout << "overflow" << std::endl;
    }
    else
	{
        for (int j = 0; j < CAPACITY; j++)
		{
            if (num_ans[j] != 0)
			{
                count++;
                std::cout << num_ans[j];
            }
            else
			 if (num_ans[j] == 0 && count >= 1)
			{
                std::cout << "000000000";
            }
        }
		std::cout << std::endl;
    }
}
 
 
int main(){
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
    std::cin.ignore();
 
   for (int i = 0; i < N; i++){
        getline(std::cin, str_a);
        getline(std::cin, str_b);
        OverDigit OverDigit_a(str_a,str_b);
       OverDigit_a.Add();
   }
 
    return 0;
}

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

int main(){
	int x[100];
	int y[100];
	int z[100];
	int n, i, j, hi;
	bool top;
	string a, b;
	
	cin >> n;
	for (i = 0; i < n; i++) {
		// initialize
		for(j=0; j<100; j++){
			x[j] = 0;
			y[j] = 0;
			z[j] = 0;
		}
		cin >> a;
		cin >> b;
		if(a.length() > 80 || b.length() > 80){
			cout << "overflow" << endl;
			continue;
		}
		for (j = 0; j < a.length(); j++){
			x[j] = atoi(a.substr(a.length()-1-j, 1).c_str());
		}
		for (j = 0; j < b.length(); j++){
			y[j] = atoi(b.substr(b.length()-1-j, 1).c_str());
		}
		
		hi = 0;
		for(j=0; j<80; j++){
			z[j] = x[j] + y[j] + hi;
			if(z[j] > 9){
				hi = 1;
				z[j] -= 10;
			}else{
				hi = 0;
			}
		}
		if(hi == 1){
			cout << "overflow" << endl;
		}else{
			top = false;
			for (j = 79; j > -1; j--) {
				if(z[j] == 0 && !top && j != 0){
					continue;
				}else{
					top = true;
					cout << z[j];
				}
			}
			cout << endl;
		}
	}
	return 0;
}