Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <math.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int kk = 0; kk < n; ++kk)
	{
		int A[1000] = {},B[1000] = {},C[1000] = {},keta = 0;
		string in1,in2;
		cin >> in1 >> in2;
		if(in1.size() >= 80 || in2.size() >= 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < in1.size(); ++i)
			A[in1.size()-i] = (int)(in1[i]-'0');
		for (int i = 0; i < in2.size(); ++i)
			B[in2.size()-i] = (int)(in2[i]-'0');
		bool flag = 1;
		for (int i = 1; i < 1000; ++i)
		{
			C[i] += A[i]+B[i];
			if(C[i] >= 10)
			{
				C[i+1] += C[i]/10;
				C[i] -= C[i]/10*10;
			}
			if(C[i] != 0)
				keta = i;
		}
		if(keta >= 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		cout << "[" << keta << "]" << endl;
		for (int i = keta; i > 0; --i)
		{
			cout << C[i];
		}
		cout << endl;
	}
}

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

class largeInt{
public:
	largeInt() : digit( 0 ){
		initNum();
	}
	~largeInt(){}

	void set( const string& s ){
		numStr = s;
		initNum();
		digit = numStr.size();
		if ( digit > 80 ) return;
		StoI();
	}
	const char* getFigure(){ return numStr.c_str(); }
	const int getDigit(){ return digit; }

	void operator+=( const largeInt& a ){
		numStr = "";
		for ( int i = 0; i < 10; ++i ){
			num[ i ] += a.num[ i ];
			if ( num[ i ] / 100000000 && i != 9 ){
				num[ i ] -= 100000000;
				num[ i + 1 ] += 1;
			}
			int t = num[ i ];
			string s;
			for ( int j = ( i == 9 ? 8 : 7 ); j >= 0; --j ){
				int power = static_cast< int >( pow( 10.0, static_cast< double >( j ) ) );
				int c = t / power;
				t %= power;
				s += static_cast< char >( c + '0' );
			}
			numStr = s + numStr;
			if ( i == 9 ){
				string::iterator it = numStr.begin();
				while ( ( *it == '0' ) && ( it != numStr.end() - 1 ) ){
					it = numStr.erase( it );
				}
			}
		}
		digit = numStr.size();
	}

private:
	void initNum(){
		for ( int i = 0; i < 10; ++i ){
			num[ i ] = 0;
		}
	}
	void StoI(){
		bool f = false;
		for ( int i = 0; i < digit / 8; ++i ){
			for ( int j = 0; j < 8; ++j ){
				if ( i*8 + j >= digit ){
					f = true;
					break;
				}else{
					conv( i, j );
				}
			}
			if ( f ) break;
		}
		for ( int i = 0; i < digit % 8; ++i ){
			conv( digit / 8, i );
		}
	}
	void conv( int i, int j ){
		int figure = static_cast< int >( numStr[ ( digit - 1 ) - ( i*8 + j ) ] - '0' );
		int power = static_cast< int >( pow( 10.0, static_cast< double >( j ) ) );
		num[ i ] += figure * power;
	}

	unsigned num[10];
	int digit;
	string numStr;
};

int main(){
	int n;
	string s;

	cin >> n;

	largeInt* a = new largeInt[ n ];
	largeInt* b = new largeInt[ n ];

	for ( int i = 0; i < n; ++i ){
		cin >> s;
		a[ i ].set( s );
		cin >> s;
		b[ i ].set( s );
	}

	for ( int i = 0; i < n; ++i ){
		if ( a[ i ].getDigit() > 80 || b[ i ].getDigit() > 80 ){
			cout << "overflow" << endl;
			continue;
		}
		a[ i ] += b[ i ];
		cout << ( a[ i ].getDigit() > 80 ? "overflow" : a[ i ].getFigure() ) << endl;
	}

	delete[] a;
	delete[] b;

	return 0;
}

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

using namespace std;

