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 <algorithm>
using namespace std;
#define repeat(i,n) for (int i = 0; i < (n); ++i)
#define MAX_DIGIT (80)
int main() {
    int N; cin >> N;
    repeat (test,N) {
        int d[MAX_DIGIT+1]; fill(d,d+MAX_DIGIT+1,0);
        repeat (i,2) {
            string s; cin >> s;
            if (80 < s.length()) {
                cout << "overflow" << endl;
                if (i == 0) cin >> s;
                goto next;
            }
            repeat (j,(int)s.length()) {
                d[j] += s[s.length()-1-j] - '0';
            }
        }
        repeat (i,MAX_DIGIT) {
            d[i+1] += d[i] / 10;
            d[i] %= 10;
        }
        if (d[MAX_DIGIT] != 0) {
            cout << "overflow" << endl;
        } else {
            int i = MAX_DIGIT;
            while (d[i] == 0) -- i;
            for (; 0 <= i; --i) cout << d[i];
            cout << endl;
        }
next: ;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void) {
	string str1, str2;
	int i1, i2;	
	vector<char> v;
	vector<char>::iterator it;
	int n; 
	cin >> n;
	while (n--) {
		cin >> str1 >> str2;
		if (str1.length() > 80 || str2.length() > 80) {
			cout << "overflow\n"; 
			continue;
		}
		int up = 0, n1, n2;
		char c;
		v.clear();
		if (str1.length() < str2.length())
			swap(str1, str2);
		for (i1 = str1.length() - 1, i2 = str2.length() - 1;
				i2 >= 0; i1--, i2--) {
			n1 = str1[i1] - '0';
			n2 = str2[i2] - '0';
			n1 = n1 + n2 + up;
			up = n1 / 10;
			n1 = n1 % 10;
			c = (char)(n1 + '0');
			v.push_back(c);
		}
		while (i1 >= 0) {
			n1 = str1[i1] - '0';
			n1 = n1 + up;
			up = n1 / 10;
			n1 = n1 % 10;
			c = (char)(n1 + '0');
			v.push_back(c);
			i1--;
		}
		if (up == 1) {
			v.push_back('1');
		}
		if (v.size() > 80) {
			cout << "overflow" << endl;
			continue;
		}
		reverse(v.begin(), v.end());
		for (it = v.begin(); it != v.end(); it++) {
			cout << *it;
		}
		cout << endl;
	}
}

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

using namespace std;

int main(){
	int n,l1,l2,i;
	string a, b;
	char *ans;
	int ia,ib,sum;
	cin>>n;
	while(n--){
		cin>>a>>b;
		if(a.length()>80 || b.length()>80){
			cout<<"overflow"<<endl;
			exit(0);
		}
		if(a.length()==80 || b.length()==80){
			if((int)a[0]-'0'+(int)b[0]-'0'>9){
				cout<<"overflow"<<endl;
				exit(0);
			}
		}
		if(a.length()<b.length()){
			swap(a,b);
		}
		l1=a.length();
		l2=b.length();
		ans=new char[l1+1];
		for(i=0;i<l1;i++)ans[i]='0';
		for(i=1;i<l2+1;i++){
			ia=(int)a[l1-i]-(int)'0';
			ib=(int)b[l2-i]-(int)'0';
			sum=ia+ib;
			ans[l1-i]+=sum;
		}
		for(i=l2+1;i<l1+1;i++){
			ans[l1-i]=a[l1-i];
		}
		for(i=0;i<l1;i++){
			if(ans[i]-'0'>9){
				ans[i]=ans[i]-10;
				ans[i-1]+=1;
			}
		}
		for(i=0;i<l1;i++){
			cout<<(int)ans[i]-'0';
		}
		cout<<endl;
	}
	return 0;
}

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

int main(){
  string s,t, u;
  int n;
  char ch;

  cin >> n;
  for( int loop=0;loop<n;loop++ ){
    cin >> s >> t;

    //    cout << "\ns=" << s << endl << "t=" <<  t << endl;

    if( s.length()>80 || t.length()>80 ){
      cout << "overflow" << endl;
      continue;
    }

    while( s.length()>t.length() )
      t = "0" + t;
    while( t.length()>s.length() )
      s = "0" + s;
    /*
    cout << "s=" << s << " len=" << s.length() << endl;
    cout << "t=" << t << " len=" << t.length() << endl;
    */
    u="";
    int c=0;
    for( int i=s.length()-1;i>=0;--i ){
      int a = s[i]-'0';
      int b = t[i]-'0';
      int sum = a + b + c;
      if( sum>=10 ){
	sum-=10; c=1;
      }else
	c=0;
      ch = sum + '0';
      u = ch + u;
    }
    if( c==1 )
      u = "1" + u;

    if( u.length()>80 )
      cout << "overflow" << endl;
    else
      cout << u << endl;
  }
  return 0;
}

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


string F(string a,string b)
{
    int i=0,CF=0,JG=0,loop=0;
    string c;
    char *pa,*pb;
    if (a.length()>b.length())
    {
        b.insert(b.begin(),a.length()-b.length(),0x30);
    }
    else
    {
        a.insert(a.begin(),b.length()-a.length(),0x30);
    }
    pb=(char*)a.c_str()+a.length()-1;
    pa=(char*)b.c_str()+b.length()-1;
    for (i=0;i<a.length() || i<b.length();i++)
    {
        JG=(*pa--)+(*pb--)+CF-0x60;
        CF=JG/10;
        JG%=10;
        c.insert(c.begin(),1,JG+0x30);
    }
    if (CF)
    {
        if (i<a.length())
        {
            JG=*pa+CF-0x30;
            CF=JG/10;
            JG%=10;
            c.insert(c.begin(),1,JG+0x30);
        }
        else
        {
            c.insert(c.begin(),1,CF+0x30);
        }
    }
    return c;
}
int main()
{
    int N,i;
    cin>>N;
    string a,b,sum;
    for (i=1;i<=N;i++)
    {
        cin>>a>>b;
        sum=F(a,b);
        if(sum.length()>80)
            cout<<"overflow"<<endl;
        else
            cout<<sum<<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	int n;
	cin >> n;
	for(int j=0;j<n;j++)
	{
		string s1,s2;
		vector<int> ans;
		cin >> s1;
		cin >> s2;
		reverse(s1.begin(),s1.end());
		reverse(s2.begin(),s2.end());
		int k=0;
		int p=max(s1.size(),s2.size());
		int len1=s1.size(),len2=s2.size();
		s1.resize(p+2);
		s2.resize(p+2);
		for(int i=len1;i<p+2;i++)
		{
			s1[i]='0';
		}
		for(int i=len2;i<p+2;i++)
		{
			s2[i]='0';
		}
		ans.resize(p+2);
		for(int i=0;i<p+2;i++)
		{
			ans[i]=((s1[i]-'0')+(s2[i]-'0')+k)%10;
			if((s1[i]-'0')+(s2[i]-'0')+k>=10)k=1;
			else k=0;
		}
		vector<int>::iterator it=ans.end();
		it--;
		int r=0;
		while(*it==0)
		{
			ans.erase(it);
			r++;
			it--;
		}
		ans.resize(p+2-r);
		reverse(ans.begin(),ans.end());
		for(int i=0;i<ans.size();i++)
		{
			cout << ans[i];
		}
		cout << endl;
	}
	return 0;
}