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 <string.h>
#include <cmath>
#include <stdio.h>

int main()
{
	int n;
	char a[10000],b[10000],sum[10000];
	int len_a,len_b,len_max;
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%s",a);
		scanf("%s",b);
		len_a = strlen(a);
		len_b = strlen(b);
		
		if(len_a > 80 || len_b > 80){
			printf("overflow\n");
			continue;
		}

		if(len_a > len_b){
			len_max = len_a;
		}else{
			len_max = len_b;
		}
		for(int j = 1; j <= len_max; j++){
			if(len_a - j < 0){
				sum[len_max - j] = b[len_b - j];
			}else if(len_b - j < 0){
				sum[len_max - j] = a[len_a - j];
			}else{
				sum[len_max - j] = a[len_a - j] + b[len_b - j] - '0';
			}
		}
		sum[len_max] = '\0';
		for(int j = len_max - 1; j >= 0; j--){
			if(sum[j] > '9' && j > 0){
				sum[j] = sum[j] - 10;
				sum[j - 1]++;
			}
		}
		if(sum[0] > '9' && len_max == 80){
			printf("overflow\n");
			continue;
		}
		if(sum[0] > '9'){
			sum[0] = sum[0] - 10;
			printf("1");
		}
		printf("%s\n",sum);
	}
	return 0;
}

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

int main(void)
{
    int N,j,k=0;
    cin >> N;
    char strA[100],strB[100];
    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;
        }
        char str1[strlen(strA)][2],str2[strlen(strB)][2];
        for(int i=0 ; i<strlen(strA) ; i++){
            str1[i][0]=strA[i];
            str1[i][1]='\0';
        }
        for(int i=0 ; i<strlen(strB) ; i++){
            str2[i][0]=strB[i];
            str2[i][1]='\0';
        }
        int a[81]={0},b[81]={0};
        j=strlen(strA)-1;
        for(int i=80 ; j>=0 ; i--){
            a[i]=atoi(str1[j]);
            j--;
        }
        j=strlen(strB)-1;
        for(int i=80 ; j>=0 ; i--){
            b[i]=atoi(str2[j]);
            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 <string.h>

class overflow {
public:
	overflow() {};
};

class BigNum {
public:
	BigNum() : c(0), keta(0), size(0) {} ;

	BigNum(int n) : keta(0) {
		size = n;
		c = new char [size];
		memset(c, 0, size);
	};

	BigNum(const char* buf) {
		keta = strlen(buf);
		if (buf[keta-1] == '\n') {
			keta --;
		}
		if (keta > 80) {
			throw overflow();
		}
		size = keta;
		c = new char [size];
		int k = 0;
		for (int i = keta - 1; i >= 0; i--) {
			c[k++] = buf[i] - '0';
		}
	};

	BigNum(BigNum& b) {
		size = b.size;
		keta = b.keta;
		c = new char [size];
		memcpy(c, b.c, size);
	};

	BigNum& operator=(const BigNum& b) {
		size = b.size;
		keta = b.keta;
		c = new char [size];
		memcpy(c, b.c, size);

		return *this;
	};

	~BigNum() {
		if (c) {
			delete [] c;
		}
	};

	BigNum add(BigNum& n) {
		BigNum* a;
		BigNum* b;

		if (keta > n.keta) {
			a = this;
			b = &n;
		} else {
			a = &n;
			b = this;
		}

		BigNum r(a->keta + 1);

		int h;
		int m = 0;
		int i;
		for (i = 0; i < a->keta; i++) {
			if (i < b->keta) {
				h = a->c[i] + b->c[i] + m;
				m = h / 10;
				r.c[i] = h % 10;
			} else {
				h = a->c[i] + m;
				m = h / 10;
				r.c[i] = h % 10;
			}
		}
		if (m > 0) {
			r.c[i] = m;
			r.keta = i+1;
		} else {
			r.keta = i;
		}

		if (r.keta > 80) {
			throw overflow();
		}

		return r;
	};

	void print(void) const {
		for (int i = keta - 1; i >= 0; i --) {
			printf("%d", c[i]);
		}
		printf("\n");
	};

	char* c;
	int keta;

private:
	size_t size;
};

int
main(void)
{
	char line[100];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	try {
		for (int i = 0; i < n; i++) {
			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			BigNum a(line);

			if (fgets(line, sizeof line, stdin) == NULL) {
				return 1;
			}
			BigNum b(line);

			BigNum r;
			r = a.add(b);

			r.print();
		}
	}
	catch (overflow) {
		printf("overflow\n");
	}

	return 0;
}

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

using namespace std;

void Solution()
{
    int i, j, n, f;
    
    string s1,s2;
    
    cin>>n;
    
    while(n--)
    {
        cin>>s1>>s2;
        
        f=0;
        
        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;
            
            f++;
        }
        
        if(s1.size() + f <= 80)
        {
            if(f) cout<<"1";
           
            cout<<s1;
        }
        else
        {
            cout<<"overflow";
        }
        
        cout<<endl;
    }
}

int main()
{
    Solution();
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int n;
	cin>>n;
	rep(i,n){
		string a,b;
		cin>>a>>b;
		if(a.size()<b.size())swap(a,b);
		while(a.size()!=b.size())b="0"+b;
		for(int i=a.size()-1;i>=0;i--){
			a[i]+=b[i]-'0';
			if(a[i]>'9'){
				a[i]-=10;
				if(i)a[i-1]++;
				else a="1"+a;
			}
		}
		if(a.size()>80)cout<<"overflow"<<endl;
		else cout<<a<<endl;
	}
}

C++: import sys

n = int(input())
for i in range(n):
    a = int(input())
    b = int(input())
    if a + b >= 10**80:
        print ("overflow")
    else:
        print(a + b)