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 <algorithm>
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	
	while(n-- > 0){
	
	string str1;
	cin >> str1;
	
	string str2;
	cin >> str2;
	
	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());
	
	int check;
	if(str1.size() > str2.size()){
		check = 1;
	}
	else if(str1.size() == str2.size()){
		check = 2;
	}
	else {
		check = 3;
	}
	
	int ans[100];
	bool next = false;
	int short_ = min(str1.size(), str2.size());
	int long_ = max(str1.size(), str2.size());	
	if(long_ >= 79){
		cout << "overflow" << endl;
		continue;
	}

	for(int i = 0; i < short_; ++i){
		int num = 0;
		num += (str1[i] - '0') + (str2[i] - '0');
		if(next){
			num++;
		}
		ans[i] = num;
		next = false;	
		if(num >= 10){
			num -= 10;
			ans[i] -= 10;
			next = true;
		}
		//cout << num << endl;
	}
	/*for(int i = 0; i < min(str1.size(), str2.size()); ++i){
		cout << ans[i];
	}
	cout << endl;*/
	
	if(check == 1){
		for(int i = str2.size(); i < str1.size(); ++i){
			int num = str1[i] - '0';
			if(next){
				num++;
			}
			ans[i] = num;
			next = false;	
			if(num >= 10){
				num -= 10;
				ans[i] -= 10;
				next = true;
			}
		}
		if(next){
			ans[str1.size()] = 1;
			long_ ++;
		}
	}	
	
	if(check == 3){
		for(int i = str1.size(); i < str2.size(); ++i){
			int num = str2[i] - '0';
			if(next){
				num++;
			}
			ans[i] = num;
			next = false;	
			if(num >= 10){
				num -= 10;
				ans[i] -= 10;
				next = true;
			}
		}
		if(next){
			ans[str2.size()] = 1;
			long_ ++;
		}
	}
	
	if(long_ >= 80){
		cout << "overflow" << endl;
		continue;
	}

	for(int i = long_ - 1; i >= 0; --i){
		cout << ans[i];
	}/*
	for(int i = 0; i < min(str1.size(), str2.size()) + 1; ++i){
		cout << ans[i];
	}*/

	cout << endl;
	//reverse(ans.begin(), ans.end());
	//cout << ans << endl;
	}
		
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <string.h>
#include <stdio.h>
using namespace std;

void checkArray(char str[])
// 配列の内容確認(テスト用)
{
	int size = strlen(str);
	for(int i = 0; i < size; ++i)
	{
		cout << "str[" << i << "]: " << str[i] << endl;
	}
}
void str_reverse(char s[])
// 文字列を反転する
{
     int i, l = strlen(s);
     char t;
     for(i = 0; i < l/2; i++) {
         t = s[i]; s[i] = s[l-i-1]; s[l-i-1] = t;
     }
}
void add(char num1[], char num2[])
// 足し算した結果を文字列として返す
{
	char res[82];
	bool carry = false; //繰り上がりの有無
	int maxlen = (strlen(num1) > strlen(num2)) ? strlen(num1) : strlen(num2);
	int flag1 = 0, flag2 = 0;

	str_reverse(num1);
	str_reverse(num2);

	for(int i = 0; i < maxlen+1; ++i){
		// '\n'以降は値を0とする
		if(num1[i] == '\0') flag1 = 1;
		if(num2[i] == '\0') flag2 = 1;
		res[i] = carry;
		if(!flag1)	res[i] += num1[i]-48;
		if(!flag2)	res[i] += num2[i]-48;
		carry = res[i] / 10;
		res[i] = res[i] % 10 + 48;
	}
	// 終端文字をつける
	if(res[maxlen] == '0')
		res[maxlen] = '\0';
	else res[maxlen+1] = '\0';

	// 元に戻す
	str_reverse(num1);
	str_reverse(num2);
	str_reverse(res);
	if(strlen(res) > 80)
		cout << "overflow" << endl;
	else
		cout << res << endl;
}

int main() {
	int dataset;
	char num1[80];
	char num2[80];

	cin >> dataset; // データセットの個数

	for(int i = 0; i < dataset; ++i){
			// 80桁以下の数字を入力
			cin  >> num1;
			cin  >> num2;
			if(strlen(num1) > 80 || strlen(num2) > 80){
				cout << "overflow" << endl;
			}else
			// 足し算した結果を表示
			add(num1, num2);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
const int INF=10000;
char a[1001],b[1001],c[1001];
void rev(int pnt,char *cp){
    for(int i=0;i<pnt/2;i++){
        char work;
        work=*(cp+i);
        *(cp+i)=*(cp+pnt-i-1);
        *(cp+pnt-i-1)=work;
    }
}
int main(){
    int n;
    cin>>n;
    while(n--){
        for(int i=0;i<1000;i++)a[i]=b[i]=c[i]=0;
        cin>>a>>b;

        int apnt,bpnt;
        for(int i=0;i<1000;i++)if(a[i]==0){apnt=i;break;}
        for(int i=0;i<1000;i++)if(b[i]==0){bpnt=i;break;}

        if(apnt>80 || bpnt>80){cout<<"overflow"<<endl;continue;}

        rev(apnt,a);
        rev(bpnt,b);
        int d[100];
        for(int i=0;i<100;i++)d[i]=0;
        int big=max(apnt,bpnt);
        for(int i=0;i<big;i++){
            if(i<apnt)d[i]+=a[i]-'0';
            if(i<bpnt)d[i]+=b[i]-'0';
        }
        for(int i=0;i<big;i++){
            if(d[i]>=10){
                d[i]%=10;
                d[i+1]++;
            }
        }
        if(d[big]==1)big++;
        if(big>80){
            cout<<"overflow"<<endl;
            continue;
        }
        for(int i=0;i<big;i++){
            c[i]=d[i]+'0';
        }
        rev(big,c);
        cout<<c<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long int ll;

int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++){
		int a[80];
		string sa1,sa2,s1="",s2="";
		for(int i=0;i<80;i++)a[i]=0;
		cin >> sa1 >> sa2;
		if(sa1.length()>80||sa2.length()>80){
			printf("overflow\n");
			continue;
		}
		for(int j=0;j<80-sa1.length();j++){
			s1+='0';
		}
		s1+=sa1;
		for(int j=0;j<80-sa2.length();j++){
			s2+='0'; 
		}
		s2+=sa2;
		for(int i=0;i<80;i++){
			a[i]+=(s1[i]-'0')+(s2[i]-'0');
		}
		for(int i=79;i>=1;i--){
			a[i-1]+=a[i]/10;
			a[i]%=10;
		}
		if(a[0]>=10){
			printf("overflow\n");
			continue;
		}
		int x=0;
		while(a[x]==0)x++;
		for(int i=x;i<=79;i++){
			cout << a[i];
		}
		if(x==80)printf("0\n");
		else printf("\n");
	}
    return 0;
}