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 <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
	int N;
	string x, y, temp;
	int i, a[80];
	

	cin >> N;

	for(i = 0;i < 80;i++){
		a[i] = 0;
	}

	while(N != 0){
		bool over = false;
		if(N == 0) break;
		cin >> x >> y;
		N--;
		if(x.size() > 80 || y.size() > 80){
			cout << "overflow" << endl;
			continue;
		}

		if(x.size() < y.size()){
			temp = x;
			x = y;
			y = temp;
		}
		int xi = 0, yi = 0, sum = 0;
		for(i = 0;i < x.size();i++){
			xi = x[x.size() - 1 - i] - '0';
			//cout << "xi = " << xi << endl;
			if(i >= y.size()){
				yi = 0;
			}
			else {
				yi = y[y.size() - 1 - i] - '0';
				//cout << "yi = " << yi << endl;
			}
			a[i] += xi + yi;
			//cout << "xi + yi  = " << a[x.size() - 1 - i] << endl;
			if(a[i] > 9){
				if(i < 79){
					a[i] = a[i] - 10;
					a[i + 1] += 1;
				}
				else if(i >= 79){
					cout << "overflow"	<< endl;
					over = true;
					break;				
				}
			}

			
		}
		 
		if(!over){
			bool start = false;
			for(i = 79;i >= 0;i--){
				if(!start && a[i] > 0){
					start = true;
				}
				if(start){
					cout << a[i];
				}
			}
			cout << endl;
		}
		
		for(i = 0;i < 80;i++){
				a[i] = 0;
		}
		
	}
	return 0;
}

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

using namespace std;

int main(){
    int n; cin >> n;
    while(n--){
        string a,b;
        cin >> a >> b;
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        if(b.size() < a.size()) swap(a,b);
        b += "0";
        for(int i=0; i<b.size()-1; i++){
            int aa = i < a.size() ? a[i] - '0' : 0;
            int bb = b[i] - '0';
            int cc = aa + bb;
            b[i] = (cc%10) + '0';
            //cout << aa << "+" << bb << "=" << cc << endl;
            if(cc >= 10){
                b[i+1]++;
            }
        }
        if(b[b.size()-1] == '0')
            b = string(b.begin(), b.end()-1);
        reverse(b.begin(), b.end());
        if(b.size() >= 80)
            cout << "overflow" << endl;
        else cout << b << endl;
    }
    return 0;
}

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

#define MAX 80

