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>
int main()
{
	std::vector<std::string>result;
	int n;
	std::cin >> n;
	for (int i = 0; i < n; i++)
	{
		std::string s1, s2;
		std::cin >> s1 >> s2;
		std::string shorter, longer;
		if (s1.length() < s2.length())
		{
			shorter = s1;
			longer = s2;
		}
		else
		{
			shorter = s2;
			longer = s1;
		}
		std::string sum;
		int remainder = 0;
		for (int j = (int)shorter.length() - 1, k = (int)longer.length() - 1; j >= 0; j--, k--)
		{
			int digit = (int)(shorter[j] - '0' + longer[k] - '0');
			sum.push_back((char)((digit + remainder) % 10 + '0'));
			remainder = (digit + remainder) / 10;
		}
		for (int j = (int)(longer.length() - shorter.length() - 1); j >= 0; j--)
		{
			int digit = (int)(longer[j] - '0');
			sum.push_back((char)((digit + remainder) % 10 + '0'));
			remainder = (digit + remainder) / 10;
		}
		if (remainder != 0)
		{
			sum.push_back((char)(remainder + '0'));
		}
		result.push_back(sum);
	}
	for (auto i : result)
	{
		if (i.length() > 80)
		{
			std::cout << "overflow";
		}
		else
		{
			for (int j = (int)i.length() - 1; j >= 0; j--)
			{
				std::cout << i[j];
			}
		}
		std::cout << std::endl;
	}
	return 0;
}

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

#define MAX_DIGIT 80
#define ERROR ("overflow")

int main(void){
	using namespace std;

	int N;
	cin >> N;

	list< pair<string,string> > input;

	for(int i=1; i<=N; i++){

		string slhs, srhs;
		cin >> slhs >> srhs;

		reverse(slhs.begin(), slhs.end());
		reverse(srhs.begin(), srhs.end());

		input.push_back(make_pair(slhs,srhs));

	}

	for(auto p=input.begin(); p!=input.end(); p++){

		auto slhs = p->first, srhs = p->second;
		if(slhs.size()>MAX_DIGIT || srhs.size()>MAX_DIGIT){
			cout << ERROR << endl;
			continue;
		}

		int headDigit = std::max(slhs.size(),srhs.size());
		vector<int> lhs(headDigit), rhs(headDigit);
		list<int> res;

		auto atoi_digit = [] (char x) -> int {
			return atoi(&x);
		};
		transform(slhs.begin(), slhs.end(), lhs.begin(), atoi_digit);
		transform(srhs.begin(), srhs.end(), rhs.begin(), atoi_digit);

		int carry = 0;
		for (auto itr=lhs.begin(); itr!=lhs.end(); itr++){
			int index = itr - lhs.begin();
			auto d = div(lhs[index]+rhs[index]+carry,10);
			carry = d.quot;
			res.push_back(d.rem);
		}

		if(headDigit==MAX_DIGIT && carry !=0){
			cout << ERROR << endl;
		}
		else{
			if (carry!=0){
				res.push_back(carry);
			}
			for(auto itr=res.rbegin(); itr!=res.rend();itr++){
				cout << *itr;
			}
			cout << endl;
		}

	}
}

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

int main(){
	int n;
	scanf(" %d", &n);
	
	for(int i=0; i<n; ++i){
		char a[200], b[200], x[200], y[200];
		scanf(" %s %s", a, b);
		
		int LA=strlen(a);
		if(LA>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LA; ++i){
			x[LA-1-i]=a[i];
		}
		
		int LB=strlen(b);
		if(LB>80){
			printf("overflow\n");
			continue;
		}
		for(int i=0; i<LB; ++i){
			y[LB-1-i]=b[i];
		}
		
		int big, small;
		bool isA;
		if(LA>LB) {big=LA; small=LB; isA=true;}
		else {big=LB; small=LA; isA=false;}
		
		char ans[81];
		int carry=0;
		for(int i=0; i<small; ++i){
			int ta=x[i]-'0', tb=y[i]-'0';
			ta+=tb+carry;
			
			if(ta>=10) carry=1;
			else carry=0;
			ans[i]=(ta%10)+'0';
		}
		if(isA){
			for(int i=small; i<big; ++i){
				int ta=x[i]-'0';
				ta+=carry;
			
				if(ta>=10) carry=1;
				else carry=0;
				ans[i]=(ta%10)+'0';
			}
		}
		else{
			for(int i=small; i<big; ++i){
				int tb=y[i]-'0';
				tb+=carry;
			
				if(tb>=10) carry=1;
				else carry=0;
				ans[i]=(tb%10)+'0';
			}
		}
		
		if(big>=80 && carry!=0) printf("overflow\n");
		else{
			if(carry!=0){
				ans[big++]=carry+'0';
				ans[big]='\0';
				//printf("carries\n");
			}	
			
			int LS=strlen(ans);
			char fans[82];
			for(int i=0; i<LS; ++i){
				fans[i]=ans[LS-1-i];
			}	
		
			printf("%s\n", fans);
		}
	
	}

	return 0;
}

C++: 






#include<iostream>
#include<algorithm>
#include<string>
#include<vector>


#define MAX 1000


//99999999999999999999999999999999999999999999999999999999999999999999999999999999

using namespace std;


int main()
{
	int n = 0;
	string in[2];
	char out[MAX] = {NULL};

	cin >> n;

	for (int i = 0; i < n; i++){
		vector<int>v;

		cin >> in[0] >> in[1];

		int len[2];
		len[0] = in[0].size();
		len[1] = in[1].size();

		//けた上がり
		int up = 0;

		for (int i = 0; i < max(len[0] , len[1]) || up == 1; i++){
			
			//足す値
			int push = up;
			up = 0;

			//indexの範囲内
			if(i < len[0]){
				push += in[0][len[0] - i - 1] - '0';
			}
			if (i < len[1]){
				push += in[1][len[1] - i - 1] - '0';
			}
			if (push > 9){
				push -= 10;
				up = 1;
			}

			v.push_back(push);
		}

		if (v.size() > 80){
			cout << "overflow" << endl;
			continue;
		}
		for (int i = v.size() - 1; i >= 0; i--){
			cout << v[i];
		}
		cout << endl;
	}

	return 0;
}