Go: package main

import (
        "fmt"
        "bufio"
        "os"
)

func main() {
        var n int
        var a, b string
        sc := bufio.NewScanner(os.Stdin)
        fmt.Scanf("%d", &n)
        for i := 0; i < n; i++ {
                sc.Scan()
                a = sc.Text()
                sc.Scan()
                b = sc.Text()

                if len(a) > len(b) {
                        s := add(a, b)
                        if s[len(a)] > 0 {
                                if len(a) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(a)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(a);i++ {
                                                fmt.Printf("%d", s[len(a)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                } else {
                        s := add(b, a)
                        if s[len(b)] > 0 {
                                if len(b) >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i <= len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i])
                                        }
                                }
                                fmt.Printf("\n")
                        } else {
                                if len(b)-1 >= 80 {
                                        fmt.Printf("overflow")
                                } else {
                                        for i := 0; i < len(b);i++ {
                                                fmt.Printf("%d", s[len(b)-i-1])
                                        }
                                }
                                fmt.Printf("\n")
                        }
                }
        }
}

// expects ln > lm
func add(n string, m string) (s [100]int) {
        ln := len(n)
        lm := len(m)
        var sum [100]int

        for i := 0; i < ln; i++ {
                var s, t int
                s = int(n[ln-1-i]) - int('0')

                if lm - 1 - i >= 0 {
                        t = int(m[lm-1-i]) - int('0')
                } else {
                        t = 0
                }

                sum[i+1] = (s + t + sum[i]) / 10
                sum[i] = (s + t + sum[i]) % 10
        }

        return sum
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

string s1, s2;

string addString(string s, string t){
    if(s.size() < t.size()) swap(s, t);
    char tmp;
    for(int i = s.size() - 1, j = t.size() - 1; i >= 0; i--, j--){
        if(j >= 0) s[i] += t[j] - '0';
        if(s[i] > '9'){
            s[i] -= 10;
            if(i == 0) s = '1' + s;
            else s[i - 1]++;
        }
    }
    return s;
}

signed main(){
    int n;
    cin >> n;
    rep(i, 0, n){
        cin >> s1 >> s2;
        string ans = addString(s1, s2);
        if(ans.size() > 80) cout << "overflow" << endl;
        else cout << ans << endl;
    }
}

C++: #include <iostream>
#include <iomanip>
#include <string.h>
#include <stdio.h>
using namespace std;

void checkArray(char str[])
// 配列の内容確認(テスト用)
{
	int size = strlen(str);
	for(int i = 0; i < size; ++i)
	{
		cout << "str[" << i << "]: " << str[i] << endl;
	}
}
void str_reverse(char s[])
// 文字列を反転する
{
     int i, l = strlen(s);
     char t;
     for(i = 0; i < l/2; i++) {
         t = s[i]; s[i] = s[l-i-1]; s[l-i-1] = t;
     }
}
char *add(char num1[], char num2[])
// 足し算した結果を文字列として返す
{
	char res[82];
	bool carry = false; //繰り上がりの有無
	int numlen1 = strlen(num1);
	int numlen2 = strlen(num2);
	int maxlen = (numlen1 > numlen2) ? numlen1 : numlen2;
	int flag1 = 0, flag2 = 0;

	str_reverse(num1);
	str_reverse(num2);

	for(int i = 0; i < maxlen+1; ++i){
		// '\n'以降は値を0とする
		if(num1[i] == '\0') flag1 = 1;
		if(num2[i] == '\0') flag2 = 1;
		res[i] = carry;
		if(!flag1) res[i] += num1[i]-48;
		if(!flag2) res[i] += num2[i]-48;
		res[i] = res[i] % 10 + 48;
		carry = ((num1[i]-48)+(num2[i]-48)+carry) / 10;
	}
	// 終端文字をつける
	if(res[maxlen] == '0')
		res[maxlen] = '\0';
	else res[maxlen+1] = '\0';

	// 元に戻す
	str_reverse(num1);
	str_reverse(num2);
	str_reverse(res);
	cout << res;
	return res;
}

int main() {
	int dataset;
	char num1[80];
	char num2[80];

	cin >> dataset; // データセットの個数

	for(int i = 0; i < dataset; ++i){
			// 80桁以下の数字を入力
			cin >> setw(80) >> num1;
			cin >> setw(80) >> num2;
			// 足し算した結果を表示
			add(num1, num2);
	}
}

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

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string str1, str2, ans;
    cin >> str1 >> str2;
    int p1 = str1.length();
    int p2 = str2.length();
    int c = 0;
    while (p1 > 0 || p2 > 0) {
      int a = 0, b = 0;
      if (p1 > 0) {
        a = str1[--p1] - '0';
      }
      if (p2 > 0) {
        b = str2[--p2] - '0';
      }
      ans = to_string((a + b + c) % 10) + ans;
      c = (a + b + c) / 10;
    }
    if (c != 0) {
      ans = to_string(c) + ans;
    }
    if (ans.length() > 80) {
      cout << "overflow\n";
    } else {
      cout << ans << "\n";
    }
  }
  return 0;
}

C++: #include <boost/multiprecision/cpp_int.hpp>
#include <iostream>

int main() {
  using namespace std;
  namespace mp = boost::multiprecision;
  // 任意長整数型
  using Bint = mp::cpp_int;

  Bint UB = pow(Bint(10), 80);
  int n;
  cin >> n;
  while (n--) {
      Bint a, b;
      cin >> a >> b;
      Bint c = a + b;
      if (a >= UB || b >= UB || c >= UB) {
          cout << "overflow";
      } else {
          cout << c;
      }
      cout << endl;
  }
}

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

int reverse(string &s){
	int n = s.size(), n2 = n/2;
	for (int i=0; i<n2; i++){
		swap(s[i], s[n-1-i]);
	}
	return 0;
}

int main(void){
	int n;
	cin>>n;
	for (int i=0; i<n; i++){
		string s1, s2, s3="";
		cin>>s1>>s2;

		reverse(s1);
		reverse(s2);

		while (s1.size()<s2.size()) s1 += '0';
		while (s2.size()<s1.size()) s2 += '0';

		long c=0, stmp;
		for (int i=0; i<s1.size(); i++){
			stmp = s1[i]-'0'+s2[i]-'0'+c;
			c = stmp / 10;
			s3 += stmp%10 +'0';
		}
		if (c!=0) s3 += c + '0';

		reverse(s3);
		if (s3.size()>80)
			cout<<"overflow"<<endl;
		else
			cout<<s3<<endl;

	}
	return 0;
}