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>
#include<iostream>
#include<algorithm>
using namespace std;
string a,b,sum;
void check(int z,int x);
int A,B;
int main(void){
    int n;
    cin>>n;
    while(n--){
        a="",b="",sum="";
        cin>>a>>b;
        if(a.length()>80||b.length()>80){
            sum="overflow";
            goto end;
        }
        A=a.length(),B=b.length();
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        if(A<B)swap(A,B),swap(a,b);
        for(int i=0;i<=A-B;i++)b+="0";
        check(0,0);
        if(sum.length()>80){
            sum="overflow";
            goto end;
        }
        reverse(sum.begin(),sum.end());
        end:;
        cout<<sum<<endl;
    }
    return 0;
}
void check(int z,int x){
    int i;
    if(a[z]==0)a[z]='0';
    if(b[z]==0)b[z]='0';
    if(z==81||(z>A&&z>B&&x==1)||(z>=A&&z>=B&&x==0)){
            x=0;
            return;
    }
    i=(int)a[z]-'0' + (int)b[z]-'0' + x,x=0;
    if(i>=10)x=1,i-=10;
    sum+=i+'0';
    check(z+1,x);
}

C++: #include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>
#include <stack>

using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)

typedef pair<int, int> P;


int main()
{
	int n;
	string a, b;
	cin >> n;
	REP(i, n){
		int a_a[85] = { 0 };
		int b_a[85] = { 0 };
		int c_a[85] = { 0 };
			cin >> a >> b;
			if (a.length() >= 80 || b.length() >= 80){
				cout << "overflow" << endl;
			}

			REP(i, a.length()){
				a_a[i] = a[a.length() - i -1] - '0';
			}
			
			REP(i, b.length()){
				b_a[i] = b[b.length() - i -1] - '0';
			}

			REP(i, 84){
				int temp = a_a[i] + b_a[i] + c_a[i];
				c_a[i + 1] += temp / 10;
				c_a[i] = temp % 10;
			}
			int i = 84;
			while (!c_a[i] && i)--i;
			if (i >= 80){
				cout << "overflow" << endl;
			}
			while (i >= 0){
				cout << c_a[i];
				--i;
			}
			cout << endl;
		}
	return 0;
}

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

int main(){
  int j;
  int n;
  char s1[111];
  char tmp[111];
  char s2[111];
  char ans[111];
  int  kuri = 0;
  cin >> n;
  while(n--){
  memset(ans,0,sizeof(ans));
  memset(s1,0,sizeof(s1));
  memset(s2,0,sizeof(s2));
  memset(tmp,0,sizeof(tmp));
  cin >> s1 >> s2;
  if(strlen(s1) > 80 || strlen(s2)> 80){
    cout << "overflow" << endl;
  }
  else if(strlen(s1) < strlen(s2)){
    for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
    for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
    for(int i=0;i<strlen(s2);i++){
      if((s2[i] + (s1[i]%'0') + kuri) > '9'){
	ans[i] = (s2[i] + (s1[i]%'0') + kuri)-10;
	kuri = 1;
      }
      else {
	ans[i] = (s2[i] + (s1[i]%'0') + kuri);
	kuri = 0;
      }
      if(i == strlen(s2)-1 && kuri == 1) ans[i+1] = '1';
    }
    if(strlen(ans) > 80) cout << "overflow" << endl;
    else{
      for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
    }
  }
  else{
    for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
    for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
    for(int i=0;i<strlen(s1);i++){
      if((s1[i] + (s2[i]%'0') + kuri) > '9'){
	ans[i] = (s1[i] + (s2[i]%'0') + kuri)-10;
	kuri = 1;
      }
      else {
	ans[i] = (s1[i] + (s2[i]%'0') + kuri);
	kuri = 0;
      }
      if(i == strlen(s1)-1 && kuri == 1) ans[i+1] = '1';
    }
    if(strlen(ans) > 80) cout << "overflow" << endl;
    else{
      for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
    }
  }
  cout << endl;
  }
}

C++: #include<stdio.h>
#include<string.h>
int c[1000];
int a[1000];
int b[1000];
char s1[1000];
char s2[1000];
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        memset(a,0,sizeof(a));
        memset(b,0,sizeof(b));
        memset(c,0,sizeof(c));
        memset(s1,'\0',sizeof(s1));
        memset(s2,'\0',sizeof(s2));
        scanf("%s %s",s1,s2);
        int x=strlen(s1);
        int y=strlen(s2);
        int m;
        int j=0;
        if(x>80||y>80)
            printf("overflow\n");
        else
        {
            for(int i=x-1; i>=0; i--)
            {
                a[j++]=s1[i]-'0';
            }
            int k=0;
            for(int i=y-1; i>=0; i--)
            {
                b[k++]=s2[i]-'0';
            }
            if(x<y)
            {
                m=x;
                x=y;
                y=m;
            }
            int l=0;
            for(int i=0; i<x+1; i++)
            {
                c[i]=a[i]+b[i]+l;
                if(c[i]>=10)
                {
                    l=c[i]/10;
                    c[i]=c[i]%10;
                }
                else
                    l=0;
            }
            int n=0;
            for(int i=x; i>=0; i--)
            {
                if(c[i]!=0)
                {
                    n=i;
                    break;
                }
            }
            if(n==0&&a[0]==0&&b[0]==0)
                printf("0\n");
            else if(n>80)
                printf("overflow\n");
            else
            {
                for(int i=n; i>=0; i--)
                    printf("%d",c[i]);
                printf("\n");
            }
        }
    }
}

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

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

using namespace std;

int main(){
    
    string d;
    string e;
    
    
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        int f[81]={0};
        int g[81]={0};
        int h[81]={0};
        
        cin>>d;
        cin>>e;
        
        int j=81;
        for(int i=(int)d.length()-1; i>=0; i--){
            f[j] = (d[i]-'0');
            j--;
        }
        j=81;
        for(int i=(int)e.length()-1; i>=0; i--){
            g[j] = (e[i]-'0');
            j--;
        }
        

        
//        for(int i=0; i<=81; i++){
//            printf("%d",f[i]);
//        }
//        printf("\n");
//        
//        for(int i=0; i<=81; i++){
//            printf("%d",g[i]);
//        }
//        printf("\n");
        
        int temp=0;
        for(int i=81; i>=0; i--){
            temp = temp + f[i]+g[i];
            h[i] = temp % 10;
            temp = temp /10;
        }
        j=0;
        while(h[j]==0){
            j++;
        }
        
        for(int i=j; i<=81; i++){
            printf("%d",h[i]);
        }
        printf("\n");
    }
    
    
}