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<cstring>
#include<cstdlib>

int main(void)
{
	char num1[1000], num2[1000];
	int n, num1_k, num2_k, rec, nnum1, nnum2, k_up, bnum1, bnum2;
	int f1, f2;
	scanf("%d", &n);
	fflush(stdin);
	for(f1 = 0; f1 < n; f1++)
	{
		//初期化
		k_up = 0;
		//入力
		scanf("%s", num1);
		scanf("%s", num2);
		//それぞれの桁数を求める
		num1_k = strlen(num1);
		num2_k = strlen(num2);
		bnum1 = num1_k - 1;
		bnum2 = num2_k - 1;
		//桁数で低いほうの桁数分だけ回す
		rec = (num1_k > num2_k) ? num2_k : num1_k;
		for(f2 = rec - 1; f2 >= 0; f2--)
		{
			//それぞれ現在桁の数を割り出す
			nnum1 = num1[bnum1] - '0';
			nnum2 = num2[bnum2] - '0';
			//桁数の大きいほうへ入れる
			if(num1_k > num2_k)
			{
				num1[bnum1] = ((nnum1 + nnum2 + k_up) % 10) + '0';
			}
			else
			{
				num2[bnum2] = ((nnum1 + nnum2 + k_up) % 10) + '0';
			}
			//桁上がりを求める
			k_up = (nnum1 + nnum2) / 10;
			bnum1--;
			bnum2--;
		}
		//残りの部分を求める
		rec = (bnum1 > bnum2) ? bnum1 : bnum2;
		for(f2 = rec; f2 >= 0; f2--)
		{	
			//桁数の大きいほうへ入れる
			if(num1_k > num2_k)
			{
				nnum1 = num1[f2] - '0';
				num1[f2] = ((k_up + nnum1) % 10) + '0';
				k_up = (k_up + nnum1) / 10;
			}
			else
			{
				nnum2 = num2[f2] - '0';
				num2[f2] = ((k_up + nnum2) % 10) + '0';
				k_up = (k_up + nnum2) / 10;
			}			
		}
		if(num1_k > 80 || num2_k > 80)
		{
			printf("overflow\n");
		}
		else
		{
			if(k_up == 1)
			{
				if(num1_k + 1 > 80 || num2_k + 1 > 80)
				{
					printf("overflow\n");
				}
				else
				{
					printf("%d", k_up);
				}
			}
			if(num1_k > num2_k)
			{
				printf("%s\n", num1);
			}
			else
			{
				printf("%s\n", num2);
			}
		}
	}
	return 0;
}

C++: //RE
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;
const int N = 100;

vector<int> makeDx(string str){
    reverse(str.begin(), str.end());
    vector<int> ret(N, 0);
    REP(i, str.size()) ret[i] = str[i] - '0';
    return ret;
}

bool isOver80(vector<int> dx){
    FOR(i, 80, dx.size()) if(dx[i] != 0) return true;
    return false;
}

