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 <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    int number_of_datasets;
    cin >> number_of_datasets;

    char A[81];
    char B[81];
    while (number_of_datasets--) {
        fill_n(A, 81, '\0');
        fill_n(B, 81, '\0');
        string input;
        cin >> input;
        copy(input.rbegin(), input.rend(), A);
        cin >> input;
        copy(input.rbegin(), input.rend(), B);

        for (char & n : A) {
            if (n == '\0') {
                break;
            }

            n -= '0';
        }

        for (char & n : B) {
            if (n == '\0') {
                break;
            }

            n -= '0';
        }

        char carry = 0;
        for (int i = 0; i < 81; i++) {
            A[i] += B[i] + carry;
            if (A[i] >= 10) {
                A[i] -= 10;
                carry = 1;
            } else {
                carry = 0;
            }
        }
        
        if (A[80] != 0) {
            cout << "overflow";
        } else {
            int last_valid_place = 0;
            for (int i = 80; i >= 0; i--) {
                if (A[i] != 0) {
                    last_valid_place = i;
                    break;
                }
            }

            for (int i = last_valid_place; i >= 0; i--) {
                A[i] += '0';
                cout << A[i];
            }
        }

        cout << endl;
    }
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<stack>
#include<set>
#include<cmath>

#define REP(i,s,e) for(int i=int(s);i<int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-6

using namespace std;

int main(){

	int n;
	cin >> n;

	rep(i,n){

	string a,b;
	cin >> a >> b;

	int sa=a.size(); int sb=b.size(); int p=max(sa,sb);
	vector<char>s;

	if(sa>80 || sb>80)
	cout << "overflow" << endl;
	else{

	string z;
	if(sa>sb){
	rep(j,sa-sb)
	z+='0';
	b=z+b;
	}
	if(sb>sa){
	rep(j,sb-sa)
	z+='0';
	a=z+a;
	}


    int c=0;
	rep(j,p){

	c+=(a[p-1-j]-'0')+(b[p-1-j]-'0');

	s.push_back(c%10+'0');
	c=c/10;

	}

    if(c==1) s.push_back(c%10+'0');

    if(s.size()>80)
    cout << "overflow" << endl;
    else
    rep(k,s.size()) cout << s[s.size()-1-k];

    cout << endl;
    s.clear();

	}
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
 
#define MOD 1000000007
#define INF  2000000000
//#define int ll
#define ll long long
#define ld long double
#define vi vector<int>
#define pa pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...)type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void MACRO_VAR_Scan(First& first, Rest&...rest) { cin >> first; MACRO_VAR_Scan(rest...); }
#define VEC(type, c, n) vector<type> c(n);for(auto& i:c)cin>>i;
#define MAT(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
 
#define BR cout << "\n";
#define SP cout << " ";
#define ENDL cout<<endl;
#define OUT(d) cout<<(d);
#define OUTL(d) cout<<(d); BR;
#define YES OUTL("YES")
#define Yes OUTL("Yes")
#define NO OUTL("NO")
#define No OUTL("No")
#define RET return 0;
#define SUM(a, n) accumulate(a, a+n, 0)
#define VSUM(v) accumulate(ALL(v), 0);
 
#define REP(i, n) for(int i=0;i<(n);i++)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define FOR(i, m, n) for(int i = m;i < n; i++)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define AREP(a, n) for(auto (a):(n))
#define ALL(a) (a).begin(),(a).end()
#define IN(n, a, b) ((a)<=(n)&&(n)<(b))

string sum(string a, string b){
    reverse(ALL(a));
    reverse(ALL(b));

    string ans = "";
    if(a.size() > 80 || b.size() > 80) return "overfrow";
    int t = 0;
    REP(k, max(a.size(), b.size())){
        int i = k < a.size() ? a[k] - '0' : 0;
        int j = k < b.size() ? b[k] - '0' : 0;
        int sum = i + j + t;
        ans += (char)(sum%10 + '0');
        t = sum / 10;
    }
    if(t) ans += (char)(t + '0');
    if(ans.size() > 80) return "overflow";
    reverse(ALL(ans));
    return ans;
}

signed main(){ INIT;
    VAR(int, n);
    REP(i, n){
        VAR(string, a, b);
        OUTL(sum(a, b));
    }
RET;}

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

int main(){
  int n;
  char a[100];
  char b[100];

  for(int m=0;m<n;m++){
  cin>>a>>b;
    int ai[100],bi[100];
    char ans[100];
    for(int i;a[i]!='\0';i++){
      ai[i]=(int)a[i];
    }
    for(int i;b[i]!='\0';i++){
      bi[i]=(int)b[i];
    }
    int i=0;
    for(i;!(ai[i]==0&&bi[i]==0);i++){
      int c=ai[i]+bi[i];
      if(c>9){
	ai[i]++;
	c-=10;
      }
      ans[i]=(char)c;
    }
    if(i>=80){
      cout<<"overflow\n";
    }
    else{
      for(int j=i;j>=0;j--){
	cout<<a[j];
      }
      cout<<'\n';
    }
  }
  return 0;
}