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>
#include <string>
 
using namespace std;
 
char calc(char x,char y,char z,bool &C){
  int a = x - '0',b = y - '0',c = z - '0';
  int d = a + b + c;
 
  if(d >= 10){
    C = true;
    d -= 10;
  }
 
  return d + '0';
}
 
string sum(string a,string b){
  string res = "";
 
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
 
  int length;
  if((int)a.size() > (int)b.size()){
    length = (int)a.size();
     
    for(int i = (int)b.size() ; i < length ; i++){
      b += '0';
    }
 
  }
  else{
    length = (int)b.size();
 
    for(int i = (int)a.size() ; i < length ; i++){
      a += '0';
    }
 
  }
 
  for(int i = 0 ; i <= length ; i++)
    res += '0';
 
  for(int i = 0 ; i < length ; i++){
    bool C = false;
    res[i] = calc(a[i],b[i],res[i],C);
    if(C) res[i+1] = ((res[i+1]-'0') + 1) + '0';
  }

  for(int i = length ; i > 0; i--){
     
    if(res[i] == '0'){
      res.erase(res.begin()+i);
    }
    else{
      break;
    }
     
  }
 
  reverse(res.begin(),res.end()); 
 
  return res;
}

int main(){
  int n;

  cin >> n;
  while(n--){
    string a,b;

    cin >> a >> b;

    string c = sum(a,b);    

    if((int)c.size() > 80) cout << "overflow" << endl;
    else cout << c << endl;
  }

  return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<cstring>

#define A strlen(a)
#define B strlen(b)
#define ANS strlen(ans)

using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    char x=0;
    for(int q = 0;q < n; q++){
        int f = 0;
        bool check[1000]={0};
        char a[1000]={0},b[1000]={0},ans[1000]={0};
        scanf("%s%s",a,b);
        reverse(a,a+A);
        reverse(b,b+B);

        int len1 = max(A,B);
        int len2 = min(A,B);

        (len1 == A) ? f=1 : f=2;

        if(len2 > 80 || len1 > 80){
            printf("overflow\n");
            continue;
        }

        for(int i = 0;i < len1; i++){
            if(a[i] == '0' && b[i] != '0'){
                b[i] -= 48;
                ans[i] = b[i];
                continue;
            }
            if(a[i] != '0' && b[i] == '0'){
                a[i] -= 48;
                ans[i] = a[i];
                continue;
            }
            if(a[i] == '0' && b[i] == '0'){
                ans[i] = '0';
                check[i] = 1;
                continue;
            }
            //printf("uu%d %d\n",A,B);
            if(i >= len2){
                //printf("('ω')v\n");
                //printf("f = %d\n",f);
                if(f == 1)ans[i] = a[i];
                if(f == 2)ans[i] = b[i];
                check[i] = 1;
                continue;
            }
            a[i] -= 48;
            b[i] -= 48;
            x = a[i] + b[i];
            ans[i]= x;
        }
        for(int i = 0;i < ANS; i++){
            if(check[i] == 1){
                if(ans[i] >= 58){
                    if(ans[i] == 58){
                        ans[i] = '0';
                        ans[i+1]++;
                        continue;
                    }
                    else {
                        ans[i] -= 10;
                        ans[i+1]++;
                    }
                }
                continue;
            }
            else if(ans[i] >= 10){
                //printf("yo-yo-\n");
                if(ans[i] == 10){
                    ans[i] = '0';
                    ans[i+1]++;
                    continue;
                }
                else {
                    ans[i] = ans[i] - 10;
                    ans[i+1]++;
                }
            }
            ans[i] += 48;
        }

        reverse(ans,ans+ANS);

        (ANS > 80) ? printf("overflow\n") : printf("%s\n",ans);
    }
    return 0;
}

C++: #include <iostream>
#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i, 0, n)
using namespace std;
int a[81], b[81];
int main()
{
    int n; cin >> n;
    while (n--) {
        rep(i, 81) a[i] = b[i] = 0;
        string s, t;
        cin >> s >> t;
        rep(i, s.size()) a[i] = s[s.size()-i-1]-'0';
        rep(i, t.size()) b[i] = t[t.size()-i-1]-'0';

        int c = 0;
        rep(i, 81) {
            a[i] = a[i] + b[i] + c;
            if (a[i] >= 10) { a[i] -= 10; c = 1; }
            else c = 0;
        }
        if (a[80] != 0)
            cout << "overflow" << endl;
        else {
            int k = 80; while (k > 0 && a[k] == 0) k--;
            for (int i = k; i >= 0; --i) cout << a[i];
            cout << endl;
        }
    }
    return 0;
}

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

int main(){
	string s1, s2;
	stack<int> sum;
	int tmp, carry, n, len1, len2;

	cin>>n;
	while(n--){
		tmp = carry = 0;
		while(!sum.empty())sum.pop();
		cin>>s1>>s2;
		len1 = s1.length()-1;
		len2 = s2.length()-1;
		reverse(s1.begin(), s1.end());
		reverse(s2.begin(), s2.end());

		for(int i=0; i<81; i++){
			tmp = carry;
			if(i<=len1) tmp += s1[i]-'0';
			if(i<=len2) tmp += s2[i]-'0';
			sum.push(tmp%10);
			carry = tmp/10;
		}
		if(sum.top() != 0)cout<<"overflow\n";
		else{
			for(int i=0; i<80; i++){
				if(sum.top()==0)sum.pop();
				else break;
			}
			while(!sum.empty()){cout<<sum.top(); sum.pop();}
			cout<<"\n";
		}
	}	
	return 0;
}

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

using namespace std;

int main (void) {
    int N;
    cin >> N;
    while (N--) {
        string s1, s2;
        cin >> s1;
        cin >> s2;
        if (s1.size() > 80) {
            cout << "overflow" << endl;
            continue;
        }
        if (s2.size() > 80) {
            cout << "overflow" << endl;
            continue;
        }
        vector<int> n1, n2, res;
        for (int i = s1.size(); i--;) {
            n1.push_back((int)(s1[i] - '0'));
        }
        for (int i = s2.size(); i--;) {
            n2.push_back((int)(s2[i] - '0'));
        }
        if (n1.size() < n2.size()) {
            for (int i = n1.size(); i < n2.size(); i++) {
                n1.push_back(0);
            }
        } else if (n2.size() < n1.size()) {
            for (int i = n2.size(); i < n1.size(); i++) {
                n2.push_back(0);
            }
        }
        int s, c = 0;
        for (int i = 0; i < n1.size(); i++) {
            s = n1[i] + n2[i] + c;
            res.push_back(s % 10);
            c = s / 10;
        }
        if (c != 0) {
            res.push_back(c);
        }
        int size = res.size();
        while (size > 0 && res[size - 1] == 0) {
            size--;
        }
        if (size > 80) {
            cout << "overflow" << endl;
        } else {
            int i = size;
            while (i--) {
                cout << res[i];
            }
            cout << endl;
        }
    }
    return 0;
}