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 <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <climits>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <queue>
#include <string>
#include <complex>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
#define repd(i,s,e) for(int i=s; i>=e; i--)

typedef vector<int> vi;

int n;
string s1, s2;
char n1[80], n2[80], sum[80];

int main() {
	scanf("%d", &n);
	rep(i,n) {
		memset(n1, 0, sizeof(n1));
		memset(n2, 0, sizeof(n2));
		memset(sum, 0, sizeof(sum));

		cin>>s1>>s2;
		int l1 = s1.size();
		int l2 = s2.size();
		if(max(l1,l2) > 80) {
			printf("overflow\n");
			return 0;
		}

		rep(k,l1) n1[k] = s1[l1-k-1] - '0';
		rep(k,l2) n2[k] = s2[l2-k-1] - '0';

		char a = 0;
		rep(i,80) {
			char c = n1[i] + n2[i] + a;
			a = c / 10;
			sum[i] = c % 10;
		}

		if(a != 0) {
			printf("overflow\n");
			return 0;
		}

		bool start = false;
		repd(i,79,0) {
			if(sum[i] != 0) start = true;
			if(!start && sum[i] == 0) continue;
			printf("%d", sum[i]);
		}
		if(!start) printf("0");
		printf("\n");
	}
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    while (n--) {
        int len, keta = 0;
        string a, b, c = "";
        cin >> a >> b;
        reverse(a.begin(), a.end());
        reverse(b.begin(), b.end());
        len = max(a.size(), b.size());
        for (int i = 0, size = len - a.size(); i < size; i++) {
            a += '0';
        }
        for (int i = 0, size = len - b.size(); i < size; i++) {
            b += '0';
        }
        for (int i = 0; i < len; i++) {
            c += ((a[i] - '0') + (b[i] - '0') + keta) % 10 + '0';
            keta = ((a[i] - '0') + (b[i] - '0') + keta) / 10;
        }
        if (keta == 1) {
            c += '1';
        }
        reverse(c.begin(), c.end());
        if (c.size() > 80) {
            cout << "overflow\n";
        }
        else {
            cout << c << endl;
        }
    }
    
    return 0;
}

C++: #include <stddef.h>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <string>
 
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s1, s2, s3 = "";
    cin >> s1 >> s2;
    size_t m = max(s1.size(), s2.size());
    while (s1.size() < m)
      s1.insert(s1.begin(), '0');
    while (s2.size() < m)
      s2.insert(s2.begin(), '0');
    char c = 0;
    auto it1 = s1.rbegin();
    auto it2 = s2.rbegin();
    for (; it1 != s1.rend(); it1++, it2++) {
      char add = *it1 - '0' + *it2 - '0' + c;
      char ch = add % 10 + '0';
      c = add / 10;
      s3.insert(s3.begin(), ch);
    }
    if (c) s3.insert(s3.begin(), c + '0');
    cout << ((s3.size() > 80) ? "overflow" :s3) << endl;
  }
}

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

int main() {
   int n;
   string str_a;
   string str_b;
   string sum = "";

   scanf("%d", &n);
   for(int i=0; i < n; ++i){
       
       cin >> str_a >> str_b;

   int id_a = str_a.size();
   int id_b = str_b.size();
   int c = 0;

   // ???????????????????????°?????????????????????
   while (id_a > 0 || id_b > 0) {
     int a = 0, b = 0;
     // int??§??°???????????????
     if (id_a > 0) a = str_a[--id_a] - '0';
     if (id_b > 0) b = str_b[--id_b] - '0';
     // ?????¨???????????°???????????????c?????????????????????????????°???????????????
     sum = to_string(((a + b + c) % 10)) + sum;
     // ?¬???????????????°????????????????¨????
     c = (a + b + c) / 10;
   }
   if (c > 0) sum = to_string(c) + sum;
       if (str_a.size() > 80 || str_b.size() > 80 || sum.size() > 80){
           cout << "overflow" << endl;}else{
   cout << sum << endl;}
   sum = "";
   }
}

C++: #include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
	char num1[1002],num2[1002];
	int a1[1002],a2[1002],ans[1002];
	int i,j,n,k,l1,l2,kuriagari=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		kuriagari=0;
		for(j=0;j<1002;j++)
		{
			num1[j]='\0';
			num2[j]='\0';
			a1[j] = 0;
			a2[j] = 0;
			ans[j] = 0;
		}
		scanf("%s",num1);
		getchar();
		scanf("%s",num2);
		getchar();
		l1 = strlen(num1);
		l2 = strlen(num2);
		//printf("%s %s\n",num1,num2);
		for(j=0;j<l1;j++)
		{
			a1[j] = num1[l1-1-j] - '0';
		}
		for(j=0;j<l2;j++)
		{
			a2[j] = num2[l2-1-j] - '0';
		}
		for(j=0;j<1002;j++)
		{
			ans[j] = (a1[j] + a2[j] + kuriagari) % 10;
			if((int)((a1[j] + a2[j] + kuriagari)/10) == 1)
			{
				kuriagari = 1;
			}
			else
			{
				kuriagari = 0;
			}
		}
		bool k=false;
		for(j=1001;j>=80;j--)
		{
			if(ans[j]!=0)
			{
				k=true;
				break;
			}
		}
		if(k)
		{
			printf("overflow\n");
			continue;
		}
		else
		{
			for(j=1001;j>=0;j--)
			{
				if(ans[j] != 0)
				{
					k = j;
					break;
				}
			}
			for(j=k;j>=0;j--)
			{
				printf("%d",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
int max(int a,int b){return a>b?a:b;}
int main(){
	int n,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		char a[81];
		char b[81];
		char x[81];
		char y[81];
		char ans[82];
		scanf(" %s",a);
		scanf(" %s",b);
		for(j=0;j<80;j++){
			x[j]='0';
			y[j]='0';
		}
		x[80]='\0';
		y[80]='\0';
		for(j=0;j<strlen(a);j++)x[79-j]=a[strlen(a)-1-j];
		for(j=0;j<strlen(b);j++)y[79-j]=b[strlen(b)-1-j];
		int k=0;
		for(j=80;j>=1;j--){
			int p=0;
			p+=k;
			p+=(x[j-1]-'0')+(y[j-1]-'0');
			k=p/10;
			ans[j]=p%10+'0';
		}
		ans[0]='0';
		ans[81]='\0';
		j=0;
		while(ans[j]=='0')j++;
		if(k!=0)printf("overflow\n");
		else if(j==81)printf("0\n");
		else{
			for(;j<81;j++){
				printf("%c",ans[j]);
			}
			printf("\n");
		}
	}
	return 0;
}