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

int main() {
  
  int n,i,j;
  cin >> n;

  for(i=0;i<n;i++){
    string str1,str2,temp;
    int kuriagari=0;
    cin >> str1 >> str2;
    
    if (str1.size()<str2.size()){
      temp = str1;
      str1 = str2;
      str2 = temp;
    }
    int goukei[str1.size()+1];
    
    for(j=0;j<str1.size()+1;j++){
      
      if (j==str1.size()){
	goukei[0] = kuriagari;
      }else if (j<str2.size()){
	goukei[str1.size()-j] = str2[str2.size()-1-j] + str1[str1.size()-1-j] + kuriagari -'0' - '0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }else{
	goukei[str1.size()-j] = str1[str1.size()-1-j] + kuriagari -'0';
	if (goukei[str1.size()-j] >= 10) {
	  goukei[str1.size()-j] -= 10;
	  kuriagari = 1;
	}else{
	  kuriagari = 0;
	}
      }
    }
    if ((str1.size()>=81)||( (str1.size()==80)&&(goukei[0]==1) )){
      cout << "overflow" <<endl;
    }else{
      if (goukei[0]!=0)
	cout << goukei[0] ;
      for(j=0;j<str1.size();j++)
	cout << goukei[j+1];
      cout <<endl;
    }
  }
      
  return 0;
  
}

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

int main(void)
{
  int N;
  scanf("%d", &N);

  int i,j,k;
  for(i=0; i<N; ++i){

    int digits[2][80];
    for(j=0; j<2; ++j){
      for(k=0; k<80; ++k){
        digits[j][k] = 0;
      }
    }

    int overflow = 0; 

    for(j=0; j<2; ++j){
      char digit[256];
      scanf("%s", digit);
      getchar();
      
      if(overflow || strlen(digit)>80){
        overflow = 1;
      }else{
        for(k=0; k<strlen(digit); ++k){
          digits[j][k] = digit[strlen(digit)-1-k]-'0';
        }
      }
    }

    if(!overflow){
      int sum[81];
      for(j=0; j<81; ++j){
        sum[j] = 0;
      }

      for(j=0; j<80; ++j){
        for(k=0; k<2; ++k){
          sum[j] += digits[k][j];
        }
        sum[j+1] += sum[j]/10;
        sum[j] %= 10;
      }

      if(sum[80]>0){
        overflow = 1;
      }else{
        int available = 0;
        for(j=80; j>=0; --j){
          if(available || sum[j]!=0 || j==0){
            available = 1;
            printf("%d", sum[j]);
          }
        }
        printf("\n");
      }
    }

    if(overflow){
      printf("overflow\n");
    }
  }

  return 0;
}

C++: #include <cstdio>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define ALL(v) v.begin(), v.end()

string calc(string a, string b);

int main()
{
	int n;
	string a,b;
	scanf("%d", &n);
	
	while(n--){
		cin >> a >> b;
		cout << calc(a,b) << endl;
	}
	return(0);
}

string calc(string a, string b)
{
	reverse(ALL(a));
	reverse(ALL(b));
	
	while(a.size() < b.size()) a += '0';
	while(b.size() < a.size()) b += '0';
	
	int c = 0;
	string res;
	
	for(int i = 0; i < a.size(); i++){
		c = c+a[i] - '0' + b[i] - '0';
		res += c%10 + '0';
		c /= 10;
	}
	if(c)res += c + '0';
	if(res.size() > 80) return "overflow";
	reverse(ALL(res));
	return res;
}

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

int c[100];

void add(char*a, char*b)  //鮟倩ョ、a豈巴髟ソ
{
    fill(c,c+100,0);      //蜥檎噪蜷?ス咲スョ髮カ
    int la=strlen(a), lb=strlen(b);
    int i,j;
    for( i=la,j=lb;i>la-lb&&j>0;i--,j--) // 菫晉蕗c豈泌刈謨ー譛?柄荳イ螟壻ク?ス?    {
            c[i]+=a[i-1]-'0'+b[j-1]-'0';
            if(c[i]>9)
            {
                c[i]-=10;
                c[i-1]++;
            }
    }
        for( i=la-lb;i>0;i--)
        {
            c[i]+=a[i-1]-'0';
            if(c[i]>9)
            {
                c[i]-=10;
                c[i-1]++;
            }
        }
        
        if(la==80&&c[0]==1) printf("overflow\n");
        else
        {
            if(c[0]==0)
            {
                for( i=1;i<=la;i++)
                    printf("%d",c[i]);
                printf("\n");
            }
            else
            {
                for( i=0;i<=la;i++)
                   printf("%d",c[i]);
                printf("\n");
            }
        }
}