int main(){
    int n; cin >>n;
    REP(z, n){
        string str[2]; cin >>str[0] >>str[1];
        if(str[0].size() > 80 || str[1].size() > 80){
            cout <<"NA" <<endl;
            continue;
        }

        vector<int> dx[2] = {makeDx(str[0]), makeDx(str[1])};
        vector<int> ans(N, 0);

        REP(i, max(dx[0].size(), dx[1].size())){
            ans[i] += (dx[0][i] + dx[1][i]);
            ans[i + 1] += (ans[i] / 10);
            ans[i] = ans[i] % 10;
        }

        if(isOver80(ans)){
            cout <<"NA" <<endl;
            continue;
        }

        reverse(ans.begin(), ans.end());
        int s = 0;
        while(ans[s] == 0 && s < N - 1) s++;
        FOR(i, s, ans.size()) cout <<ans[i];
        cout <<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
int main(int, char**)
{
	int number = 0;
	std::cin >> number;

	std::string buff1;
	std::string buff2;
	for (int count = 0; number > count; ++count)
	{
		std::cin >> buff1 >> buff2;

		std::vector<std::string> sum;
		sum.reserve(10);
		int carry = 0;
		for (int offset = 0; buff1.length() > offset || buff2.length() > offset; offset += 8)
		{
			auto cutoff = [](const std::string& buff, const int offset)->int
			{
				if (buff.length() <= offset)
				{
					return 0;
				}
				if (buff.length() <= offset + 8)
				{
					return std::stoi(buff.substr(0, buff.length() - offset));
				}
				return std::stoi(buff.substr(buff.length() - offset - 8, 8));
			};
			int num1 = cutoff(buff1, offset);
			int num2 = cutoff(buff2, offset);
			std::string sum_buff = std::to_string(num1 + num2 + carry);
			
			if (8 < sum_buff.length())
			{
				carry = std::stoi(sum_buff.substr(0, 1));
				sum.emplace_back(sum_buff.substr(1));
			}
			else
			{
				carry = 0;
				sum.emplace_back(sum_buff);
			}
		}
		if (10 < sum.size() || (sum.size() == 10 && sum[0].length() == 8 && 0 != carry))
		{
			std::cout << "overflow";
		}
		else
		{
			if (0 != carry)
			{
				std::cout << std::to_string(carry);
			}
			for (int index = static_cast<int>(sum.size()) - 1; 0 <= index; --index)
			{
				if (index != static_cast<int>(sum.size()) - 1 && "0" == sum[index])
				{
					std::cout << "00000000";
				}
				else
				{
					std::cout << sum[index];
				}
			}
		}
		std::cout << std::endl;
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int N;

int f(string s1,string s2,int x){
	if(N>80){cout<<"overflow"<<endl;return 0;}
	if(s1.size()<=N&&s2.size()<=N&&x==0)return 0;
	if(s1.size()>N)x+=s1[s1.size()-N-1]-'0';
	if(s2.size()>N)x+=s2[s2.size()-N-1]-'0';
	++N;
	f(s1,s2,x/10);
	if(N<=80)cout<<x%10;
	return 0;
}

int main(){
	int n;
	cin>>n;
	rep(i,n){
		string s1,s2;
		cin>>s1>>s2;
		f(s1,s2,0);
		cout<<endl;
	}
	return 0;
}

C++: #define scanf_s scanf
#define sscanf_s sscanf
#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
using namespace std;
#define MAX 81
#define _MAX 100
//#define CONSTNUM 10000000
int main(void)
{
	int n, s = 0, x, y, r = 0, a, b;
	int sum_n[50][3] = { 0 };
	char sum[50][_MAX], astr[_MAX], bstr[_MAX], num[11] = { "0123456789" };
	char ca, cb;
	scanf_s("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf_s("%s %s", &astr, &bstr);
		for (x = 0; astr[x] != '\0'; ++x);
		for (y = 0; bstr[y] != '\0'; ++y);
		if (x > 80 || y > 80) {
			printf("overflow\n");
			continue;
		}
		for (int j = 0; j < x || j < y; ++j) {
			if (j < x && j < y) {
				ca = astr[x - j - 1]; cb = bstr[y - j - 1];
				sscanf_s(&ca, "%d", &a);
				sscanf_s(&cb, "%d", &b);
				if (x > y) sum[i][x - j] = num[(a + b + r) % 10];
				else sum[i][y - j] = num[(a + b + r) % 10];
				if (a + b + r >= 10) r = (a + b + r) / 10;
				else r = 0;
			}
			else {
				if (x > y) {
					if (r != 0) {
						ca = astr[x - j - 1];
						sscanf_s(&ca, "%d", &a);
						sum[i][x - j] = num[(a + r) % 10];
						if (a + r >= 10) r = (a + r) / 10;
						else r = 0;
					}
					else {
						sum[i][x - j] = astr[x - j - 1];
					}
				}
				else {
					if (r != 0) {
						cb = bstr[y - j - 1];
						sscanf_s(&cb, "%d", &b);
						sum[i][y - j] = num[(b + r) % 10];
						if (b + r >= 10) r = (b + r) / 10;
						else r = 0;
					}
					else {
						sum[i][y - j] = bstr[y - j - 1];
					}
				}
			}
		}
		if (y <= 80 - r && x <= 80 - r) {
			if (r == 1) 	printf("%d", r);
			for (int j = 1; j <= x || j <= y; ++j) {
				printf("%c", sum[i][j]);
			}
		}
		else {
			printf("overflow");
		}
		printf("\n");
		r = 0;
	}
}