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 <stdio.h>
#include <string.h>
#include <stdlib.h>
char num1[82],num2[82];
	int a1[82],a2[82],ans[82];
	int i,j,n,k,l1,l2,kuriagari=0;
int main(void)
{
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		for(j=0;j<82;j++)
		{
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		scanf("%s",num2);
		l1 = strlen(num1);
		l2 = strlen(num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<82;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		if(ans[80] != 0)
		{
			printf("overflow\n");
		}
		else
		{
			for(j=81;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

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

int main(){
  int n;
  string up,un;
  cin >> n;
  while(n--){
    cin >> up >> un;
    if(up.size() > 80 || un.size() > 80){
    exit:
      cout << "overflow\n";
      continue;
    } 
    if(up.size() < un.size()) swap(up,un);
    for(int i=up.size()-1,j=un.size()-1;i>=0;i--,j--){
      if(j >= 0) up[i] += un[j]-'0';
      if(up[i] > '9'){
	up[i] -= 10;
	if(i == 0) up = "1" + up;
	else up[i-1]++;
      }
    }
    if(up.size() > 80) goto exit;
    cout << up << endl;
  }
}

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

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, j, n;
  int len1, len2;
  char tmp;

  scanf("%d",&n);
  rep(i,n){
    string str1, str2, res;
    cin >> str1;
    cin >> str2;

    vector<int> a(100, 0), b(100, 0);
    len1 = (int)str1.size(); len2 = (int)str2.size();
    rep(j,len1) a[j] = str1[(int)len1-1-j] - '0';
    rep(j,len2) b[j] = str2[(int)len2-1-j] - '0';

    rep(j,81){
      int sum = a[j] + b[j];
      if(sum >= 10){ sum %= 10; a[j+1]++;}
      res += (sum + '0');
    }

    reverse(res.begin(), res.end());
    int f = 0;
    rep(j,res.size()){
      if(res[j] != '0') f = 1;
      if(f && res.size()-j > 81){
        cout << "overflow" << endl;
        return 0;
      }
      if(f) cout << res[j];
    }

    cout << endl;
  }

  return 0;
}

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

using namespace std;

void add(string &a, string &b) {
	if (a.size() > 80 || b.size() > 80) {
		cout << "overflow" << endl;
		return;
	}

	string aa = a;
	string bb = b;
	reverse(aa.begin(), aa.end());
	reverse(bb.begin(), bb.end());
	string cc;
	int carry = 0;
	int sa = a.size();
	int sb = b.size();
	int ss = sa>sb ? sa : sb;
	for (int i = 0; i < ss; i++) {
		char ca = i < sa ? aa[i] : '0';
		char cb = i < sb ? bb[i] : '0';
		char code = ca + cb + carry - '0';
		if (code > '9') {
			code -= 10;
			carry = 1;
		} else
			carry = 0;
		cc += code;
	}

	if (carry)
		cc += '1';

	if (cc.size() > 80)
		cout << "overflow" << endl;
	else {
		reverse(cc.begin(), cc.end());
		cout << cc << endl;
	}
}

int main() {
	string a, b;
	while (cin >> a >> b) {
		add(a, b);
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  for(int i = 0;i < n;i++){
    string a,b,c; char tmp;
    cin >> a >> b;
    if(a.size() > 80 || b.size() > 80){
      cout << "overflow" << endl;
      continue;
    }
    if(a.size() < b.size()){swap(a,b);}
    for(int k = 0;k< a.size();k++)
      c[k] = '0';
     for(int k = 0;k < b.size();k++){
       c[k] = b[b.size()-1-k];
     }
     b.resize(a.size());
     for(int k = 0;k < a.size();k++)
       {b[k] = c[k]; c[k] = a[k];} 
     for(int k = 0;k < a.size();k++){
      	a[a.size()-k-1] = c[k];
     }
	
     tmp = '0';
     for(int k = 0;k < a.size();k++){
       c[k] = a[k] + b[k] + tmp -'0' -'0';
	  if(c[k] > '9'){ tmp = '1'; c[k] = c[k] - ':' + '0'; }
	  else {tmp = '0';}
     } 
     if(a.size() <= 80 ){if(tmp == '1'){ cout << tmp;}
       for(int k = a.size()-1;k >=0;k--){
	 cout << c[k]; 
	  }
       cout << endl;
     } else {cout <<"overflow"<<endl; } 
     
  }
}