int main()
{
    char a[100], b[100];
    int n;
    scanf("%d",&n);

    while(n--){
    scanf("%s%s",a,b);
    int la = strlen(a), lb = strlen(b);
    if(la>80 || lb>80)
        printf("overflow\n");
    else if(la>lb)
        add(a,b);
    else add(b,a);
    }
    return 0;
}

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

using namespace std;

string sumString(string a, string b) {
  if (a.size() > b.size()) swap(a, b);
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  for (int i = 0; i < a.size(); i++) {
    if (a[i] + b[i] - 2 * '0' < 10) {
      b[i] += a[i] - '0';
    } else {
      b[i] = (a[i] + b[i] - 2 * '0') % 10 + '0';
      int j = i + 1;
      while (j < b.size() && b[j] == '9') {
        b[j++] = '0';
      }
      if (j == b.size()) b += "1";
      else b[j] += 1;
    }
  }
  reverse(b.begin(), b.end());
  return b;
}

int main(void) {
  int n;
  cin >> n;

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

    string ans = sumString(a, b);
    cout << (ans.size() <= 80 ? ans : "overflow") << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<string>
typedef unsigned int u;
using namespace std;
typedef string::iterator s;
u z=100000000;
void p(u*a,u*l,u n){
	if(a-l)
	p(a+1,l,(n+=*a*10)/z),
	*a=n%z;	
}
u t(u*a,u*l){
	u r=0;
	char b[11]={};
	if(a-l)
	if(!t(a+1,l)){
		if(*a)cout<<*a,r=1;
	}else
		sprintf(b,"%d",*a+z),
		cout<<b+1,
		r=1;
	return r;
}
void d(u*a,u*l,u*b,u n=0){
	if(a-l)
	d(a+1,l,b+1,(n+=(*a+*b))/z),
	*a=n%z;
}
u main(){
	u n;
	cin>>n;
	string a,b;
	getline(cin,a);
	for(;n--;){
		getline(cin,a);
		getline(cin,b);
		u x[11]={},y[11]={},c=0;
		for(s i=a.begin();i!=a.end();p(x,x+10,*i++-48))
			if(++c>80)goto g;
		c=0;
		for(s i=b.begin();i!=b.end();p(y,y+10,*i++-48))
			if(++c>80)goto g;
		d(x,x+11,y);
		if(x[10])goto g;
		else if(!t(x,x+10))cout<<'0';
		if(0)
g:
		cout<<"overflow";
		cout<<'\n';
	}
}

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

char a[256], b[256], c[256];	
int sz = 0;
int carry = 0;

int main()
{

	memset( a, '0', 80 );
	memset( b, '0', 80 );
	std::cin >> a >> b;
	
	int maxlen = std::max( strlen( a ), strlen( b ) );
	
	if( maxlen > 80 ){
	 	goto OVERFLOW;
	}
	
	std::reverse( a, a + strlen( a ) );
	std::reverse( b, b + strlen( b ) );
	
	a[strlen( a )] = '0';
	b[strlen( b )] = '0';
	
	for( int i = 0; i <= maxlen + 1; i++ ){
		int na = a[i] - '0' + carry;
		int nb = b[i] - '0';
		
		if( na + nb >= 10 ){
			na += nb - 10;
			carry = 1;
		}
		else{
			na += nb;
			carry = 0;
		}
		
		c[i] = na + '0';
	}
	
	sz = maxlen;
	
	if( c[sz] >= '1' && c[sz] <= '9' ){
	 	sz++;
	}
	
	if( sz >= 80 ){
OVERFLOW:
	 	std::cout << "overflow" << std::endl;
	}
	else{
		std::reverse( c, c + sz );
		c[sz] = '\0';
		std::cout << c << std::endl;
	}

 	return 0;
}