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<cstring>
#include<algorithm>
using namespace std;
int main(void){
    int n;
    scanf("%d",&n);
    while(n--){
        int x[1000] = {0},y[1000] = {0},sum[1000] ={0};
        char a[1000] = {0},b[1000] = {0};
        scanf("%s%s",a,b);
        int c = max(strlen(a),strlen(b));
        int cnt1 = 1,cnt2 = 1;
        for(int i = 100;i>=0; i--){
            if(a[i] != '\0'){
                x[cnt1] = a[i]-'0';
                cnt1++;
            }
            if(b[i] != '\0'){
                y[cnt2] = b[i] - '0';
                cnt2++;
            }
        }
        for(int i = 1;i <= 100; i++){
            sum[i] += x[i] + y[i];
            if(sum[i] > 9){
                sum[i] -= 10;
                sum[i+1] = sum[i+1]++;
            }
        }
        int d = 0;
        if(sum[c+1] == 0)d = 1;
        cnt1 = 0;
        for(int i = c+1-d; i >= 0; i--){
            if(i==0 && sum[0]==0 && cnt1==81){
                goto overflow;
            }
            cnt1++;
        }
        for(int i = c+1-d; i >= 0; i--){
            if(i==0 && sum[0]==0)break;
            printf("%d",sum[i]);
        }
        printf("\n");
        continue;
        overflow:
        printf("overflow\n");
    }
    return 0;
}

C++: #include <iostream>
#include <iostream>
#include <vector>
using namespace std;
string add(string a,string b){
  int numa[200] = {0},numb[200] = {0};
  for(int i = a.size()-1 ; i >= 0 ; i-- )numa[a.size()-i-1] = a[i]-'0';
  for(int i = b.size()-1 ; i >= 0 ; i-- )numb[b.size()-i-1] = b[i]-'0';

  vector<int> renum(201);
  fill(renum.begin(),renum.end(),0);
  int mxsize = max(a.size(),b.size());

  for(int i = 0 ; i < mxsize ; i++ ){
    renum[i+1] = (renum[i] + numa[i] + numb[i])/10;
    renum[i] = (renum[i] + numa[i] + numb[i])%10;
  }

  string srenum = "";
  for(int i = mxsize ; i >= 0 ; i-- ){
    if(i == mxsize && renum[i] == 0)continue;
    srenum += renum[i]+'0';
  }
  return srenum;
}

int main(){
  int n;
  cin >> n;
  while(n--){
    string a,b;
    cin >> a >> b;
    a = add(a,b);
    if(a.size() > 80)cout << "overflow" << endl;
    else cout << a << endl;
  }
  return 0;
}

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

using namespace std;

int main(void){
	int n;

	cin >> n;
	for(int i=0;i<n;i++){
		int len,mlen=0;
		char val[2][81]={0},tmp[81],crr=0;

		for(int j=0;j<2;j++){
			cin >> tmp;
			len = strlen(tmp);
			mlen = mlen>len?mlen:len;
			for(int k=0;k<len;k++)
				val[j][len-1-k]=tmp[k]-0x30;
		}

		for(int j=0;j<mlen;j++){
			val[0][j]+=val[1][j]+crr;
			crr=val[0][j]/10;
			val[0][j]%=10;

			if(j==mlen-1&&crr)
				mlen++;
		}
	}

	return 0;
}

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

int main(void){
	string a,b;
	vector<int> ans;
	int n,num,ai,bi,c=0;
	bool flag;

	cin >> n;

	if(n>0&&n<=100){
		for(int i=0;i<n;i++){
			cin >> a >> b;
			flag=false;	

			for(int j=0;j<100;j++){
				num=0;
				ai=a.size()-j-1;
				bi=b.size()-j-1;
				if(ai<0&&bi<0&&c==0) break;
				if(ai>=0) num+=a[ai]-48;
				if(bi>=0) num+=b[bi]-48;
				ans.push_back((num+c)%10);
				if(num+c>=10) c=1;
				else c=0;
			}
			if(ans.size()>80){
				cout << "overflow";
			}else{
				for(int j=ans.size()-1;j>=0;--j){
					cout << ans[j];
				}
				cout << endl;
				ans.clear();
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <math.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (int kk = 0; kk < n; ++kk)
	{
		int A[1001] = {},B[1001] = {},C[1001] = {},keta = 0;
		string in1,in2;
		cin >> in1 >> in2;
		if(in1.size() > 80 || in2.size() > 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = 0; i < in1.size(); ++i)
			A[in1.size()-i] = (int)(in1[i]-'0');
		for (int i = 0; i < in2.size(); ++i)
			B[in2.size()-i] = (int)(in2[i]-'0');
		bool flag = 1;
		for (int i = 1; i <= 1000; ++i)
		{
			C[i] += A[i]+B[i];
			if(C[i] >= 10)
			{
				C[i+1] += C[i]/10;
				C[i] -= C[i]/10*10;
			}
			if(C[i] != 0)
				keta = i;
		}
		if(keta >= 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for (int i = keta; i > 0; --i)
		{
			cout << C[i];
		}
		cout << endl;
	}
}

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

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[81], b[81], x[81], y[81];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		int LB=strlen(b);
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[81];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(big>=80 && carry!=0) printf("overflow\n");
		else{
			if(carry!=0){
				ans[big++]=carry+'0';
				ans[big]='\0';
				//printf("carries\n");
			}	
			
			int LS=strlen(ans);
			char fans[82];
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}	
		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int N;
	string x, y, temp;
	int i, a[80];
	bool over = false;

	cin >> N;

	for(i = 0;i < 80;i++){
		a[i] = 0;
	}

	while(N != 0){
		if(N == 0) break;
		cin >> x >> y;
		N--;
		if(x.size() > 80 || y.size() > 80){
			cout << "overflow" << endl;
			continue;
		}

		if(x.size() < y.size()){
			temp = x;
			x = y;
			y = temp;
		}
		int xi = 0, yi = 0, sum = 0;
		for(i = 0;i < x.size();i++){
			xi = x[x.size() - 1 - i] - '0';
			//cout << "xi = " << xi << endl;
			if(i >= y.size()){
				yi = 0;
			}
			else {
				yi = y[y.size() - 1 - i] - '0';
				//cout << "yi = " << yi << endl;
			}
			a[i] += xi + yi;
			//cout << "xi + yi  = " << a[x.size() - 1 - i] << endl;
			if(a[i] > 9){
				if(i < 79){
					a[i] = a[i] - 10;
					a[i + 1] += 1;
				}
				else if(i >= 79){
					cout << "overflow"	<< endl;
					over = true;
					break;				
				}
			}

			
		}
		 
		if(!over){
			bool start = false;
			for(i = 79;i >= 0;i--){
				if(!start && a[i] > 0){
					start = true;
				}
				if(start){
					cout << a[i];
				}
			}
		}
		cout << endl;
		for(i = 0;i < 80;i++){
				a[i] = 0;
		}
		
	}
	return 0;
}