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

int main(void) {

  int n;

  char buf[1000];
  char outbuf[1000];

  char c;

  int a[1000],b[1000];
  int result[1000];
  
  int sum,carry;
  int idx1,idx2;
  int maxlen;

  int i,j;

  scanf("%d",&n);

  c=getchar();

  for(i=0;i<n;i++) {

    fgets(buf,sizeof(buf),stdin);

    idx1=0;

    while(buf[idx1]!='\n') {

      a[idx1]=buf[idx1]-48;

      idx1++;

    }

    //for(j=0;j<idx1;j++) printf("%d",a[j]);

    fgets(buf,sizeof(buf),stdin);

    idx2=0;

    while(buf[idx2]!='\n') {

      b[idx2]=buf[idx2]-48;

      idx2++;

    }

    if(idx1>idx2) maxlen=idx1;
    
    else maxlen=idx2;

    if(maxlen>80) {

      printf("overflow\n");

      continue;

    }

    carry=0;

    for(j=0;j<maxlen;j++) {

      if(j<idx1 && j<idx2) sum=a[idx1-j-1]+b[idx2-j-1]+carry;

      else if(j>=idx1) sum=b[idx2-j-1]+carry;

      else sum=a[idx1-j-1]+carry;


      if(sum>=10) carry=1;

      else carry=0;

      result[j]=sum%10;

    }
    //printf("%d\n",carry);
    if(carry==1) {

      if(maxlen>=80) printf("overflow\n");

      else {

	outbuf[0]='1';

	for(j=0;j<maxlen;j++) {

	  outbuf[j+1]=result[maxlen-j-1]+48;

	}

	outbuf[maxlen+1]='\0';

	printf("%s",outbuf);

	puts("");

      }

    }

    else {

      for(j=0;j<maxlen;j++) {

	outbuf[j]=result[maxlen-j-1]+48;

      }

      outbuf[maxlen]='\0';

      printf("%s",outbuf);

      puts("");

    }

  }

  return 0;

}

C++: #include<iostream>
#include<string>
using namespace std;
ios::sync_with_stdio(false);

