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++: //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];
        vector<int> dx[2] = {makeDx(str[0]), makeDx(str[1])};
        vector<int> ans(N, 0);

        if(isOver80(dx[0]) || isOver80(dx[1])){
            cout <<"NA" <<endl;
            continue;
        }

        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, N) cout <<ans[i];
        cout <<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

const int MAX_SIZE = 90;

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = 0;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == 0&& r.d[i] == 0){
	if(!updigit)
	  goto end;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i])
	  a = toI(this->d[i]);
	if(r.d[i])
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
  end:
    this->size = tmp;
    return;
  }

  void print()
  {
    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
    puts("");
  }

  int sz()
  {
    return this->size;
  }
};

int main()
{
  int x;
  scanf("%d", &x);
  char s1[1000], s2[1000];  
  for(int i=0;i<x;i++){
    scanf("%s %s",s1, s2);
    if(strlen(s1) > 80 || strlen(s2) > 80){
      puts("overflow");
      continue;
    }
    Z z1(s1);
    Z z2(s2);
    z1.add(z2);
    z1.print();
  }
  return 0;
}

C++: #include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
class N{
public:
  string s;
  int ln;
  N(){
  }
  N(int n){
    s.assign(n,'0');
    ln=n;
  }
  N(string t){
    s=t;
    ln=s.length();
    update();
  }
  N plus(const N& t){
    int i;
    N u(max(ln,t.ln)+1);
    int c=0;
    for(i=0;i<max(ln,t.ln);++i){  
      int p=(ln-i-1<0?0:s[ln-i-1]-'0')+(t.ln-i-1<0?0:t.s[t.ln-i-1]-'0')+c;
      u.s[u.ln-i-1]=p%10+'0';
      c=p/10;
    }
    u.s[u.ln-i-1]=c+'0';
    u.update();
    return u;
  }
  void update(){
    int i;
    for(i=0;i<ln-1&&s[i]=='0';++i);
    s.erase(0,i);
    ln-=i;
  }
};
int main(){
  int i;
  int n;
  cin>>n;
  for(i=0;i<n;++i){
    string s,t;
    cin>>s>>t;
    N a(s),b(t);
    N c=a.plus(b);
    if(c.ln>80)
      cout<<"overflow"<<endl;
    else
      cout<<c.s<<endl;
  }
  return 0;
}

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

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
 
	for (int i = 0; i < N; i++)
	{
		std::cin >> str_a;
		std::cin >> str_b;
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;
bool isover(int);
bool isover(int,int);
int main() {
	int n; string ans; bool is_str_use;
	string str, str1; int nexta; int memo, age;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		age = 0; ans = ""; is_str_use = false;
		cin >> str >> str1;
		if (isover(str.size(), str1.size())) {
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < str.size() / 2; ++i) {
			swap(str[i], str[str.size() - 1 - i]);

		}
		for (int i = 0; i < str1.size() / 2; ++i) {
			swap(str1[i], str1[str1.size() - 1 - i]);
		}
		if (str.size() < str1.size()) {
			is_str_use = true;
		}
		for (int i = 0; i < min(str.size(), str1.size()); ++i) {
			memo = (str[i] - '0') + (str1[i] - '0') + age;
			if (memo > 9) {
				age = memo / 10;
				memo -= (memo / 10) * 10;
			}
			ans += memo + '0';
		}
		if (str.size() == str1.size()&&age!=0) {
			ans += age + '0';
			age = 0;
		}
		if (isover(ans.size())) {
			cout << "overflow" << endl;
			continue;
		}
		if (is_str_use) {
			swap(str, str1);

		}
		for (int i = min(str.size(), str1.size()); i < str.size(); ++i) {
			memo = (str[i] - '0') + age;
			if (memo > 9) {
				age = memo / 10;
				memo -= (memo / 10) * 10;
			}
			ans += memo + '0';
		}
		if (age != 0)ans += age+'0';
		if (isover(ans.size())) {
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < ans.size() / 2; ++i) {
			swap(ans[i], ans[ans.size() - 1 - i]);
		}
		cout << ans << endl;
	}
	return 0;
}
bool isover(int a) {
	if (a > 80) {
		return true;
	}
	return false;
}
bool isover(int a, int b) {
	if (a > 80 || b > 80) {
		return true;
	}
	return false;
}

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


int main(){
  int n,i,j;
  string a,b;
  int sum[102]={};
  int up = 0;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> a >> b;
    int sa=a.size(),sb=b.size();
    for(j=0;j<max(sa,sb);j++){
      if(sa>j&&sb>j){
	sum[j] = (a[sa-j-1]-'0') + (b[sb-j-1]-'0') + up;
      }else if(sa>j){
	sum[j] = (a[sa-j-1]-'0') + up;
      }else if(sb>j){
	sum[j] = (b[sb-j-1]-'0') + up;
      }
      up=0;
      if(sum[j]>9){
	up=1;
	sum[j]-=10;
      }
    }
    sum[max(sa,sb)]=up;
    int k=101;
    while(sum[k]==0&&k>0) k--;
    //cout << k<< " "<<sum[k] << endl;
    for(j=k;j>=0;j--)
      cout << sum[j];
    cout << endl;
  }
    

  
}