Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}

C++: 






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


#define MAX 1000


using namespace std;


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

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> in[0] >> in[1];

		for (int i = 0; i < MAX; i++){
			out[i] = '\0';
		}

		int count = in[0].size() - 1;

		for (int i = 0; i < in[0].size(); i++){
			out[count--] += in[0][i];
		}

		count = in[0].size();
		int count2 = in[1].size() - 1;

		count = max(count , count2) - 1;

		for (int i = 0; i < in[1].size(); i++){
			if (out[i] != '\0'){
				out[i] -= '0';
			}
			out[i] += in[1][count2--];
			count--;
		}
		
		int i = 0;
		for (i = 0; out[i] != '\0'; i++){
			;
		}

		bool flag = false;


		for (int j = 0; j < i; j++){
			if (out[j] > '9'){
				out[j] -= 10;
				out[j + 1] += 1;
			}
		}

		if (out[i] > '\0' && out[i] < '0'){
			out[i] += '0';
		}
		
		for (i = 0; i < out[i] != '\0'; i++){
			;
		}

		for (int j = 0; j < i / 2; j++){
			char tmp = out[j];
			out[j] = out[i - j - 1];
			out[i - j - 1] = tmp;
		}

		for (i = 0; out[i]; i++){
			;
		}

		if (i >= 81 || (flag == true && i >= 79)){
			cout << "overflow" << endl;
		}else{
			cout << out << endl;
		}
	}

	return 0;
}

C++: #include <stdio.h>

void rev_str(char str[1024]) {
	int length = 0;
	char str2[1024];
	int temp;

	int i;

	for(i = 0; i < 1024; i++)
		str2[i] = '\0';

	while(str[length])
		length++;

	temp = length;
	i = 0;
	while(temp) {
		str2[temp - 1] = str[i];
		i++;
		temp--;
	}

	for(i = 0; i < length; i++)
		str[i] = str2[i];
}

int exor(int a, int b) {
	if(a && b)
		return 0;
	else if(a || b)
		return 1;
	else
		return 0;
}

int main() {
	char input_a[1024];
	char input_b[1024];
	char ans[286][1024];
	char kuriagari;
	int temp;
	int n;

	int i, j;

	scanf("%d", &n);

	for(j = 0; j < n; j++) {
		for(i = 0; i < 1024; i++) {
			input_a[i] = '\0';
			input_b[i] = '\0';
			ans[j][i] = '\0';
		}

		kuriagari = 0;

		scanf("%s", input_a);
		scanf("%s", input_b);

		rev_str(input_a);
		rev_str(input_b);

		i = 0;
		while(input_a[i] && input_b[i]) {
			temp = input_a[i] + input_b[i] - 2 * '0' + kuriagari;
			ans[j][i] = temp % 10 + '0';
			kuriagari = temp / 10;
			i++;
		}

		if(kuriagari && !input_a[i] && !input_b[i]) {
			ans[j][i] = kuriagari + '0';
		}

		else {
			while (kuriagari && exor((int)input_a[i], (int) input_b[i])) {
				temp = input_a[i] + input_b[i] - '0' + kuriagari;
				ans[j][i] = (char)(temp % 10 + '0');
				kuriagari = temp / 10;
				i++;
			}

			if (kuriagari)
				ans[j][i] = kuriagari + '0';
		}

		while(input_b[i]) {
			ans[j][i] = input_b[i];
			i++;
		}

		while(input_a[i]) {
			ans[j][i] = input_a[i];
			i++;
		}

		rev_str(ans[j]);
		
		if(ans[j][80])
			printf("overflow");
		else
			printf("%s", ans[j]);

		putchar('\n');

	}

	return 0;
}

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;
}