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 <algorithm>

using namespace std;

int main(){
  string str1,str2;
  int testnum;

  cin>>testnum;
  int t=0;
  while(t<testnum&&cin>>str1>>str2){
    string sumstr;
    reverse(str1.begin(),str1.end());
    reverse(str2.begin(),str2.end());

    unsigned size=min(str1.size(),str2.size());
    unsigned i;
    unsigned carry=0;
    for(i=0;i<size;++i){
      unsigned sum=str1[i]+str2[i]+carry-'0'*2;
      sumstr.push_back(sum%10+'0');
      carry=sum/10;
    }

    string large=(str1.size()>str2.size())?str1:str2;
    for(;i<large.size();++i){
      unsigned sum=large[i]+carry-'0';
      sumstr.push_back(sum%10+'0');
      carry=sum/10;
    }

    if(carry) sumstr.push_back(carry+'0');
    reverse(sumstr.begin(),sumstr.end());

    if(sumstr.size()<=81)
      cout<<sumstr<<endl;
    else
      cout<<"overflow"<<endl;
    t++;
  }
}

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

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

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

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

	BigNum(const char* buf) {
		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 <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		string a,b,c;
		int d=0,st;
		cin>>a>>b;
		for(int j=a.size();j<81;++j) a="0"+a;
		for(int j=b.size();j<81;++j) b="0"+b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		for(int j=0;j<80;++j){
			c+=((a[j]-'0')+(b[j]-'0')+d)%10+'0';
			d=((a[j]-'0')+(b[j]-'0')+d)/10;
		}
		if(d) cout<<"overflow\n";
		else{
			reverse(c.begin(), c.end());
			for(st=0;st<c.size();++st)if(c[st]!='0')break;
			cout<<((st==c.size())?"0":c.substr(st,c.size()-st))<<"\n";
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		scanf("%s",num2);
		l1 = strlen(num1);
		l2 = strlen(num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		if(ans[1000] != 0)
		{
			printf("overflow\n");
		}
		else
		{
			for(j=1001;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}