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>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int counter = 0; counter < n; counter++){
		string a, b;
		cin >> a >> b;
		if (a.length() >80 || b.length() > 80){
			cout << "overflow" << endl;
			continue;
		}
		int inta[82], intb[82], sum[82];
		fill(inta, inta + 82, 0);
		fill(intb, intb + 82, 0);
		fill(sum, sum + 82, 0);
		for (int i = 0; i < (signed)a.length(); i++){
			inta[i] = a[a.length() - i - 1] - '0';
		}
		for (int i = 0; i < (signed)b.length(); i++){
			intb[i] = b[b.length() - i - 1] - '0';
		}
		
		int over = 0;
		for (int i = 0; i < 82; i++){
			sum[i] = inta[i] + intb[i] + over;
			if (sum[i] >= 10){
				sum[i] -= 10;
				over = 1;
			}
			else{
				over = 0;
			}
		}

		for (int i = 81;; i--){
			if (sum[i] != 0){
				if (i >= 80){
					cout << "overflow" << endl;
					break;
				}
				for (int j = i; j >= 0; j--){
					cout << sum[j];
				}
				cout << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
 
#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
 
int main(void){
    int n; cin >> n;

    while(n --){
        vi res(81);

        rep(i, 2){
            string in; cin >> in;
            if(in.size() > 80){ res[80] = 1; break; }
            rep(j, in.size() + 1){
                if(j != in.size()) res[j] += in[in.size() - j - 1] - '0';
                for(int l = 0; res[j + l] > 9; l ++) res[j + l + 1] ++, res[j + l] %= 10;
            }
        }

        if(res[80]){ cout << "overflow" << endl; continue; }

        bool ok = false;
        for(int i = 79; i >= 0; i --){
            if(!ok) if(res[i]) ok = true;
            if(ok) cout << res[i];
        }
        cout << endl;
    }
 
    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>

using namespace std;

const size_t opsize = 81, bufsize = 102;
unsigned char op1[opsize], op2[opsize];
char buf[bufsize];

bool readOp(unsigned char * op){
    memset(op, 0, opsize);
    
    fgets(buf, bufsize, stdin);
    int l = strlen(buf);
    if(l > 81) return true;

    char *p = &buf[l-2];
    for (int j = 0; j < l-1; j++) {
        op[j] = *p - '0';
        p--;
    }
    return false;
}

void printOp(unsigned char * op){
    int mh = opsize - 1;
    while(op[mh] == 0 && mh > 0) mh--;
    for(; mh >= 0; mh--){
        putchar(op[mh] + '0');
    }
    putchar('\n');
}

bool plus(){
    for (int i = 0; i < opsize - 1; i++) {
        op1[i] += op2[i];
        if(op1[i] >= 10){
            op1[i] -= 10;
            op1[i+1] += 1;
        }
    }
    return op1[opsize - 1] != 0;
}

int main(int argc, char const* argv[])
{
    int n;
    scanf("%d ", &n);
    for (int i = 0; i < n; i++) {
        bool overflow = false;
        overflow |= readOp(op1);
        overflow |= readOp(op2);
        if(overflow){
            puts("overflow");
            continue;
        }
        overflow = plus();

        if(overflow){
            puts("overflow");
            continue;
        }
        printOp(op1);
    }
    
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
				in[i][ie[i]]=in[i][ie[i]]-'0';
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			max10=0;
			
			for(;ien[NMin]>-1;ien[NMin]--){
				in[NMin][ien[NMin]]=in[NMin][ien[NMin]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
			}
			for(int j=0;j<ie[NMin]+1;j++){
				in[NMin][j]=in[NMin][j]+'0';
			}
			
			
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int n;
	cin >> n;
	while(n--) {
		char a[84], b[84];
		int x[84], y[84], s[84], max;
		cin >> a >> b;
		int i = 0, j = 0;
		for(; a[i] != '\0'; ++i) {
			x[i] = a[i] - '0';
		}
		for(; b[j] != '\0'; ++j) {
			y[j] = b[j] - '0';
		}
		if(i > 80 || j > 80) {
			cout << "overflow" << endl;
			break;
		}
		if(i > j) {
			for(int k = j - 1; k >= 0; k--) {
				y[i-j+k] = y[k];
			}
			rep(k,i-j) {
				y[k] = 0;
			}
			max = i;
		} else if(i < j) {
			for(int k = i - 1; k >= 0; k--) {
				x[j-i+k] = x[k];
			}
			rep(k,j-i) {
				x[k] = 0;
			}
			max = j;
		} else max = i;
		bool f = 0;
		for(int k = max - 1; k >= 0; k--) {
			int c = x[k] + y[k];
			if(f) c++;
			if(c >= 10) {
				f = 1, c -= 10;
			} else f = 0;
			s[k] = c;
		}
		if(f) {
			max++;
		}
		if(max > 80) cout << "overflow" << endl;
		else {
			if(f) {
				cout << 1;
				max--;
			}
			rep(k,max) {
				cout << s[k];
			}
			cout << endl;
		}
	}
	return 0;
}

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

int main(){
  int n;
  string a,b;
  cin>>n;
  for(int j=0;j<n;j++){
    cin>>a>>b;
    int asize=a.length();
    int bsize=b.length();
    int smax=max(asize,bsize);
    bool flag=false;
    int s;
    stringstream ss;
    for(int i=0;i<smax;i++){
      if(asize-i-1<0) s=strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      else if(bsize-i-1<0) s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0);
      else s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0)+strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      if(flag) s++;
      ss<<s%10;
      if(s>9)
	flag=true;
      else
	flag=false;
    }
    string ans=ss.str();
    if(ans.length()>80){
      cout<<"overflow"<<endl;
      continue;
    }
    if(flag) cout<<1;
    for(string::reverse_iterator rit=ans.rbegin();rit!=ans.rend();rit++)
    cout<<*rit;
    cout<<endl;
  }
  return 0;
}