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<string>

using namespace std;

int main(){
	int n,l1,l2,i;
	string a, b;
	char ans[80];
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80){
			cout<<"overflow"<<endl;
			continue;
		}
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
				continue;
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		for(i=0;i<80;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[80-i]+=sum+'0';
		}
		for(i=l2+1;i<l1+1;i++){
			ans[80-i]=a[l1-i];
		}
		for(i=79;i>=0;i--){
			if(ans[i]-'0'>9 && ans[i]!=0){
				ans[i]=ans[i]-10;
				if(ans[i-1]==0)ans[i-1]+=49;
				else ans[i-1]+=1;
			}
		}
		for(i=0;i<80;i++){
			if(ans[i]!=0){
				cout<<(int)ans[i]-'0';
			}
		}
		cout<<endl;
	}
	while(1);
	return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <deque>
class BigInt
{
  std::deque<char> m_digits;
public:
  BigInt(std::string str) {
    for(auto it = str.begin(); it != str.end(); ++it) {
      m_digits.push_back(*it - '0');
    }
  }

  BigInt(int num) {
    std::ostringstream oss;
    oss << num;
    BigInt(oss.str());
  }

  std::string str() const {
    if (m_digits.size() >= 80) {
      return "overflow";
    }
    std::string str;
    for (auto it = m_digits.begin(); it != m_digits.end(); ++it) {
      str += *it + '0';
    }
    return str;
  }

  const BigInt& operator +=(const BigInt& rhs) {
    std::deque<char> new_digits;
    auto lhs_rit = m_digits.rbegin();
    auto rhs_rit = rhs.m_digits.rbegin();

    char inc = 0;
    while (lhs_rit != m_digits.rend() &&
           rhs_rit != rhs.m_digits.rend()) {
      char temp = *lhs_rit + *rhs_rit;
      temp += inc;
      if (temp >= 10) {
        inc = temp / 10;
        temp -= inc * 10;
      }
      new_digits.push_front(temp);
      ++lhs_rit;
      ++rhs_rit;
    }

    if (lhs_rit != m_digits.rend()) {
      while (lhs_rit != m_digits.rend()) {
        char temp = *lhs_rit + inc;
        if (temp >= 10) {
          inc = temp / 10;
          temp -= inc * 10;
        } else {
          inc = 0;
        }
        new_digits.push_front(temp);
        ++lhs_rit;
      }
    }
    else if (rhs_rit != rhs.m_digits.rend()) {
      while (rhs_rit != rhs.m_digits.rend()) {
        char temp = *rhs_rit + inc;
        if (temp >= 10) {
          inc = temp / 10;
          temp -= inc * 10;
        } else {
          inc = 0;
        }
        new_digits.push_front(temp);
        ++rhs_rit;
      }
    }
    if (inc > 0) new_digits.push_front(inc);
    m_digits = new_digits;
  }
};

BigInt operator +(const BigInt& lhs, const BigInt& rhs)
{
  BigInt result(lhs);
  result += rhs;
  return result;
}

int main()
{
  int n;
  std::cin >> n;
  while (n--) {
    std::string num;
    std::cin >> num;
    BigInt num1(num);
    std::cin >> num;
    BigInt num2(num);
    
    BigInt num3 = num1 + num2;
    std::cout << num3.str() << std::endl;
  }
  return 0;
}

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

int main() {
  
  int n,i,j;
  cin >> n;

  for(i=0;i<n;i++){
    string str1,str2,temp;
    int kuriagari=0;
    cin >> str1 >> str2;
    
    if (str1.size()<str2.size()){
      temp = str1;
      str1 = str2;
      str2 = temp;
    }
    int goukei[str1.size()+1];
    
    for(j=0;j<str1.size()+1;j++){
      
      if (j==str1.size()){
	goukei[0] = kuriagari;
      }else if (j<str2.size()){
	goukei[str1.size()-j] = str2[str2.size()-1-j] + str1[str1.size()-1-j] + kuriagari -'0' - '0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }else{
	goukei[str1.size()-j] = str1[str1.size()-1-j] + kuriagari -'0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }
    }
    if ((str1.size()>81)||( (str1.size()==80)&&(goukei[0]==1) )){
      cout << "overflow" <<endl;
    }else{
      if (goukei[0]!=0)
	cout << goukei[0] ;
      for(j=0;j<str1.size();j++)
	cout << goukei[j+1];
      cout <<endl;
    }
  }
      
  return 0;
  
}

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

#define MAX_DIGIT 80
#define ERROR ("overflow")



int main(void){
	using namespace std;

	int N;
	cin >> N;

	vector< pair<string,string> > input;
	input.reserve(N);

	for(int i=1; i<=N; i++){

		string slhs, srhs;
		cin >> slhs >> srhs;

		reverse(slhs.begin(), slhs.end());
		reverse(srhs.begin(), srhs.end());

		input.push_back(make_pair(slhs,srhs));
	}

	for(auto p=input.begin(); p!=input.end(); p++){
		auto slhs = p->first, srhs = p->second;

		if(slhs.size()>MAX_DIGIT || srhs.size()>MAX_DIGIT){
			cout << ERROR << endl;
			continue;
		}

		int lhs[MAX_DIGIT], rhs[MAX_DIGIT], res[MAX_DIGIT];
		fill(lhs, lhs+MAX_DIGIT, 0);
		fill(rhs, rhs+MAX_DIGIT, 0);
		fill(res, res+MAX_DIGIT, 0);
		auto atoi_digit = [] (char x) -> int {
			return atoi(&x);
		};
		transform(slhs.begin(), slhs.end(), lhs, atoi_digit);
		transform(srhs.begin(), srhs.end(), rhs, atoi_digit);

		int headDigit;
		for (headDigit=MAX_DIGIT-1; headDigit>=0; headDigit--){
			if(lhs[headDigit]!=0 || rhs[headDigit]!=0){
				break;
			}
		}
		if(headDigit != MAX_DIGIT-1){
			headDigit++;
		}

		int carry = 0;
		for (int j=0; j<=headDigit; j++){
			auto d = div(lhs[j]+rhs[j]+carry,10);
			carry = d.quot;
			res[j] = d.rem;
		}
		if(headDigit==MAX_DIGIT-1 && carry !=0){
			cout << ERROR << endl;
			continue;
		}


		for (; headDigit>=1; headDigit--){
			if(res[headDigit]!=0){
				break;
			}
		}
		for (int j=headDigit; j>=0; j--){
			cout << res[j];
		}
		cout << endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
char strn[1000],str1[101],str2[101];
void add(int one,int two)
{
    int n,carry=0;
    for(int i=0;one-i>=0||two-i>=0||carry==1;i++){
        if(one-i>=0&&two-i>=0)n=(str1[one-i]-'0')+(str2[two-i]-'0');
        else if(one-i>=0)n=(str1[one-i]-'0');
        else if(two-i>=0)n=(str2[two-i]-'0');
        else n=0;
        if(n+carry>9){
            strn[i]=n+'0'+carry-10;
            carry=1;
        }
        else {
            strn[i]=n+'0'+carry;
            carry=0;
        }
    }
}
int main()
{
    int n,firs,seco,co;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>str1>>str2;
        firs=strlen(str1);
        seco=strlen(str2);
        if(firs>80||seco>80)cout<<"overflow"<<endl;
        else {
            add(firs,seco);
            co=strlen(strn);
            if(co>80)cout<<"overflow"<<endl;
            else {
                for(int i=co-1;i>0;i--)printf("%c",strn[i]);
                cout<<endl;
            }
        }

    }
}