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 main(){
	string a,b;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a>>b;
		if(a.size()>80||b.size()>80)
			cout<<"overflow"<<endl;
		else{
			int t;
			int c[100]={0};
			if(a.size()>=b.size())
				t=a.size();
			if(a.size()<b.size())
				t=b.size();
			for(int j=0;j<t;j++){
				if(j<a.size())
					c[j]+=a[a.size()-j-1]-'0';
				if(j<b.size())
					c[j]+=b[b.size()-j-1]-'0';
				if(c[j]>=10){
					c[j]-=10;
					c[j+1]=1;
				}
			}
			bool h=true;
			if(c[t]==1){
				if(t==80){
					cout<<"overflow"<<endl;
					h=false;
				}
				else
				    cout<<"1";
			}
			if(h==true){
			for(int j=t-1;j>=0;j--)
				cout<<c[j];
			cout<<endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdlib>
#define DIGIT 80
using namespace std;

class largenum{
  int nums[DIGIT];
  bool overflow;
  int most;
public:
  largenum(){
    overflow=false;
    most=DIGIT-1;
    for(int i=0;i<DIGIT;i++)
      nums[i]=0;
  }
  bool isoverflow(){ return overflow;}
  friend ostream& operator<<(ostream &out,largenum &l);
  friend istream& operator>>(istream &is,largenum &l);
  friend largenum operator+(largenum l1,largenum l2);
};

largenum operator+(largenum l1,largenum l2){
  bool carry=false;
  largenum ans;
  for(int i=DIGIT-1;i>=0;i--){
    int tmp=l1.nums[i]+l2.nums[i]+carry;
    carry=bool((tmp)/10);
    ans.nums[i]=(tmp)%10;
  }
  for(int i=0;i<DIGIT;i++){
    if(ans.nums[i]!=0){
      ans.most=i;
      break;
    }
  }  
  ans.overflow=carry;
  return ans;
}

ostream& operator<<(ostream &out,largenum &l){
  for(int i=l.most;i<DIGIT;i++){
    out<<l.nums[i];
  }
  return out;
}

istream& operator>>(istream &is,largenum &l){
  string str;
  is>>str;
  if(str.size()>DIGIT){
    l.overflow=true;
  }else{
    for(int i=0;i<(int)str.size();i++){
      int index = DIGIT-str.size()+i;
      switch(str[i]){
      case '0':
	l.nums[index]=0;
	break;
      case '1':
	l.nums[index]=1;
	break;
      case '2':
	l.nums[index]=2;
	break;
      case '3':
	l.nums[index]=3;
	break;
      case '4':
	l.nums[index]=4;
	break;
      case '5':
	l.nums[index]=5;
	break;
      case '6':
	l.nums[index]=6;
	break;
      case '7':
	l.nums[index]=7;
	break;
      case '8':
	l.nums[index]=8;
	break;
      case '9':
	l.nums[index]=9;
	break;
      }
    }
    
    l.most=DIGIT-str.size();
  }
  return is;
}

int main(){
  int num;
  cin>>num;
  while(num--){
    largenum a,b;
    cin>>a>>b;
    if(a.isoverflow() || b.isoverflow()){
      cout<<"overflow"<<endl;
      continue;
    }
    a = a+b;
    if(a.isoverflow()){
      cout<<"overflow"<<endl;
    }else{
      cout<<a<<endl;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef vector <int> VI;

VI string_to_vi( string number )
{
	VI converted( number.size() );
	for ( int i = 0; i < number.size(); i++ ) converted[i] = (int)( number[i] - '0' );
	return converted;
}

VI add( VI left, VI right )
{
	VI result;
	reverse( left.begin(), left.end() );
	reverse( right.begin(), right.end() );
	VI::iterator it_left = left.begin();
	VI::iterator it_right = right.begin();

	int carry = 0;
	while ( it_left != left.end() || it_right != right.end() )
	{
		int l = 0, r = 0;
		if ( it_left != left.end() ) l = *it_left;
		if ( it_right != right.end() ) r = *it_right;

		result.push_back( ( l + r + carry ) % 10 );
		carry = ( l + r + carry >= 10 ) ? 1 : 0;

		if ( it_left != left.end() ) it_left ++;
		if ( it_right != right.end() ) it_right ++;
	}
	if ( carry ) result.push_back( 1 );

	reverse( result.begin(), result.end() );
	return result;
}

void print_number( VI& number )
{
	for ( VI::iterator it = number.begin(); it != number.end(); it++ ) cout << *it;
	cout << endl;
}

int main( void )
{
	int n; cin >> n;
	for ( int i = 0; i < n; i++ )
	{
		string input_a, input_b;
		cin >> input_a >> input_b;

		VI a = string_to_vi( input_a );
		VI b = string_to_vi( input_b );
		VI c = add( a, b );

		cout << c.size() << endl;
		if ( c.size() > 80 ) cout << "overflow" << endl;
		else print_number( c );

	}
	return 0;
}