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 <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> pint;
#define rep(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

int m;

int f(string s1,string s2,int x){
	if(m>80){cout<<"overflow";return 0;}
	if(s1.size()<=m&&s2.size()<=m&&x==0)return 0;
	if(s1.size()>m)x+=s1[s1.size()-m-1]-'0';
	if(s2.size()>m)x+=s2[s2.size()-m-1]-'0';
	++m;
	f(s1,s2,x/10);
	if(m<=80)cout<<x%10;
	return 0;
}

int main(){
	int n;
	cin>>n;
	rep(i,n){
		m=0;
		string s1,s2;
		cin>>s1>>s2;
		f(s1,s2,0);
		cout<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <ctype.h>

using namespace std;


int ctoi(char c) {
  return isdigit(c) ? c - '0' : c;
}

char itoc(int i) {
  return i + '0';
}

string add(string a, string b) {
  int max_leng, t, ap, bp;
  bool over = false;

  string ret = "";
  max_leng = (a.length() > b.length()) ? a.length() : b.length();
  if (max_leng > 80)
    return "overflow";

  ap = a.length() - 1;
  bp = b.length() - 1;
  for (int i = 0; i < max_leng; i++) {
    if (ap >= 0 && bp >= 0)
      t = ctoi(a.at(ap)) + ctoi(b.at(bp));
    if (ap >= 0 && bp < 0)
      t = ctoi(a.at(ap));
    if (ap < 0 && bp >= 0)
      t = ctoi(b.at(bp));
    if (over) t++; // increase in digit
    ret += itoc(t % 10);
    if (t > 9) over = true;
    else over = false;
    ap--; bp--;
  }
  if (over) ret += '1';
  reverse(ret.begin(), ret.end());
  if (ret.length() > 80) return "overflow";
  else return ret;
}

int main() {
  int n;
  string number1, number2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> number1;
    cin >> number2;
    cout << add(number1, number2) << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){

	int n;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		string a, b;
		cin >> a;
		cin >> b;

		if(b.size() > a.size()){
			string temp;
			temp = a;
			a = b;
			b = temp;
		}

		if(a.size() > 80){
			cout << "overflow" << endl;
		}else{
			for(int j=0 ; j<b.size() ; j++){
				a[a.size()-1-j] = a[a.size()-1-j] + b[b.size()-1-j] -'0';
				if(a[a.size()-1-j] > '9'){
					a[a.size()-1-j] -= 10;
					for(int l=j ; l<a.size() ; l++){
						a[a.size()-2-l] ++;
						if(a[a.size()-2-l] > '9'){
							if(a.size()-2-l == 0){
								a = "0" + a;
							}
							a[a.size()-2-l] -= 10;
						}else break;
					}
				}
			}
			if(a.size() > 80){
				cout << "overflow" << endl;
			}else{
				cout << a << endl;
			}
		}

		}

	return 0;
}

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

int inttostring(char *x,int n){
  return sprintf(x,"%d",n);
}

int main(){
  std::string a;
  std::string b;
  char sum[102];
  int num_a,num_b,num_sum,size_sum;
  int n;

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> a >> b;
    num_a = std::atoi(&a[0]);
    num_b = std::atoi(&b[0]);

    num_sum = num_a+num_b;
    //sum = std::to_string(num_sum);

    size_sum = inttostring(sum,num_sum);

    if(size_sum>80){
      std::cout << "overflow" << std::endl;
      break;
    }

    std::cout << sum << std::endl;
  }
  //std::cout << num_a << std::endl;
  //std::cout << num_b << std::endl;
}

C++: #include<iostream>
#include<stdio.h>
#include <algorithm>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][10000];
	char ans[100000];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		for(int i=0;i<2;i++){
			for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){
				in[i][ie[i]]=in[i][ie[i]]-'0';
			}
		}
		ie[0]--;
		ie[1]--;
		Min=max(ie[0],ie[1]);
		if(Min>80){
			cout<<"overflow"<<endl;
		}else if(Min>79){
			if((int(ie[0][0])+int(ie[1][0]))>9){
				cout<<"overflow"<<endl;
			}
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]];
				if(in[NMin][ien[NMin]+1]>9){
					in[NMin][ien[NMin]+1]-=10;
					in[NMin][ien[NMin]]  +=1;
				}
				
			}
			max10=0;
			if(in[NMin][ien[NMin]+1]>9){
				in[NMin][ien[NMin]+1]-=10;
				max10=1;
			}
			for(int i=0;i<2;i++){
				for(int j=0;j<ie[i]+1;j++){
					in[i][j]=in[i][j]+'0';
				}
			}
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
 
int main(void) {
    char a[81],b[81],result[81],temp[81];
    int ketaagari;
    int i,j;
    int max;
    char in;
    int overflow;
    int count,kazu;
    scanf("%d",&kazu);
    for(count=0;count<kazu;count++) {
        for(i=0;i<81;i++) {
            a[i]=0;b[i]=0;
        }
        i=0;
        overflow=0;
    	
    	scanf(" %s ",temp);
    	
    	i=strlen(temp);
    	//puts(temp);
        if(overflow==0) {
            for(j=0;j<i;j++)a[j]=temp[i-j-1]-'0';
        }
        i=0;
    	//printf("a %s\n",a);
    	scanf(" %s ",temp);
    	i=strlen(temp);
    	

    	
    	if(overflow==0) {
            for(j=0;j<i;j++)b[j]=temp[i-j-1]-'0';
    		
    		//printf("b %s\n",b);
 
            for(i=0,ketaagari=0,max=0;i<80;i++) {
                result[i]=(a[i]+b[i]+ketaagari)%10;
                ketaagari=(a[i]+b[i]+ketaagari)/10;
                if(result[i]!=0)max=i;
            }
            if(ketaagari)overflow=1;
        }
        if(overflow==0) {
            for(i=max;i>=0;i--)printf("%d",result[i]);
            printf("\n");
        } else printf("overflow\n");
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){

    string s;
    int n, num1[101], num2[101], num3[102];

    cin >> n;

    for(int i = 0; i < n; ++i){

        memset(num1, 0, sizeof(num1));
        memset(num2, 0, sizeof(num2));
        memset(num3, 0, sizeof(num3));

        cin >> s;

        for(int i = 0, len = s.size(); i < len; ++i){
            num1[i] = s[len - 1 - i] - '0';
        }

        cin >> s;

        for(int i = 0, len = s.size(); i < len; ++i){
            num2[i] = s[len - 1 - i] - '0';
        }

        for(int i = 0, num; i < 101; ++i){
            num = num1[i] + num2[i] + num3[i];
            num3[i] = num % 10;
            num3[i + 1] = num / 10;
        }

        int ldigit = 0;
        for(int i = 101; i >= 0; i--){
            if(num3[i] != 0){
                ldigit = i;
                break;
            }
        }

        if((ldigit + 1) > 80){
            cout << "overflow" << endl;
        } else {
            for(int i = ldigit; i >= 0; i--){
                cout << num3[i];
            }
            cout << endl;
        }

    }

}