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 <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
string s1, s2;
int main(void) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        vector<int> ans;
        cin >> s1;
        cin >> s2;
        int size1 = s1.size();
        int size2 = s2.size();
        if (size2 > size1) {
            swap(size1, size2);
            swap(s1, s2);
        }
        size1++;
        reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end());
        s1 += "0";
        for (int i = 0; i + size2 < size1; i++) {
            s2 += "0";
        }
        //    cout << s1 << endl;
        //    cout << s2 << endl;
        int old = 0;
        for (int i = 0; i < size1; i++) {
            int tmp = (s1[i]-'0') + (s2[i]-'0') + old;
            //        cout << tmp << endl;
            ans.push_back(tmp % 10);
            old = tmp / 10;
        }
        if (ans[size1-1] == 0) size1--;
        if (size1 > 80) {
            cout << "overflow" << endl;
            continue;
        }
        for (int i = size1-1; i >= 0; i--) {
            cout << ans[i];
        }
        cout << endl;
    }
    return 0;
}

C++: #include<string>
#include<iostream>
#include<algorithm>
using namespace std;
string a,b,sum;
void check(int z,int x);
int A,B;
int main(void){
    int n;
    cin>>n;
    while(n--){
        a="",b="",sum="";
        cin>>a>>b;
        if(a.length()>80||b.length()>80){
            sum="overflow";
            goto end;
        }
        A=a.length(),B=b.length();
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        if(A<B)swap(A,B),swap(a,b);
        for(int i=0;i<=A-B;i++)b+="0";
        check(0,0);
        if(sum.length()>80){
            sum="overflow";
            goto end;
        }
        reverse(sum.begin(),sum.end());
        end:;
        cout<<sum<<endl;
    }
    return 0;
}
void check(int z,int x){
    int i;
    if(a[z]==0)a[z]='0';
    if(b[z]==0)b[z]='0';
    if(z==81||(z>A&&z>B&&x==1)||(z>=A&&z>=B&&x==0)){
            x=0;
            return;
    }
    i=(int)a[z]-'0' + (int)b[z]-'0' + x,x=0;
    if(i>=10)x=1,i-=10;
    sum+=i+'0';
    check(z+1,x);
}

C++: #include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>

using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)

typedef pair<int, int> P;


int main()
{
	int n;
	string a, b;
	cin >> n;
	REP(i, n){
		int a_a[85] = { 0 };
		int b_a[85] = { 0 };
		int c_a[85] = { 0 };
			cin >> a >> b;
			if (a.length() >= 80 || b.length() >= 80){
				cout << "overflow" << endl;
			}

			REP(i, a.length()){
				a_a[i] = a[a.length() - i -1] - '0';
			}
			
			REP(i, b.length()){
				b_a[i] = b[b.length() - i -1] - '0';
			}

			REP(i, 84){
				int temp = a_a[i] + b_a[i] + c_a[i];
				c_a[i + 1] += temp / 10;
				c_a[i] = temp % 10;
			}
			int i = 84;
			while (!c_a[i] && i)--i;
			if (i >= 80){
				cout << "overflow" << endl;
			}
			while (i >= 0){
				cout << c_a[i];
				--i;
			}
			cout << endl;
		}
	return 0;
}

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

int main(){
  int j;
  int n;
  char s1[111];
  char tmp[111];
  char s2[111];
  char ans[111];
  int  kuri = 0;
  cin >> n;
  while(n--){
  memset(ans,0,sizeof(ans));
  memset(s1,0,sizeof(s1));
  memset(s2,0,sizeof(s2));
  memset(tmp,0,sizeof(tmp));
  cin >> s1 >> s2;
  if(strlen(s1) > 80 || strlen(s2)> 80){
    cout << "overflow" << endl;
  }
  else 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;
  }
}