Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define X real()
#define Y imag()
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

  template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

unsigned long long int ulli;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string s1,s2,ans(105,' ');
  cin >> N;
  rep(i,N){
    cin >> s1 >> s2;
    ans = string(105,' ') ;
    if(s1.size()> 80 || s2.size() > 80){
      cout << "overflow" << endl;
      continue;
    }
    int a,b,c = 0;
    bool f = s1.size() >= s2.size();
    for(int i = 0;i <min(s1.size(),s2.size());++i){
      if(f){
        a = s1[s1.size()-1-i] - '0' ;
        b = s2[s2.size()-1-i] - '0' ;
      }
      else{
        a = s1[s1.size()-1-i] - '0' ;
        b = s2[s2.size()-1-i] - '0' ;
      }
//       debug((a+b+c)%10+'0');
      ans[ans.size()-1-i] = (a+b+c)%10+'0';
      c = (a+b+c)/10;
//       cout << ans.size()-1-i << " :" << a << " :" << b << " :" << c <<endl;
    }
    for(int i = min(s1.size(),s2.size()); i < max(s1.size(),s2.size());++i){
      if(f){
        ans[ans.size()-1-i] = (s1[s1.size()-1-i] - '0' + c)%10+'0';
        c = (s1[s1.size()-1-i] - '0' + c )/10;
      }
      else{
        ans[ans.size()-1-i] = (s2[s2.size()-1-i] + c - '0')%10+'0';
        c = (s2[s2.size()-1-i] + c - '0')/10;
      }
    }
    if(c > 0){
//       cout << ans << "c :"<<  c << endl;
      ans[0] = c +'0' ;
    }
    if(ans.size()-count(all(ans),' ') > 80){
      cout << "overflow" << endl;
      continue;
    }
    for(size_t c = ans.find_first_of(" "); c != string::npos; c = ans.find_first_of(" ")){
      ans.erase(c,1);
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <utility>
using namespace std;
int toNumber(char c){
	switch (c)
	{
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	}
	return 0;
}
int main()
{
	int n, sa, sb, k, r, i;
	string a, b;
	int sum[81] = {};
	cin >> n;
	while (n--){
		cin >> a >> b;
		if (a.size() < b.size()) swap(a, b);
		sa = a.size();
		sb = b.size();
		k = i = 0;
		for (; i < sa; ++i){
			if (i < sb) k = toNumber(a[sa - 1 - i]) + toNumber(b[sb - 1 - i]) + k;
			else 		k = toNumber(a[sa - 1 - i]) + k;
			r = k % 10;
			k = k / 10;
			sum[i] = r;
		}
		if (0 != k) sum[i] = k;
		else --i;
		for (int d = i; d >= 0; --d)
			cout << sum[d];
		cout << "\n";
	}
	return 0;
}

C++: #include<algorithm>
#include<iostream>
#include<cstdio>
#include<stdio.h>
#include<string>
#include<string.h>
#include <math.h>
using namespace std;
int main()
{
	char a1,a2  ;
	long long a, b,c;
	int kaisu = 0;
	cin >> kaisu;
	for (int i = 0; i < kaisu; i++)
	{
		cin >> a;
		cin >> b;
		a1 = (long long)log10(a) + 1;;
		a2 = (long long)log10(b) + 1;;
		if (a1 + a2 >= 80) { printf("overflow"); }
		else { c = a + b; printf(c + "\n"); }
	}
	return 0;
}