Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}

C++: #include<iostream>
#include<string.h>
#define MAX(x,y) (x>y?x:y)
using namespace std;

int N;
int sum[1000][100];
	char stra[1000][85],strb[1000][85];

int main(){
	int i,j;
	int a[100],b[100];
	cin >> N;
	for(i = 0;i < N;i++){
		for(j = 0;j < 100;j++){
			a[j] = 0;
			b[j] = 0;
		}
		cin >> stra[i];
		for(j = strlen(stra[i])-1;j >= 0;j--){
			a[j] = stra[i][strlen(stra[i])-1-j]-48;
		}
		cin >> strb[i];
		for(j = strlen(strb[i])-1;j >= 0;j--){
			b[j] = strb[i][strlen(strb[i])-1-j]-48;
		}
		for(j = 0;j < MAX(strlen(stra[i]),strlen(strb[i]));j++){
			sum[i][j] += (a[j]+b[j]);
			sum[i][j+1] += (sum[i][j])/10;
			sum[i][j] %= 10;
		}
	}
	for(i = 0;i < N;i++){
		for(j = 99;sum[i][j] == 0 && j > 0;j--);
		if(j >= 80)
			cout << "overflow" << endl;
		else{
			for(j;j >= 0;j--)
				cout << sum[i][j];
			cout << endl;
		}
	}
	return 0;
}

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

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int n;
	cin >> n;
	while(n--) {
		string a, b;
		int x[84], y[84], s[84], max;
		cin >> a >> b;
		if(a.length() > 80 || b.length() > 80) {
			cout << "overflow" << endl;
			break;
		}
		int i = 0, j = 0;
		for(; a[i] != '\0'; ++i) {
			x[i] = a[i] - '0';
		}
		for(; b[j] != '\0'; ++j) {
			y[j] = b[j] - '0';
		}
		
		if(i > j) {
			for(int k = j - 1; k >= 0; k--) {
				y[i-j+k] = y[k];
			}
			rep(k,i-j) {
				y[k] = 0;
			}
			max = i;
		} else if(i < j) {
			for(int k = i - 1; k >= 0; k--) {
				x[j-i+k] = x[k];
			}
			rep(k,j-i) {
				x[k] = 0;
			}
			max = j;
		} else max = i;
		bool f = 0;
		for(int k = max - 1; k >= 0; k--) {
			int c = x[k] + y[k];
			if(f) c++;
			if(c >= 10) {
				f = 1, c -= 10;
			} else f = 0;
			s[k] = c;
		}
		if(f) {
			max++;
		}
		if(max > 80) cout << "overflow" << endl;
		else {
			string ans;
			if(f) {
				ans += "1";
				max--;
			}
			rep(k,max) {
				ans += s[k] + '0';
			}
			cout << ans << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[200], b[200], x[200], y[200];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		if(LA>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		
		int LB=strlen(b);
		if(LB>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[200];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(carry!=0){
			ans[big++]=carry+'0';
			ans[big]='\0';
			//printf("carries\n");
		}	
			
		int LS=strlen(ans);
		char fans[200];
		if(LS>80) printf("overflow\n");
		else{
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){

	int n;
	cin >> n;
	while(n > 0){
        char a[120] = {0};
        char b[120] = {0};
        scanf("%s%s",a,b);
        char ans[120] = {0};
        for(int i = 0; i < strlen(a)/2; i++){
            swap(a[i],a[strlen(a)-i-1]);
        }
        for(int i = 0; i < strlen(b)/2; i++){
            swap(b[i],b[strlen(b)-i-1]);
        }
        int len = max(strlen(a),strlen(b));
        for(int i = 0; i < len; i++){
            if(ans[i] != 0){
                if(a[i] == 0 || b[i] == 0)
                    ans[i] += a[i] + b[i] - '0';
                else ans[i] += a[i] + b[i] - '0' - '0';

            }
            else if(a[i] == 0 || b[i] == 0) ans[i] += a[i] + b[i];
            else ans[i] += a[i] + b[i] - '0';
            if(ans[i] >= 58){
                ans[i+1]+='1';
                ans[i] -= 10;
            }
        }
        for(int i = 0; i < strlen(ans)/2; i++){
            swap(ans[i],ans[strlen(ans)-i-1]);
        }
        int Len_a = 0,Len_b = 0,Len_ans = 0;
        for(int i = 0; a[i] != 0; i++) Len_a++;
        for(int i = 0; b[i] != 0; i++) Len_b++;
        for(int i = 0; ans[i] != 0; i++) Len_ans++;
        if(Len_a > 80 || Len_b > 80 || Len_ans > 80) printf("overflow");
        else for(int i = 0; ans[i] != 0; i++) printf("%c",ans[i]);
        printf("\n");
        n--;
	}

	return 0;
}

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

using namespace std;

int main() {
	int n;
	cin>>n;
	
	string str1, str2, of="overflow";
	for(int i=0; i<n; i++){
		cin>>str1>>str2;
		int size1=str1.size();
		int size2=str2.size();

		if(size1 > 80 || size2 > 80){
			cout<<of<<endl;
		}
		else{
			int num1[80] = {0}, num2[80] = {0}, buf[81] = {0};

			for(int i=0; i<size1; i++){ num1[size1-1-i] = (str1[i]-'0'); }
			for(int i=0; i<size2; i++){ num2[size2-1-i] = (str2[i]-'0'); }
			for(int i=0; i<80; i++){ buf[i] = num1[i]+num2[i]; }
			for(int i=0; i<80; i++){
				if(buf[i] > 9){
					buf[i+1] += buf[i]/10;
					buf[i] = buf[i]%10;
				}
			}
			if(buf[80] != 0) cout<<of<<endl;
			else{
				int flag = 79;
				while(buf[flag] == 0 && flag != 0){ flag--; }

				for(int i=flag; i>=0; i--){
					cout<<buf[i];
				}
				cout<<endl;
			}

		}
	}
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){

    int n;
    cin>>n;
    rep(i,n){
        string a,b;
        cin>>a>>b;
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        if(b.size()>a.size()){
            swap(a,b);
        }
        int keta=b.size();
        int ans[100];
        rep(i,n)ans[i]=0;
        int kuri=0;
        for(int i=0;i<b.size();i++){
           // char o=a[i];char oo=b[i];
           // int aa=atoi(&o);int bb=atoi(&oo);
            int aa=a[i]-'0';int bb=b[i]-'0';
            ans[i]=(aa+bb+kuri)%10;
           // cout<<a[i]<<b[i]<<endl;
            cout<<aa<<bb<<endl;
            kuri=(aa+bb+kuri)/10;
        }
        for(int i=b.size();i<=100&&i<a.size();i++){
            keta++;
            //char oo=a[i];
            int aa=a[i]-'0';
            ans[i]=kuri+aa;
            kuri=0;
        }
        if(keta>=80){
            cout<<"overflow"<<endl;
        }else{
            for(int i=keta-1;i>=0;i--){
                cout<<ans[i];
            }
            cout<<endl;
        }
    }
    
    return 0;
}