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>
using namespace std;


int getValue(string str, int i){
	int endp,startp;

	endp = str.length() - 8 * i;
	startp = str.length() - 8 - 8 * i;
	if( endp <= 0 )
		return 0;
	else if( startp <= 0 ) {
		return atoi( str.substr(0,endp).c_str() );					
	}
	else {
		return atoi( str.substr(startp,8).c_str() );					
	}
	return -1;
}


int main()
{
	int num,i,j,startp,endp;
	string str1, str2;
	long v1,v2;
	int v[10];
	cin >> num;
	for(i = 0; i < num; i++ ) {
		cin >> str1;
		cin >> str2;
		if( str1.length() > 80 || str2.length() > 80 ){
			
		}
		//8桁ずつ分けて計算
		int flg = 0;
		for( j = 0; j < 10; j++ ) {
			v1 = getValue( str1, j );
			v2 = getValue( str2, j );
			
			v[j] = v1 + v2 + flg;
			if( v[j] >= 100000000 ) {
				flg = 1;
				v[j] -= 100000000;
			}
			else {
				flg = 0;
			}
		}
		if( flg == 1 )
			printf("overflow\n");
		else {
			flg = 0;
			for( i = 9 ; i >= 0; i-- ) {
				if( v[i] > 0 ){
					printf("%d",v[i] );
					flg = 1;
				}
				else if( flg == 1 ) {
					printf("%08d",v[i] );
				}
				
			}
			printf("\n");	
		}
	}




	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
  string num1,num2,tmp;
  int n;

  cin >> n;
  while(n--){

    cin >> num1 >> num2;

    if((int)num1.size() < (int)num2.size()){
      tmp = num2;
      num2 = num1;
      num1 = tmp;
    }

    if(num1.size() > 80){
      cout << "overflow" << endl;
      continue;
    }

    for(int i = 0 ; i < (int)num1.size() ; i++ )tmp[i] = num1[i];

    for(int i = (int)num1.size() - 1 ; i >= 0 ; i-- )
      {
	num1[i] = tmp[(int)num1.size() - 1 - i];
      }
    for(int i = 0 ; i < (int)num2.size() ; i++ )tmp[i] = num2[i];

    for(int i = (int)num2.size() - 1  ; i >= 0 ; i-- )
      {
	num2[i] = tmp[(int)num2.size() - 1 - i];
      }

    for(int i = (int)num2.size() ; i < (int)num1.size() ; i++ )num2+='0';

    char tmp2 = '0';
    string ans;

    for(int i = 0 ; i < num1.size() ; i++ ){
      if((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') > 9){
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0') - 10) + '0');
	tmp2 = '1';
      } else {
	ans += (char)(((tmp2 - '0') + (num1[i] - '0') + (num2[i] - '0')) + '0');
	tmp2 = '0'; 
      }
    }
  
    if((int)((tmp2 - '0') + (num1[num1.size() - 1] - '0') + (num2[num1.size() - 1] - '0')) > 9)ans+='1'; 
    if(ans.size() > 80){
      cout << "overflow" << endl;
    }else{

      for(int i = (int)ans.size() ; i >= 0 ; i-- ){
	cout << ans[i];
      }  
      cout << endl;
    }
  }

  return 0;
}

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;
}