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>
#include<iomanip>
#include<cmath>
using namespace std;

int main(){

	int n;

	string a, b;
	char N1[80], N2[80];
	char sum[80], temp[81];
	string ans;

	cin >> n;

	for( int i=0;i<n;i++ ){

		cin >> a;
		
		cin >> b;

		if( a.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		if( b.length() >= 80 ){
			cout << "overflow" << endl;
			continue;
		}

		for( int i=0;i<80;i++ ){
			N1[i] = -1; N2[i] = -1; sum[i] = 0;
		}

		for( int i=1;i<=a.length();i++ )
			N1[i] = a[a.length()-i] - '0';
		for( int i=1;i<=b.length();i++)
			N2[i] = b[b.length()-i] - '0';

		int over = 0;
		
		for( int i=0;i<80;i++ ){


			if( N1[i] == -1 && N2[i] == -1 ){
				if( over >= 10 ){
					sum[i] = over / 10;
					over = 0;
				}else
					sum[i] = -1;
				continue;
			}

			if( N1[i] != -1 )
				sum[i] += N1[i];
			if( N2[i] != -1 )
				sum[i] += N2[i];

			sum[i] += over / 10;

			over = floor((double)sum[i]/10)*10;

			sum[i] -= over;
			
		}

		if(over > 0)cout << "overflow" << endl;
		else{
			int j=0;
			for( int i=1;i<=80;i++ ){
				if( sum[80-i] >= 0 ){
					temp[j] = sum[80-i] + '0';
					j++;
					continue;
				}
				
			}
			temp[j] = '\0';

			ans = temp;

			cout << ans << endl;
		}

	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#define x 81
using namespace std;

int main(){
	int n;
	cin >> n;
	cin.ignore();
	for(int i=0;i<n;i++){
		string a,b;
		getline(cin,a);
		getline(cin,b);
		bool c = false;
		if(a.size()>=x) c = true;
		if(b.size()>=x) c = true;
		int p[x];
		int k = 0;
		for(int j=0;j<x;j++){
			p[j] = k;
			int s = a.size()-j-1;
			int t = b.size()-j-1;
			string f;
			string g;
			if(s>=0) f = a.substr(s,1);
			if(t>=0) g = b.substr(t,1);
			if(s>=0) p[j] += atoi(f.c_str());
			if(t>=0) p[j] += atoi(g.c_str());
			if(p[j]>=10){ p[j] -= 10; k = 1; }
			else k = 0;
		}
		if(k==1) c = true;
		if(c) cout << "overflow" << endl;
		else{
			int d = x-1;
			while(p[d]==0){ d--; }
			for(int j=d;j>=0;j--) cout << p[j];
			cout << endl;
		}
	}
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>
#include <cstring>		//strlen

using namespace std;



bool solve(){

//	なぜかわからないがstirngだと数字が大きいとSegmentation fault
/*
	string str1,str2;
	cin>> str1>> str2;
	int n1 = str1.size();
	int n2 = str2.size();
*/	
	char str1[10000],str2[10000];
	scanf("%s %s",str1,str2);
	int n1 = strlen(str1);
	int n2 = strlen(str2);
	
	int n  = max(n1,n2);

/*	string str="";
*/
	char str[10000];
	int c = 0;
	int i=0;
	while(i<n){
		int a = c;
		if(i<n1){
			a += (str1[n1-i-1]-'0');
		}
		if(i<n2){
			a += (str2[n2-i-1]-'0');
		}
		c = a/10; 
		a = a%10;
		
		str[i] = a + '0';
		i++;
	}
	if(c){
		str[i] = c + '0';
		i++;
	}
	
	if(i>=81){
		cout<< "overflow"<<endl;
		return true;
	}
	
	for(int j=i-1;j>=0;j--){
		cout<< str[j];
	}
	cout<<endl;
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(5);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}
	return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

using namespace std;

const int MAX_INPUT = 1000000;
const int ARRAY_SIZE = 9;
const int MAX_LEN = 8;
char inputA[MAX_INPUT];
char inputB[MAX_INPUT];

void toBigInt(char *str, long *r) {
    int len = strlen(str);
    int startIndex = ARRAY_SIZE - (len / MAX_LEN) - 1;

    {
        int offset = 0;
        for (int i = 0; i < ARRAY_SIZE; ++i) {
            char temp[MAX_LEN + 1] = { 0 };
            char* start = str + ((i == 0) ? 0 : offset);
            int readLen = ((len - offset) < MAX_LEN) ? len - offset : MAX_LEN;

            strncpy(temp, start, readLen);
            r[ARRAY_SIZE - i - 1] = (long)atoi(temp);
            offset += readLen;
        }
    }
}

int main() {
    while (scanf("%s\n%s", &inputA, &inputB) != EOF) {
        long a[ARRAY_SIZE] = { 0 };
        long b[ARRAY_SIZE] = { 0 };
        long r[10] = { 0 };
        int lenA = 0;
        int lenB = 0;
        const int MAX_INPUT_LEN = 80;
        lenA = strlen(&inputA[0]);
        lenB = strlen(&inputB[0]);
        if ((MAX_INPUT_LEN < lenA) || (MAX_INPUT_LEN < lenB)) {
            printf("overflow\n");
            continue;
        }

        toBigInt(inputA, a);
        toBigInt(inputB, b);
        for (int i = 0; i < ARRAY_SIZE; ++i) {
            int curRIndex = 10 - i - 1;
            r[curRIndex] += a[ARRAY_SIZE - i - 1] + b[ARRAY_SIZE - i - 1];
            const int MAX = 99999999;
            if (MAX < r[curRIndex]) {
                r[curRIndex - 1] = r[curRIndex] / (MAX + 1);
                r[curRIndex] %= (MAX + 1);
            }
        }

        {
            bool started = false;
            bool noOutput = true;
            for (int i = 0; i < 10; ++i) {
                if (!started && (0 < r[i])) {
                    started = true;
                    printf("%d", r[i]);
                    noOutput = false;
                    continue;
                }

                if (started) {
                    long temp = (r[i] == 0) ? 1 : r[i];
                    for (int j = 0; temp * pow(10, j) < 10000000; ++j) {
                        printf("0");
                    }

                    printf("%d", r[i]);
                }
            }

            if (noOutput) {
                printf("0");
            }
        }
        printf("\n");
    }

    return 0;
}

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

int eval(char a)
{
    return a - '0';
}

int main(void)
{
    string a, b;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        stack<int> c;
        cin >> a >> b;
        auto ia = a.rbegin();
        auto ib = b.rbegin();
        int g = 0;
        while (true) {
            int e = 0, f = 0;
            if (ia != a.rend())
                e = eval((char)*ia++);
            if (ib != b.rend())
                f = eval((char)*ib++);
            c.push((e + f + g)%10);
            g = (e + f + g >=10)? 1 : 0;
            if (ia == a.rend() && ib == b.rend())
            {
                if (g == 1)
                    c.push(1);
                break;
            }
        }
        int l = c.size();
        if (l > 80) {
            cout << "overflow" << endl;
            continue;
        }
        for (int i = 0; i < l; ++i) {
            cout << c.top();
            c.pop();
        }
        cout << endl;
    }
    return 0;
}