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 <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,lengthof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

int main() {
	int n;
	cin >> n;
	while (n--){
		string s1, s2;
		cin >> s1 >> s2;
		string ans = "";
		int s1l = s1.length();
		int s2l = s2.length();
		bool up = false;
		REP(i, max(s1l, s2l)){
			int a = up ? 1 : 0;
			if (s1l - i - 1 >= 0)
				a += s1.c_str()[s1l - i - 1] - '0';
			if (s2l - i - 1 >= 0)
				a += s2.c_str()[s2l - i - 1] - '0';
			up = (a >= 10);
			ans = to_string(a % 10) + ans;
			if (max(s1l, s2l) - i-1 == 0 && up)ans = "1" + ans;
		}
		if (ans.length()<=80)
		cout<<ans<<endl;
		else
			cout << "overflow"<<endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
char str[102],str1[102],ans[102];
int sam(int ma1,int ma2)
{
    int co,carry=0,a,b;
    for(int i=0;ma1-i>=0||ma2-i>=0||carry==1;i++){
            if(ma1-i>=0&&ma2-i>=0){
                    a=str[ma1-i]-'0';
                    b=str1[ma2-i]-'0';
                    if(a+b+carry>=10){
                        ans[i]=a+b+carry-10+'0';
                        carry=1;
                    }
                    else {
                        ans[i]=a+b+carry+'0';
                        carry=0;
                    }
            }
            else if(ma1-i>=0){
                    a=str[ma1-i]-'0';
                    if(a+carry>=10){
                        ans[i]=a+carry-10+'0';
                        carry=1;
                    }
                    else {
                        ans[i]=a+carry+'0';
                        carry=0;
                    }
            }
            else if(ma2-i>=0){
                    b=str1[ma2-i]-'0';
                    if(a+carry>=10){
                        ans[i]=a+carry-10+'0';
                        carry=1;
                    }
                    else {
                        ans[i]=a+carry+'0';
                        carry=0;
                    }
            }
            else {
                ans[i]='0'+1;
                return i;
            }
        co=i;

    }
    return co;

}
int main()
{
    int a,b,n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>str>>str1;
        a=strlen(str);
        b=strlen(str1);
        a=sam(a,b);
        for(int j=a;j>0;j--)cout<<ans[j];
        cout<<endl;
    }

}

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

int main(){
  int n;
  string a,b;
  cin>>n;
  while(cin>>a>>b){
    int asize=a.length();
    int bsize=b.length();
    int smax=max(asize,bsize);
    bool flag=false;
    int s;
    stringstream ss;
    for(int i=0;i<smax;i++){
      if(asize-i-1<0) s=strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      else if(bsize-i-1<0) s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0);
      else s=strtol(a.substr(asize-i-1,1).c_str(),NULL,0)+strtol(b.substr(bsize-i-1,1).c_str(),NULL,0);
      if(flag) s++;
      ss<<s%10;
      if(s>9)
	flag=true;
      else
	flag=false;
    }
    if(flag) cout<<1;
    string ans=ss.str();
    for(string::reverse_iterator rit=ans.rbegin();rit!=ans.rend();rit++)
    cout<<*rit;
    cout<<endl;
  }
  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<stdio.h>
#include <algorithm>
#include<string>
#include <utility>
using namespace std;
using namespace std;
int main(){
	
	int m;
	char in[2][100];
	char ans[100];
	int ie[2];
	int ien[2];
	bool max10;
	int Min;
	bool NMin;
	scanf("%d",&m);
	for(;m--;){
		
		for(int i=0;i<2;i++){
			scanf(" %s",&in[i]);
		}
		ie[0]=strlen(in[0])-1;
		ie[1]=strlen(in[1])-1;
		Min=max(ie[0],ie[1]);
		if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){
			cout<<"overflow"<<endl;
		}else{	
			if(ie[0]>ie[1]){
				NMin=0;
			}else{
				NMin=1;
			}
			ien[0]=ie[0];
			ien[1]=ie[1];
			for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){
				in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]-'0';
				if(in[NMin][ien[NMin]]>9+'0'){
					in[NMin][ien[NMin]]-=10;
					in[NMin][ien[NMin]-1]  +=1;
				}
			}
			max10=0;
			for(;ien[NMin]>-1;ien[NMin]--){
				if(in[NMin][ien[NMin]]>9+'0'){
					in[NMin][ien[NMin]]-=10;
					in[NMin][ien[NMin]-1]+=1;
					max10=1;
				}else{
					max10=0;
				}
			}
			if(max10) cout<<"1";
			cout<<in[NMin]<<endl;
		}
	}
	return 0;
}