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 <vector>
#include<string>
#include<sstream>

#define CAPACITY 9

 
namespace stoi{
 
    int stoi(std::string str){
        int ret;
        std:: stringstream ss;
        ss << str;
        ss >> ret;
        return ret;
    }
 
}
class OverDigit
{
public:
    int num_a[CAPACITY];
    int num_b[CAPACITY];
    OverDigit(std::string str_a, std::string str_b);
    void ChangeDigit(std::string str,int num[]);
    void Add();
};
 
OverDigit::OverDigit(std::string str_a,std::string str_b)
{
    ChangeDigit(str_a, num_a); 
    ChangeDigit(str_b, num_b);
}

void OverDigit::ChangeDigit(std::string str, int num[])
{
	std::vector <int> num_str(CAPACITY, 0);
    int loc = CAPACITY, k = 8;
    int str_Max, str_rest;

    str_Max = str.length() / CAPACITY;//
    str_rest = str.length() % CAPACITY;


	for (int j = str.length() - CAPACITY; str_Max > 0; j = j-CAPACITY)
	{
        num_str[k] = stoi::stoi(str.substr(j, CAPACITY));
        loc = k;
        k--;
        str_Max--;
    }

    if(str_rest!=0)
	{
		num_str[loc - 1] = stoi::stoi(str.substr(0, str_rest));
	}
 
    for (int j = 0; j < CAPACITY; j++)
	{
		num[j]=num_str[j];
    }
}

void OverDigit::Add()
{
    int num_ans[CAPACITY] = {};
    int fat,overflow=0,count=0;
 
    for (int j = CAPACITY-1; j >0; j--)
	{
        if (num_a[j] + num_b[j]<=999999999)
		{
            num_ans[j] = num_a[j] + num_b[j];
        }
        else
		 if (num_a[j] + num_b[j] > 999999999)
		{
            fat = (num_a[j] + num_b[j]) - 1000000000;
            num_ans[j] = fat;
            num_a[j - 1]++;     
        }
    }

    if (num_a[0] + num_b[0] > 99999999)
	{
        overflow = 1;
    }
    else
	{
		 num_ans[0]= num_a[0] + num_b[0];
    }
 
    if (overflow == 1)
	{
        std::cout << "overflow" << std::endl;
    }
    else
	{
        for (int j = 0; j < CAPACITY; j++)
		{
            if (num_ans[j] != 0)
			{
                count++;
                std::cout << num_ans[j];
            }
            else
			 if (num_ans[j] == 0 && count >= 1)
			{
                std::cout << "000000000";
            }
        }
		std::cout << std::endl;
    }
}
 
 
int main(){
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
    //std::cin.ignore();
 
	for (int i = 0; i < N; i++)
	{
		//getline(std::cin, str_a);
		//getline(std::cin, str_b);
		std::cin >> str_a >> str_b;
        OverDigit OverDigit_a(str_a,str_b);
		OverDigit_a.Add();
	}
 
    return 0;
}











#include <iostream>
#include <string>

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
    std::cin.ignore(2);
 
	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<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

int main(){
    int n;
    cin >> n;
    rep(k,n){
        char input1[82], input2[82];
        cin >> input1 >> input2;
        //後ろから和を求める
        int ans[81] = {0};
        int size1 = strlen(input1) - 1;
        int size2 = strlen(input2) - 1;
        int i = 0;
        if(size1 > 80 || size2 > 80){
            cout << "overflow" << endl;
            break;
        }
        while(1){
            if(size1 - i >= 0 && size2 - i >= 0)
                ans[i] += input1[size1 - i] - '0' + input2[size2 - i] - '0';
            else if(size1 - i >= 0)
                ans[i] += input1[size1 - i] - '0';
            else if(size2 - i >= 0)
                ans[i] += input2[size2 - i] - '0';
            //桁数を繰り上げる
            if(ans[i] >= 10){
                ans[i] -= 10;
                ans[i + 1]++;
            }
            if(size1 - i < 0 && size2 - i < 0)
                break;
            i++;
        }
        //出力
        if(ans[80] == 1)
            cout << "overflow" << endl;
        else{
            for(int j = i; j >= 0; j--){
                if(ans[i] == 0 && j == i)
                    continue;
                cout << ans[j];
            }
        }
        cout << endl;
    }
}

C++: #include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    int n;
    scanf("%d\n",&n);
    for(int ix=0;ix<n;ix++){
        char t1[85],t2[85];
        scanf("%s\n%s\n",t1,t2);
        string s1(t1),s2(t2);
        reverse(s1.begin(),s1.end());
        reverse(s2.begin(),s2.end());
        string res;
        int kuri=0;
        for(int i=0;i<80;i++){
            int now;
            if(i<s1.size()&&i<s2.size())now=(s1[i]-'0')+(s2[i]-'0')+kuri;
            else if(i<s1.size())now=(s1[i]-'0')+kuri;
            else if(i<s2.size())now=(s2[i]-'0')+kuri;
            else if(kuri==1)now=kuri;
            else continue;
            res.append(1,(char)(now%10+'0'));
            kuri=now/10;
        }
        if(kuri==1)printf("overflow\n");
        else{
            reverse(res.begin(),res.end());
            printf("%s\n",res.c_str());
        }
    }
}

C++: #include<stdio.h>
#include<string.h>

int a[85],b[85];

int reverse(int *p,int length)
{
	int i,t;

	for(i=1;i<=length/2;i++)
	{
		t=p[i];
		p[i]=p[length+1-i];
		p[length+1-i]=t;
	}

	return 0;
}

int main()
{
	int N,i,la,lb,lmax,carry,t;
	char ch;
	
	scanf("%d%*c",&N);
	
	while(N--)
	{
		la=0;
		lb=0;
		carry=0;
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));

		while(1)
		{
			ch=getchar();

			if(ch>='0'&&ch<='9')
			{
				la++;
				a[la]=ch-'0';
			}

			else if(ch=='\n')
			{
				break;
			}
		}
	
		while(1)
		{
			ch=getchar();
			
			if(ch>='0'&&ch<='9')
			{
				lb++;
				b[lb]=ch-'0';
			}

			else if(ch=='\n')
			{
				break;
			}
		}
	
		if(la>80||lb>80)
		{
			printf("overflow\n");
			continue;
		}

		reverse(a,la);
		reverse(b,lb);

		lmax=la>lb?la:lb;

		for(i=1;i<=lmax+1;i++)
		{
			t=a[i];
			a[i]=(t+b[i]+carry)%10;
			carry=(t+b[i]+carry)/10;
		}

		for(i=lmax+1;i>=1;i--)
		{
			if(a[i]!=0)
			{
				t=i;
				break;
			}
		}

		if(t>80)
		{
			printf("overflow\n");
			continue;
		}

		if(i==0)
		{
			printf("0\n");
			continue;
		}

		for(i=t;i>=1;i--)
		{
			printf("%d",a[i]);
		}

		printf("\n");
	}
	
	return 0;
}