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 <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


string add(string& a, string& b) {
  int n = max(a.size(), b.size()) + 1;
  reverse(begin(a), end(a));
  reverse(begin(b), end(b));
  while (a.size() < n) a += '0';
  while (b.size() < n) b += '0';
  string c(n, 0);
  int d = 0;
  for (int i = 0; i < n; ++i) {
    int x = (a[i] - '0') + (b[i] - '0') + d;
    if (x < 10) {
      c[i] = '0' + x;
      d = 0;
    } else {
      c[i] = '0' + x - 10;
      d = 1;
    }
  }
  while (c.size() > 1 and c.back() == '0') c.pop_back();
  reverse(begin(c), end(c));
  return c;
}

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  for (int _ = 0; _ < n; ++_) {
    string a, b; cin >> a >> b;
    auto c = add(a, b);
    if (c.size() > 80) cout << "overflow" << '\n';
    else cout << c << '\n';
  }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int n,m;
	string aindex, bindex, ans;
	cin >> m;
	n = 0;
	string a,b;
	for(int j = 0; j < m; j++){
		cin >> a >> b;
		if(a.size()>80||b.size()>80){
			cout << "overflow" << endl;
		}else{
			for(int i = 0; i< max(a.size(),b.size()); i++){
				if(a.size()>= i+1){
					aindex = a[a.size()-i-1];
				}else{
					aindex = "0";
				}
				if(b.size() >= i+1){
					bindex = b[b.size()-i-1];
				}else{
					bindex = "0";
				}
				n = stoi(aindex) + stoi(bindex) + (n-n%10==10);
				aindex = to_string(n%10);
				ans = aindex + ans;
			}
			if(ans.size()>80){
				cout << "overflow" << endl;
			}else{
				if(n-n%10 == 10){
					ans = '1' + ans;
				}
				cout << ans << endl;
			}
		}
		ans ="";
		n = 0;
	}
}

C++: #include <stdio.h>
#include <string.h>
 
int max(int a, int b) {
  return a > b ? a : b;
}
 
int main(void) {
  int i, ans = 0, j, n;
  char a[110], b[110];
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%s\n%s", a, b);
    if(strlen(a) > 80 || strlen(b) > 80) {
      printf("overflow\n");
      continue;
    }
    for(j = 0; j < strlen(a); ++j) a[j] -= '0' - 1;
    for(j = 0; j < strlen(b); ++j) b[j] -= '0' - 1;
    /*for(j = 0; j < strlen(a); ++j) printf("%d", (int)a[j] - 1);
    printf("\n");
    for(j = 0; j < strlen(b); ++j) printf("%d", (int)b[j] - 1);
    printf("\n");*/
    if(strlen(a) < strlen(b)) {
      char t[110];
      for(j = 0; j <= strlen(a); ++j) t[j] = a[j];
      for(j = 0; j <= strlen(b); ++j) a[j] = b[j];
      for(j = 0; j <= strlen(t); ++j) b[j] = t[j];
    }
    char t[110];
    int st = 0;
    for(j = 0; j <= strlen(b); ++j) t[j] = b[j];
    for(j = 0; j <= strlen(a); ++j) b[j] = 1;
    for(j = strlen(a) - strlen(t); j <= strlen(a); ++j) b[j] = t[j - strlen(a) + strlen(t)];
    /*for(j = 0; j < strlen(a); ++j) printf("%d", (int)a[j] - 1);
    printf("\n");
    for(j = 0; j < strlen(a); ++j) printf("%d", (int)b[j] - 1);
    printf("\n");*/
    for(j = strlen(a) - 1; j >= 0; --j) {
      a[j] = a[j] + b[j] - 1;
      if(a[j] >= 11) {
        if(j) {
          a[j - 1]++;
          a[j] -= 10;
        } else {
          st = 1;
          a[j] -= 10;
        }
      }
    }
    if(st) {
      if(strlen(a) == 80) {
        printf("overflow\n");
        continue;
      } else printf("1");
    }
    for(j = 0; j < strlen(a); ++j) printf("%d", (int)a[j] - 1);
    printf("\n");
  }
  return 0;
}

