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 <cstdio>
#include <cstring>
#include <algorithm>

#define 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[MAX_SIZE], s2[MAX_SIZE];  
  for(int i=0;i<x;i++){
 /*   scanf("%s%s",s1, s2);
   Z z1(s1);
    Z z2(s2);
    if(z1.sz() > 80 || z2.sz() > 80){
      puts("overflow");
      continue;
    }
    z1.add(z2);
    z1.print(); */
  }
  return 0;
}

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

void swap(std::string& str1, std::string& str2)
{
	std::string temp;

	temp = str1;

	str1 = str2;

	str2=temp;
}

int main()
{
	int n=0;

	std::cin >> n;

	for(int i=0; i<n; ++i)
	{
		std::vector<int> a, b;

		std::string stra, strb;

		std::cin >> stra >> strb;

		if(stra.length()<strb.length())
		{
			swap(stra,strb);
		}

		for(size_t i=0; i<stra.length(); ++i)
		{
			a.push_back(stra[stra.length()-1-i]-48);
		}

		for(size_t i=0; i<strb.length(); ++i)
		{
			b.push_back(strb[strb.length()-1-i]-48);
		}

		for(size_t i=0; i<b.size(); ++i)
		{
			a[i] += b[i];
		}

		for(size_t i=0; i<a.size()-1; ++i)
		{
			if(a[i]>=10)
			{
				++a[i+1];

				a[i] %= 10;
			}
		}

		if(a[a.size()-1]>=10)
		{
			a[a.size()-1] %= 10;

			a.push_back(1);
		}
		
		if(a.size()>80)
		{
			std::cout << "overflow";
		}
		else
		{
			for(size_t i=0; i<a.size(); ++i)
			{
				std::cout << a[a.size()-1-i];
			}	
		}

		std::cout << '\n';
	}
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,lengthof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int n;
	cin >> n;
	while (n--){
		string s1, s2;
		cin >> s1 >> s2;
		string ans = "";
		int s1l = s1.length();
		int s2l = s2.length();
		bool up = false;
		REP(i, max(s1l, s2l)){
			int a = up ? 1 : 0;
			if (s1l - i - 1 >= 0)
				a += s1.c_str()[s1l - i - 1] - '0';
			if (s2l - i - 1 >= 0)
				a += s2.c_str()[s2l - i - 1] - '0';
			up = (a >= 10);
			ans = to_string(a % 10) + ans;
			if (max(s1l, s2l) - i-1 == 0 && up)ans = "1" + ans;
		}
		cout<<ans<<endl;
	}
}

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

std::string num_1, num_2;

void solver() {
    std::stack<char>ss_1, ss_2;
    std::stack<int> ss;
    bool flag=false;
    int tmp;
    for (int i=0; i<num_1.length(); i++) {
        ss_1.push(num_1[i]);
    }
    for (int j=0; j<num_2.length(); j++) {
        ss_2.push(num_2[j]);
    }

    while (!ss_1.empty() && !ss_2.empty()) {
        tmp = (ss_1.top() - '0') + (ss_2.top() - '0');
        ss_1.pop();
        ss_2.pop();

        if (flag) {
            tmp += 1;
        }
        ss.push(tmp % 10);

        flag = (tmp > 9) ? true:false;
    }
    if (ss_1.empty() && !ss_2.empty()) {
        while (!ss_2.empty()) {
            tmp = ss_2.top() - '0';
            if (flag) tmp += 1;

            ss.push(tmp % 10);
            ss_2.pop();
            flag = (tmp > 9) ? true:false;
        }
    } else if (ss_2.empty() && !ss_1.empty()) {
        while (!ss_1.empty()) {
            tmp = ss_1.top() - '0';
            if (flag) tmp += 1;

            ss.push(tmp % 10);
            ss_1.pop();
            flag = (tmp > 9) ? true:false;
        }
    }
    if (flag) ss.push(1);
    if (ss.size() > 80) {
        std::cout << "overflow" << std::endl;
    } else {
        while (!ss.empty()) {
            std::cout << ss.top();
            ss.pop();
        }
        std::cout << std::endl;
    }
}

int main(void) {
    int n;

    std::cin >> n;

    for (int i=0; i<n; i++) {
        std::cin >> num_1;
        std::cin >> num_2;
        solver();
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
	string sa,sb;
	int a[100],b[100],res[100],n;
	cin >> n;
	for(int i=0;i<n;i++){
		fill(a,a+100,0); fill(b,b+100,0); fill(res,res+100,0);
		cin >> sa >> sb;
		int a_len = sa.length(),b_len = sb.length(),res_len=0;
		if(a_len>80 || b_len>80){
			f:
			printf("overflow\n");
			continue;
		}
		for(int j=0;j<a_len;j++)
			a[j] = sa[a_len-1-j]-'0';
		for(int j=0;j<b_len;j++)
			b[j] = sb[b_len-1-j]-'0';
		for(int j=0;j<max(a_len,b_len);j++){
			res[j] += a[j]+b[j];
			res[j+1] = res[j]/10;
			res[j] %=10;
		}
		string s="";bool flag=false;
		for(int j=max(a_len,b_len);j>=0;j--){
			if(!flag && res[j]!=0){
				flag=true;
				if(j >=80) goto f;
			}
			if(flag){
				printf("%d",res[j]);
			}
		}
		printf("\n");
	}
}