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 <algorithm>
#include <string>
#include <sstream>

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin>>v; return v; }
template<class T> inline string toString(T x){ ostringstream sout; sout<<x; return sout.str(); }

#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x) cerr<<#x<<" = "<<(x)<<"(L"<<__LINE__<<")"<<" "<<__FILE__<<endl;

int main(){
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		string a, b; cin >> a >> b;
		if (a.size() < b.size()) {
			string tmp("");
			for (int j = 0; j < b.size()-a.size(); j++) { tmp += "0"; }
			a = tmp + a;
		} else if (b.size() < a.size()) {
			string tmp("");
			for (int j = 0; j < a.size()-b.size(); j++) { tmp += "0"; }
			b = tmp + b;
		}
		
		string res("");
		for (int j = 0; j < a.size()+1; j++) res += "0";
		a = "0"+a; b = "0"+b;
		for (int j = res.size()-1; j >= 0; j--) {
			int cur = 0;
			if (res[j] >= '0' && res[j] <= '9') {
				cur = res[j]-'0';
			}
			int ai = a[j]-'0', bi = b[j]-'0';
			int res_tmp = ai+bi+cur;
			if (res_tmp >= 10) { 
				res[j] = '0'+(res_tmp%10);
				res[j-1] = '0'+(res_tmp/10); 
			} else {
				res[j] = '0'+res_tmp;
			}
		}
		int j = 0;
		while (res[j] == '0') { j++; }
		string ans("");
		for (; j < res.size(); j++) ans += res[j];
		
		if (ans.size() > 80) {
			cout << "overflow" << endl;
		} else {
			cout << ans << endl;
		}
	}

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>


using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
	{
		char a[81], b[81];
		scanf(" %s %s", a, b);
		int aa[80], bb[80];
		memset(aa, 0, sizeof(aa));
		memset(bb, 0, sizeof(bb));
		for (int j = 0; j < strlen(a); ++j)
			aa[j] = a[strlen(a)-j-1] - '0';
		for (int j = 0; j < strlen(b); ++j)
			bb[j] = b[strlen(b)-j-1] - '0';

		int sum[81];
		memset(sum, 0, sizeof(sum));
		for (int j = 0; j < 80; ++j)
		{
			sum[j] += aa[j]+bb[j];
			sum[j+1] = sum[j]/10;
			sum[j] %= 10;
		}
		if (sum[80])
			puts("overflow");
		else
		{
			int d;
			for (d = 80; sum[d] == 0; --d)
				;
			for (; d >= 0; --d)
				printf("%d", sum[d]);
			printf("\n");
		}
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdlib>
#define DIGIT 80
using namespace std;

class largenum{
  int nums[DIGIT];
  bool overflow;
  int most;
public:
  largenum(){
    overflow=false;
    most=DIGIT-1;
    for(int i=0;i<DIGIT;i++)
      nums[i]=0;
  }
  bool isoverflow(){ return overflow;}
  friend ostream& operator<<(ostream &out,largenum &l);
  friend istream& operator>>(istream &is,largenum &l);
  friend largenum operator+(largenum l1,largenum l2);
};

largenum operator+(largenum l1,largenum l2){
  bool carry=false;
  largenum ans;
  for(int i=DIGIT-1;i>=0;i--){
    int tmp=l1.nums[i]+l2.nums[i]+carry;
    carry=bool((tmp)/10);
    ans.nums[i]=(tmp)%10;
  }
  for(int i=0;i<DIGIT;i++){
    if(ans.nums[i]!=0){
      ans.most=i;
      break;
    }
  }  
  ans.overflow=carry;
  return ans;
}

ostream& operator<<(ostream &out,largenum &l){
  for(int i=l.most;i<DIGIT;i++){
    out<<l.nums[i];
  }
  return out;
}

istream& operator>>(istream &is,largenum &l){
  string str;
  is>>str;
  if(str.size()>DIGIT){
    l.overflow=true;
  }
  for(int i=0;i<(int)str.size();i++){
    int index = DIGIT-str.size()+i;
    switch(str[i]){
    case '0':
      l.nums[index]=0;
      break;
    case '1':
      l.nums[index]=1;
      break;
    case '2':
      l.nums[index]=2;
      break;
    case '3':
      l.nums[index]=3;
      break;
    case '4':
      l.nums[index]=4;
      break;
    case '5':
      l.nums[index]=5;
      break;
    case '6':
      l.nums[index]=6;
      break;
    case '7':
      l.nums[index]=7;
      break;
    case '8':
      l.nums[index]=8;
      break;
    case '9':
      l.nums[index]=9;
      break;
    }
  }
 
  l.most=DIGIT-str.size();
  return is;
}

int main(){
  int num;
  cin>>num;
  while(num--){
    largenum a,b;
    cin>>a>>b;
    if(a.isoverflow() || b.isoverflow()){
      cout<<"overflow"<<endl;
      continue;
    }
    a = a+b;
    if(a.isoverflow()){
      cout<<"overflow"<<endl;
    }else{
      cout<<a<<endl;
    }
  }
  return 0;
}

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

// typedef std::vector<char> TLongInt;
// TLongInt Decode(const std::string& Code)
// {
//     std::vector<char> Value(100, 0);
//     for(int i = 0; i < Code.size(); ++i){
//         Value[i] = Code[Code.size() -1 -i] - '0';
//     }
//     return Value;
// }
// TLongInt Add(const TLongInt& A, const TLongInt& B)
// {
//     assert(A.size() == B.size());
//     TLongInt C(A.size(), 0);
//     int kuriagari = 0;
//     for(int i = 0; i < A.size(); ++i){
//         int V = A[i] + B[i] + kuriagari;
//         C[i] = V % 10;
//         kuriagari = V / 10;
//     }
//     return C;
// }

// void Print(const TLongInt& Value, std::ostream& out)
// {
//     bool Left = true???
//     for(int i = Value.size() - 1; i >= 0; --i){
//         if(Value[i] == 0 && Left) continue;
//         if(i >= 80){
//             out << "overflow" << std::endl;
//             return;
//         }
//         Left = false;
//         out << int(Value[i]);
//     }
//     if(Left) out << "0";
//     out << std::endl;
// }

char* add(const char* a, const char* b)
{
    int sizeA, sizeB, sizeX;
    int A, B, C;
    char* x;
    char* t;
    const char* ap;
    const char* bp;
    char* xp;
    C = 0;
    sizeA = strlen(a);
    sizeB = strlen(b);
    sizeX = (sizeA > sizeB ? sizeA : sizeB)+1;
    x = malloc(sizeX);
    ap = a + sizeA-1;
    bp = b + sizeB-1;
    xp = x + sizeX-1;
    
    while(xp >= x){
        A = ap < a ? 0 : *ap - '0';
        B = bp < b ? 0 : *bp - '0';
        *xp = '0' + (A + B + C) % 10;
        C = (A + B + C) / 10;
        ap--;
        bp--;
        xp--;
    }
    if (*x == '0'){
        t = malloc(sizeX - 1);
        strcpy(t, x + 1);
        free(x);
        return t;
    }
    return x;
}
int main()
{
    int N;
    scanf("%d", &N);
    for(int i = 0; i < N; ++i){
        char first[101];
        char second[101];
        scanf("%s", first);
        scanf("%s", second);
        if(strlen(first) > 80
        || strlen(second) > 80){
            printf("overflow\n");
            continue;
        }
        char* result = add(first, second);
        if(strlen(result) <= 80){
            printf("%s\n", result);
            free(result);
        }else{
            printf("overflow\n");
        }
    }
    return 0;
}