Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

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

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>
#include <math.h>

#define DIGIT 100000

int main(void){
	char temp[1000];
	int a[100];
	int b[100];
	int c[100];
	int t;
	int n;

	scanf("%d", &n);
	for(int i=0; i<n; i++){
		for(int k=0; k<100; k++){
			a[k] = 0;
			b[k] = 0;
			c[k] = 0;
		}
		int j;
		scanf("%s", temp);

		for(int k=0, j=strlen(temp)-1; j>=0; k++){
			for(int l=0; l<5; l++, j--){
				if(j < 0) break;
				a[k] +=	(temp[j] - '0') * pow(10, l);
			}
		}

		for(int k=0; k<100; k++){
			temp[k] = 0;
		}

		scanf("%s", temp);
		for(int k=0, j=strlen(temp)-1; j>=0; k++){
			for(int l=0; l<5; l++, j--){
				if(j < 0) break;
				b[k] +=	(temp[j] - '0') * pow(10, l);
			}
		}

		for(j=0; j<100; j++){
			t = a[j] + b[j] + c[j];
			c[j] = t % DIGIT;
			c[j+1] += (t / DIGIT);
		}
		
		j=99;
		while(c[j] == 0) j--;
		if(j > 15){
			printf("overflow\n");
		}else{
			printf("%d", c[j]);
			j--;
			for(; j>=0; j--){
				printf("%05d", c[j]);
			}
			puts("");
		}
	}

	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int N; cin >> N;
	for (int i = 0; i < N;i++) {
		vector<int> v1(101), v2(101);
		string str1, str2;
		cin >> str1 >> str2;
		for (int j = 0; j < str1.size(); j++) v1[j] = str1[str1.size() - j - 1] - '0';
		for (int j = 0; j < str2.size(); j++) v1[j] = str2[str2.size() - j - 1] - '0';
		for (int j = 0; j < 100;j++) {
			v1[j] += v2[j];
			if (v1[j] >= 10) {
				v1[j] -= 10;
				v1[j + 1]++;
			}
		}
		int dig = 0;
		for (int j = 100; j >= 0; j--) {
			if (v1[j] != 0) {
				dig = j; break;
			}
		}
		if (dig >= 80) cout << "overflow" << endl;
		else {
			for (int j = dig; j >= 0; j--) {
				cout << v1[j];
			}
			cout << endl;
		}
	}
}

C++: #include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n, m = 103;
    cin >> n;
    while (n--){
        string sa, sb;
        VI a(m), b(m);
        cin >> sa >> sb;
        REP(i,sa.length()) a[i] = sa[sa.length()-i-1] - '0';
        REP(i,sb.length()) b[i] = sb[sb.length()-i-1] - '0';
        int p = 0;
        REP(i,m){
            a[i] += b[i] + p;
            if (a[i] >= 10){
                a[i] -= 10;
                p = 1;
            }else{
                p = 0;
            }
        }
        int h = 0;
        REP(i,m) if (a[i] > 0) h = i;
        if (h >= 80){
            cout << "overflow" << endl;
        }else{
            FORR(i,h,0) cout << a[i];
            cout << endl;
        }
    }

    return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
using namespace std;
int a[110],b[110],c[110];
char x[110],y[110];
void ff(char z[110])
{
    int d=strlen(z);
    for(int i=0;i<d/2;i++)
    {
        swap(z[i],z[d-1-i]);
    }

}
int main()
{
   int n;
   scanf("%d",&n);
   while(n--)
   {
       memset(a,0,sizeof(a));
       memset(b,0,sizeof(b));
       memset(c,0,sizeof(c));
       scanf("%s",x);
       scanf("%s",y);
      ff(x),ff(y);
     for(int i=0;i<strlen(x);i++)
     {
         a[i]=x[i]-'0';
     }
     for(int i=0;i<strlen(y);i++)
     {
         b[i]=y[i]-'0';
     }
     int d=0,s;
      for(int i=0;i<110;i++)
      {
          s=a[i]+b[i]+d;
         c[i]=s%10;
         d=s/10;
      }
      int p=0;
      for(int i=109;i>=0;i--)
      {
          if(c[i])
          {
              p=i;
              break;
          }
      }
      if(p>=80)
      {
          printf("overflow\n");
         
      }
      else
        {
          for(int i=p;i>=0;i--)
          {
              printf("%d",c[i]);
          }
          printf("\n");
      }
   }
}

C++: #include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	string a,b;
	vector<int> ans;
	int n,tmp,carry,num;
	cin >> n;
	for(int i=0; i<n; i++){
		ans.clear();
		cin >> a >> b;
		int ai = a.size()-1;
		int bi = b.size()-1;
		carry=0;
		if(a.size() > 80 || b.size() > 80){
			cout << "overflow" << endl;
		}
		while(ai >= 0 || bi >= 0){
			tmp=0;
			if(ai >= 0) tmp += a[ai] - '0';
			if(bi >= 0) tmp += b[bi] - '0';
			ans.push_back((tmp+carry)%10);
			carry = (tmp+carry)/10;
			ai--; bi--;
		}
		if(carry != 0) ans.push_back(carry);
		if(ans.size() > 80){
			cout << "overflow" << endl;
		}
		
		for(int j=ans.size()-1; j>=0; j--)
			cout << ans[j];
		cout << endl;
	}
	return 0;
}