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 <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int n;
    cin >> n;
    while(n-- > 0){
        string s1, s2;
        cin >> s1 >> s2;
        int i = s1.size() - 1;
        int j = s2.size() - 1;
        if(i >= 80 || j >= 80){
            cout << "overflow" << endl;
            continue;
        }

        int k = max(i, j) + 1;
        string s3(k+1, '0');
        while(k >= 0){
            int a = s3[k] - '0';
            if(i >= 0)
                a += s1[i] - '0';
            if(j >= 0)
                a += s2[j] - '0';
            if(a > 9){
                ++ s3[k-1];
                a -= 10;
            }
            s3[k] = a + '0';

            -- i;
            -- j;
            -- k;
        }

        if(s3[0] == '0')
            cout << s3.substr(1) << endl;
        else
            cout << s3 << endl;
    }
}

C++: #include<stdio.h>

#define STR_MAX 80
#define ASCII_BIAS 48

char h_adder(char n1, char n2, char *n3, char carry)
{
  char result = n1 + n2 + carry;
  
  if(result<10){ *n3 = result + ASCII_BIAS; return 0; }
  else{ *n3 = result-10+ASCII_BIAS; return 1; }
}

int main(void)
{
  int i, j;
  int dataset;
  char in[2][STR_MAX+2], out[STR_MAX+2], result[STR_MAX+2];
  int len_in[2], idx_min, idx_max, lmin, lmax, lout, dif;
  char carry;

  scanf("%d\n", &dataset);

  for(i=0;i<dataset;i++){
    fgets(in[0], sizeof in[0], stdin); rewind(stdin);
    fgets(in[1], sizeof in[1], stdin); rewind(stdin);
    len_in[0] = strlen(in[0])-1; len_in[1] = strlen(in[1])-1;

    // check # of digits
    if(in[0][len_in[0]]!='\n' || in[1][len_in[1]]!='\n'){
      printf("overflow\n"); continue;
    }
    in[0][len_in[0]] = '\0';
    in[1][len_in[1]] = '\0';
    
    idx_min = (len_in[0]>len_in[1]) ? 1 : 0; // idx of shoter str
    idx_max = (idx_min + 1) & 1; // idx of longer str
    lmin = len_in[idx_min]-1; lmax = len_in[idx_max]-1;
    dif = (len_in[0]>len_in[1]) ? len_in[0]-len_in[1] : len_in[1]-len_in[0]; // difference in digits

    // execute addition
    carry = 0;
    for(j=0;j<lmin+1;j++){
      carry = h_adder(in[idx_min][lmin-j]-ASCII_BIAS, in[idx_max][lmin-j+dif]-ASCII_BIAS, &out[j+1], carry);
    }
    for(j=lmin+1;j<lmax+1;j++){
      carry = h_adder(0, in[idx_max][lmin-j+dif]-ASCII_BIAS, &out[j+1], carry);
    }
    
    // if carry is 0, validate overflow
    if(carry==1){
      if(lmax==STR_MAX-1){
  	printf("overflow\n"); continue;
      }    
    }

    lout = carry ? lmax+2 : lmax+1;
    out[lmax+2] = carry ? 1+ASCII_BIAS : 0+ASCII_BIAS;

    
    // if overflow does not occur, addition succeeded
    out[0] = '\0';
    for(j=0;j<lout+1;j++){
      result[j] = out[lout-j];
    }
    printf("%s\n", result);
  }
  
}

C++: #include<bits/stdc++.h>
using namespace std;

struct Integer{
    int num[100];
    Integer(char *s){
        fill_n(num,100,0);
        int l=strlen(s);
        for(int i=0;i<l;i++){
            num[l-i-1]=s[i]-'0';
        }
    }
};
const Integer operator+(const Integer &lint,const Integer &rint){
    Integer ret("0");

    for(int i=0;i<100;i++){
        int v=ret.num[i]+lint.num[i]+rint.num[i];
        ret.num[i]=v%10;
        if(i+1>=100)continue;
        ret.num[i+1]+=v/10;

    }
    return ret;
}

char a[200],b[200];
int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        scanf("%s %s",a,b);
        Integer ans=Integer(a)+Integer(b);
        int s=0;
        for(int i=0;i<100;i++)if(ans.num[i])s=i;
        if(s>=80){
            puts("overflow");
            continue;
        }
        for(int i=s;i>=0;i--)printf("%d",ans.num[i]);
        puts("");
    }
    return 0;
}

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

string reverse(const string& str) {
	string ret;
	string::const_reverse_iterator it = str.rbegin();
	for (; it != str.rend(); it++) {
		ret.push_back(*it);
	}
	return ret;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string S1;
		string S2;
		int overflow = 0;
		cin >> S1 >> S2;
		if (S1.size() > 80 || S2.size() > 80) {
			cout << "overflow"<<endl;
		}
		else {
			S1 = reverse(S1);
			S2 = reverse(S2);
			S1.resize(80, '0');
			S2.resize(80, '0');
			int a = 0;
			for (int i = 0; i < 80; i++) {
				S1[i] += S2[i] - '0';
				if (S1[i] > '9') {
					if (i + 1 > 79) {
						cout << "overflow";
						overflow++;
					}
					S1[i + 1] += 1;
					S1[i] -= 10;
				}
				if (S1[i] != '0')
					a = i;
			}
			S1 = reverse(S1);
			if (overflow == 0)
				for (int i = 79 - a; i < 80; i++) {
					cout << S1[i];
				}
		}
		cout << endl;
	}
	return 0;
}