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(){

  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.size()>80)
      cout << "overflow" << endl;
    else
      cout << a << endl;
    //a='0';
  }

}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;


int a[1000],b[1000],c[1000];
string s;

int main(){
	int n;
	cin>>n;
	rep(i,n){
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		cin>>s;
		//cout<<s<<endl;
		//cout<<s.size()<<endl;
		if(s.size()>80){
			cout<<"overflow\n";
			cin>>s;
			continue;
		}
		rep(j,s.size()){
			a[90-j]=s[s.size()-j-1]-'0';
			//cout<<s[s.size()-j-1]-'0';
		}
		//cout<<a[87]<<endl;
		cin>>s;
		if(s.size()>80){
			cout<<"overflow\n";
			continue;
		}
		rep(j,s.size()){
			b[90-j]=s[s.size()-j-1]-'0';
		}
		/*
		rep(j,91) cout<<a[j];
		cout<<endl;
		rep(j,91) cout<<b[j];
		cout<<endl;
		*/
		int t=0;
		for(int j=90;j>=0;j--){
			c[j]=(a[j]+b[j]+t)%10;
			if((a[j]+b[j]+t)>9) t=1;
			else t=0;
		}
		bool f=true;
		/*
		rep(j,91) cout<<c[j];
		cout<<endl;
		*/
		rep(j,91){
			if(f&&c[j]!=0){
				f=false;
				if(j<=10){
					cout<<"overflow";
					break;
				}
			}
			if(!f) cout<<c[j];
		}
		cout<<endl;
		
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int a_len,b_len,m_len;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		a_len=in.size();
		b_len=in2.size();
		for(int i=0;i<a_len;i++){
			a[a_len-1-i]=in[i]-'0';
		}
		for(int i=0;i<b_len;i++){
			b[b_len-1-i]=in2[i]-'0';
		}
		m_len=max(a_len,b_len);
		if(m_len>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<m_len+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[m_len]!=0){
			if(m_len>79){
				cout<<"overflow"<<endl;
				continue;
			}
			cout<<ans[m_len];
		}
		for(int i=0;i<m_len;i++){
			cout<<ans[m_len-1-i];
		}cout<<endl;
		
		
		
	}
	
	
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#define	BCD_SIZE	96

int checkOverFlow(char *numStr) {
	return strlen(numStr) > 80;
}

template <typename T> void mySwap(T &a, T &b) {
	T t = a; a = b; b = t;
}

template <typename T> void reverseArray(T a[], int n) {
	for (int i = n / 2 - 1; i >= 0; --i) { mySwap(a[i], a[n - i - 1]); }
}

void str2bcd(char *str, int n) {
	int len = (int)strlen(str), i;
	reverseArray(str, len);
	for (i = 0; i < len; ++i) { str[i] &= 0xf; }
	for (; i < n; ++i) { str[i] = 0; }
}

void bcd2str(char *bcd, int n) {
	int len;
	for (int i = n - 1; i >= 0 && bcd[i] == 0; --i) { len = i; }
	reverseArray(bcd, len);
	for (int i = 0; i < len; ++i) { bcd[i] |= 0x30; }
}

void calcLargeIntSum(char sumStr[], char numStr[][BCD_SIZE], int numNum) {
	char carry = 0;
	for (int i = 0; i < numNum; ++i) { str2bcd(numStr[i], BCD_SIZE); }
	for (int i = 0; i < BCD_SIZE; ++i) {
		sumStr[i] = carry;
		for (int j = 0; j < numNum; ++j) { sumStr[i] += numStr[j][i]; }
		carry = sumStr[i] / 10;
		sumStr[i] %= 10;
	}
	bcd2str(sumStr, BCD_SIZE);
	for (int i = 0; i < numNum; ++i) { bcd2str(numStr[i], BCD_SIZE); }
}

int main() {
	char numStr[2][BCD_SIZE], sumStr[BCD_SIZE];
	int dataSet;
	for (scanf("%d", &dataSet); dataSet > 0; --dataSet) {
		scanf("%82s\n%82s", numStr[0], numStr[1]);
		if (checkOverFlow(numStr[0]) || checkOverFlow(numStr[1])) {
			puts("overflow");
			continue;
		}
		calcLargeIntSum(sumStr, numStr, 2);
		if (checkOverFlow(sumStr)) {
			puts("overflow");
			continue;
		}
		printf("%s\n", sumStr);
	}
	return 0;
}

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;
		}
		for (int i = keta; i > 0; --i)
		{
			cout << C[i];
		}
		cout << endl;
	}
}

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

int main(){
  stack<int> n1,n2;
  int n,nn1,nn2,up,k,f,num[100];
  char c;
  cin>>n;
  scanf("%c",&c);
  for(int i=0;i<n;i++){
    while(1){
      scanf("%c",&c);
      if(c=='\n')break;
      n1.push(c-'0');
    }
    while(1){
      scanf("%c",&c);
      if(c=='\n')break;
      n2.push(c-'0');
    }
    up=0;
    k=0;
    f=0;
    while(1){
      if(n1.size()!=0){
	nn1=n1.top();n1.pop();
      }else nn1=0;
      if(n2.size()!=0){
	nn2=n2.top();n2.pop();
      }else nn2=0;
      num[k]=(nn1+nn2+up)%10;
      up=(nn1+nn2+up)/10;
      if(n1.size()==0&&n2.size()==0&&up==0){
	break;
      }
      k++;
      if(k>=80)f=1;
    }
    if(f==1)cout<<"overflow"<<endl;
    else {
      for(int i=k;i>=0;i--)cout<<num[i];
    }
    cout<<endl;
  }
  return 0;
}