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 <stdio.h>
#include <string.h>

class overflow {
public:
	overflow() {};
};

class BigNum {
public:
	BigNum() : c(0), keta(0), size(0) {};

	BigNum(int n) : c(0), keta(0), size(0) {
		size = n;
		c = new char [size];
		memset(c, 0, size);
	};

	BigNum(const char* buf) : c(0), keta(0), size(0) {
		keta = strlen(buf);
		if (buf[keta-1] == '\n') {
			keta --;
		}
		if (keta > 80) {
			throw overflow();
		}
		size = keta;
		c = new char [size];
		int k = 0;
		for (int i = keta - 1; i >= 0; i--) {
			c[k++] = buf[i] - '0';
		}
	};

	BigNum(BigNum& b) {
		size = b.size;
		keta = b.keta;
		c = new char [size];
		memcpy(c, b.c, size);
	};

	BigNum& operator=(const BigNum& b) {
		size = b.size;
		keta = b.keta;
		c = new char [size];
		memcpy(c, b.c, size);

		return *this;
	};

	~BigNum() {
		if (c) {
			delete [] c;
		}
	};

	BigNum add(BigNum& n) {
		BigNum* a;
		BigNum* b;

		if (keta > n.keta) {
			a = this;
			b = &n;
		} else {
			a = &n;
			b = this;
		}

		BigNum r(a->keta + 1);

		int h;
		int m = 0;
		int i;
		for (i = 0; i < a->keta; i++) {
			if (i < b->keta) {
				h = a->c[i] + b->c[i] + m;
				m = h / 10;
				r.c[i] = h % 10;
			} else {
				h = a->c[i] + m;
				m = h / 10;
				r.c[i] = h % 10;
			}
		}
		if (m > 0) {
			r.c[i] = m;
			r.keta = i+1;
		} else {
			r.keta = i;
		}

		if (r.keta > 80) {
			throw overflow();
		}

		return r;
	};

	void print(void) const {
		for (int i = keta - 1; i >= 0; i --) {
			printf("%d", c[i]);
		}
		printf("\n");
	};

	char* c;
	int keta;

private:
	size_t size;
};

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	try {
		for (int i = 0; i < n; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			BigNum a(line);

			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			BigNum b(line);

			BigNum r;
			r = a.add(b);

			r.print();
		}
	}
	catch (overflow) {
		printf("overflow\n");
	}

	return 0;
}

C++: #include <stdio.h>
#include <string.h>

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	int num1[BUF_SIZE];
	int num2[BUF_SIZE];
	int sum[BUF_SIZE];
	char str1[BUF_SIZE];
	char str2[BUF_SIZE];
	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", &str1);
		
		// second integer
		fgets(buf, sizeof(buf), stdin);
		sscanf(buf, "%s", &str2);
		
		// overflow
		if (strlen(str1) > 80 || strlen(str2) > 80) {
			printf("overflow\n");
			continue;
		}
		
		// ??????
		for (j=0; j<strlen(str1)-1; j++)  ;
		for (k=0; j>=0; k++) {
			num1[k] = str1[j] - '0';
			j--;
		}
		for (j=0; j<strlen(str2)-1; j++)  ;
		for (k=0; j>=0; k++) {
			num2[k] = str2[j] - '0';
			j--;
		}
		
		// sum
		for (j=0; j<80; j++) {
			sum[j] += num1[j]+num2[j];
			if (sum[j]/10 >= 1) {
				sum[j+1] += sum[j]/10;
				sum[j] = sum[j]%10;
			}
		}
		
		if (sum[80] > 0) {
			printf("overflow\n");
		}
		else {
			for (j=79; sum[j]==0 && j!=0; j--)  ;
			for (; j>=0; j--) {
				printf("%d", sum[j]);
			}
			printf("\n");
		}
	}
	
	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,out,tmp;
    cin >> a;
    cin >> b;
    //int m=max(a.size(),b.size());
    if(a.size()<b.size()){
      tmp=a;
      a=b;
      b=tmp;
    }
    //cout << a << endl;
    int si=-a.size()+b.size();
    for(int j=a.size()-1;j>=0;j--){
      if(j+si>=0){
	//cout << si << endl;
	a[j]+=b[j+si]-'0';
	//cout << a[j] << endl;
      }else{
	a[j]+=0;
	//cout << "!" << endl;
      }
      if(a[j]>'9'&&j!=0){
	a[j-1]++;
	a[j]-=10;
      }else if(a[j]>'9'&&j==0){
	a='1'+a;
	a[1]-=10;
	//for(int i=a.size();i>0;i--)
	//  a[i]=a[i-1];
	//a[1]-=10;
	//a[0]='1';
      }
    }
    if(a[80]!='\0')
      cout << "overflow" << endl;
    else
      cout << a << endl;
  }

}

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

