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 <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cctype>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <functional>
#include <stdexcept>
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
const double PI = 3.141592653589793238462643383279502884L;
const int LARGE_INT = 1000000007;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(auto i = (c).rbegin(); i != (c).rend(); i++)
#define repfn(i,a,cont,next) \
  for(auto i = (a); [=](){return(cont);}(); i = [=](){return(next);}())
#define repby(i,a,b,s) repfn(i,a,i<b,i+s)
#define repab(i,a,b) repby(i,a,b,1)
#define rep(i,b) repab(i,0,b)
#define pb push_back
#define sz(c) int((c).size())

typedef vector<int> bignum;
const int max_digit = 80;

bignum operator+(const bignum& lhs, const bignum& rhs)
{
  int tmp, carry;
  bignum res(max_digit);
  for (int i = 0; i < max_digit; i++) {
    tmp = lhs[i] + rhs[i] + carry;
    if (tmp > 9) {
      carry = 1;
      res[i] = tmp % 10;
    } else {
      carry = 0;
      res[i] = tmp;
    }
  }
  if (carry)
    throw runtime_error("overflow");
  return res;
}

ostream& operator<<(ostream& os, const bignum& rhs)
{
  bool skip = true;
  rtr(rhs, i) {
    if (*i == 0 && skip)
      continue;

    skip = false;
    os << *i;
  }
  return os;
}

istream& operator>>(istream& is, bignum& rhs)
{
  string s;
  int i = 0;
  is >> s;
  rhs.assign(max_digit, 0);
  for (auto p = s.rbegin(); p != s.rend(); p++, i++) {
    rhs[i] = *p - '0';
  }
  if (sz(rhs) > max_digit + 1)
    throw runtime_error("overflow >>");
  return is;
}

int main(int argc, char **argv)
{
  int n;
  bignum a, b;
  string s;
  ostringstream os(s);

  cin >> n;
  try {
    while (n--) {
        cin >> a >> b;
        os << (a + b) << endl;
    }
    cout << os.str();
  } catch (runtime_error& re) {
    cout << re.what() << endl;
  }
  return 0;
}

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

using namespace std;


// string^ÅÁZðs¢AÊðÔ·
string add(string &str1,string &str2){
  string str;
  int carry = 0;
  for(int i = 0; i < max(str1.size(),str2.size()); i++){
    if(i >= str1.size()){
      int ret = carry + str2[str2.size()-1-i] - '0';
      carry = ret / 10;
      str += (ret % 10) + '0';
    }
    else if(i >= str2.size()){
      int ret = carry + str1[str1.size()-1-i] - '0';
      carry = ret / 10;
      str += (ret % 10) + '0';
    }
    else{
      int ret = str1[str1.size()-1-i] + str2[str2.size()-1-i] - '0' - '0' + carry;
      carry = ret / 10;
      str += (ret % 10) + '0';
    }
  }
  str+=(carry+'0');
  // jóIÏX
  reverse(str.begin(),str.end());
  // æªÌ0ðÁ·
  int idx;
  for(int i = 0; i < str.size(); i++){
    idx=i;
    if(str[i]!='0'||str.size()-1==i)
      break;
  }
  return str.substr(idx);
}

int main(){

	int n;
	cin>>n;
	for(int i = 0; i < n; i++){
		string s1,s2;
		cin>>s1>>s2;
		if(s1.size()>80||s2.size()>80){
			cout<<"overflow"<<endl;
		}
		else{
			string ret=add(s1,s2);
			if(ret.size()>80){
				cout<<"overflow"<<endl;
			}
			else
				cout<<ret<<endl;
		}
	}

	return 0;
}

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

using namespace std;

void ans(string n);

int main()
{
	int i,j,cy;
	string a,b,c,d;
	int n;
	
	cin >> n;
	
	for(int k=0;k<n;k++)
	{
		c=d="";
		cin >> a >> b ;
		
		if(a.size()>b.size())
		{
			
			for(i=b.size();i<a.size();i++)
				d+="0";
				d+=b;
				b=d;
		}
		else
		{
			for(i=a.size();i<b.size();i++)
				d+="0";
				d+=a;
				a=d;
		}
//		cout << "a:" << a << endl;
//		cout << "b:" << b << endl;
		cy=0;
		for(i=a.size()-1,j=0;i>=0;i--,j++)
		{
			c+=a[i]+b[i]-'0'+cy;
			if(c[j]-'9'>0)
			{
				c[j]='0'+c[j]-':';
				cy=1;
			}
			else
				cy=0;
		}
		if(cy==1)
			c+=char(cy+48);
		if(c.size()<81)
			ans(c);
		else
			cout << "overflow" << endl;
	}
}

void ans(string n)
{
	for(int i=n.size()-1;i>=0;i--)
		cout << n[i] ;
	cout << endl;
	return ;
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
 
 int main()
 {
   int N;
   cin>>N;
   while(N--)
   {
     string a,b,sum;
     cin>>a>>b;
     int up=0;
     int i;
     for(int j=0;j<a.length()/2;j++) swap(a[j],a[a.length()-j-1]);
     for(int j=0;j<b.length()/2;j++) swap(b[j],b[b.length()-j-1]);
     for(i=0;i<a.length()&&i<b.length();i++)
     {
       sum+=(((a[i]-'0')+(b[i]-'0')+up)%10)+'0'; 
       if(a[i]-'0'+b[i]-'0'+up>=10) up=1;   
       else up=0;  
     }          
     while(i<a.length()) 
     {
       sum+=((a[i]-'0'+up)%10)+'0';
       if(a[i]-'0'+up>=10) up=1; 
       else up=0;         
       i++;          
     }
     while(i<b.length()) 
     {
       sum+=((b[i]-'0'+up)%10)+'0';
       if(b[i]-'0'+up>=10) up=1; 
       else up=0;
       i++;                   
     }
     if(up==1) sum+='1';
     if(sum.length()>=80) cout<<"overflow"<<endl;
     else
     {
       for(int i=sum.length()-1;i>=0;i--) cout<<sum[i];
       cout<<endl;    
     }
   }
   //while(1);      
   return 0;    
 }