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 <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>

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

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

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

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

int main() {
    const char OVER[] = "overflow\n";
    int n = 0;
    scanf("%d", &n);

    for (int i = 0; i < n; ++i) {
        scanf("%s\n%s", &inputA, &inputB);
        long a[ARRAY_SIZE] = { 0 };
        long b[ARRAY_SIZE] = { 0 };
        long r[12] = { 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(OVER);
            continue;
        }

        toBigInt(inputA, a);
        toBigInt(inputB, b);
        for (int i = 0; i < ARRAY_SIZE; ++i) {
            int curRIndex = 12 - 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);
            }
        }

        if ((9999999 < r[2]) || (0 < r[1])) {
            printf(OVER);
            continue;
        }

        {
            bool started = false;
            bool noOutput = true;
            for (int i = 0; i < 12; ++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];
                    bool didFor = false;
                    for (int j = 0; temp * pow(10, j) < 1000000; ++j) {
                        printf("0");
                        didFor = true;
                    }
                    if (didFor) {
                        printf("0");
                    }
                    printf("%d", r[i]);
                }
            }

            if (noOutput) {
                printf("0");
            }
        }
        printf("\n");
        for (int i = 0; i < MAX_INPUT; ++i) {
            inputA[i] = 0;
            inputB[i] = 0;
        }
    }
    return 0;
}

C++: #include<algorithm>
#include<iostream>
#include<cstdio>
#include<stdio.h>
#include<string>
#include<string.h>
#include <math.h>
using namespace std;
int main()
{
	char a1, a2;
	long long a, b, c;
	int kaisu = 0;
	cin >> kaisu;
	for (int i = 0; i < kaisu; i++)
	{
		cin >> a;
		cin >> b;
		a1 = (long long)log10(a) + 1;;
		a2 = (long long)log10(b) + 1;;
		if (a1 + a2 >= 80) { cout << "overflow" << endl; }
		else {
			c = a + b; cout
				<< c << endl;
		}
	}
	return 0;
}

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[100],str2[100];
	scanf("%s %s",str1,str2);
	int n1 = strlen(str1);
	int n2 = strlen(str2);
	
	int n  = max(n1,n2);

/*	string str="";
*/
	char str[1000];
	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 <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		//getchar();
		scanf("%s",num2);
		//getchar();
		l1 = strlen(num1);
		//cout << l1 << endl;
		l2 = strlen(num2);
		//printf("%s %s\n",num1,num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((a1[j] + a2[j] + kuriagari)>=10)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool p=false;
		/*for(int i=0;i<1002;i++)
		{
			cout << ans[i];
		}
		cout << endl;*/
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				p=true;
				break;
			}
		}
		if(p)
		{
			printf("overflow\n");
			continue;
		}
		else
		{
			for(j=79;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdio.h>

using namespace std;

int main()
{
	int i,j,n;
	string s1,s2;

	cin>>n;
	
	while(n--){
		cin>>s1>>s2;
		if(s1.size()<s2.size())swap(s1,s2);

		for(i=0;i<s2.size();i++){s1[i+s1.size()-s2.size()]+=s2[i]-'0';}

		for(i=s1.size()-1;i>0;i--){
			if(s1[i]>'9'){s1[i]-=10; s1[i-1]++;}
		}

		if(s1[0]>'9'){s1[0]-=10;cout<<"1";}

		cout<<s1<<endl;
	}
	return 0;
}