int main(){
    int n;
    for(cin>>n;n--;){
        int k=0;
        string a,b;
        cin >> a;
        cin >> b;
        if(a.size() < b.size()) swap(a,b);//????????????a>b?????????
        while(b.size() < a.size()) b = '0' + b;//????????????a==b?????????
        for(int i=a.size()-1;i>=0;i--){//???????????????????????????
            a[i] += b[i] - '0' + k;
            if(a[i] > '9'){
                a[i]-=10;
                k = 1;
            }
            else k = 0;
        }
        if(k)   a="1"+a;//??°??????????????????????????????????¶?????????¨???
        if(a.size() > 80)   cout << "overflow" << "\n";
        else    cout << a << "\n";
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#define N 1000
using namespace std;
int main(){
  
  int n,anum,bnum;
  cin >> n;
  for(int i = 0;i < n;i++){
    string a,b,c,tmp;
    cin >> a >> b;
      if(a.size() < b.size()){swap(a,b);}
      for(int k = 0;k< a.size();k++)
	c[k] = '0';
      for(int k = 0;k < b.size();k++){
	c[k] = b[b.size()-1-k];
      }
      for(int k = 0;k < a.size();k++)
	   {b[k] = c[k]; c[k] = a[k];}
      for(int k = 0;k < a.size();k++){
      	a[a.size()-k-1] = c[k];
	  tmp[k] = '0';}

      //for(int k = 0;k <= a.size();k++)
      //	cout << a[k] ;
      //cout << endl;
      //for(int k = 0;k <= a.size();k++)
      //	cout << b[k] ;
      //cout << endl;
      
        for(int k = 0;k < a.size();k++){
	  //  cout << a[k] << b[k] << " " <<tmp[k] << endl;
	c[k] = a[k] + b[k] + tmp[k] -'0' -'0';
	
	if(c[k] > '9'){ tmp[k+1] = '1'; c[k] = c[k] - ':' + '0'; }
	}

	if(a.size() < 80 && tmp[a.size()] == '1'){ cout << tmp[a.size()];
      for(int k = a.size()-1;k >=0;k--){
	cout << c[k];  //cout << tmp[0];
	}

      cout << endl;
	} else {cout <<"overflow"<<endl; }
  }
}

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

int main(){
	int n,t,i;
	char a[100],b[100],x[100],y[100];
	scanf("%d",&n);
	for(int o=0;o<n;o++){
		t=0;
		scanf("%s %s",a,b);
		for(i=0;a[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			x[j]=a[i-j-1];
		}
		for(;i<100;i++){
			x[i]='0';
		}
		for(i=0;b[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			y[j]=b[i-j-1];
		}
		for(;i<100;i++){
			y[i]='0';
		}
		for(i=0;i<99;i++){
			x[i]+=y[i]-'0';
			if(x[i]>'9'){
				x[i]-=10;
				x[i+1]+=1;
			}
		}
		for(i=99;i>=0;i--){
			if(x[i]!='0' || t){
				if(i>78){
					printf("overflow");
					break;
				}
				printf("%c",x[i]);
				t=1;
			}
		}
		printf("\n");
	}
	return 0;
}

C++: // 2012/10/28 Tazoe

#include <iostream>
#include <string>
using namespace std;

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

	for(int i=0; i<N; i++){
		string S1, S2;
		cin >> S1;
		cin >> S2;

		if(S1.size()<S2.size()){
			string tmp = S1;
			S1 = S2;
			S2 = tmp;
		}

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

		int A[80];
		int C = 0;
		for(int j=0; j<S1.size(); j++){
			int tmp = (int)(S1[S1.size()-1-j]-'0')+C;
			if(j<S2.size()){
				tmp += (int)(S2[S2.size()-1-j]-'0');
			}

			A[j] = tmp%10;
			C = tmp/10;
		}

		if(S1.size()==80&&C==1){
			cout << "overflow" << endl;
		}
		else{
			if(C==1){
				cout << C;
			}
			for(int j=S1.size()-1; j>=0; j--){
				cout << A[j];
			}
			cout << endl;
		}
	}

	return 0;
}

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

#define MAX_SIZE 80

int strlen(const char* str) {
    int i;
    for(i=0; i<999+1; ++i) {
        if(!str[i]) {
            return i;
        }
    }
    return -1;
}

int main() {
    int n, i, j, num1_index, num2_index;
    char num1[999], num2[999];

    scanf("%d", &n);
    for(i=0; i<n; ++i) {
        scanf("%s %s", num1, num2);
        num1_index = strlen(num1);
        num2_index = strlen(num2);
        int sum=0, act=0, temp=0;
        char result[999] = {};
        for(j=0; j<MAX_SIZE && (num1_index > 0 || num2_index > 0); ++j) {
            if(num1_index <= 0) {
                temp = act + num2[--num2_index] - 48;
            }else if(num2_index <= 0) {
                temp = act + num1[--num1_index] - 48;
            }else {
                temp = act + num1[--num1_index] + num2[--num2_index] - 96;
            }
            result[j] = temp % 10;
            act = temp / 10;
        }
        if(j<MAX_SIZE) {
            result[j++] = act;
            act = 0;
        }
        if(j>=MAX_SIZE && (num1_index || num2_index || act)) {
            printf("overflow\n");
        }else {
            int zeros = 1;
            for(j=MAX_SIZE-1; j>=0; --j) {
                if(zeros && !result[j]) {
                    continue;
                }
                zeros = 0;
                printf("%d", result[j]);
            }
            printf("\n");
        }

    }

    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>
#include <cstdlib>
#include <typeinfo>
using namespace std;



int main(){
	int n;
	string x, y;
	int a, b, c;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x >> y;
		if (x.length() > 80 || y.length() > 80)
		{
			cout << "overflow" << endl;
		}
		else
		{
			a = stoi(x);
			b = stoi(x);
			cout << a << b << endl;
			if (to_string(a + b).length() > 80)
			{
				cout << "overflow" << endl;
			}
			else cout << a + b << endl;
		}
	}
}