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 <stack>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main(){
	int n;
	cin >> n;
	REP(i, n){
		stack<int> a,b,ret;
		string p,q;
		cin>>p>>q;
		REP(j, p.length()) a.push(p[j]-'0');
		REP(j, q.length()) b.push(q[j]-'0');
		int k = 0;
		while(a.size() || b.size() || k){
			int buf = k;
			if (a.size()){
				buf += a.top();
				a.pop();
			}
			if(b.size()){
				buf += b.top();
				b.pop();
			}
			ret.push(buf % 10);
			k = buf / 10;
		}
		if (ret.size() > 80){
			cout<<"overflow"<<endl;
		}
		else{
			while(ret.size()) {
				cout<<ret.top();
				ret.pop();
			}
			cout<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int j = 0; j < n; j++){
        char a[1000] = {0};
        char b[1000] = {0};
        scanf("%s%s",a,b);
        int len_a = 0,len_b = 0;
        for(int i = 0; a[i] != 0; i++) len_a++;
        for(int i = 0; b[i] != 0; i++) len_b++;
        if(len_a > 80 || len_b > 80){
            printf("overflow\n");
        }
        else{
            char ans[1000] = {0};
            reverse(a,a+len_a);
            reverse(b,b+len_b);
            int len = max(len_a,len_b);
            for(int i = 0; i < len; i++){
                if(ans[i] != 0){
                    if(a[i] == 0 || b[i] == 0)
                        ans[i] += a[i] + b[i] - '0';
                    else ans[i] += a[i] + b[i] - '0' - '0';

                }
                else if(a[i] == 0 || b[i] == 0) ans[i] += a[i] + b[i];
                else ans[i] += a[i] + b[i] - '0';
                if(ans[i] >= 58){
                    ans[i+1]+='1';
                    ans[i] -= 10;
                }
            }
            int len_ans = 0;
            for(int i = 0; ans[i] != 0; i++) len_ans++;
            reverse(ans,ans+len_ans);
            if(len_ans > 80) printf("overflow");
            else for(int i = 0; ans[i] != 0; i++) printf("%c",ans[i]);
            printf("\n");
        }
    }
    return 0;
}

C++: //#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

signed main(void)
{
	int n;
	cin >> n;
	REP(i, n) {
		string s, t;
		cin >> s >> t;

		int dif = abs(s.size()-t.size());
		string tmp(dif, '0');
		if(s.size() < t.size()) s = tmp + s;
		else t = tmp + t;
		//cout << s << " " << t << endl;

		bool flag = false;
		for(int i=t.size()-1; i>=0; --i) {
			int tmp = (t[i]-'0')+(s[i]-'0');
			if(flag) tmp++;
			flag = false;
			if(tmp >= 10) {tmp -= 10; t[i] = tmp+'0'; flag = true;}
			else {t[i] = tmp+'0';}
		}
		if(flag) t = '1' + t;
		if(t.size() > 80) cout << "overflow" << endl;
		else cout << t << endl;
	}

	return 0;
}

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 num_str[CAPACITY];
	for (int j = 0; j < CAPACITY; j++) { 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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		getchar();
		scanf("%s",num2);
		getchar();
		l1 = strlen(num1);
		l2 = strlen(num2);
		//printf("%s %s\n",num1,num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool p=false;
		/*for(int i=0;i<1002;i++)
		{
			cout << ans[i];
		}
		cout << endl;*/
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				k=true;
				break;
			}
		}
		if(p)
		{
			printf("overflow\n");
			continue;
		}
		else
		{
			for(j=1001;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}