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<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){

	int n;
	cin >> n;
	while(n > 0){
        char a[120] = {0};
        char b[120] = {0};
        scanf("%s%s",a,b);
        int len_a = 0,len_b = 0;
        //長さを測る
        for(int i = 0; a[i] != 0; i++) len_a++;
        for(int i = 0; b[i] != 0; i++) len_b++;
        //もし80桁を超えてたらoverflowと出力
        if(len_a > 80 || len_b > 80){
            printf("overflow\n");
        }
        //80桁を超えてなかったら
        else{
            char ans[120] = {0};
            //aを逆向きに入れ替える
            for(int i = 0; i < len_a/2; i++){
                swap(a[i],a[len_a-i-1]);
            }
            //bを逆向きに入れ替ええる
            for(int i = 0; i < len_b/2; i++){
                swap(b[i],b[len_b-i-1]);
            }
            //aとbで長い方の長さをとる
            int len = max(len_a,len_b);
            //ここで足し算をする
            for(int i = 0; i < len; i++){
                if(ans[i] != 0){
                    if(a[i] == 0 || b[i] == 0)
                        ans[i] += a[i] + b[i] - '0';
                    else ans[i] += a[i] + b[i] - '0' - '0';

                }
                else if(a[i] == 0 || b[i] == 0) ans[i] += a[i] + b[i];
                else ans[i] += a[i] + b[i] - '0';
                if(ans[i] >= 58){
                    ans[i+1]+='1';
                    ans[i] -= 10;
                }
            }
            //このままではansが逆向きなので入れ替える
            for(int i = 0; i < strlen(ans)/2; i++){
                swap(ans[i],ans[strlen(ans)-i-1]);
            }
            
            int len_ans = 0;
            //ansの長さを測る
            for(int i = 0; ans[i] != 0; i++) len_ans++;
            //もし80桁を超えていたらoverflowと出力する
            if(len_ans > 80) printf("overflow");
            //それ以外なら一文字ずつ出力
            else for(int i = 0; ans[i] != 0; i++) printf("%c",ans[i]);
            printf("\n");
        }
        n--;
	}

	return 0;
}

C++: #include <array>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

typedef array<int, 11> BigInt;

string BigInt2String(BigInt bi) {
  reverse(bi.begin(), bi.end());
  char buf[89] = {};
  char *pos = buf;
  for (auto i : bi) {
    sprintf(pos, "%08d", i);
    pos += 8;
  }
  string result(buf);
  return result.substr(result.find_first_not_of('0'));
}

BigInt String2BigInt(const string& s) {
  BigInt bi { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };

  string t(s);
  int i = 0;
  while (!t.empty()) {
    size_t offset = t.size() < 8 ? 0 : t.size() - 8;
    bi[i++] = atoi(t.substr(offset).c_str());
    t = t.substr(0, offset);
  }
  return bi;
}

