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<string>
#include<vector>
using namespace std;

int main() {
	int n,x1,x2,y1,y2,p,q,a=0,b=0;
	vector<int> E,F;
	vector<long long int> S, T;
	vector<vector<long long int>> I,J;
	string s, t;
	vector<string> U;
	vector<vector<string>> UU;

	cin >> n;
	for (int k = 0; k < n; k++) {
		cin >> s >> t;
		int f = 0;
		if (s.size() > 80 || t.size() > 80) {
			f = 1;
			F.push_back(f);
		}
		else F.push_back(0);
		x1 = s.size() % 10; y1 = (s.size()+9) / 10;p = 8 - y1;
		for (int i = 0; i < p; i++)S.push_back(0);
		if (x1 == 0) for (int i = 0; i < y1; i++)S.push_back(stoll(s.substr(i * 10, 10)));
		else {
			S.push_back(stoll(s.substr(0, x1)));
			for (int i = 1; i < y1; i++)S.push_back(stoll(s.substr(x1 + (i-1) * 10, 10)));
		}

		x2 = t.size() % 10; y2 = (t.size()+9) / 10;q = 8 - y2;
		for (int i = 0; i < q; i++)T.push_back(0);
		if (x2 == 0) for (int i = 0; i < y2; i++)T.push_back(stoll(t.substr(i * 10, 10)));
		else {
			T.push_back(stoll(t.substr(0, x2)));
			for (int i = 1; i < y2; i++)T.push_back(stoll(t.substr(x2 + (i-1) * 10, 10)));
		}
		I.push_back(S); S.clear();
		J.push_back(T); T.clear();
	}
	for (int k = 0; k < I.size(); k++) {
		for (int i = 0; i < 8; i++) U.push_back(to_string(I[k][i] + J[k][i]));
		UU.push_back(U); U.clear();
	}
	
	for (int k = 0; k < I.size(); k++) {
		for (int i = 7; i >= 0; i--) {
			UU[k][i] = to_string(stoll(UU[k][i]) + b);
			if (UU[k][i].size() == 11 && i == 0) {
				UU[k][i] = "a";
				b = 1;
			}
			else if (UU[k][i].size() == 11) {
				UU[k][i] = UU[k][i].substr(1, 10);
				b = 1;
			}
			else if (UU[k][i].size() < 10) {
				for (int j = 0; j < 10 - UU[k][i].size()+j; j++) UU[k][i] = "0" + UU[k][i];
				b = 0;
			}
			else b = 0;
		}
		b = 0;
	}

	for (int k = 0; k < UU.size(); k++) {
		int e = 0;
		for (int i = 0; i < UU[k].size(); i++) {
			if (UU[k][i] == "a") {
				e = 100;
				break;
			}
			else if (stoll(UU[k][i]) == 0);
			else {
				e = i;
				E.push_back(e);
				break;
			}
		}
	}

		for(int k=0;k<UU.size();k++){
			if (E[k] == 100)cout << "overflow" << endl;
			else if (F[k] == 1)cout << "overflow" << endl;
			else {
				cout << stoll(UU[k][E[k]]);
				for (int i = E[k]+1; i < UU[k].size(); i++) cout << UU[k][i];
			}
			cout << endl;
		}
	return 0;
}

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

