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<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    for(int j=0;j<n;j++){
        string a,b;
        cin>>a>>b;
        int numa[100000]={0},numb[100000]={0};
        int flag=0;
        vector<int> sum;
        if(80<max(a.size(),b.size())){
            puts("overflow");
            goto exit;
        }
        for(int i=a.size()-1,k=0;0<=i;i--,k++)numa[k]=a[i]-'0';
        for(int i=b.size()-1,k=0;0<=i;i--,k++)numb[k]=b[i]-'0';
        for(int i=0;i<max(a.size(),b.size());i++){
            sum.push_back((numa[i]+numb[i])%10);
            numa[i+1]+=(numa[i]+numb[i])/10;
            if(i==max(a.size(),b.size())-1&&(numa[i]+numb[i])/10==1)printf("1");
        }
        if(80<sum.size())puts("overflow");
        else{
            for(int i=sum.size()-1;0<=i;i--)printf("%d",sum[i]);
            puts("");
        }
exit:
;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i){
		string a,b,c;
		char d=0,st;
		cin>>a>>b;
		for(int j=a.size();j<81;++j) a="0"+a;
		for(int j=b.size();j<81;++j) b="0"+b;
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		for(int j=0;j<80;++j){
			c+=(((a[j]-'0')+(b[j]-'0')+d)%10+'0');
			d=((a[j]-'0')+(b[j]-'0')+d)/10;
		}
		if(d) cout<<"overflow\n";
		else{
			reverse(c.begin(), c.end());
			for(st=0;st<c.size();++st)if(c[st]!='0')break;
			cout<<((st==c.size())?"0\n":c.substr(st,c.size()-st)+"\n");
		}
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
using namespace std;
typedef pair<int,int> P;
const int INF = ~(1<<31) / 2;

int main(){
    int k;
    cin >> k;
    for(int j=0;j<k;j++){
        int n[80];
        string a,b;
        cin >> a >> b;
        int n_a = a.size(),n_b = b.size();
        fill(n,n+80,0);

        bool is_over = false;
        for(int i=0;i<max(n_a,n_b);i++){
            int ai,bi;
            if (i<n_a) ai = a[n_a-i-1]-'0';
            else ai = 0;
            if (i<n_b) bi = b[n_b-i-1]-'0';
            else bi = 0;
            n[i] += ai + bi;
            if (n[i]>=10){
                if(i+1 == 80){
                    is_over = true;
                    break;
                }else{
                    n[i+1] += n[i]/10;
                    n[i] = n[i]%10;
                }
            }
        }
        if (is_over){
            cout << "overflow" << endl;
        }else{
            bool started = false;
            for(int i=79;i>=0;i--){
                if(!started && n[i]>0){
                    started = true;
                }
                if(started){
                    cout << n[i];
                }
            }
            cout << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
const int DIGIT=9;

int main() {
  int n;
  char buf[81];
  int l, x, y;
  char buf_part[DIGIT+1];
  int a[2][9];
  int b[9];

  cin >> n;
  while (n--) {
    for (int i=0; i<2; i++) {
      cin >> buf;
      l = strlen(buf);
      x = (l+DIGIT-1)/DIGIT;
      y = (l-1)%DIGIT+1;
      for (int j=0; j<9; j++) {
        a[i][j] = 0;
      }
      for (int j=0; j<x; j++) {
        if (!j) {
          memcpy(buf_part, buf, y);
          buf_part[y] = '\0';
        }
        else {
          memcpy(buf_part, &buf[y+DIGIT*(j-1)], DIGIT);
          buf_part[DIGIT] = '\0';
        }
        a[i][x-j-1] = atoi(buf_part);
      }
    }

    for (int i=0; i<9; i++) b[i] = 0;
    x = 0;
    for (int i=0; i<9; i++) {
      if (a[0][i] || a[1][i]) {
        b[i] = a[0][i] + a[1][i];
        if (b[i] >= 1000000000) {
          a[0][i+1]++;
          b[i] -= 1000000000;
        }
        x++;
      } else {
        break;
      }
    }
    if (b[8] >= 100000000) {
      cout << "overflow" << endl;
    } else {
      cout << b[x-1];
      for (int i=x-2; i>=0; i--) {
        cout.fill('0');
        cout.width(DIGIT);
        cout << b[i];
      }
      cout << endl;
    }
  }
  return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
	int n = 0;
	char i1[100], i2[100], o[100];
	int d1[81], d2[81], d[81];
	int c = 0;

	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%s", i1);
		scanf("%s", i2);
		if(strlen(i1) > 80 || strlen(i2) > 80){
			puts("overflow");
			continue;
		}
		for(int j=0;j<81;++j){
			d1[j] = d2[j] = d[j] = 0;
		}
		for(int j=strlen(i1)-1;j>=0;--j){
			d1[j] = *(i1 + j) - '0';
		}
		for(int j=strlen(i2)-1;j>=0;--j){
			d2[j] = *(i2 + j) - '0';
		}
		for(int j=0;j<81; ++j){
			d[j] = d1[j] + d2[j] + c;
			c = d[j] >= 10 ? 1 : 0;
			d[j] -= 10 * c;
		}
		for(c=80; c>=0; --c){
			if(d[c] != 0){
				break;
			}
		}
		if(c == 80){
			puts("overflow");
			continue;
		}
		for(int j = 0; j<=c; ++j){
			o[j] = d[c - j] + '0';
		}
		o[c + 1] = '\0';
		printf("%s\n", o);
	}
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		string s1,s2;
		cin >> s1 >> s2;
		vector<int> ans;
		int k=0;
		for(int j=0;j<1000;j++)
		{
			int num=0;
			int a=s1.size()-1-j,b=s2.size()-1-j;
			if(a<0&&b<0&&k==0)break;
			if(a>=0)num+=s1[a]-'0';
			if(b>=0)num+=s2[b]-'0';
			ans.pb((num+k)%10);
			if(num+k>=10)k=1;
			else k=0;
		}
		if(ans.size()>80)
		{
			printf("overflow\n");
			continue;
		}
		for(int j=ans.size()-1;j>=0;j--)
		{
			cout << ans[j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <stack>

using namespace std;

int main(void){
	stack <char> buffer;
	int a[80],n,i,j;
	char buffer2;
	cin >> n;
	scanf(" ");
	for (int i = 0; i < n; i++)
	{
		for(j=0;j<80;j++) a[j]=0;
		buffer2 = 0;
		for(j=0;;j++){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			if(j>=80) goto error;
			buffer.push(buffer2);
		}
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		buffer2 = 0;
		for(j=0;;j++){
			scanf("%c",&buffer2);
			if(buffer2=='\n') break;
			if(j>=80) goto error;
			buffer.push(buffer2);
		}
		for(j=0;!buffer.empty();j++){
			a[j]+=buffer.top()-'0';
			buffer.pop();
		}
		for(j=0;a[j]!=0;j++){
			if(a[j]>=10){a[j]-=10;a[j+1]++;}
		}
		for(j=79;a[j]==0;j--);
		for(;j>=0;j--){
			cout << a[j];
		}
		goto normal;
		error : cout << "overflow";
		normal : cout << endl;
	}
	return 0;
}