string AddBig(const string& x, const string& y) {
  if (x.size() > 80 || y.size() > 80) { return string("overflow"); }

  BigInt x_bi = String2BigInt(x);
  BigInt y_bi = String2BigInt(y);
  BigInt sum { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
  for (int i = 0; i < x_bi.size(); ++i) {
    sum[i] += x_bi[i] + y_bi[i];
    if (sum[i] > 99999999) {
      sum[i + 1] = 1;
      sum[i] -= 100000000;
    }
  }
  if (sum[10] != 0) { return string("overflow"); }
  return BigInt2String(sum);
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string x, y;
    cin >> x;
    cin >> y;
    cout << AddBig(x, y) << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
//ðÇÁ·é
void addplace(unsigned int *a, unsigned int *last, int num){
	if( a == last ) return; //[·¬ÜÛÀ
	
	int carry = (*a * 10 + num) / 100000000;
	addplace(a+1, last, carry);
	*a = (*a * 10 + num) % 100000000;
}
bool trace(unsigned int *a, unsigned int *last){
	if( a == last ) return false; //[·¬ÜÛÀ
	if( !trace(a+1, last) ){
		if( *a > 0 ){
			std::cout << *a;
			return true;
		}
	}else{
		char b[11]={};
		sprintf(b,"%d",*a+100000000);
		std::cout<<b+1;
		return true;
	}
	return false;
}
void add(unsigned int *a, unsigned int *alast, unsigned int *b, int num=0){
	if( a == alast ) return; //[·¬ÜÛÀ
	
	int carry = (*a + *b + num) / 100000000;
	add(a+1, alast, b+1, carry);
	*a = (*a + *b + num) % 100000000;
}
int main(){
	int n;
	std::cin>>n;
	std::string a,b;
	std::getline(std::cin, a);//üsÇÝÌÄ
	for(;n--;){
		std::getline(std::cin, a);
		std::getline(std::cin, b);
		//uint ½è1 0000 0000-1ÜÅJEg·é
		unsigned int _a[11]={},_b[10]={};
		for(std::string::iterator it=a.begin();
			it!=a.end(); it++){
			addplace(_a, _a+10, *it-'0');
		}
		for(std::string::iterator it=b.begin();
			it!=b.end(); it++){
			addplace(_b, _b+10, *it-'0');
		}
		add(_a, _a+11, _b);
		if( _a[10] >= 1 ){
			std::cout<<"overflow\n";
		}else{
			trace(_a, _a+10);
			std::cout<<'\n';
		}
	}
}

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

int main()
{
    int N,j;
    cin >> N;
    for(int i=0 ; i<N ; i++){
        int ans[81]={0};
        ans[0]=11111;
        char strA[100],strB[100];
        cin >> strA >> strB;
        if(strlen(strA)>80||strlen(strB)>80){
            cout << "overflow" << endl;
            continue;
        }
        char str1[strlen(strA)][2],str2[strlen(strB)][2];
        for(int i=0 ; i<strlen(strA) ; i++){
            str1[i][0]=strA[i];
            str1[i][1]='\0';
        }
        for(int i=0 ; i<strlen(strB) ; i++){
            str2[i][0]=strB[i];
            str2[i][1]='\0';
        }
        int a[81]={0},b[81]={0};
        j=strlen(strA)-1;
        for(int i=80 ; j>=0 ; i--){
            a[i]=atoi(str1[j]);
            j--;
        }
        j=strlen(strB)-1;
        for(int i=80 ; j>=0 ; i--){
            b[i]=atoi(str2[j]);
            j--;
        }
        for(int i=80 ; i!=0 ; i--){
            ans[i]=ans[i]+a[i]+b[i];
            if(ans[i]>=10){
                ans[i]=ans[i]-10;
                ans[i-1]++;
            }
        }
        if(ans[0]!=11111){
            cout << "overflow" << endl;
            continue;
        }
        for(int i=1 ; i<81 ; i++){
            if(ans[i]!=0){
                j=i;
                break;
            }
        }
        char c[2];
        for(int i=j ; i<81 ; i++){
            itoa(ans[i],c,10);
            cout << c;
        }
        cout << '\n';
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include<string>
#include <utility>
using namespace std;
using namespace std;
int main(){
	int m;
	string in,in2;
	int a[90],b[90],ans[90];
	int f;
	int a_len,b_len,m_len;
	cin>>m;
	while(m--){
		for(int i=0;i<90;i++){
			a[i]=b[i]=ans[i]=0;
		}
		cin>>in;
		cin>>in2;
		a_len=in.size();
		b_len=in2.size();
		for(int i=0;i<a_len;i++){
			a[a_len-1-i]=in[i]-'0';
		}
		for(int i=0;i<b_len;i++){
			b[b_len-1-i]=in2[i]-'0';
		}
		m_len=max(a_len,b_len);
		if(m_len>80){
			cout<<"overflow"<<endl;
			continue;
		}
		f=0;
		for(int i=0;i<m_len+1;i++){
			ans[i]=(a[i]+b[i]+f)%10;
			f=(a[i]+b[i]+f)/10;
		}
		if(ans[m_len]!=0){
			printf("%d",ans[0])
		}
		
		
	}
	
	
	return 0;
}