int main(){
	const int size = 80;
	char str1[size + 10], str2[size + 10];
	int num1[size], num2[size], res[size];
	int n, leng1, leng2, loop, kuri;
	bool output;
	
	scanf("%d", &n);
	
	while(n--){
		fill(str1, str1 + size + 10, 0);
		fill(str2, str2 + size + 10, 0);
		fill(num1, num1 + size, 0);
		fill(num2, num2 + size, 0);
		scanf("%s", str1);
		scanf("%s", str2);
		
		//char -> int
		for(leng1 = 0; str1[leng1 + 1] >= 48 && str1[leng1] <= 57; leng1++);//length of str1
		for(leng2 = 0; str2[leng2 + 1] >= 48 && str2[leng2] <= 57; leng2++);//length of str2
		
		loop = 1;
		while(leng1 >= 0){
			num1[size - loop] = (int)str1[leng1] - 48;
			leng1--; loop++;
		}
		loop = 1;
		while(leng2 >= 0){
			num2[size - loop] = (int)str2[leng2] - 48;
			leng2--; loop++;
		}
		kuri = 0;
		for(int i = size - 1; i >= 0; i--){
			res[i] = num1[i] + num2[i] + kuri;
			kuri = res[i] / 10;
			if(kuri > 0) res[i] -= 10;
		}
		
		if(kuri > 0) printf("overflow\n");
		else{
			output = false;
			for(int i = 0; i < size; i++){
				if(!output && res[i] == 0) continue;
				else{
					output = true;
					printf("%d", res[i]);
				}
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<vector>
#include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>

typedef std::vector<int> bignum;

const int e9=1000000000;

bignum add(const bignum& a,const bignum& b);
bignum subtract(const bignum& a,const bignum& b);
void output(const bignum& num);
int compare(const bignum& a,const bignum& b);
bignum newnum(const std::string& str);

int main()
{
	bignum a,b,sum;
	std::string str;
	int n;
	std::cin>>n;
	for(int i=0;i<n;i++)
	{
		std::cin>>str;
		a=newnum(str);
		std::cin>>str;
		b=newnum(str);
		sum.clear();
		sum=add(a,b);
		if(compare(sum,newnum("100000000000000000000000000000000000000000000000000000000000000000000000000000000"))>=0)
		{
			std::cout<<"overflow"<<std::endl;
		}
		else
		{
			output(sum);
		}
	}
}

bignum add(const bignum& a,const bignum& b)
{
	bignum sum;
	int carry=0;
	long long temp;
	for(int i=0;i<((a.size()>b.size())?a.size():b.size())||carry==1;i++)
	{
		temp=carry;
		carry=0;
		if(i<a.size())
		{
			temp+=a[i];
		}
		if(i<b.size())
		{
			temp+=b[i];
		}
		sum.push_back(temp%e9);
		if(temp>=e9)
		{
			carry=1;
		}
	}

	return sum;
}

int compare(const bignum& a,const bignum& b)
{
	if(a.size()>b.size()){return 1;}
	else if(a.size()<b.size()){return -1;}
	else
	{
		for(int i=a.size()-1;i>=0;i--)
		{
			if(a[i]>b[i]){return 1;}
			else if(a[i]<b[i]){return -1;}
		}
	}
	return 0;
}

bignum newnum(const std::string& str)
{
	bignum num;
	int len;
	for(int i=str.size();i>=0;i-=9)
	{
		len=9;
		if(i<9)len=i;
		num.push_back(atoi(str.substr(i-len,len).c_str()));
	}
	return num;
}

void output(const bignum& num)
{
	for(int i=num.size()-1;i>=0;i--)
	{
		if(i==num.size()-1)
		{
			std::cout<<num[i];
		}
		else
		{
			std::cout<<std::setfill('0')<<std::setw(9)<<std::right<<num[i];
		}
	}
	std::cout<<std::endl;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;


int main(){
	int n;
	cin >> n;
	for(int i=0 ; i<n ; i++){
		string a, b;
		cin >> a;
		cin >> b;

		int flag=0;

		if(a.size() < b.size()){
			string temp;
			temp = a;
			a = b;
			b = temp;
		}
		while(b.size() != a.size()){
			b = "0" + b;
		}

		if(a.size() > 80){
			flag = 1;
			cout << "overflow" << endl;
		}else{
			for(int i=0 ; i<a.size() ; i++){
				a[a.size()-1-i] += b[b.size()-1-i] - '0';
			}
			for(int j=0 ; j<a.size()-1 ; j++){
				if(a[a.size()-1-j] > '9'){
					a[a.size()-1-j] -= 10;
					a[a.size()-2-j]++;
				}
			}
			if(a[0] > '9'){
				a[0] -= 10;
				a = "1" + a;
			}

		}

		if(a.size() > 80) {
			if(flag == 0)cout << "overflow" << endl;
		}else{
			cout << a << endl;
		}

	}

	return 0;
}

C++: import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		
		BigInteger a, b;
		int N = Integer.parseInt(input.nextLine());
		
		while(N > 0) {
			a = new BigInteger(input.nextLine());
			b = new BigInteger(input.nextLine());
			
			a = a.add(b);
			
			if(a.toString().length() > 80) {
				out.println("overflow");
			} else {
				out.println(a.toString());
			}			
			N--;
		}
		input.close();
		out.close();
	}
}