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 <vector>

using std::cin;
using std::cout;
using std::endl;
using std::vector;

constexpr int MAX_DIGIT = 80;

int main()
{
    int data_num;
    cin >> data_num;

    while (data_num--) {
        std::string in01_str, in02_str;
        cin >> in01_str >> in02_str;

        vector<char> in01_ch(in01_str.rbegin(), in01_str.rend());
        vector<char> in02_ch(in02_str.rbegin(), in02_str.rend());

        std::size_t size;
        if (in01_ch.size() < in02_ch.size()) {
            size = in02_ch.size();
            in01_ch.resize(size, '0');
        } else {
            size = in01_ch.size();
            in02_ch.resize(size, '0');
        }

        vector<int> in01(size), in02(size);
        for (unsigned i = 0; i < size; i++) {
            in01.at(i) = in01_ch.at(i) - '0';
            in02.at(i) = in02_ch.at(i) - '0';
        }

        vector<int> out;
        bool is_over = false;
        for (unsigned i = 0; i < size; i++) {
            int num = in01.at(i) + in02.at(i) + (is_over? 1: 0);
            is_over = (num > 9)? true: false;

            out.push_back(num % 10);
        }
        if (is_over) {
            out.push_back(1);
        }

        if (out.size() > MAX_DIGIT) {
            cout << "overflow" << endl;
            continue;
        }

        for (unsigned i = 0; i < out.size(); i++) {
            cout << out.at(out.size() - 1 - i);
        }
        cout << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main(){
long n,i,j,k,l,m,u,v,c;
string s,t,w;
char p[81];
cin>>n;
for(k=0;k<n;k++){
cin>>s>>t;
l=s.size();if(l>80){cout<<"overflow"<<endl;continue;}
m=t.size();if(m>80){cout<<"overflow"<<endl;continue;}
if(l<m){w=s;s=t;t=w;}
for(c=0,i=l-1,j=m-1;j>=0;i--,j--){
u=s[i]-48;v=t[j]-48;
u+=v+c;
c=0;
if(u>9){c=1;u-=10;}
s[i]=u+48;
}
for(;i>=0;i--){
u=s[i]-48;
u+=c;
c=0;
if(u>9){c=1;u-=10;}
s[i]=u+48;
}
if(l==80&&c==1){cout<<"overflow"<<endl;continue;}
if(c==1)cout<<"1";cout<<s<<endl;
}
return 0;
}

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

using namespace std;

int main (int argc, char * const argv[]) {
    // insert code here...
	int n;
    string a, b;
		
	cin>> n;	
	for(int i=0;i<n;i++){
		int x[81]={0}, y[81]={0}, z[81]={0};

		cin >> a;
		cin >> b;
		if(a.size()>80 || b.size()>80){
		cout << "overflow" <<endl;
		continue;
		}
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());
		
		for(int j=0;j<a.size();j++){
			x[j]=a[j]-'0';
		}
		for(int j=0;j<b.size();j++){
			y[j]=b[j]-'0';
		}
		
		for(int j=0;j<80;j++){
			z[j]+=x[j]+y[j];
			if(z[j]>=10){
				z[j+1]++;
				z[j]-=10;
			}
		}
		
		if(z[80]>0){
			cout << "overflow" <<endl;
		}else{
			bool flag = 0;
			for(int j=79;j>=0;j--){
				if(z[j]==0&& flag==0){
					continue;
				}else{
					flag=1;
				}
				cout<<z[j];
			}
			if(flag==0){
				cout<<0;
			}
			cout<<endl;
			
		}
		
	}
	
	return 0;
}

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

using namespace std;

void tasu(string s1, string s2){
        int num[2][max(s1.length(), s2.length())+1];
        for(int i = 0; i < sizeof(num[0])/sizeof(int); i++){
                if(s1.length() > i){ 
                        num[0][i] = (int)s1.at(s1.length()-1-i) - (int)'0';
                }else{
                        num[0][i] = 0;
                }   
                if(s2.length() > i){ 
                        num[1][i] = (int)s2.at(s2.length()-1-i) - (int)'0';
                }else{
                        num[1][i] = 0;
                }   
        }   
        for(int i = 0; i < sizeof(num[0])/sizeof(int)-1; i++){
                num[1][i] += num[0][i];
                if(num[1][i] > 9){ 
                        num[1][i+1] += (int)(num[1][i]/10);
                        num[1][i] %= 10; 
                }   
        }   
        int keta = sizeof(num[0])/sizeof(int);
        while(keta && !num[1][keta-1]){
                keta--;
        }   
        if(keta => 80){
                cout << "overflow" << endl;
        }else{
                while(keta--){
                        cout << num[1][keta];
                }   
                cout << endl;
        }   
}
int main(){
        int n;
        cin >> n;
        while(n--){
                string s1, s2; 
                cin >> s1 >> s2; 
                tasu(s1, s2);
        }   
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n;
    cin >> n;
    rep(i,n){
        char input1[81], input2[81];
        cin >> input1 >> input2;
        //後ろから和を求める
        int ans[81] = {0};
        int size1 = strlen(input1) - 1;
        int size2 = strlen(input2) - 1;
        int i = 0;
        while(1){
            if(size1 - i >= 0 && size2 - i >= 0)
                ans[i] += input1[size1 - i] - '0' + input2[size2 - i] - '0';
            else if(size1 - i >= 0)
                ans[i] += input1[size1 - i] - '0';
            else if(size2 - i >= 0)
                ans[i] += input2[size2 - i] - '0';
            //桁数を繰り上げる
            if(ans[i] >= 10){
                ans[i] -= 10;
                ans[i + 1]++;
            }
            if(size1 - i < 0 && size2 - i < 0)
                break;
            i++;
        }
        //出力
        if(ans[80] == 1)
            cout << "overflow" << endl;
        else{
            for(int j = i; j >= 0; j--){
                if(ans[i] == 0 && j == i)
                    continue;
                cout << ans[j];
            }
        }
        cout << endl;
    }
}

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

#define DIGIT  ( 80 )

using namespace std;

static
int N;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  cin >> N;

  while ( N-- )
  {
    string        A, B;
    int           C[ DIGIT + 1 ] = { 0 };
    const char  * p;

    cin >> A >> B;

    p = A.c_str ( );
    for ( size_t i = 0; i < A.length ( ); ++i )
    {
      C[ i ] = p[ A.length ( ) - i - 1 ] - '0';
    }

    p = B.c_str ( );
    for ( size_t i = 0; i < B.length ( ); ++i )
    {
      C[ i ]     += p[ B.length ( ) - i - 1 ] - '0';
    }

    for ( size_t i = 0; i < DIGIT; ++i )
    {
      C[ i + 1 ] += C[ i ] / 10;
      C[ i ]     %= 10;
    }

    if ( C[ DIGIT ] )
    {
      cout << "overflow";
    }
    else
    {
      int i = DIGIT;
      while ( !C[ i ] )
        --i;
      while ( i >= 0 )
      {
        cout << C[ i-- ];
      }
    }
    cout << endl;
  }

  return ( 0 );
}