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>

#define Max 80
 
using namespace std;
 
int main(){
 
  int n, i, j;
  scanf("%d",&n);
 
  while(n--){
	  char str[100];
	  int ar[3][100], leng[3], ovf=0;

	  for(i=0; i<100; i++) ar[0][i]=ar[1][i]=ar[2][i]=0;

	  for(i=0; i<2; i++){
		scanf(" %s",str);
		leng[i]=strlen(str);
		if(Max<leng[i]) ovf=1;

			for(j=0; j<leng[i];j++)
				ar[i][j]=str[leng[i]-1-j]-'0';
	  }
	 
	for(i=0; i<100-1; i++){
		int s =(ar[2][i]+ar[0][i]+ar[1][i]);
		ar[2][i]  =s%10;
		ar[2][i+1]=s/10;
	}

	for(i=0; (i<100)&&(0==ar[2][100-1-i]); i++);
		leng[2]=100-i;

	
	if(Max<leng[2]) ovf=1;
 
  if(1==ovf)   printf("overflow\n");
  else{
	  for(i=0; i<leng[2]; i++)
		  printf("%d",ar[2][leng[2]-1-i]);
	  printf("\n");
  }
  }

    return 0;
}

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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    while (N--) {
        string s1, s2;
        cin >> s1;
        cin >> s2;
        vector<int> n1, n2, res;
        for (int i = s1.size(); i--;) {
            n1.push_back((int)(s1[i] - '0'));
        }
        for (int i = s2.size(); i--;) {
            n2.push_back((int)(s2[i] - '0'));
        }
        if (n1.size() < n2.size()) {
            for (int i = n1.size(); i < n2.size(); i++) {
                n1.push_back(0);
            }
        } else if (n2.size() < n1.size()) {
            for (int i = n2.size(); i < n1.size(); i++) {
                n2.push_back(0);
            }
        }
        int s, c = 0;
        for (int i = 0; i < n1.size(); i++) {
            s = n1[i] + n2[i] + c;
            res.push_back(s % 10);
            c = s / 10;
        }
        if (c != 0) {
            res.push_back(c);
        }
        int size = res.size();
        while (size > 0 && res[size - 1] == 0) {
            size--;
        }
        if (size > 80) {
            cout << "overflow" << endl;
        } else {
            int i = size;
            while (i--) {
                cout << res[i];
            }
            cout << endl;
        }
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#define max(a,b) a>b?a:b
using namespace std;
int che(char a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(a==i){
			return j;
		}
		j++;
	}
	return 0;
}
char cha(int a){
	char i;
	int j=0;
	for(i='0';i<='9';i++){
		if(j==a){
			return i;
		}
		j++;
	}
}
int main(){
	string a,b;
	int c=0;
	int i,j,k,m,n;
	int x,y;
	char d[200];
	cin>>n;
	for(k=0;k<n;k++){
		cin>>a>>b;
		x=a.size();
		y=b.size();
		m=max(x,y);
		for(i=1;i<=m;i++){
			j=che(a[x-i])+che(b[y-i])+c;
			if(j>=10){
				c=1;
				j-=10;
			}else{
				c=0;
			}
			d[i]=cha(j);
		}
		if(c==1){
			d[i]=cha(1);
			c=0;
			i++;
		}
		if(i>80){
			cout<<"overflow"<<endl;
			continue;
		}
		for(j=i-1;j>0;j--){
			cout<<d[j];
		}
		cout<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	string a,b;
	vector<int> ans;
	int n,tmp,carry,num;
	cin >> n;
	for(int i=0; i<n; i++){
		ans.clear();
		cin >> a >> b;
		int ai = a.size()-1;
		int bi = b.size()-1;
		carry=0;
		if(a.size() > 80 || b.size() > 80){
			cout << "overflow" << endl;
			return 0;
		}
		while(ai >= 0 || bi >= 0){
			tmp=0;
			if(ai >= 0) tmp += a[ai] - '0';
			if(bi >= 0) tmp += b[bi] - '0';
			ans.push_back((tmp+carry)%10);
			carry = (tmp+carry)/10;
			ai--; bi--;
		}
		if(carry != 0) ans.push_back(carry);
		if(ans.size() > 80){
			cout << "overflow" << endl;
			return 0;
		}
		
		for(int j=ans.size()-1; j>=0; j--)
			cout << ans[j];
		cout << endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	string a,b;
	cin >> n;
	while(n--) {
		cin >> a >> b;
		string ret = "";
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		int a_len = a.size(),b_len = b.size();
		int num = max(a_len,b_len),carry = 0,v;
		char tmp[1];
		for(int i = 0; i < num; i++) {
			if(a_len <= i || b_len <= i) v = carry + (b_len <= i ? a[i] : b[i]) - '0';
			else v = carry + a[i] + b[i] - '0' * 2;
			carry = v / 10;
			sprintf(tmp,"%d",v % 10);
			ret += tmp;
		}
		sprintf(tmp,"%d",carry);
		if(carry != 0) ret += tmp;
		reverse(ret.begin(),ret.end());
		cout << (ret.size() > 80 ? "overflow" : ret) << endl;
	}
	return 0;
}

C++: #include <cassert>
#include <iostream>
#include <string>
#include <vector>

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]);
    }
    out << std::endl;
}

int main()
{
    int N;
    std::cin >> N;
    for(int i = 0; i < N; ++i){
        std::string first, second;
        std::cin >> first;
        std::cin >> second;
        Print(Add(Decode(first), Decode(second)), std::cout);
    }
    return 0;
}