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>
#include <stdlib.h>
char num1[82],num2[82];
	int a1[82],a2[82],ans[82];
	int i,j,n,k,l1,l2,kuriagari=0;
int main(void)
{
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		for(j=0;j<82;j++)
		{
			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<82;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[80] != 0)
		{
			printf("overflow\n");
		}
		else
		{
			for(j=81;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
  int n;
  string up,un;
  cin >> n;
  while(n--){
    cin >> up >> un;
    if(up.size() > 80 || un.size() > 80){
    exit:
      cout << "overflow\n";
      continue;
    } 
    if(up.size() < un.size()) swap(up,un);
    for(int i=up.size()-1,j=un.size()-1;i>=0;i--,j--){
      if(j >= 0) up[i] += un[j]-'0';
      if(up[i] > '9'){
	up[i] -= 10;
	if(i == 0) up = "1" + up;
	else up[i-1]++;
      }
    }
    if(up.size() > 80) goto exit;
    cout << up << endl;
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <cstring>
#include <functional>

using namespace std;

#define REP(i,a,b) for((i)=(a);(i)<(int)(b);(i)++)
#define rep(i,n) REP(i,0,n)
// BEGIN CUT HERE
#define foreach(itr,c) for(typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
// END CUT HERE

int main(){
  int i, j, n;
  int len1, len2;
  char tmp;

  scanf("%d",&n);
  rep(i,n){
    string str1, str2, res;
    cin >> str1;
    cin >> str2;

    vector<int> a(100, 0), b(100, 0);
    len1 = (int)str1.size(); len2 = (int)str2.size();
    rep(j,len1) a[j] = str1[(int)len1-1-j] - '0';
    rep(j,len2) b[j] = str2[(int)len2-1-j] - '0';

    rep(j,81){
      int sum = a[j] + b[j];
      if(sum >= 10){ sum %= 10; a[j+1]++;}
      res += (sum + '0');
    }

    reverse(res.begin(), res.end());
    int f = 0;
    rep(j,res.size()){
      if(res[j] != '0') f = 1;
      if(f && res.size()-j > 81){
        cout << "overflow" << endl;
        return 0;
      }
      if(f) cout << res[j];
    }

    cout << endl;
  }

  return 0;
}

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

using namespace std;

void add(string &a, string &b) {
	if (a.size() > 80 || b.size() > 80) {
		cout << "overflow" << endl;
		return;
	}

	string aa = a;
	string bb = b;
	reverse(aa.begin(), aa.end());
	reverse(bb.begin(), bb.end());
	string cc;
	int carry = 0;
	int sa = a.size();
	int sb = b.size();
	int ss = sa>sb ? sa : sb;
	for (int i = 0; i < ss; i++) {
		char ca = i < sa ? aa[i] : '0';
		char cb = i < sb ? bb[i] : '0';
		char code = ca + cb + carry - '0';
		if (code > '9') {
			code -= 10;
			carry = 1;
		} else
			carry = 0;
		cc += code;
	}

	if (carry)
		cc += '1';

	if (cc.size() > 80)
		cout << "overflow" << endl;
	else {
		reverse(cc.begin(), cc.end());
		cout << cc << endl;
	}
}

int main() {
	string a, b;
	while (cin >> a >> b) {
		add(a, b);
	}
	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,c; char tmp;
    cin >> a >> b;
    if(a.size() > 80 || b.size() > 80){
      cout << "overflow" << endl;
      continue;
    }
    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];
     }
     b.resize(a.size());
     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 = '0';
     for(int k = 0;k < a.size();k++){
       c[k] = a[k] + b[k] + tmp -'0' -'0';
	  if(c[k] > '9'){ tmp = '1'; c[k] = c[k] - ':' + '0'; }
	  else {tmp = '0';}
     } 
     if(a.size() <= 80 ){if(tmp == '1'){ cout << tmp;}
       for(int k = a.size()-1;k >=0;k--){
	 cout << c[k]; 
	  }
       cout << endl;
     } else {cout <<"overflow"<<endl; } 
     
  }
}

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

int main(void){

	int N,math1,math2,kuri,keta;
	int i,j,k;
	char fi[100],se[100],ans[100];

	scanf("%d",&N);

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

		scanf("%s",fi);
		scanf("%s",se);

		
		for(j=strlen(fi)-1,k=strlen(se)-1,keta=0,kuri=0;j>=0||k>=0;j--,k--,keta++){
			if(j<0) math1=0;
			else math1=fi[j]-'0';
			if(k<0) math2=0;
			else math2=se[k]-'0';
            ans[keta]=((math1+math2+kuri)%10)+'0';
			kuri=(math1+math2+kuri)/10;
		}
		if(keta-1<=80){
			for(j=keta-1;j>=0;j--){
				printf("%c",ans[j]);
			}
		}
		else printf("overflow");
		printf("\n");
	}

	return 0;
}

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

#define N(c) (c-'0')

// using namespace std;



int main(){
	int i, j, k, n, s;
	char  ar[3][100], c;

  scanf("%d",&n);

  while(n--){
	  scanf("%s %s",ar[0],ar[1]);

	  for(i=0; i<2; i++){
		  j=strlen(ar[i]);
		  for(k=0; k<j/2; k++){
			  c=ar[i][k]; ar[i][k]=ar[i][j-k-1]; ar[i][j-k-1]=c;
		  }
	  }

    if(strlen(ar[0])<strlen(ar[1])){
      strcpy(ar[2], ar[1]); strcpy(ar[1], ar[0]); strcpy(ar[0], ar[2]);
    }

    i=strlen(ar[0]);
    j=strlen(ar[1]);
    for(k=0,s=0; k<j; k++){
      s += N(ar[0][k]) + N(ar[1][k]);
      ar[2][k]=(s%10)+'0';
      s=s/10;
    }

    for( ; k<i; k++){
      if(ar[0][k]=='\0')  ar[2][k]=s+'0';
      else{
        s += N(ar[0][j]);
        ar[2][k]=(s%10)+'0';         
        s=s/10;
      }
    }

    if(0==s)  ar[2][k]='\0';
    else {
      ar[2][k]=s+'0';
      ar[2][k+1]='\0';
    }

// printf("%s\n%s\n%s\n",ar[0],ar[1],ar[2]);


	  i=2;
		  j=strlen(ar[i]);
		  for(k=0; k<j/2; k++){
			  c=ar[i][k]; ar[i][k]=ar[i][j-k-1]; ar[i][j-k-1]=c;
		  }

  if(80<strlen(ar[2]))  	printf("overflow\n");
  else printf("%s\n",ar[2]);
	}
    return 0;
}