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 <cstring>
using namespace std;

#define NUMBER_DIGITS 80

int main()
{
  int N;
  char str1[NUMBER_DIGITS + 1];
  char str2[NUMBER_DIGITS + 1];
  char str3[NUMBER_DIGITS / 2 + 1][3];
  char str4[NUMBER_DIGITS / 2 + 1][3];
  int n1[NUMBER_DIGITS / 2 + 1] = {};
  int n2[NUMBER_DIGITS / 2 + 1] = {};
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > NUMBER_DIGITS || m2 > NUMBER_DIGITS)
      cout << "overflow" << endl;
    else if(atoi(str1) <= 2000000000 && atoi(str2) <= 2000000000 && atoi(str1) + atoi(str2) <= 2000000000){
      cout << atoi(str1) + atoi(str2) << endl;
      break;
    }else{
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m1 + 1; i += 2, j--){
	if(m1 % 2 == 1 && m1 - i < 0){
	  str3[j][0] = str1[0];
	  str3[j][1] == '\0';
	}else{
	  strncpy(str3[j], &str1[m1 - i], 2);
	  str3[j][2] == '\0';
	}
      }
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m2 + 1; i += 2, j--){
	if(m2 % 2 == 1 && m2 - i < 0){
	  str4[j][0] = str2[0];
	  str4[j][1] == '\0';
	}else{	  
	  strncpy(str4[j], &str2[m2 - i], 2);
	  str4[j][2] == '\0';
	}
      }
      for(int i = NUMBER_DIGITS / 2; i + ((m1 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m1 / 2; i--)
	if(str3[i][0] == '0' && str3[i][1] == '0')
	  n1[i] = 1000;
	else
	  n1[i] = atoi(str3[i]);
      for(int i = NUMBER_DIGITS / 2; i + ((m2 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m2 / 2; i--)
	if(str4[i][0] == '0' && str4[i][1] == '0')
	  n2[i] = 1000;
	else
	  n2[i] = atoi(str4[i]);
      int ans[NUMBER_DIGITS / 2 + 1] = {};
      int i = 0;
      int m = (m1 > m2) ? m1 : m2;
      for(int j = NUMBER_DIGITS / 2; NUMBER_DIGITS / 2 - 1 - m / 2 < ((m % 2) ? j + 1 : j); i++, j--)
	if(n1[j] + n2[j] >= 100)
	  if(n1[j] == 1000 && n2[j] < 10){
	    n1[j - 1] *= 10;
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] < 10){
	    n2[j - 1] *= 10;
	    ans[i] = n1[j];
	  }else if(n1[j] == 1000 && n2[j] == 1000){
	    if(n1[j - 1] % 10 != 0)
	      n1[j - 1] *= 10;
	    ans[i] = 1000;
	  }else if(n1[j] == 1000 && n2[j] >= 10){
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] >= 10){
	    ans[i] = n1[j];
	  }else if(n1[j] + n2[j] < 110){
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] + 900;
	  }else{
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] - 100;
	  }
	else
	  ans[i] = n1[j] + n2[j];
      int k = i;
      for(; i > 0; i--)
	if((i == k) && (ans[i - 1] == 0))
	  ;
	else if(ans[i - 1] == 1000)
	  cout << "00";
	else if(ans[i - 1] > 1000)
	  cout << "0" << ans[i - 1] % 1000;
	else
	  cout << ans[i - 1];
      cout << endl;
    }
  }
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n,g;
    int k,l;
    bool check;

    cin >> n;
    rep(i,n){
        char c1[81], c2[81];
        int i1[81] = {0}, i2[81] = {0};
        int ans[82] = {0};
        check = false;
        k = 0; l = 0;
        cin >> c1 >> c2;
/*      for(int j = 80; 0 <= j; j--){
            if(j <= strlen(c1) - 1){
                i1[k] = c1[j] - '0';
                k++;
            }
            if(j <= strlen(c2) - 1){
                i2[l] = c2[j] - '0';
                l++;
            }
        }*/
        rep(j, 80){
            ans[j]+= i1[j] + i2[j];
            if(ans[j] >= 10){
                ans[j]-=10;
                ans[j+1]++;
            }
        }
        if(ans[80] != 0){
            cout << "overflow";
        }else{
            for(int j = 81; 0 <= j; j--){
                if(ans[j] != 0){
                    check = true;
                }
                if(check == true)
                    cout << ans[j];
            }
        }
        cout << endl;
    }
}

