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 <vector>
#include <string>
using namespace std;

int main(){
    string a, b;
    vector<int> ans;
    int n, num, ai, bi, c=0;
    bool flag;
    
    cin >> n;
    
    for(int i=0 ; i<n ; i++){
        cin >> a >> b;
        flag = false;
        
        for(int j=0 ; j<100 ; j++){
            num = 0;
            ai = a.size()-j-1;
            bi = b.size()-j-1;
            if( ai<0 && bi<0 && c==0) break;
            
            if(ai>=0)num += a[ ai ] - 48;
            if(bi>=0)num += b[ bi ] - 48;
            ans.push_back( (num+c)%10 );
            if(num+c >= 10) c = 1;
            else c = 0;
        }
        if(ans.size()>80){
            flag = true;
        }
        if(flag){
            printf("overflow");
        }else{
            for(int j=ans.size()-1 ; j>=0 ; --j){
                printf("%d", ans[j]);
            }
        }
        printf("\n");
        ans.clear();
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <set>
#define INF 10000000
using namespace std;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    string str1,str2;
    cin >> str1 >> str2;
    if(str1.size()>str2.size()){
      string temp = str1;
      str1 = str2;
      str2 = temp;
    }

    int len1 = str1.size(),len2 = str2.size();
    int kuriagari = 0;
    for(int j=1;len2-j>=0;j++){
      if(len1-j>=0){
        int sum = (str2[len2-j]-'0') + (str1[len1-j]-'0') + kuriagari;
        if(sum>=10){
          sum -=10;
          kuriagari = 1;
        }else{
          kuriagari = 0;
        }
        str2[len2-j] = sum+'0';
      }else{
        if(kuriagari){
          int sum = (str2[len2-j]-'0') + kuriagari;
          if(sum>=10){
            sum -=10;
            kuriagari = 1;
          }else{
            break;
          }
          str2[len2-j] = sum+'0';
        }else{
          break;
        }
      }
    }
    if(kuriagari){
      str2 = "1" + str2;
    }
    cout << str2 << endl;
  }
}

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

#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;

#define CINT cpp_int 

int main() {
	int n; cin >> n; CINT a, b; 
	CINT REF = pow(CINT(10), 80);
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		if (a + b >= REF) cout << "overflow" << endl;
		else cout << a + b << endl;
	}
	return 0;
}

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

void str_plus(string &str, int d, int i){
  int keta = str.size()-i-1;//?????¨?¶??????????????????±???
  if(keta < 0){
    str.insert(0, "0");
    keta++;
  }
  int r = str[keta] - '0' + d;
  str[keta] = '0' + r % 10;
  if(r/10)
    str_plus(str, r/10, i+1);
}
int main(){
  int n;
  string str1, str2;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> str1 >> str2;
    for(int i = 0; i < str2.size(); i++)
      str_plus(str1, str2[str2.size()-i-1]-'0', i);

    cout << str1 << endl;
  }
  return 0;
}

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

int main(){
  int j;
  int n;
  char s1[111];
  char tmp[111];
  char s2[111];
  char ans[180];
  int  kuri = 0;
  cin >> n;
  while(n--){
  memset(ans,0,sizeof(ans));
  memset(s1,0,sizeof(s1));
  memset(s2,0,sizeof(s2));
  memset(tmp,0,sizeof(tmp));
  cin >> s1 >> s2;
  if(strlen(s1) < strlen(s2)){
      for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
      for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
      for(int i=0;i<strlen(s2);i++){
	if((s2[i] + (s1[i]%'0') + kuri) > '9'){
	  ans[i] = (s2[i] + (s1[i]%'0') + kuri)-10;
	  kuri = 1;
	}
	else {
	  ans[i] = (s2[i] + (s1[i]%'0') + kuri);
	  kuri = 0;
	}
	if(i == strlen(s2)-1 && kuri == 1) ans[i+1] = '1';
      }
      if(strlen(ans) > 80) cout << "overflow" << endl;
      else{
	for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
      }
  }
  else{
    for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]);
    for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]);
    for(int i=0;i<strlen(s1);i++){
      if((s1[i] + (s2[i]%'0') + kuri) > '9'){
	ans[i] = (s1[i] + (s2[i]%'0') + kuri)-10;
	kuri = 1;
      }
      else {
	ans[i] = (s1[i] + (s2[i]%'0') + kuri);
	kuri = 0;
      }
      if(i == strlen(s1)-1 && kuri == 1) ans[i+1] = '1';
    }
    if(strlen(ans) > 80) cout << "overflow" << endl;
    else{
      for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i];
    }
  }
  cout << endl;
  }
}

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

int main() {
	int n;
	cin >> n;
	for(int k = 0; k < n; k++) {
		string str1, str2;
		cin >> str1 >> str2;
		int a = str1.size(), b = str2.size();
		if(a > 79 || b > 79) {
			cout << "overflow" <<endl;
		} else if(a >= b) {
			for(int i = 0; i < b; i++) {
				str1[a - b + i] += str2[i] - '0';
				for(int i = a - 1; i >= 0; i--) {
					if(str1[i] > '9') {                 //?????????//
						if(i != 0) {
							str1[i] = str1[i] - ':' + '0';
							str1[i - 1] = str1[i - 1] + 1;
						}
					}
				}
			}
			if(a == 79 && str1[0] > '9') {
				cout << "overflow" <<endl;
			} else {
				for (int j = 0; j < a; j++) {
					if(str1[j] > '9') {
						printf("1%c",str1[j] - ':' + '0');
					} else cout<< str1[j];
				}
			}
		} else if(b > a) {
			for(int i = 0; i < a; i++) {
				str2[b - a + i] += str1[i] - '0';
				for(int i = b - 1; i >= 0; i--) {
					if(str2[i] > '9') {                    //?????????//
						if(i != 0) {
							str2[i] = str2[i] - ':';
							str2[i - 1] = str2[i - 1] + 1;
						}
					}
				}
			}
			if(b == 79 && str2[0] > '9') {
					cout << "overflow" <<endl;
			} else {
				for (int j = 0; j < b; j++) { 
					if(str2[j] > '9') {
						printf("1%c",str2[j] - ':' + '0');
					} else cout << str2[j];
				}
			}
		}	
		cout <<endl;
	}
	return 0;
}