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>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    int n;
    cin >> n;
    REP(i, n){
    	string s1, s2;
    	cin >> s1 >> s2;
    	int len1 = s1.length(), len2 = s2.length();
    	if (len1 > 80 || len2 > 80) {
    		cout << "overflow" << endl;
    	} else {
    		int num1[100] = {0}, num2[100] = {0}, ans[100] = {0};
    		REP(j, len1){
    			num1[j] = s1[len1-1-j] - '0';
    		}
    		REP(j, len2){
    			num2[j] = s2[len2-1-j] - '0';
    		}
    		int ll = len1 > len2 ? len1 : len2;
    		REP(j, ll){
    			ans[j] += num1[j] + num2[j];
    			if (ans[j]/10 > 0) {
    				ans[j+1]++;
    				ans[j] -= 10;
    			}
    		}
    		if (ans[80] > 0){
    			cout << "overflow" << endl;
    		} else {
    			if (ans[ll] > 0) cout << ans[ll];
    			REP(j, ll){
    				cout << ans[ll-1-j];
    			}
    			cout << endl;
    		}
    	}
    }
}

C++: #include <iostream>
#include <sstream>
#include <cstring>

using namespace std;

int main()
{
	stringstream ss;
	string str;
	int n;
	long num;
	
	cin >> n;
	while (n != 0){
		int sum = 0;
		for (int i = 0; i < 2; i++){
			cin >> str;
			ss.clear();
			ss.str("");
			ss << str;
			ss >> num;
			sum += num;
		}
		ss.clear();
		ss.str("");
		ss << sum;
		ss >> str;
		
		if (str.size() > 80){
				cout << "overflow" << endl;
				break;
		}
		else{
			cout << str << endl;
		}
		n--;
	}
	return (0);
}

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

int main(void){
	int n;
	std::cin >> n;
	char i1[81]="",i2[81]="",res[81]="";
	for(int i=0; i<n; i++){
		bool cflag=false;
		std::cin >> i1;
		std::cin >> i2;
		for(int j=0;j<80;j++){
			char c='0';
			if(cflag)
				c+=1;
			cflag=false;
			if(strlen(i1)>j){
				c+=i1[strlen(i1)-j-1]-'0';
			}
			if(strlen(i2)>j){
				c+=i2[strlen(i2)-j-1]-'0';
			}
			if(c > '9'){
				cflag=true;
				c-=10;
			}
			res[79-j]=c;
		}

		if(cflag){
			std::cout << "overflow" << std::endl;
		}else{
			char *p = res;
			while(*p++ == '0');
			std::cout << (p-1) << std::endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;

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

char itos(int a){
	return a+'0';
}

int main(){
	int n;
	string s1,s2,ans;
	int lmin , lmax , sum , tmp , tmp2;
	bool bs1=true;
	cin >> n;
	for(int i=0; i<n ; ++i){
		cin >> s1 >> s2;
		reverse(s1.begin(),s1.end());
		reverse(s2.begin(),s2.end());
		lmin=min(s1.length(),s2.length());
		lmax=max(s1.length(),s2.length());
		if(s1.length()<s2.length()) bs1=false;
		for(int j=0;j<lmin;++j){
			ans.resize(j+2 , '0');
			sum=stoi(s1[j])+stoi(s2[j]);
			if(sum>=10){
				ans[j+1]=itos(1);
				tmp=stoi(ans[j]);
				tmp+=sum%10;
				ans[j]=itos(tmp);
			} else {
				int tmp=stoi(ans[j]);
				tmp+=sum;
				if(tmp>=10){
					ans[j+1]=itos(1);
					tmp2=stoi(ans[j]);
					tmp2=tmp%10;
					ans[j]=itos(tmp2);
				} else {
					ans[j]=itos(tmp);
				}
			}
			
		}
		for(int k=lmin; k<lmax ; ++k){
			ans.resize(k+2, '0');
			if(bs1){
				sum=stoi(ans[k])+stoi(s1[k]);
				if(sum>=10){
				ans[k+1]=itos(1); 
				tmp=sum%10;
				ans[k]=itos(tmp);
				} else {
					ans[k]=itos(sum);
				}
			} else {
				sum=stoi(s2[k]);
				sum+=stoi(ans[k]);
				if(sum>=10){
				ans[k+1]=itos(1);
				tmp=sum%10;
				ans[k]=itos(tmp);
				} else {
				ans[k]=itos(sum);
				}
			}
		}
		reverse(ans.begin(),ans.end());
		if(ans[0]=='0') ans.erase(0,1);
		if(ans.length()>80|| s1.length()>80 || s2.length()>80) {cout << "overflow" << endl; ans.erase();}
		else {
			cout << ans << endl;
			ans.erase();
		}
	}
	return 0; 
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s1, s2, ans = "";
        cin >> s1 >> s2;
        int len1 = s1.length() - 1;
        int len2 = s2.length() - 1;
        int mlen = max(len1, len2);
        int pre = 0;
        for (int i = 0; i <= mlen; i++) {
            int sum = pre;
            sum += (len1 >= 0) ? s1[len1--] - '0' : 0;
            sum += (len2 >= 0) ? s2[len2--] - '0' : 0;
            pre = sum / 10;
            sum -= pre * 10;
            ans += '0' + sum;
        }
        if (pre > 0) ans += '0' + pre;
        reverse(ans.begin(), ans.end());
        if (ans.length() > 80) {
            puts("overflow");
        }
        else {
            cout << ans << endl;
        }
    }
    return 0;
}

C++: #include <cmath>
#include <cstdlib>
#include <cstdio>

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>



int main() {

  std::string a, b;
  long x[100] = {};
  long y[100] = {};
  long N;
  long temp;
  long len;

  std::cin >> N;
  for(int i = 0; i < N; ++i) {
    std::cin >> a >> b;
    for(int j = 0; j < 100; ++j) {
      x[j] = y[j] = 0;
    }
    for(int j = 0; j < a.size(); ++j) x[j] = a[ a.size()-j-1 ] - '0';
    for(int j = 0; j < b.size(); ++j) y[j] = b[ b.size()-j-1 ] - '0';

    temp = 0;
    for(int j = 0; j < 100; ++j) {
      temp = x[j] + y[j] + temp;
      x[j] = (temp % 10);
      temp /= 10;
    }

    len = std::max(a.size(), b.size());
    if( x[len] != 0 ) {
      if( len <= 80 ) { 
	std::cout << "overflow" << std::endl;
	continue;
      }
      for(int j = len; j >= 0; --j) {
	std::cout << x[j];
      }
      std::cout << std::endl;
      continue;
    }
    for(int j = len-1; j >= 0; --j) {
      std::cout << x[j];
    }
    std::cout << std::endl;
  }
    
  return 0;
}