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<algorithm>
using namespace std;

string strplus(string x,string y){
  if(x.size()>80||y.size()>80)return "overflow";
  string ans;
  int xa[80],ya[80],za[80];
  for(int i=0;i<80;i++)xa[i]=ya[i]=za[i]=0;
  for(int i=0;i<(int)x.size();i++)xa[i]=x[x.size()-1-i]-'0';
  for(int i=0;i<(int)y.size();i++)ya[i]=y[y.size()-1-i]-'0';
  for(int i=0;i<80;i++){
    za[i]+=xa[i]+ya[i];
    if(za[i]>=10){
      if(i==79)return "overflow";
      else za[i+1]++;
    }
    za[i]%=10;
  }
  int flg=0;
  for(int i=79;i>=0;i--){
    if(flg==0&&za[i]==0)continue;
    else{
      flg=1;
      ans.push_back(za[i]+'0');
    }
  }
  return ans;
}
int main(){
  int n;
  string a,b;
  cin>>n;
  while(n--){
    cin>>a>>b;
    cout<<strplus(a,b)<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		//getchar();
		scanf("%s",num2);
		//getchar();
		l1 = strlen(num1);
		//cout << l1 << endl;
		l2 = strlen(num2);
		//printf("%s %s\n",num1,num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((a1[j] + a2[j] + kuriagari)>=10)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool p=false;
		/*for(int i=0;i<1002;i++)
		{
			cout << ans[i];
		}
		cout << endl;*/
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				p=true;
				break;
			}
		}
		if(p)
		{
			printf("overflow\n");
		}
		else
		{
			for(j=79;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}