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 <iterator>
#include <typeinfo>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;++a) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define int_maxvalue numeric_limits<int>::max()
ll mod = 1e9 + 7;
string Addition(string a,string b) {
	string ans = "";
	int bef = 0;
	int be1 = 0;
	for (int i = a.length() - 1; i >= 0; i--) {
		int added = stoi(a.substr(i, 1)) + stoi(b.substr(i, 1))+be1;

		if (added >= 10) {
			bef = 1;
			added -= 10;
		}
		else {
			bef = 0;
		}
		stringstream ss;
		ss << added;

		ans = ss.str()+ans;
		if (i == 0) 
		{
			break;
		}
		be1 = bef;
	}
	if (be1 == 1) {
		ans = "1" + ans;
	}
	return ans;
}
int main() {
	int n;
	cin >> n;
	rep(o1, n) {
		string a, b;
		cin >> a >> b;
		if (a.length() < b.length()) {
			swap(a, b);
		}
		string b1 = b;
		for (int i = 0; i < a.length() - b1.length(); ++i) {
			b = '0' + b;
		}
		string ans = Addition(a, b);
		if (ans.length() > 80) { cout << "overflow" << endl; }
		else {
			cout << ans << endl;
		}
	}
	return 0;
}

C++: #include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main() {
  int n, i;
  string a, b;
  bool f;
  cin >> n;
  while (n--) {
    cin >> a >> b;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    if (b.size() > a.size()) a.swap(b);
    for (i = f = 0; i < a.size(); i++) {
      int n = (a[i] - '0') + f;
      if (i < b.size()) n += b[i] - '0';
      a[i] = (n % 10) + '0';
      f = n > 9;
    }
    if (f) a += "1";
    reverse(a.begin(), a.end());
    if (a.size() > 80) {
      cout << "overflow" << endl;
    } else {
      cout << a << endl;
    }
  }
  return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n;
    cin >> n;
    rep(k,n){
        char input1[81], input2[81];
        cin >> input1 >> input2;
        //後ろから和を求める
        int ans[81] = {0};
        int size1 = strlen(input1) - 1;
        int size2 = strlen(input2) - 1;
        int i = 0;
        while(1){
            if(size1 - i >= 0 && size2 - i >= 0)
                ans[i] += input1[size1 - i] - '0' + input2[size2 - i] - '0';
            else if(size1 - i >= 0)
                ans[i] += input1[size1 - i] - '0';
            else if(size2 - i >= 0)
                ans[i] += input2[size2 - i] - '0';
            //桁数を繰り上げる
            if(ans[i] >= 10){
                ans[i] -= 10;
                ans[i + 1]++;
            }
            if(size1 - i < 0 && size2 - i < 0)
                break;
            i++;
        }
        //出力
        if(ans[80] == 1)
            cout << "overflow" << endl;
        else{
            for(int j = i; j >= 0; j--){
                if(ans[i] == 0 && j == i)
                    continue;
                cout << ans[j];
            }
        }
        cout << endl;
    }
}

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

int main(){
  int j;
  char s1[111] = {0};
  char tmp[111] = {0};
  char s2[111] = {0};
  char ans[111];
  int  kuri = 0 ;
  memset(ans,0,sizeof(ans));
  cin >> s1 >> s2;
  if(strlen(s1) < strlen(s2)){
      for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
      for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
      for(int i=0;i<strlen(s2);i++){
	if((s2[i] + (s1[i]%'0') + kuri) > '9'){
	  ans[i] = (s2[i] + (s1[i]%'0') + kuri)-10;
	  kuri = 1;
	}
	else {
	  ans[i] = (s2[i] + (s1[i]%'0') + kuri);
	  kuri = 0;
	}
	if(i == strlen(s2)-1 && kuri == 1) ans[i+1] = '1';
      }
      if(strlen(ans) > 80) cout << "overflow" << endl;
      else{
	for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
      }
  }
  else{
    for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
    for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
    for(int i=0;i<strlen(s1);i++){
      if((s1[i] + (s2[i]%'0') + kuri) > '9'){
	ans[i] = (s1[i] + (s2[i]%'0') + kuri)-10;
	kuri = 1;
      }
      else {
	ans[i] = (s1[i] + (s2[i]%'0') + kuri);
	kuri = 0;
      }
      if(i == strlen(s1)-1 && kuri == 1) ans[i+1] = '1';
    }
    if(strlen(ans) > 80) cout << "overflow" << endl;
    else{
      for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
    }
  }
  cout << endl;
}