int main() {
    int N;
    cin >> N;
    for (int i=0; i<N; i++) {
        string a, b;
        cin >> a >> b;
        int sum, ret=0;
        if (a.length() < b.length()) swap(a,b);
        int l = b.length()-1;
        for (int i=a.length()-1; i>=0; i--) {
            if (l >= 0) {
                sum = (a[i]-'0')+(b[l]-'0')+ret;
                l--;
            } else {
                sum = (a[i]-'0')+ret;
            }
            if (sum>=10) {
                ret = 1;
                sum -= 10;
            } else {
                ret = 0;
            }
            a[i] = sum+'0';
        }
        if (ret != 0) {
            a.insert(a.begin(), ret+'0');
        }
        if (a.length() > 80) cout << "overflow" << endl;
        else cout << a << endl;
    }
    return 0;
}

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

using namespace std;
void add(string& ans,string& a,string& b);
int main() {
	string a,b;
	int al,bl;
	int n;
	cin>>n;
	while(n--){
	        string ans= "";
		cin>>a>>b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		al=a.size();
		bl=b.size();
		if(bl>al){
			swap(a,b);
			swap(al,bl);
		}
		for(int i=0;i<(al-bl);i++){
			b+='0';
		}
		add(ans,a,b);
		if(ans.size()>80) ans="overflow";
		reverse(ans.begin(),ans.end());
	  	cout<<ans<<endl;
	}
	return 0;
}
void add(string& ans,string& a,string& b){
	int x,y=0;
	for(int i= 0;i<a.size();i++){
		x=a[i]-'0'+b[i]-'0';
		if(x>=10){
			ans+= (x%10)+'0';
			y=1;
		}else{
			ans+= x+y+'0';
			y=0;
		}
	}
	if(y==1)ans+='1';
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>

using namespace std;

int main()
{
	int N; cin >> N;

	for(int i=0; i<N; i++){
		int a[80], b[80], c[80];
		string s, t, m;

		fill(a,a+80,0); fill(b,b+80,0); fill(c,c+80,0);
		cin >> s >> t;
		for(int j=s.length()-1, k=0; j>=0; j--, k++){
			m=s.substr(k,1);
			if(m=="0"){ a[j]=0;}
			else if(m=="1"){ a[j]=1;}
			else if(m=="2"){ a[j]=2;}
			else if(m=="3"){ a[j]=3;}
			else if(m=="4"){ a[j]=4;}
			else if(m=="5"){ a[j]=5;}
			else if(m=="6"){ a[j]=6;}
			else if(m=="7"){ a[j]=7;}
			else if(m=="8"){ a[j]=8;}
			else{ a[j]=9;}
		}
		for(int j=t.length()-1, k=0; j>=0; j--,k++){
			m=t.substr(k,1);
			if(m=="0"){ b[j]=0;}
			else if(m=="1"){ b[j]=1;}
			else if(m=="2"){ b[j]=2;}
			else if(m=="3"){ b[j]=3;}
			else if(m=="4"){ b[j]=4;}
			else if(m=="5"){ b[j]=5;}
			else if(m=="6"){ b[j]=6;}
			else if(m=="7"){ b[j]=7;}
			else if(m=="8"){ b[j]=8;}
			else{ b[j]=9;}
		}

		for(int j=79; j>=0; j--){
			cout << a[j];
		}
		cout << endl;
		for(int j=79; j>=0; j--){
			cout << b[j];
		}
		cout << endl;
		/*		
		int d=0;
		bool flag=false;
		for(int j=0; j<80; j++){
			c[j] = (a[j]+b[j]+d)%10;
			d = (a[j]+b[j]+d)/10;
			if(j==79 && d>0){ flag=true;}
		}
		
		if(flag){cout << "overflow";}		
		else{
				flag = false;
				for(int j=79; j>=0; j--){
					if(flag){ cout << c[j];}
					else if(c[j] != 0){ cout << c[j]; flag=true;}
				}
		}
		cout << endl;*/
	}

	return 0;
}