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>

int main(){
	int a[82] = {};
	int b[82] = {};
	int c[82] = {};
	int n;
	int k,l,m,f;
	char t;
	int of;

	scanf("%d", &n);

	for(int i = 0; i < n; i++){
		of = k = l = 0;
		scanf("%c", &t);
		while(t - 10){
			k++;
			a[k] = t - '0';
			scanf("%c", &t);
			if(k == 81){
				of = 1;
				while(t - 10){
					scanf("%c", &t);
				}
			}
		}
		scanf("%c", &t); 

		while(t - 10){
			l++;
			b[l] = t - '0';
			scanf("%c", &t);
			if(l == 81){
				of = 1;
				while(t - 10){
					scanf("%c", &t);
				}
			}

		}

		m = 0;
		f = 0;

		while(k - m){
			c[m] = a[k - m];
			m++;
		}
		m = 0;
		while(l - m){
			c[m] += b[l - m ] + f;
			f = 0;
			if(c[m] > 9){
				c[m] -= 10;
				f = 1;
			}
			m++;
		}

		while(f){
			c[m] += 1;
			f = 0;
			if(c[m] > 9){
				c[m] -= 10;
				f = 1;
			}
			m++;
		}

		if(k > m){
			m = k;
		}

		for(int i = 0; i < m; i++){
			if(m == 81 || of){
				printf("overflow ");
				f = 1;
				i = m;
			}else{
				if((c[m - i -1]) || f){
					printf("%d", c[m - i - 1]);
					f = 1;
				}
			}
		}
		if(f - 1){
			printf("0");
		}
		printf("\n");
	}
	return 0;
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 int main()
 {
   int N;
   cin>>N;
   while(N--)
   {
     string a,b,sum;
     cin>>a>>b;
     int up=0;
     int i;
     for(int j=0;j<a.length()/2;j++) swap(a[j],a[a.length()-j-1]);
     for(int j=0;j<b.length()/2;j++) swap(b[j],b[b.length()-j-1]);
     for(i=0;i<a.length()&&i<b.length();i++)
     {
       sum+=(((a[i]-'0')+(b[i]-'0')+up)%10)+'0'; 
       if(a[i]-'0'+b[i]-'0'+up>=10) up=1;   
       else up=0;  
     }          
     while(i<a.length()) 
     {
       sum+=((a[i]-'0'+up)%10)+'0';
       if(a[i]-'0'+up>=10) up=1; 
       else up=0;         
       i++;          
     }
     while(i<b.length()) 
     {
       sum+=((b[i]-'0'+up)%10)+'0';
       if(b[i]-'0'+up>=10) up=1; 
       else up=0;
       i++;                   
     }
     if(up==1) sum+='1';
     if(sum.length()>=80) cout<<"overflow"<<endl;
     else
     {
       for(int i=sum.length()-1;i>=0;i--) cout<<sum[i];
       cout<<endl;    
     }
   }
   //while(1);      
   return 0;    
 }

C++: #include <iostream>
#include <algorithm>
#include <string>
 
using namespace std;
 
char calc(char x,char y,char z,bool &C){
  int a = x - '0',b = y - '0',c = z - '0';
  int d = a + b + c;
 
  if(d >= 10){
    C = true;
    d -= 10;
  }
 
  return d + '0';
}
 
string sum(string a,string b){
  string res = "";
 
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
 
  int length;
  if((int)a.size() > (int)b.size()){
    length = (int)a.size();
     
    for(int i = (int)b.size() ; i < length ; i++){
      b += '0';
    }
 
  }
  else{
    length = (int)b.size();
 
    for(int i = (int)a.size() ; i < length ; i++){
      a += '0';
    }
 
  }
 
  for(int i = 0 ; i <= length ; i++)
    res += '0';
 
  for(int i = 0 ; i < length ; i++){
    bool C = false;
    res[i] = calc(a[i],b[i],res[i],C);
    if(C) res[i+1] = ((res[i+1]-'0') + 1) + '0';
  }

  for(int i = length ; i > 0; i--){
     
    if(res[i] == '0'){
      res.erase(res.begin()+i);
    }
    else{
      break;
    }
     
  }
 
  reverse(res.begin(),res.end()); 
 
  return res;
}

int main(){
  int n;

  cin >> n;
  while(n--){
    string a,b;

    cin >> a >> b;

    string c = sum(a,b);    

    if((int)c.size() > 80) cout << "overflow" << endl;
    else cout << c << 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] -= 48;
                ans[i] = b[i];
                continue;
            }
            if(a[i] != '0' && b[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;
                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]++;
                    }
                }
                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 <iostream>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i, 0, n)
using namespace std;
int a[81], b[81];
int main()
{
    int n; cin >> n;
    while (n--) {
        rep(i, 81) a[i] = b[i] = 0;
        string s, t;
        cin >> s >> t;
        rep(i, s.size()) a[i] = s[s.size()-i-1]-'0';
        rep(i, t.size()) b[i] = t[t.size()-i-1]-'0';

        int c = 0;
        rep(i, 81) {
            a[i] = a[i] + b[i] + c;
            if (a[i] >= 10) { a[i] -= 10; c = 1; }
            else c = 0;
        }
        if (a[80] != 0)
            cout << "overflow" << endl;
        else {
            int k = 80; while (k > 0 && a[k] == 0) k--;
            for (int i = k; i >= 0; --i) cout << a[i];
            cout << endl;
        }
    }
    return 0;
}