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>

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	char num1[100];
	char num2[100];
	char sum[100];
	char str[100];
	int n;
	int i, j, k;
	
	fgets(buf, sizeof(buf), stdin);
	sscanf(buf, "%d", &n);
	
	for (i=0; i<n; i++) {
		for (j=0; j<100; j++) {
			num1[j] = num2[j] = sum[j] = 0;
		}
		
		// first integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str); j++)  ;
		for (k=0; j>0; k++) {
			j--;
			num1[k] = str[j] - '0';
		}
		
		// second integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str);
		if (strlen(str) > 80) {
			printf("overflow\n");
		}
		
		for (j=0; j<strlen(str); j++)  ;
		for (k=0; j>0; k++) {
			j--;
			num2[k] = str[j] - '0';
		}
		
		// sum
		for (j=0; j<80; j++) {
			sum[j] += num1[j]+num2[j];
			if (sum[j] >= 10) {
				sum[j+1]++;
				sum[j] = sum[j]%10;
			}
		}
		
		if (sum[80] != 0) {
			printf("overflow\n");
		}
		else {
			for (j=79; sum[j]==0 && j>=1; j--)  ;
			for (; j>=0; j--) {
				printf("%d", sum[j]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

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(200, 0), b(200, 0);
    len1 = (int)str1.size(); len2 = (int)str2.size();
    if(len1 > 80){
      cout << "overflow" << endl;
      break;
    }
    if(len2 > 80){
      cout << "overflow" << endl;
      break;
    }
    rep(j,len1) a[j] = str1[(int)len1-1-j] - '0';
    rep(j,len2) b[j] = str2[(int)len2-1-j] - '0';

    rep(j,200){
      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;
    string tmp;
    rep(j,res.size()){
      if(res[j] != '0') f = 1;
      if(f) tmp += res[j];
    }

    if((int)tmp.size() > 80) cout << "overflow" << endl;
    else cout << tmp << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin>>n;
  cin.ignore();
  while(n--){
    string a,b;
    getline(cin,a);
    int num[200] = {0},tab = 0,i = 0;
    int as = a.size()-1;
    int bs = b.size()-1;
    int nmi = min(a.size(),b.size());
    int nma = max(a.size(),b.size());
    for(int x; i<nma; i++){
      if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;}
      else if(i>as){x = tab+b[bs-i]-'0';}
      else if(i>bs){x = tab+a[as-i]-'0';}
      tab = x/10;
      num[i] = x%10;
    }
    if(tab){num[nma] = tab;i++;}
    if(i>80){cout <<"overflow"<<endl;}
    else{
      for(int x=i-1; x>=0; x--){
	cout <<num[x];
      }
      cout <<endl;
    }
  }
  return 0;
}

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

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[81], b[81], x[81], y[81];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		int LB=strlen(b);
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[81];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(big==81 && carry!=0) printf("overflow\n");
		else{
			if(carry!=0){
				ans[big++]=carry+'0';
				ans[big]='\0';
				//printf("carries\n");
			}	
			
			int LS=strlen(ans);
			char fans[81];
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}	
		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}