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>
#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;
}

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

int main(void)
{
int N,j,k=0;
cin >> N;
char strA[300],strB[300];
while(1){
k++;
if(k==N+1){
break;
}
cin >> strA >> strB;
int ans[81]={0};
ans[0]=11111;
if(strlen(strA)>80||strlen(strB)>80){
cout << "overflow" << endl;
continue;
}
int a[81]={0},b[81]={0};
if(strA[strlen(strA)-1]=='0'&&strB[strlen(strB)-1]=='0'){
    cout << 0 << endl;
    continue;
}
j=strlen(strA)-1;
for(int i=80 ; j>=0 ; i--){
a[i]=(int)strA[j]-48;
j--;
}
j=strlen(strB)-1;
for(int i=80 ; j>=0 ; i--){
b[i]=(int)strB[j]-48;
j--;
}
for(int i=80 ; i!=0 ; i--){
ans[i]=ans[i]+a[i]+b[i];
if(ans[i]>=10){
ans[i]=ans[i]-10;
ans[i-1]++;
}
}
if(ans[0]!=11111){
cout << "overflow" << endl;
continue;
}
for(int i=1 ; i<81 ; i++){
if(ans[i]!=0){
j=i;
break;
}
}
char c[3];
for(int i=j ; i<81 ; i++){
printf("%c",ans[i]+48);
}
cout << '\n';
}
return 0;
}

C++: #include <stdio.h>
#include <math.h>

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool overflowFLG;
	int n,length1,length2,kuriagari,tmp,output[101];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=81 || length2 >= 81)printf("overflow\n");
		else{
			overflowFLG=false;
			kuriagari=0;
			if(length1>length2){
				for(int k=0;length1-1-k>=0;k++){
					tmp = kuriagari;
					if(length2-1-k>=0){
						tmp += (buf1[length1-1-k]-'0')+(buf2[length2-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;
						}else{
							kuriagari = 0;
						}
						output[length1-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length1-1-k] = buf1[length1-1-k]-'0';
						}else{
							output[length1-1-k] = buf1[length1-1-k]-'0' + kuriagari;
							if(output[length1-1-k]>=10){
								output[length1-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length1-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}else{
				for(int k=0;length2-1-k>=0;k++){
					tmp = kuriagari;
					if(length1-1-k>=0){
						tmp += (buf2[length2-1-k]-'0')+(buf1[length1-1-k]-'0');
						if(tmp>=10){
							tmp %= 10;
							kuriagari = 1;
							if(k==79)overflowFLG=true;

						}else{
							kuriagari = 0;
						}
						output[length2-1-k] = tmp;
					}else{
						if(kuriagari == 0){
							output[length2-1-k] = buf2[length2-1-k]-'0';
						}else{
							output[length2-1-k] = buf2[length2-1-k]-'0' + kuriagari;
							if(output[length2-1-k]>=10){
								output[length2-1-k] %= 10;
								kuriagari = 1;
								if(k==79)overflowFLG=true;
							}else{
								kuriagari = 0;
							}
						}
					}
				}
				if(overflowFLG){
					printf("overflow\n");
				}else{
					if(kuriagari == 1)printf("1");
					for(int k=0;k<=length2-1;k++){
						printf("%d",output[k]);
					}
					printf("\n");
				}
			}
		}
	}

    return 0;
}

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

int main () {
    int n;
    string a, b;
    
    cin >> n;
    for(int i=0;i<n;i++){
        int x[81]={0}, y[81]={0}, z[81]={0};
        
        cin >> a;
        cin >> b;
        
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        
        for(int j=0;j<a.size();j++){
            x[j]=a[j]-'0';
        }
        for(int j=0;j<b.size();j++){
            y[j]=b[j]-'0';
        }
        int c=0;
        int r;
        for(int j=0;j<80;j++){
            r=x[j]+y[j]+c;
            if (r >= 10){
                z[j]=r%10;
                c=1;
            }else{
                z[j]=r;
                c=0;
            }
        }
        
//        if(z[80]==1){
//            cout << "overflow" <<endl;
//        }else{
            bool flag = 0;
            for(int j=79;j>=0;j--){
                if(z[j]==0 && flag==0){
                    continue;
                }else{
                    flag=1;
                }
                cout<<z[j];
            }
            if(flag==0){
                cout<<0;
            }
            cout<<endl;
            
//        }
    }
    return 0;
}

C++: #include <stdio.h>
#include <math.h>

using namespace std;


int main(){
	char buf1[101],buf2[101];
	bool FLG1,FLG2;
	int n,length1,length2,S1,S2,num1_index,num2_index,kuriagari=0;
	int output[9],num1[9],num2[9];
	scanf("%d",&n);

	for(int loop=0;loop<n;loop++){
		length1 = length2 = 0;
		scanf("%s",buf1);
		scanf("%s",buf2);
		for(int i=0; buf1[i] !='\0';i++)length1++;
		for(int i=0; buf2[i] !='\0';i++)length2++;

		if(length1 >=80 || length2 >= 80)printf("overflow\n");
		else{
			FLG1=FLG2=false;
			num1_index = num2_index = 0;
			for(int k=0;k<9;k++){
				num1[k] = num2[k] = output[k]=-1;//????????¨??????????????????
			}

			for(int k=0;k<81&&(FLG1==false||FLG2==false);){
				S1=S2=0;
				for(int p=0;p<9&&k<81;p++,k++){
					if(k <= length1-1){
						S1 = 10*S1 + (buf1[k] - '0');
					}else{
						FLG1=true; //??????
					}

					if(k <= length2-1){
						S2 = 10*S2+(buf2[k] - '0');
					}else{
						FLG2=true; //??????
					}
				}
				if(S1!=0||FLG1==false){
					num1[num1_index++] = S1;
				}
				if(S2!=0||FLG2==false){
					num2[num2_index++] = S2;
				}
			}

			for(int calc=0;calc<=8;calc++){
				if(num1[calc] == -1 && num2[calc] == -1){
					break;
				}else{
					output[calc] = kuriagari;
					if(num1[calc] != -1){
						output[calc] += num1[calc];
					}
					if(num2[calc] != -1){
						output[calc] += num2[calc];
					}
					if(output[calc]/1000000000 >= 1){
						kuriagari = output[calc]/1000000000;
						output[calc] %= 1000000000;
					}else{
						kuriagari = 0;
					}
				}
			}

			if(output[8]/10000000 >= 1){
				printf("overflow\n");
			}else{
				bool firstFLG=true;
				for(int show=8;show>=0;show--){
					if(output[show] != -1){
						if(firstFLG == false && output[show] < 100000000){
							printf("%09d",output[show]);
						}else{
							printf("%d",output[show]);
							firstFLG = false;
						}
					}
				}
				printf("\n");
			}
		}
	}

    return 0;
}