int main(){
	string a, b;
	vector<int> ans;
	int n, num, ai, bi, c=0;
	bool flag;

	cin >> n;
	
	for(int i=0 ; i<n ; i++){
		cin >> a >> b;
		flag = false;
		
		for(int j=0 ; j<100 ; j++){
			num = 0;
			ai = a.size()-j-1;
			bi = b.size()-j-1;
			if( ai<0 && bi<0 && c==0) break;
			
			if(ai>=0)num += a[ ai ] - 48;
			if(bi>=0)num += b[ bi ] - 48;
			ans.push_back( (num+c)%10 );
			if(num+c >= 10) c = 1;
			else c = 0;
		}
		if(ans.size()>80){
			flag = true;
		}
		if(flag){
			printf("overflow");
		}else{
			for(int j=ans.size()-1 ; j>=0 ; --j){
				printf("%d", ans[j]);
			}
		}
		printf("\n");
		ans.clear();
	}
	return 0;
}

C++: #include<vector>
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>

typedef std::vector<int> bignum;

const int e9=1000000000;

bignum add(const bignum& a,const bignum& b);
bignum subtract(const bignum& a,const bignum& b);
void output(const bignum& num);
int compare(const bignum& a,const bignum& b);
bignum newnum(const std::string& str);

int main()
{
	bignum a,b,sum;
	std::string str;
	int n;
	std::cin>>n;
	for(int i=0;i<n;i++)
	{
		std::cin>>str;
		a=newnum(str);
		std::cin>>str;
		b=newnum(str);
		sum.clear();
		sum=add(a,b);
		if(compare(sum,newnum("10000000000000000000000000000000000000000000000000000000000000000000000000000000"))>0)
		{
			std::cout<<"overflow"<<std::endl;
		}
		else
		{
			output(sum);
		}
	}
}

bignum add(const bignum& a,const bignum& b)
{
	bignum sum;
	int carry=0;
	long long temp;
	for(int i=0;i<((a.size()>b.size())?a.size():b.size())||carry==1;i++)
	{
		temp=carry;
		carry=0;
		if(i<a.size())
		{
			temp+=a[i];
		}
		if(i<b.size())
		{
			temp+=b[i];
		}
		sum.push_back(temp%e9);
		if(temp>=e9)
		{
			carry=1;
		}
	}

	return sum;
}

int compare(const bignum& a,const bignum& b)
{
	if(a.size()>b.size()){return 1;}
	else if(a.size()<b.size()){return -1;}
	else
	{
		for(int i=a.size()-1;i>=0;i--)
		{
			if(a[i]>b[i]){return 1;}
			else if(a[i]<b[i]){return -1;}
		}
	}
	return 0;
}

bignum newnum(const std::string& str)
{
	bignum num;
	int len;
	for(int i=str.size();i>=0;i-=9)
	{
		len=9;
		if(i<9)len=i;
		num.push_back(atoi(str.substr(i-len,len).c_str()));
	}
	return num;
}

void output(const bignum& num)
{
	for(int i=num.size()-1;i>=0;i--)
	{
		if(i==num.size()-1)
		{
			std::cout<<num[i];
		}
		else
		{
			std::cout<<std::setfill('0')<<std::setw(9)<<std::right<<num[i];
		}
	}
	std::cout<<std::endl;
}