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>

#define DIGIT  ( 80 )

using namespace std;

static
int N;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  cin >> N;

  while ( N-- )
  {
    string        A, B;
    int           C[ DIGIT + 1 ] = { 0 };
    const char  * p;

    cin >> A >> B;

    p = A.c_str ( );
    for ( size_t i = 0; i < A.length ( ); ++i )
    {
      C[ i ] = p[ A.length ( ) - i - 1 ] - '0';
    }

    p = B.c_str ( );
    for ( size_t i = 0; i < B.length ( ); ++i )
    {
      C[ i ]     += p[ B.length ( ) - i - 1 ] - '0';
    }

    for ( size_t i = 0; i < DIGIT; ++i )
    {
      C[ i + 1 ] += C[ i ] / 10;
      C[ i ]     %= 10;
    }

    if ( C[ DIGIT ] )
    {
      cout << "overflow";
    }
    else
    {
      int i = DIGIT;
      while ( !C[ i ] && i > 0 )
        --i;
      while ( i >= 0 )
      {
        cout << C[ i-- ];
      }
    }
    cout << endl;
  }

  return ( 0 );
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int n;
int main()
{
	cin>>n;
	for(;n--;)
	{
		string s,t,u="";cin>>s>>t;
		if(s.size()<t.size())swap(s,t);
		int a=0;
		for(int i=0;i<s.size();i++)
		{
			a+=s[s.size()-i-1]-48;
			if(i<t.size())a+=t[t.size()-i-1]-48;
			u+=a%10+48;
			a/=10;
		}
		if(a)u+=a+48;
		if(u.size()>80)
		{
			cout<<"overflow"<<endl;
		}
		else
		{
			for(int i=u.size();i--;)cout<<u[i];
			cout<<endl;
		}
	}
}

C++: //0015 National Budget
//80ÜÅÌ2ÂÌ®Ì«µZÊðoÍ¹æ
//1sÚÉf[^Zbgnª^¦çêé
//^¦çê½â»Ìaª80ð´¦½êAoverflowÆoÍµÄ­¾³¢

#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;


int main(void)
{
	int n;
	cin >> n;
	while(n--)
	{
		const int N = 80;
		int i;
		string a, b;
		//0ú»
		char c[N+2] = "";

		cin >> a >> b;

		//vZµâ·¢æ¤É½]
		reverse(a.begin(), a.end());
		reverse(b.begin(), b.end());

		int aSize, bSize;
		aSize = a.size();
		bSize = b.size();

		//Ü¸ÍAcÉ»ÌÜÜlðüêÄ¢­
		for(int i = 0; i < max( max(aSize, bSize), N); i++)
		{
			int s = 0;
			if(i < aSize)
				s += a[i] - '0';
			if(i < bSize)
				s += b[i] - '0';

			c[i] += s;
			c[i+1] += c[i]/10;
			c[i] %= 10;
		}

		//ã©ç©Ä¢ÁÄA0ÈOÌ¶ª»ê½ç¶»·é
		bool isAnswer = false;
		for(i = sizeof(c)-1; i >= 0; i--)
		{
			if(c[i])
				isAnswer = true;
			if(isAnswer)
				c[i] += '0';
		}
		//½]µÄ®¬
		reverse(c, c+strlen(c));

		//àµà80¶ÚªNULL¶Å êÎI[o[t[
		if(c[N])
			cout << "overflow" << endl;
		else
			cout << c << endl;
	}
	return 0;
}

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

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

	for(int i=0;i<n;++i){
		string N1,N2;
		vector<int> num_line;
		cin >> N1 >> N2;

		int upper=0;
		int num;
		string longer  = N1.size() > N2.size() ? N1 : N2;
		string shorter = N1.size() < N2.size() ? N1 : N2;

		for(int i=0;i<longer.size();++i){
			if(i < shorter.size())
				num = longer[i]-'0' + shorter[i]-'0' + upper;
			else
				num = longer[i] - '0' + upper;
			
			if(num > 9){
				upper = 1;
				if(i != longer.size() -1)
					num -= 10;
			}else{
				upper = 0;
			}

			num_line.push_back(num);
		}

		for(int i = num_line.size()-1;i>=0;--i){
			cout << num_line[i] ;
		}

	}
	return 0;
}

C++: #include <stdio.h>
#include <string.h>
#define N 80

int main(void){
    char buf[N+1];
    int datas;
    int degits;
    int lint1[N+1], lint2[N+1], sum[N+1];
    int cry;
    
    scanf("%d", &datas);
    for (int n=0; n<datas; n++){
        // reset
        for (int i=0; i<N; i++) lint1[i]=lint2[i]=0;
        // input
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint1[degits-i-1]= buf[i]-'0';
        }
        scanf("%s", buf);
        degits = strlen(buf);
        for (int i=0; i<degits; i++){
            lint2[degits-i-1]= buf[i]-'0';
        }
        // calc
        cry=0;
        for (int i=0; i<N; i++){
            sum[i] = lint1[i]+lint2[i] + cry;
            cry = sum[i]>9 ? 1:0;
            if (cry) sum[i] -= 10;
        }
        // output
        if (cry){
            puts("overflow");
        } else {
            bool zero=true;
            if (cry) puts("1");
            for (int i=N-1; i>=0; i--){
                if (zero && sum[i] != 0) zero=false;
                if (!zero) printf("%d", sum[i], i);
            }
            printf("\n");
        }
        
    }
    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <map>
#include <queue>
#include <string>
using namespace std;

int N,ans[81],a,b,la,lb,up,deg;
string sta,stb;

int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>sta>>stb;
		la=sta.size();
		lb=stb.size();
		up=0;
		for(int i=0;i<max(la,lb)+1;i++){
			if(i>=la)a='0';
			else a=sta[la-1-i];
			if(i>=lb)b='0';
			else b=stb[lb-1-i];
			if(a+b+up>105){
				ans[i]=a+b+up-10-96;
				up=1;
			}
			else{
				ans[i]=a+b+up-96;
				up=0;
			}
			if(ans[i]!=0)deg=i+1;
		}
		if(deg>80)cout<<"overflow"<<endl;
		else{
			for(int i=0;i<deg;i++)cout<<ans[deg-1-i];
			cout<<endl;
		}
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >>n;
  cin.ignore();
  while(n--){
    string one;
    string two;
    string ans[200];
    getline(cin,one);
    getline(cin,two);
    int os = one.size()-1, ts = two.size()-1;
    int ls = max(os,ts), ss = min(os,ts);
    int as = 0,x,t = 0;
    for(int i=0; i<=ls; i++){
      if(i<=os && i<=ts){x = one[os-i]+two[ts-i]-'0'*2+t;}
      else if(i<=os){x = one[os-i]-'0'+t;}
      else if(i<=ts){x = two[ts-i]-'0'+t;}
      t = x/10;
      x = x%10;
      ans[i] = x+'0';
      as++;
    }
    if(t>0){ans[as+1] = t+'0';as++;}
    if(as>=80){cout <<"overflow"<<endl;}
    else{
      for(int i=as; i>=0; i--){
	cout <<ans[i];
      }
      cout <<endl;
    }
  }
  return 0;
}