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<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 <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
    int n;
    string a,b,ans;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        ans="";
        cin>>a>>b;
        if(a.size()>80||b.size()>80){
            cout<<"overflow"<<endl;
            continue;
        }
        reverse(a.begin(),a.end());
        reverse(b.begin(),b.end());
        int size=(a.size()>b.size())?a.size():b.size();
        bool af=false,bf=false,uf=false;
        for(int j=0;j<size;j++){
            int pr=0;
            if(a.size()<j+1)af=true;
            if(b.size()<j+1)bf=true;
            if(!af){
                pr+=a[j];
                pr-=48;
            }
            if(!bf){
                pr+=b[j];
                pr-=48;
            }
            if(uf)pr++;
            if(pr>9){
                pr-=10;
                uf=true;
            }else uf=false;
            pr+=48;
            ans=(char)pr+ans;
        }
        if(uf)ans='1'+ans;
        if(ans.size()>80)cout<<"overflow"<<endl;
        else cout<<ans<<endl;
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <stdlib.h>

using namespace std;

#define MAX_ORDER 80

void alignOrder(std::string& input1, std::string& input2);
int myAtoi(const char c);
void addTwoInputs(const std::string& input1, const std::string& input2, std::string& output);
bool overflowCheck(const std::string& output);

int main(void)
{
  int n;
  std::string input1, input2;
  std::string output;

  std::cin >> n;

  for (int i = 0; i < n; i++) {
    std::cin >> input1;
    std::cin >> input2;

    alignOrder(input1, input2);
    addTwoInputs(input1, input2, output);
    if (overflowCheck(output)) {
      std::cout << output << std::endl;
    }
    else {
      std::cout << "overflow" << std::endl;
    }
  }

  return 0;
}

void alignOrder(std::string& input1, std::string& input2)
{
  if (input1.size() == input2.size()) {
    return;
  }
  if (input1.size() < input2.size()) {
    std::swap(input1, input2);
  }
  int distance = input1.size() - input2.size();
  for (int i = 0; i < distance; i++) {
    input2.insert(0, "0");
  }
  return;
}

int myAtoi(const char c)
{
  return c - '0';
}

void addTwoInputs(const std::string& input1, const std::string& input2, std::string& output)
{
  int outputOrder = input1.size() + 1;
  output.resize(outputOrder);

  bool advance = false;
  for (int i = outputOrder - 2; i >= 0; i--) {
    int num1 = myAtoi(input1[i]);
    int num2 = myAtoi(input2[i]);
    int sum = num1 + num2;
    if (advance) {
      sum++;
    }
    char sumStr[10];
    itoa(sum, sumStr, 10);
    if (sumStr[1] == '\0') {
      output[i + 1] = sumStr[0];
      advance = false;
    }
    else {
      output[i + 1] = sumStr[1];
      advance = true;
    }
    if (i == 0) {
      if (advance) {
        output[0] = '1';
      }
      else {
        output = output.substr(1);
      }
    }
  }
}

bool overflowCheck(const std::string& output)
{
  if (output.size() > MAX_ORDER) {
    return false;
  }
  return true;
}

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


#define DIGIT (5)

int main()
{
	int i, j, n, temp;
	char num[2][DIGIT + 1];
	char ans[DIGIT + 2];
	char fmt[8];
	int len[2], index;
	
	// scanf format
	sprintf(fmt, "%%%ds", DIGIT);
	
	scanf("%d", &n);
	
	for (i = 0; i < n; ++i) {
		for (j = 0; j < 2; ++j) {
			scanf(fmt, num[j]);
			while (getchar() != '\n');
			
			len[j] = strlen(num[j]);
		}
		
		// bigger one
		index = (len[0] < len[1]) ? 1 : 0;
		
		ans[len[index] + 1] = '\0';
		
		temp = 0;
		for (j = 1; j <= len[index ^ 1]; ++j) {
			temp += (num[0][len[0] - j] - '0') + (num[1][len[1] - j] - '0');
			ans[len[index] - j + 1] = temp % 10 + '0';
			temp /= 10;
		}
		for (; j <= len[index]; ++j) {
			temp += (num[index][len[index] - j] - '0');
			ans[len[index] - j + 1] = temp % 10 + '0';
			temp /= 10;
		}
		
		if (temp) {
			if (len[index] == DIGIT) {
				puts("overflow");
			} else {
				ans[0] = '1';
				puts(ans);
			}
		} else {
			puts(ans + 1);
		}
	}
	
	return 0;
}

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

int main(){
  std::string as;
  std::string bs;
  int a[102]={0};
  int b[102]={0};
  int sum[102]={0};
  int a_size,b_size,sum_size,n,i,j,flag=0;
  char num;

  std::cin >> n;

  for(i=0;i<n;i++){
    std::cin >> as >> bs;
    a_size = as.size();
    b_size = bs.size();

    for(j=0;j<102;j++){   //??????????????????(100??????00100)
      if(101-j<=a_size){
        a[101-j] = as[j-a_size] - '0';
      }else{
        a[101-j] = 0;
      }
      if(101-j<=b_size){
        b[101-j] = bs[j-a_size] - '0';
      }else{
        b[101-j] = 0;
      }
    }

    for(j=0;j<102;j++){       //sum????¨????
      sum[j] = a[j] + b[j];
      if(flag){               //??°?????????
        sum[j] += 1;
        flag = 0;
      }
      if(j>=80&&sum[j]!=0){   //???????????????????????????
        overflow = 1;
        break;
      }
      if(sum[j] > 9){         //??°???????????????
        sum[j] -= 10;
        flag = 1;
      }
    }
    if(overflow){             //??????
      std::cout << "overflow" << std::endl;
      overflow = 0;
      continue;
    }
    for(j=0;j<102;j++){
      if(sum[101-j]!=0){
        sum_size = 101-j;
        break;
      }
    }
    for(j=sum_size;j>=0;j--){
      num = sum[j] + '0';
      std::cout << num;
    }
    std::cout << std::endl;
  }
}