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>

using namespace std;

int main() {
    int N;
    cin >> N;
    while(N--) {
        string s1, s2;
        cin >> s1 >> s2;

        if(s1.size() >= 80 || s2.size() >= 80) {
            cout << "overflow" << endl;
            continue;
        }
        char buf[81] = {0};
        int p1 = s1.size()-1, p2 = s2.size()-1, pb = 79;
        int carry = 0;
        while(p2 >= 0) buf[pb--] = s2[p2--];
        pb = 79;
        while(p1 >= 0) {
            int bd = buf[pb];
            if(bd > 0) bd -= '0';
            int d = s1[p1--]-'0' + bd + carry;
            carry = d / 10;
            d %= 10;
            buf[pb--] = d+'0';
        }
        if(pb == 0 && carry > 0) cout << "overflow" << endl;
        else {
            if(carry > 0) buf[pb--] = carry+'0';
            cout << (char*)(buf+(pb+1)) << endl;
        }
    }
    return 0;
}

C++: #include "bits/stdc++.h"

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;

void solve() {
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	int n;
	cin >> n;
	rep(i, n) {
		vector<ll> v1(12), v2(12);
		string s1, s2;
		cin >> s1 >> s2;
		rep(j, 11) {
			if (s1.size() > 9 * j) v1[j] = stoi(s1.substr(9 * j, (s1.size() - 9 * j >= 9 ? 9 : s1.size() - 9 * j)));
			if (s2.size() > 9 * j) v2[j] = stoi(s2.substr(9 * j, (s2.size() - 9 * j >= 9 ? 9 : s2.size() - 9 * j)));
		}
		rep(j, 12) {
			v1[j] += v2[j];
			if (v1[j] >= 1e9) {
				v1[j] -= 1e9;
				if (j != 11) v2[j + 1]++;
			}
		}
		if (v1[8] || v1[9] || v1[10] || v1[11]) cout << "overflow" << endl;
		else {
			rep(j, 12) if (v1[11 - j] != 0) cout << v1[11 - j];
			cout << endl;
		}
	}

}




int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	solve();
	//system("PAUSE");
	return 0;
}

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

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
 
	for (int i = 0; i < N; i++)
	{
		getline(std::cin, str_a);
		getline(std::cin, str_b);
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}

C++: #include <iostream>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
  int n, maxlen;
  char a[100], b[100];

  cin >> n;
  for(int ii = 0 ; ii < n ; ii++){
    string ans = "";
    scanf("%s%s", a, b);
    
    maxlen = max(strlen(a), strlen(b));

    reverse(a, a+strlen(a));
    reverse(b, b+strlen(b));
    
    for(int i = strlen(a) ; i < 100 ; i++){
      a[i] = '0';
    }
    for(int i = strlen(b) ; i < 100 ; i++){
      b[i] = '0';
    }

    int tmp, tmp2 = 0;
    bool flag = 0;

    for(int i = 0 ; i < maxlen ; i++){
      tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
      
      if(i == maxlen - 1){
	//cout << "OK" << endl;
	//tmp = (a[i] - '0') + (b[i] - '0') + tmp2;
	if(tmp >= 10){
	  tmp2 = 1;
	  tmp -= 10;
	  ans += tmp + '0';
	  ans += '1';
	}
	else ans += tmp + '0';
      }

      else if(tmp >= 10){
	tmp2 = 1;
	tmp -= 10;
	ans += tmp + '0';
      }
      else if(tmp <= 9){
	ans += tmp + '0';
	tmp2 = 0;
      }
    }

    reverse(ans.begin(), ans.end());
   
    if(ans.size() > 80) cout << "overflow" << endl;
    else cout << ans << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<string.h>
using namespace std;

int n;
char a[85],b[85],answer[86];
char aa[85],bb[85];
int na=0,nb=0;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		na=0,nb=0;
		//配列aa(bb)を'0'で初期化
		fill(aa,aa+85,'0');
		fill(bb,bb+85,'0');
		fill(a,a+85,0);
		fill(b,b+85,0);
		fill(answer,answer+85,0);
		scanf("%s%s",a,b);
		for(int i=0;a[i]!='\0';i++)
		{
			na++;
		}
		for(int i=0;b[i]!='\0';i++)
		{
			nb++;
		}
		//配列a(b)を右詰めでaa(bb)に収納する
		memcpy(aa+85-na,a,sizeof(char)*na);
		memcpy(bb+85-nb,b,sizeof(char)*nb);
		//以下足し算
		for(int j=84;j>=0;j--)
		{
			answer[j]+=aa[j]+bb[j]-'0';
			//繰り上げ
			if(answer[j]>'9')
			{
				answer[j-1]++;
				answer[j]-=10;
			}
		}
		int count=0;
		for(int j=0;(j<84)&&answer[j]=='0';j++)
		{
			count++;
		}
		if(count<5)
		{
			printf("overflow\n");
		}
		else
		{
		answer[85]='\0';//文字列終了のお知らせ
		memcpy(answer,answer+count,85-count+1);
		//出力
		printf("%s\n",answer);
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string* sum (string& a, string& b);

int main(){
  string a1 = "", a2 = "", *sum0;
  int n, A1, A2;

  cin >> n;
  for(int i = 0; i < n ; i++){
    cin >> a1 >> a2;
    reverse(a1.begin(), a1.end());
    reverse(a2.begin(), a2.end());
    A1 = a1.length();
    A2 = a2.length();
    if(A1 < A2) {
      swap (A1, A2);
      swap (a1, a2);
    }

    for(int i = 0; i < A1 - A2; i++)   a2 += '0';

    sum0 = sum(a1, a2);

    if (sum0->length() > 80) sum0 = new string("overflow");
    else  reverse(sum0->begin(), sum0->end());
    
    cout << *sum0 <<endl;
  }
}

string* sum(string& a, string& b){
  static string buff = "";
  int x = 0, y ;
  for(int i = 0; i < a.length(); i++){
    y = a[i] - '0' + b[i] - '0';
    if (y + x > 9){
      buff += (y + x)% 10 + '0';
      x = 1;
    } else {
      buff += y + x+ '0';
      x = 0;
    }
  }
  if (x==1) buff += '1';
  return &buff;
}

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

using namespace std;
int main(){
	int n,l,m,c;
	string a,b;
	cin >> n;
	for(int i=0;i<n;i++){
		char s[90] = {0};
		cin >> a;
		cin >> b;
		reverse(a.begin(),a.end());
		reverse(b.begin(),b.end());
		if(a.length()<b.length())swap(a,b);
		l = a.length();
		m = b.length();
		c=0;
		for(int j=0;j<l;j++){
			int o=a[j]-'0' + c;
			if(j<m)o += b[j]-'0';
			c = o>9;
			s[j] = o%10 + '0';
		}
		if(c>0)s[l++]='1';
		reverse(s,s+l);
		if(l>80)cout << "overflow" << endl;
		else printf("%s\n",s);
	}
	return 0;
}