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 <iomanip>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef vector <int> vi;
typedef vector <string> vs;

string right(string &text, int n){
	int length = text.size();
	string tmp;
	tmp = text.substr(length-n, n);
	text = text.substr(0, length-n);
	return tmp;
}

long str2lng(string text){
	stringstream ss;
	ss<<text;
	long tmp;
	ss>>tmp;
	return tmp;
}

string lng2str(long n){
	stringstream ss;
	ss<<n;
	string text;
	ss>>text;
	return text;
}

string lng2str8(long n){
	stringstream ss;
	ss<<setw(10)<<setfill ('0')<<n;
	string text;
	ss>>text;
	return text;
}

vi longstr2num(string text){
	vi buf;
	while (!text.empty()){
		if (text.size()>=8)
			buf.push_back(str2lng(right(text, 8)));
		else{
			buf.push_back(str2lng(text));
			text="";
		}
	}
	return buf;
}

int main(void){
	int n;
	cin>>n;
	for (int i=0; i<n; i++){
		string s1, s2;
		cin>>s1>>s2;
		vi tmp, tmp1 = longstr2num(s1), tmp2 = longstr2num(s2);
		int size1 = tmp1.size(), size2 = tmp2.size(), size=max(size1, size2);
		long s, c = 0;
		for (int j=0; j<size; j++){
			s = c;
			if (j<size1) s += tmp1[j];
			if (j<size2) s += tmp2[j];
			
			tmp.push_back(s%100000000);
			c = s / 100000000;
		}
		if (c != 0)	tmp.push_back(c);

		for (int j=tmp.size()-1; j>=0; j--)
			if (j != tmp.size()-1)
				cout<<setfill('0')<<setw(8)<<tmp[j];
			else
				cout<<tmp[j];
		cout<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(){
long double x,y,z;
int i,j,f,n;

scanf("%d",&n);
for(i=0;i<n;i++){
f=0;
scanf("%d %d",&x,&y);
z=x+y;
for(j=0;j<79;j++){
z/=10;
if(z<0){
f=1;
break;
}
}
z=x+y;
if(f==0){
printf("%d\n",z);
}
else if(f==1){
printf("overflow\n");
}
}

return 0;
}

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

int main(void){
	string a,b;
	vector<int> ans;
	int n,num,ai,bi,c=0;
	bool flag;

	cin >> n;

	if(n>0&&n<=100){
		for(int i=0;i<n;i++){
			cin >> a >> b;
			flag=false;	

			for(int j=0;j<100;j++){
				num=0;
				ai=a.size()-j-1;
				bi=b.size()-j-1;
				if(ai<0&&bi<0&&c==0) break;
				if(ai>=0) num+=a[ai]-48;
				if(bi>=0) num+=b[bi]-48;
				ans.push_back((num+c)%10);
				if(num+c>=10) c=1;
				else c=0;
			}
			if(ans.size()>80){
				flag=true;
			}
			if(flag){
				cout << "overflow";
			}else{
				for(int j=ans.size()-1;j>=0;--j){
					cout << ans[j];
				}
			}
			cout << endl;
			ans.clear();
		}
	}
	return 0;
}

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

int add(int a[], int b[]);

int main(){
	const int smax = 81;
	int n;
	int a[smax + 1];
	int b[smax + 1];
	int sum[smax + 1];
	string s1, s2;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> s1 >> s2;
		if(s1.size() >= smax || s2.size() >= smax){
			cout << "overflow" << endl;
		} else {
			int i = 1;
			for(int i = 1; i <= smax; i++){
				a[i] = 0; b[i] = 0; sum[i] = 0;
			}
			for(string::const_reverse_iterator iter = s1.rbegin();
				iter != s1.rend(); iter++)
			{
				a[i++] = ((int)(*iter) - 48);
			}
			i = 1;
			for(string::const_reverse_iterator iter = s2.rbegin();
				iter != s2.rend(); iter++)
			{
				b[i++] = ((int)(*iter) - 48);
			}
			int c = 0;
			for(int j = 1; j < smax; j++){
				sum[j] = (a[j] + b[j] + c) % 10;
				c = (a[j] + b[j] + c) / 10;
			}
			if(c){
				cout << "overflow" << endl;
			} else {
				int sum_sz = max(s1.size(), s2.size());
				if(sum[sum_sz + 1]) cout << 1;
				for(int k = sum_sz; k >= 1; k--)
					cout << sum[k];
				cout << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  string s,n,final;
  int o,c=0;
  cin>>s>>n;
  reverse(s.begin(),s.end());
  reverse(n.begin(),n.end());
  for(int i = 0; i < s.size() || i<n.size() || c;i++){
    if( n.size() == i || s.size() == i){ 
      final.append(1,'1');
      break;
    }
    o = (s[i]-'0')+(n[i]-'0')+c;
    c = o / 10;
    o %= 10;
    final.append(1,o+'0');
  }
  reverse(final.begin(),final.end());
  if(n.size()>=80 || s.size()>=80 || final.size()>=80) cout<<"overflow"<<endl;
  else cout<<final<<endl;
}

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

#define MAX_SIZE 80

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

    string n1, n2;

    while(cin >> n1 >> n2)
    {

        if( n1.size()>80 || n2.size()>80 ){
                cout << "overflow" << endl;
                continue;
        }

        // 先頭を0で埋めて80桁に合わせる
        char num1[MAX_SIZE], num2[MAX_SIZE];
        for(int i=n1.size(); i<80; i++) n1.insert(0, "0");
        for(int i=n2.size(); i<80; i++) n2.insert(0, "0");

        int c=0; // carry out
        char s=0; // sum
        for(int i=0; i<MAX_SIZE; i++){
            s = n1.at(n1.size()-i-1) + n2.at(n2.size()-i-1) - 2*'0' + c;
            // 桁上がりの有無
            if(s>=10){ 
                c = 1;
                s -= 10;
            }else{
                c = 0;
            }
            n1.at(n1.size()-i-1) = s + '0';
        }
 
        if(c){ 
            cout << "overflow" << endl; 
        }else{
            while(n1.at(0)=='0') n1.erase(0,1); // 先頭の0を除く処理
            cout << n1 << endl;
        }

        n1.clear();
        n2.clear();
    }

    return 0;
}

C++: #include <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <queue>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a[80], b[80], r[81];
    fill(a, a+80, 0);
    fill(b, b+80, 0);
    fill(r, r+81, 0);
    string sa, sb;
    cin >> sa >> sb;
    reverse(sa.begin(), sa.end());
    reverse(sb.begin(), sb.end());
    for (unsigned int j = 0; j < sa.length(); j++)
      a[j] = sa[j] - '0';
    for (unsigned int j = 0; j < sb.length(); j++)
      b[j] = sb[j] - '0';
    for (int j = 0; j < 80; j++) {
      r[j] += a[j] + b[j];
      r[j+1] += r[j] / 10;
      r[j] %= 10;
    }
    if (r[80]) {
      cout << "overflow" << endl;
      continue;
    }
    int k = 79;
    for (; k >= 1 && !r[k]; k--);
    for (int j = k; j >= 0; j--)
      cout << r[j];
    cout << endl;
  }
  return 0;
}