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<algorithm>
#include<string>
#include<vector>


#define MAX 1000


//99999999999999999999999999999999999999999999999999999999999999999999999999999999

using namespace std;


int main()
{
	int n = 0;
	string in[2];
	char out[MAX] = {NULL};

	cin >> n;

	for (int i = 0; i < n; i++){
		vector<int>v;

		cin >> in[0] >> in[1];

		int len[2];
		len[0] = in[0].size();
		len[1] = in[1].size();

		//けた上がり
		int up = 0;

		for (int i = 0; i < max(len[0] , len[1]) || up == 1; i++){
			
			//足す値
			int push = up;
			up = 0;

			//indexの範囲内
			if(i < len[0]){
				push += in[0][len[0] - i - 1] - '0';
			}
			if (i < len[1]){
				push += in[1][len[1] - i - 1] - '0';
			}
			if (push > 9){
				push -= 10;
				up = 1;
			}

			v.push_back(push);
		}

		if (v.size() > 80){
			cout << "overflow" << endl;
			continue;
		}
		for (int i = v.size() - 1; i >= 0; i--){
			cout << v[i];
		}
		cout << endl;
	}

	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cstring>

#define A strlen(a)
#define B strlen(b)
#define ANS strlen(ans)

using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    char x=0;
    for(int q = 0;q < n; q++){
        int f = 0;
        bool check[1000]={0};
        char a[1000]={0},b[1000]={0},ans[1000]={0};
        scanf("%s%s",a,b);
        reverse(a,a+A);
        reverse(b,b+B);

        int len1 = max(A,B);
        int len2 = min(A,B);

        (len1 == A) ? f=1 : f=2;

        if(len2 > 80 || len1 > 80){
            printf("overflow\n");
            continue;
        }

        for(int i = 0;i < len1; i++){
            if(a[i] == '0' && b[i] != '0'&&b[i] != 0){
                b[i] -= 48;
                ans[i] = b[i];
                //printf("o_o\n");
                continue;
            }
            if(a[i] != '0' && b[i] == '0'&&a[i] != 0){
                a[i] -= 48;
                ans[i] = a[i];
                continue;
            }
            if(a[i] == '0' && b[i] == '0'){
                ans[i] = '0';
                check[i] = 1;
                continue;
            }
            //printf("uu%d %d\n",A,B);
            if(i >= len2){
                //printf("('ω')v\n");
                //printf("f = %d\n",f);
                if(f == 1)ans[i] = a[i];
                if(f == 2)ans[i] = b[i];
                check[i] = 1;
                //printf("yoyo\n");
                continue;
            }
            a[i] -= 48;
            b[i] -= 48;
            x = a[i] + b[i];
            ans[i]= x;
        }
        for(int i = 0;i < ANS; i++){
            if(check[i] == 1){
                if(ans[i] >= 58){
                    if(ans[i] == 58){
                        ans[i] = '0';
                        ans[i+1]++;
                        continue;
                    }
                    else {
                        ans[i] -= 10;
                        ans[i+1]++;
                    }
                }
                //printf("yo-\n");
                continue;
            }
            else if(ans[i] >= 10){
                //printf("yo-yo-\n");
                if(ans[i] == 10){
                    ans[i] = '0';
                    ans[i+1]++;
                    continue;
                }
                else {
                    ans[i] = ans[i] - 10;
                    ans[i+1]++;
                }
            }
            ans[i] += 48;
        }

        reverse(ans,ans+ANS);

        (ANS > 80) ? printf("overflow\n") : printf("%s\n",ans);
    }
    return 0;
}

C++: #include <stdio.h>

void rev_str(char str[128]) {
	int length = 0;
	char str2[128];
	int temp;

	int i;

	for(i = 0; i < 128; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[128];
	char input_b[128];
	char ans[128];
	char kuriagari = 0;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 128; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[i] = '\0';
		}

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}
		
		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[i] = kuriagari + '0';
		}
		
		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[i] = input_a[i];
			i++;
		}

		rev_str(ans);

		if(ans[81])
			printf("overflow");
		else
			printf("%s", ans);

		putchar('\n');
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


const int lim = 80;

int main()
{
	int n;
	cin >> n;
	rep(i, n)
	{
		int ans[128];
		memset(ans, 0, sizeof(ans));
		string a, b;
		cin >> a >> b;

		int ai = a.size()-1, bi = b.size()-1;
		for(int i = 0; ai >= 0 || bi >= 0; ai--, bi--, i++)
		{
			int as = (ai >= 0 ? a[ai] - '0' : 0), bs = (bi >= 0 ? b[bi] - '0' : 0);

			ans[i] += as + bs;
			ans[i+1] += 9 < ans[i];
			if(9 < ans[i]) ans[i] -= 10;

			if(i == lim + 4) break;
		}


		if(ans[lim] != 0 ||(lim < a.size() || lim < b.size()))
		{
			cout << "overflow" << endl;
		}
		else
		{
			int index = 0;
			rep(i, lim)
				if(ans[i] != 0)
					index = i;

			for(int i = index; i >= 0; i--)
				cout << ans[i];

			cout << endl;
		}
	}
}

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

using namespace std;

int main(){
	int n,l1,l2,i;
	string a, b;
	char *ans;
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80)cout<<"overflow"<<endl;
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		ans=new char[l1+1];
		for(i=0;i<l1;i++)ans[i]='0';
		for(i=1;i<l2+1;i++){
			ia=(int)a[l1-i]-(int)'0';
			ib=(int)b[l2-i]-(int)'0';
			sum=ia+ib;
			ans[l1-i]+=sum;
		}
		for(i=l2+1;i<l1+1;i++){
			ans[l1-i]=a[l1-i];
		}
		for(i=0;i<l1;i++){
			if(ans[i]-'0'>9){
				ans[i]=ans[i]-10;
				ans[i-1]+=1;
			}
		}
		for(i=0;i<l1;i++){
			cout<<(int)ans[i]-'0';
		}
		cout<<endl;
	}
	while(1);
	return 0;
}