C++: #include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	int n;
	scanf("%d%*c", &n);
	rep(i, n){
		vi a, b;
		char c;
		while(scanf("%c", &c), c != '\n')
			a.push_back(c-'0');
		while(scanf("%c", &c), c != '\n')
			b.push_back(c-'0');
		
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());

		int kuri = 0;
		vi ans;
		for(int j=0, k=0; j<(int)a.size() || k<(int)b.size() || kuri; ++j, ++k){
			int v = (j<(int)a.size() ? a[j] : 0) + (k<(int)b.size() ? b[k] : 0) + kuri;
			kuri = v/10;
			ans.push_back(v%10);
		}

		if(ans.size()>80)
			puts("overflow");
		else{
			for(int j=ans.size()-1; j>=0; --j)
				printf("%d", ans[j]);
			puts("");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
typedef long long int ll;
using namespace std;

int main()
{
	string s1, s2, sum;
	int n;
	cin >> n;
	while (n--) {
		cin >> s1 >> s2;
		int len = max(s1.size(), s2.size());
		for (int i = 0; i < len; i++) {
			sum += "0";
		}
		//?????????????????????????????????????????????'0'??§??°????????????
		if (s1.size() < s2.size()) {
			//s1????????????????????§s2.size()-s1.size()?????????'0'?????°????????????
			//??????s1??????????????????
			string r_s1 = "";
			for (int i = s1.size() - 1; i >= 0; i--) {
				r_s1 += s1[i];
			}
			//r_s1???s2.size()-s1.size()?????????'0'???????????°??????
			for (int i = 0; i < s2.size() - s1.size(); i++) {
				r_s1 += "0";
			}
			//r_s1????????????????????????
			s1 = "";
			for (int i = r_s1.size() - 1; i >= 0; i--) {
				s1 += r_s1[i];
			}
		}
		else {
			//??????s2??????????????????
			string r_s2 = "";
			for (int i = s2.size() - 1; i >= 0; i--) {
				r_s2 += s2[i];
			}
			//s1.size()-s2.size()?????????'0'??§????????°??????
			for (int i = 0; i < s1.size() - s2.size(); i++) {
				r_s2 += "0";
			}
			//r_s2??????????????????
			s2 = "";
			for (int i = r_s2.size() - 1; i >= 0; i--) {
				s2 += r_s2[i];
			}
		}
		




		int carry = 0;
		char s;
		for (int i = 0; i < len; i++) {
			if (carry == 0) {
				//cout << s1[s1.size() - 1 - i] - '0' + s2[s2.size() - 1 - i] - '0' << endl;
				//cout << (s1[s1.size() - 1 - i] - '0' + s2[s2.size() - 1 - i] - '0')+'0' << endl;
				//sum[len - 1 - i] = s1[s1.size() - 1 - i] - '0' + s2[s2.size() - 1 - i] - '0' + '0';
				s = s1[s1.size() - 1 - i] - '0' + s2[s2.size() - 1 - i] - '0' + '0';
				if (s - '0' >= 10) {
					carry = 1;
					sum[len - 1 - i] = int((s - '0') % 10) + '0';
				}
				else {
					sum[len - 1 - i] = s;
				}
			}
			else {//carry over
				//sum[len - 1 - i] = (int)s1[s1.size() - 1 - i] - '0' + (int)s2[s2.size() - 1 - i] - '0' + 1;
				s = s1[s1.size() - 1 - i] - '0' + s2[s2.size() - 1 - i] - '0' + '0' + 1;
				if (s - '0' >= 10) {
					carry = 1;
					sum[len - 1 - i] = int((s - '0') % 10) + '0';
				}
				else {
					carry = 0;
					sum[len - 1 - i] = s;
				}
			}
		}

		cout << (carry == 1 ? "1" : "");
		for (int i = 0; i < len; i++) {
			cout << (int)sum[i] - '0';
		}
		cout << endl;
	}
    return 0;
}