C++: #include <algorithm>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
using namespace std;

void stlip(vector<int> &v, string &s) {
  for (auto i = s.rbegin(), e = s.rend(); i != e; i++) {
    v.push_back(*i - 48);
  }
}

void print(vector<int> &v) {
  int n;
  string s;
  for (auto i = v.rbegin(), e = v.rend(); i != e; i++) {
    s += to_string(*i);
  }
  if (s.size() > 80)
    cout << "overflow" << endl;
  else
    cout << s << endl;
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    vector<int> v1, v2, ret;
    string a, b;
    bool flag = true;
    cin >> a >> b;
    if (a.size() > 80 || b.size() > 80) {
      cout << "overflow" << endl;
      continue;
    }
    if (a.size() < b.size())
      swap(a, b);
    stlip(v1, a);
    stlip(v2, b);
    v2.resize(v1.size());
    for (int i = 0; i < v1.size(); i++) {
      int tmp;
      tmp = v1[i] + v2[i];
      if (tmp > 9) {
        if (i == v1.size() - 1) {
          v1.resize(v1.size() + 1);
          v2.resize(v1.size() + 1);
        }
        v2[i + 1] += 1;
        tmp -= 10;
      }
      ret.push_back(tmp);
    }
    if (flag)
      print(ret);
  }

  return 0;
}

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

using namespace std;

int main(){
    
    string d[10000];
    string e[10000];
    
    stack<char> st1;
    stack<char> st2;
    stack<int> st3;
    int n=0;
    scanf("%d",&n);
    
    for(int i=0; i<n; i++){
        cin>>d[i];
        cin>>e[i];
    }
    
    
    for(int i=0; i<n; i++){
        for(int j=0; j<(int)(d[i].size()); j++){
            st1.push(d[i][j]);
        }
        for(int j=0; j<(int)(e[i].size()); j++){
            st2.push(e[i][j]);
        }
        int temp=0;
        char temp_char;
        while(st1.empty()==false||st2.empty()==false){
            if(st1.empty()==false&&st2.empty()==false){
                temp_char=st1.top();
                temp+=atoi(&temp_char);
                temp_char=st2.top();
                temp+=atoi(&temp_char);
                st1.pop();
                st2.pop();
            }else if(st1.empty()==false&&st2.empty()==true){
                temp_char=st1.top();
                temp+=atoi(&temp_char);
                st1.pop();
            }else if(st1.empty()==true&&st2.empty()==false){
                temp_char=st2.top();
                temp+=atoi(&temp_char);
                st2.pop();
            }
            st3.push(temp%10);
            temp=temp/10;
        }
        
        if(temp!=0){
            st3.push(temp);
        }
        
        if(st3.size()>=80){
            printf("overflow");
        }else{
            while(st3.empty()==false){
                printf("%d",st3.top());
                st3.pop();
            }
        }
        printf("\n");
    }
    
}

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

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::cin >> i1;
		std::cin >> i2;
		for(int j=0;j<80;j++){
			char c='0';
			if(cflag)
				c+=1;
			cflag=false;
			if(strlen(i1)>j){
				c+=i1[strlen(i1)-j-1]-'0';
			}
			if(strlen(i2)>j){
				c+=i2[strlen(i2)-j-1]-'0';
			}
			if(c > '9'){
				cflag=true;
				c-=10;
			}
			res[79-j]=c;
		}

		if(cflag){
			std::cout << "overflow" << std::endl;
			continue;
		}
		char *p = res;
		while(*p++ == '0');
		std::cout << (p-1) << std::endl;
	}
	return 0;
}