int main(){
	int i, j, n, na, nb, flg;
//	long a[10], b[10];
	char a[MAX*10]={'\0'}, b[MAX*10]={'\0'}, tp;

	scanf("%d", &n);
	while(n--){

	scanf("%s", a);
	na=strlen(a);
	for(i=0, j=na; i<na/2; i++, j--){
		tp=a[i]; a[i]=a[j-1]; a[j-1]=tp;
	}
	scanf("%s", b);
	nb=strlen(b);
	for(i=0, j=nb; i<nb/2; i++, j--){
		tp=b[i]; b[i]=b[j-1]; b[j-1]=tp;
	}


	if(na>nb){
 		for(i=0, flg=0; i<nb; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}	
		for(i=nb; i<na; i++){
			flg+=a[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}
	else {
		for(i=0, flg=0; i<na; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}			
		for(i=na; i<nb; i++){
			flg+=b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}


	j=strlen(a);

	if((na>MAX) || (nb>MAX)||(j>MAX))
		printf("overflow\n");
	else{
		for(i=j; i>0; i--) printf("%c",a[i-1]);
		printf("\n");
	}
	}
	return 0;
}

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

string tasu(string& a, string& b) {
    string s = "";
    if (a.size() < b.size()) swap(a, b);
    int prev = 0;
    for (int i = 1; i <= a.size(); i++) {
        int ac, bc, sum;
        ac = a[a.size()-i] - '0';
        if (b.size() < i) {
            bc = 0;
        } else {
            bc = b[b.size() - i] - '0';
        }
        sum = ac + bc + prev;
        prev = 0;
        if (sum >= 10) {
            prev = 1;
            sum -= 10;
        }
        s.push_back(sum + '0');
    }
    if (prev) s.push_back('1');
    reverse(s.begin(), s.end());
    if (s.size() > 80) s = "overflow";
    return s;
}

int main() {
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        string a, b;
        cin >> a >> b;
        cout << tasu(a, b) << endl;
    }
    return 0;
}

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

#define NUMBER_DIGITS 80

int main()
{
  int N;
  cin >> N;
  for(int i = 0; i < N; i++){
    char str1[NUMBER_DIGITS + 1];
    char str2[NUMBER_DIGITS + 1];
    char str3[NUMBER_DIGITS / 2 + 1][3];
    char str4[NUMBER_DIGITS / 2 + 1][3];
    int n1[NUMBER_DIGITS / 2 + 1] = {};
    int n2[NUMBER_DIGITS / 2 + 1] = {};
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > NUMBER_DIGITS || m2 > NUMBER_DIGITS)
      cout << "overflow" << endl;
    else if(atoi(str1) <= 2000000000 && atoi(str2) <= 2000000000 && atoi(str1) + atoi(str2) <= 2000000000){
      cout << atoi(str1) + atoi(str2) << endl;
    }else{
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m1 + 1; i += 2, j--){
	if(m1 % 2 == 1 && m1 - i < 0){
	  str3[j][0] = str1[0];
	  str3[j][1] == '\0';
	}else{
	  strncpy(str3[j], &str1[m1 - i], 2);
	  str3[j][2] == '\0';
	}
      }
      for(int i = 2, j = NUMBER_DIGITS / 2; i <= m2 + 1; i += 2, j--){
	if(m2 % 2 == 1 && m2 - i < 0){
	  str4[j][0] = str2[0];
	  str4[j][1] == '\0';
	}else{	  
	  strncpy(str4[j], &str2[m2 - i], 2);
	  str4[j][2] == '\0';
	}
      }
      for(int i = NUMBER_DIGITS / 2; i + ((m1 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m1 / 2; i--)
	if(str3[i][0] == '0' && str3[i][1] == '0')
	  n1[i] = 1000;
	else
	  n1[i] = atoi(str3[i]);
      for(int i = NUMBER_DIGITS / 2; i + ((m2 % 2 == 1) ? 1 : 0) >= NUMBER_DIGITS / 2 - m2 / 2; i--)
	if(str4[i][0] == '0' && str4[i][1] == '0')
	  n2[i] = 1000;
	else
	  n2[i] = atoi(str4[i]);
      int ans[NUMBER_DIGITS / 2 + 1] = {};
      int i = 0;
      int m = (m1 > m2) ? m1 : m2;
      for(int j = NUMBER_DIGITS / 2; NUMBER_DIGITS / 2 - 1 - m / 2 < ((m % 2) ? j + 1 : j); i++, j--)
	if(n1[j] + n2[j] >= 100)
	  if(n1[j] == 1000 && n2[j] < 10){
	    n1[j - 1] *= 10;
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] < 10){
	    n2[j - 1] *= 10;
	    ans[i] = n1[j];
	  }else if(n1[j] == 1000 && n2[j] == 1000){
	    if(n1[j - 1] % 10 != 0)
	      n1[j - 1] *= 10;
	    ans[i] = 1000;
	  }else if(n1[j] == 1000 && n2[j] >= 10){
	    ans[i] = n2[j];
	  }else if(n2[j] == 1000 && n1[j] >= 10){
	    ans[i] = n1[j];
	  }else if(n1[j] + n2[j] < 110){
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] + 900;
	  }else{
	    n1[j - 1]++;
	    ans[i] = n1[j] + n2[j] - 100;
	  }
	else
	  ans[i] = n1[j] + n2[j];
      int k = i;
      for(; i > 0; i--)
	if((i == k) && (ans[i - 1] == 0))
	  ;
	else if(ans[i - 1] == 1000)
	  cout << "00";
	else if(ans[i - 1] > 1000)
	  cout << "0" << ans[i - 1] % 1000;
	else
	  cout << ans[i - 1];
      cout << endl;
    }
  }
}