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

const int size = 80;
char str1[size + 10], str2[size + 10];
int num1[size], num2[size], res[size];
int n, leng1, leng2, rep, kuri;
bool output;

int main(){
	scanf("%d", &n);
	
	for(int a = 0; a < n; a++){
		fill(str1, str1 + size + 10, 0);
		fill(str2, str2 + size + 10, 0);
		fill(num1, num1 + size, 0);
		fill(num2, num2 + size, 0);
		fill(res, res + size, 0);
		scanf("%s", str1);
		scanf("%s", str2);
		
		//char -> int
		for(leng1 = 0; (int)str1[leng1 + 1] >= 48 && (int)str1[leng1 + 1] <= 57 && leng1 + 1 < size + 10; leng1++);//length of str1
		for(leng2 = 0; (int)str2[leng2 + 1] >= 48 && (int)str2[leng2 + 1] <= 57 && leng2 + 1 < size + 10; leng2++);//length of str2
		
		rep = 1;
		while(leng1 >= 0){
			num1[size - rep] = (int)str1[leng1] - 48;
			leng1--; rep++;
		}
		rep = 1;
		while(leng2 >= 0){
			num2[size - rep] = (int)str2[leng2] - 48;
			leng2--; rep++;
		}
		kuri = 0;
		for(int i = size - 1; i >= 0; i--){
			res[i] = num1[i] + num2[i] + kuri;
			kuri = res[i] / 10;
			if(kuri > 0) res[i] -= 10;
		}
		
		if(kuri > 0) printf("overflow\n");
		else{
			output = false;
			for(int i = 0; i < size; i++){
				if(!output && res[i] == 0) continue;
				else{
					output = true;
					printf("%d", res[i]);
				}
			}
			if(!output) printf("0");
			printf("\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){
			cout<<ans[m_len]<<ans[m_len-1];
		}
		
		
	}
	
	
	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>

const int MAX_SIZE = 128;

#define toI(x) (x-'0')

using namespace std;

class Z
{
private:
  int size;
  char d[MAX_SIZE];
public:
  Z(char *s)
  {
    size = strlen(s);
    for(int i=0;i<MAX_SIZE - size;i++)
      d[i] = 0;
    for(int i=0,j=MAX_SIZE - size;j < MAX_SIZE; i++, j++)
      d[j] = s[i];
  }

  void add(Z r)
  {
    int tmp = max(this->size, r.size);
    int updigit = 0;
    for(int i=MAX_SIZE-1;i>=0;i--){
      int a = 0, b = 0;
      if(this->d[i] == 0&& r.d[i] == 0){
	if(!updigit)
	  goto end;
	this->d[i] = updigit+'0';
	updigit = 0;
	tmp++;
      }else{
	if(this->d[i])
	  a = toI(this->d[i]);
	if(r.d[i])
	  b = toI(r.d[i]);
	int n = a + b + updigit;
	updigit = n / 10;
	this->d[i] = (n % 10)+'0';
      }
    }
  end:
    this->size = tmp;
    return;
  }

  void print()
  {
    if(this->size > 80){
      puts("overflow");
      return;
    }
    for(int i=0;i<MAX_SIZE;i++)
      if(d[i] != -1)
	putchar(d[i]);
    puts("");
  }

  int sz()
  {
    return this->size;
  }
};

int main()
{
  int d;
  scanf("%d", &d);
  char s1[128], s2[128];  
  while(d--){
    scanf("%s%s",s1, s2);
    Z z1(s1);
    Z z2(s2);
    if(z1.sz() > 80 || z2.sz() > 80){
      puts("overflow");
      continue;
    }
    z1.add(z2);
    z1.print();
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>

using namespace std;

int A[95],B[95],C[95];

int main()
{
    int n;
    cin >> n;
    while(n > 0)
    {
        n--;
        string str1,str2;
        cin >> str1 >> str2;
        int len1 = str1.length();
        int len2 = str2.length();
        if(len1 < len2)
        {
            string st = str1;
            str1 = str2;
            str2 = st;
            int ll = len1;
            len1 = len2;
            len2 = ll;
        }
        for(int i = 0; i < 90; i++)
        {
            C[i] = 0;
            A[i] = 0;
            B[i] = 0;
        }

        for(int i = 0; i < len1; i++)
            A[i] = str1[len1 - 1 - i] - '0';
        for(int i = 0; i < len2; i++)
            B[i] = str2[len2 - 1 - i] - '0';
        for(int i = 0 ; i < len1; i++)
        {
            C[i] = A[i] + B[i] + C[i];
            C[i+1] = C[i] / 10;
            C[i] = C[i] % 10;
        }
        //for(int i = len2; i <len1; i++)
       // {
           //  C[i] = C[i] + A[i];
           //  C[i+1] = C[i] / 10;
          //   C[i] = C[i] % 10;
       // }


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

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()

int main(){
	string in1,in2;
	int t; scanf("%d",&t);
	while(t--){
		char str[100];
		cin>>in1>>in2;
		if( in1.size()>80 || in2.size()>80 ){
			puts("overflow"); continue;
		}
		reverse(all(in1)); reverse(all(in2));
		int k = 0;
		int i;
		for(i=0; i<min(in1.size(),in2.size()); i++){
			k = (in1[i]-'0')+(in2[i]-'0') + k;
			str[i] = (k%10)+'0';
			k /= 10;
		}
		if( i==in1.size() ){ //in2
			for(; i<in2.size(); i++){
				k = (in2[i]-'0')+k;
				str[i] = (k%10)+'0';
				k /= 10;
			}
		}else{ //in1
			for(; i<in1.size(); i++){
				k = (in1[i]-'0')+k;
				str[i] = (k%10)+'0';
				k /= 10;
			}
		}
		if( k!=0 )str[i++] = k+'0';
		str[i] = 0;
		if( i>80 ){
			puts("overflow"); continue;
		}
		reverse(str,str+i);
		puts(str);
	}
	
	return 0;
}