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<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int t;
    scanf("%d",&t);
    while(t--){
        char c1,c2;
        scanf("%s",&c1);
        scanf("%s",&c2);
        string s1,s2;
        s1=c1, s2=c2;
        if(s1=="0" && s2=="0"){
            printf("0\n");
            continue;
        }
        reverse(s1.begin(),s1.end());
        reverse(s2.begin(),s2.end());
        int n=max(s1.size(),s2.size())+1;
        for(int i=s1.size();i<n;i++){
            s1+='0';
        }
        for(int i=s2.size();i<n;i++){
            s2+='0';
        }
        string res;
        int b=0;
        for(int i=0;i<max(s1.size(),s2.size());i++){
            int u=s1[i]-'0'+s2[i]-'0'+b;
            b=(u>=10); u%=10;
            res+=u+'0';
        }

        reverse(res.begin(),res.end());
        string res2;
        int j=0;
        while(res[j]=='0'){
            j++;
        }
        for(;j<res.size();j++){
            res2+=res[j];
        }

        if(res2.size()>80){
            printf("overflow\n");
        }else{
            printf("%s\n",res2.c_str());
        }
    }
    return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

class lInt
{
private:
	vector<int> place;
public:
	lInt( string number )
	{
		for ( unsigned int i = 0; i < number.length(); i++ )
		{
			place.push_back( number[i] - '0' );
		}

		reverse( place.begin(), place.end() );

		return;
	}

	void printNumber()
	{
		if ( place.size() < 80 )
		{
			for ( vector<int>::reverse_iterator it = place.rbegin(); it != place.rend(); it++ )
			{
				cout << *it;
			}
		}
		else
		{
			cout << "overflow";
		}

		cout << endl;

		return;
	}

	void operator += ( string number )
	{
		vector<int> buffer;
		
		for ( unsigned int i = 0; i < number.length(); i++ )
		{
			buffer.push_back( number[i] - '0' );
		}
		reverse( buffer.begin(), buffer.end() );

		for ( unsigned int i = 0; i < buffer.size(); i++ )
		{
			if ( i < place.size() )
			{
				place[i] += buffer[i];
			}
			else
			{
				place.push_back( buffer[i] );
			}
		}
		
		for ( unsigned int i = 0; i < place.size(); i++ )
		{
			if ( 10 <= place[i] )
			{
				if ( i + 1 < place.size() )
				{
					place[i + 1] += place[i] / 10;
				}
				else
				{
					place.push_back( place[i] / 10 );
				}

				place[i] %= 10;
			}
		}
	}
};

int main()
{
	int n;
	string buffer;

	cin >> n;

	for ( int i = 0; i < n; i++ )
	{
		cin >> buffer;
		lInt li( buffer );
		cin >> buffer;
		li += buffer;

		li.printNumber();
	}

	return 0;
}

C++: #include <cstdio>

int myAbs(int num) { return (num > 0) ? num : -num ; }

int countNumberLength(char *data) {
	for (int i = 0;; i++) {
		if (data[i] == '\0')
			return i;
	}
	return 0;
}

void moveNumber(char *data, int diff, int length) {
	int idx = length;
	for (int i = 0; i < length+1; i++) {
		data[idx-i+diff] = data[idx-i];
	}
	for (int i = 0; i < diff; i++) {
		data[i] = '0';
	}
}

int chr2int(char chr) {
	int ret;
	switch (chr) {
	case '1':
		ret = 1;
		break;
	case '2':
		ret = 2;
		break;
	case '3':
		ret = 3;
		break;
	case '4':
		ret = 4;
		break;
	case '5':
		ret = 5;
		break;
	case '6':
		ret = 6;
		break;
	case '7':
		ret = 7;
		break;
	case '8':
		ret = 8;
		break;
	case '9':
		ret = 9;
		break;
	case '0':
		ret = 0;
		break;
	case 'X':
		ret = 10;
		break;
	
	}
	return ret;
}

const char int2chr[11] = {
	'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'X'
};

void makeSumNumber(char *left, char *right, char *sum, int length) {
	sum[length] = '\0';
	for (int i = length-1; i !=-1; i--) {
		int t_sum = chr2int(left[i]) + chr2int(right[i]);
		if (t_sum >= 10) {
			if (i != 0) {
				left[i-1] = int2chr[chr2int(left[i-1])+1];
				t_sum %= 10;
			}
		}
		sum[i] = int2chr[t_sum];
	}
}

int main(int argc, char *argv[]) {
	using namespace std;
	
	int dataN;
	fscanf(stdin, "%d", &dataN);
	
	for (int i = 0; i < dataN; i++) {
		char tmp1[100], tmp2[100], sum[100];
		int cnt1, cnt2, diff, longer;
		fscanf(stdin, "%s", tmp1);
		fscanf(stdin, "%s", tmp2);
		cnt1 = countNumberLength(tmp1);
		cnt2 = countNumberLength(tmp2);
		diff = myAbs(cnt1 - cnt2);
		
		// is Overflow
		if (cnt1 > 80 || cnt2 > 80) {
			puts("overflow");
		}
		else {
			//printf("%d:%s\n", cnt1, tmp1);
			//printf("%d:%s\n", cnt2, tmp2);
			if (cnt1 > cnt2) {
				longer = cnt1;
				// set tmp
				moveNumber(tmp1, 1, cnt1+1);
				moveNumber(tmp2, diff+1, cnt2+1);
				// get sum
				makeSumNumber(tmp1, tmp2, sum, cnt1+1);
			}
			else if (cnt1 < cnt2) {
				longer = cnt2;
				// set tmp
				moveNumber(tmp2, 1, cnt2+1);
				moveNumber(tmp1, diff+1, cnt1+1);
				// get sum
				makeSumNumber(tmp1, tmp2, sum, cnt2+1);
			}
			else {
				longer = cnt1;
				// set tmp
				moveNumber(tmp1, 1, cnt1+1);
				moveNumber(tmp2, 1, cnt2+1);
				// get sum
				makeSumNumber(tmp1, tmp2, sum, cnt1+1);
			}
			// after calc
			if (sum[0] == '0') {
				for (int i = 1; i < longer+2; i++) {
					sum[i-1] = sum[i];
				}
			}
			else {
				if (cnt1 >= 80 || cnt2 >= 80) {
					puts("overflow");
					continue;
				}
			}
			
			printf("%s\n", sum);
		}
	}
	return 0;
}

C++: #include <stdio.h>

#define DEGITS 80

void load(int a[]);
void print(int a[]);

int main(void){
    int a[DEGITS]; // a[0] = LSD
    int b[DEGITS];
    int n;
    int cry;
    
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        // reset
        for (int i=0; i<DEGITS; i++){
            a[i]=b[i]=0;
        }
        // load
        load(a);
        load(b);
        // add ( a <- a + b )
        cry=0;
        for (int d=0; d<DEGITS; d++){
            a[d] += (b[d] + cry);
            cry = a[d]/10;
            if (a[d]>9){
                a[d]-=10;
            }
        }
        // print
        if (cry){
            printf("overflow\n");
        } else{
            print(a);
        }
    }

    return 0;
}

void load(int a[]){
    char *pt;
    char st[DEGITS+1];
    
    scanf("%s", st);
    for (pt=st; *pt!='\0'; pt++) ;
    for (int i=0; pt!=st; i++){
        a[i] = *(--pt)-'0';
    }
}

void print(int a[]){
    int d;
    
    for (d=DEGITS-1; d>0; d--){ 
        if (a[d] != 0) break;
    }
    for (; d>0; d--) printf("%d", a[d]);
    printf("%d\n", a[0]);
}