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 <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;

int main(){
	int n;
	cin >> n;
	while( n-- > 0 ){
		string num1, num2;
		cin >> num1 >> num2;
		char sum[101];
		int degit = 0;
		for( int i = 0; i < 101; i++ ) sum[i] = '0';
		for( int i = 0; i < num1.size(); i++ ){
			sum[100-i] = num1[num1.size()-i-1];
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now;
			if( i < num2.size() ){
				now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit;
			}else{
				now = (int)(sum[100-i]-'0') + degit;
			}
			
			sum[100-i] = (char)(now%10)+'0';
			if( now >= 10 ) degit = 1;
			else degit = 0;
			d = i;
		}
		if( d < 80 ){
			for( int i = 100-d; i < 101; i++ ) cout << sum[i];
			cout << endl;
		}else{
			cout << "overflow" << endl;
		}
	}
}

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

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin>>v; return v; }
template<class T> inline string toString(T x){ ostringstream sout; sout<<x; return sout.str(); }

#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
#define debug(x) cerr<<#x<<" = "<<(x)<<"(L"<<__LINE__<<")"<<" "<<__FILE__<<endl;

int main(){
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		string a, b; cin >> a >> b;
		if (a.size() < b.size()) {
			string tmp("");
			for (int j = 0; j < b.size()-a.size(); j++) { tmp += "0"; }
			a = tmp + a;
		} else if (b.size() < a.size()) {
			string tmp;
			for (int j = 0; j < a.size()-b.size(); j++) { tmp += "0"; }
			b = tmp + b;
		}
		
		string res("");
		for (int j = 0; j < a.size()+1; j++) res += "0";
		a = "0"+a; b = "0"+b;
		for (int j = res.size()-1; j >= 0; j--) {
			int cur = 0;
			if (res[j] >= '0' && res[j] <= '9') {
				cur = res[j]-'0';
			}
			int ai = a[j]-'0', bi = b[j]-'0';
			int res_tmp = ai+bi+cur;
			if (res_tmp >= 10) { 
				res[j] = '0'+(res_tmp%10);
				res[j-1] = '0'+(res_tmp/10); 
			} else {
				res[j] = '0'+res_tmp;
			}
		}
		int j = 0;
		while (res[j] == '0') { j++; }
		string ans("");
		for (; j < res.size(); j++) ans += res[j];
		
		if (ans.size() > 80) {
			cout << "overflow" << endl;
		} else {
			cout << ans << endl;
		}
	}

	return 0;
}

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

struct bigint {
private:
    std::string s;
public:
    bigint(std::string s): s(s) {}
    bigint& operator +(bigint rhs)
    {
        int d = rhs.s.size() < this->s.size() ? this->s.size() - rhs.s.size() : rhs.s.size() - this->s.size();
        if (rhs.s.size() < this->s.size()) for (int i = 0; i < d; ++i) rhs.s = '0' + rhs.s;
        else for (int i = 0; i < d; ++i) this->s = '0' + this->s;

        int c = 0;
        for (int i = this->s.size() - 1; i >= 0; --i) {
            int a = this->s[i] - '0' + rhs.s[i] - '0' + c;
            this->s[i] = a % 10 + '0';
            c = a / 10;
        }
        if (c) this->s = (char)(c + '0') + this->s;
        return *this;
    }
    void print()
    {
        if (s.size() > 80) std::cout << "overflow";
        else std::cout << s;
    }
};

int main()
{
    int n;
    std::cin >> n;
    std::cin.ignore();

    for (int i = 0; i < n; ++i) {
        std::string s1, s2;
        getline(std::cin, s1);
        getline(std::cin, s2);

        bigint bi1(s1), bi2(s2);
        (bi1 + bi2).print();
        std::cout << std::endl;
    }
}

C++: //#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
//#include <iomanip>
#include <vector>
#include <string>
//#include <algorithm>
//#include <functional>
//#include <cmath>
//#include <time.h>

using namespace std;


int main(){

	int n, k1, k2, left, right, buf, flag;
	string s1, s2 , out;
	int aa1[10], aa2[10], ans[10];

	cin >> n;

	for (int nn = 0; nn < n; nn++){
		for (int i = 0; i < 10; i++){
			aa1[i] = 0;
			aa2[i] = 0;
			ans[i] = 0;
		}
		flag = 0;

		cin >> s1 >> s2;
		k1 = s1.size();
		k2 = s2.size();

		if (k1 > 80 || k2 > 80){
			cout << "overflow" << endl;
		}
		else{
			buf = 8 - k1 % 8;
			for(int i = 0; i < buf; i++){
				s1.insert(0,"0");
			}
			buf = 8 - k2 % 8;
			for (int i = 0; i < buf; i++){
				s2.insert(0, "0");
			}
			left = s1.size()-8;
			for (int i = 0; i < 10; i++){
				aa1[i] = atoi(s1.substr(left, 8).c_str());
				left -= 8;
				if (left < 0)break;
			}
			left = s2.size() - 8;
			for (int i = 0; i < 10; i++){
				aa2[i] = atoi(s2.substr(left, 8).c_str());
				left -= 8;
				if (left < 0)break;
			}

			for (int i = 0; i < 10; i++){
				ans[i] += aa1[i] + aa2[i];
				if (ans[i] >= 100000000){
					ans[i + 1] += 1;
					ans[i] -= 100000000;
				}
			}
			if (ans[10] >= 100000000){
				cout << "overflow" << endl;
			}
			else{
				for (int i = 9; i >= 0; i--){
					if (flag == 0){
						if (ans[i] != 0){
							printf("%d",ans[i]);
							flag = 1;
						}
					}
					else{
						printf("%08d", ans[i]);
					}
				}
				cout << endl;
			}
		}

	}
	
	return 0;
}

C++: #include <cstdio>
#include <iostream>

using namespace std;

int main(void) {
	int sets;
	char input1[100], input2[100], out[100];
	int i1, i2, o, carry;
	int ic1, ic2;
	int i;

	cin >> sets;
	for(i=0;i<sets;i++) {
		scanf("%s", input1);
		scanf("%s", input2);
		for(i1=0;input1[i1] != '\0';i1++);
		for(i2=0;input2[i2] != '\0';i2++);
		i1--;i2--;o=0;carry=0;
		while(i1>=0 || i2>=0 || carry) {
			if(o > 80) { break; }
			if(i1>=0) { ic1 = input1[i1]-'0'; i1--; } else { ic1 = 0; }
			if(i2>=0) { ic2 = input2[i2]-'0'; i2--; } else { ic2 = 0; }
			if( ic1+ic2+carry < 10 ) { 
				out[o] = ic1+ic2+carry+'0';
				carry = 0;
			} else {
				out[o] = ic1+ic2+carry-10+'0';
				carry = 1;
			}
			o++;
		}
		if(o > 80) { printf("overflow"); }
		else { for(o--;o>=0;o--) { printf("%c", out[o]); } }
		printf("\n"); 
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
char str[102],str1[102],ans[102];
int sam(int ma1,int ma2)
{
int co,carry=0,a,b;
for(int i=0;ma1-i>=0||ma2-i>=0||carry==1;i++){
if(ma1-i>=0&&ma2-i>=0){
a=str[ma1-i]-'0';
b=str1[ma2-i]-'0';
if(a+b+carry>=10){
ans[i]=a+b+carry-10+'0';
carry=1;
}
else {
ans[i]=a+b+carry+'0';
carry=0;
}
}
else if(ma1-i>=0){
a=str[ma1-i]-'0';
if(a+carry>=10){
ans[i]=a+carry-10+'0';
carry=1;
}
else {
ans[i]=a+carry+'0';
carry=0;
}
}
else if(ma2-i>=0){
b=str1[ma2-i]-'0';
if(b+carry>=10){
ans[i]=b+carry-10+'0';
carry=1;
}
else {
ans[i]=b+carry+'0';
carry=0;
}
}
else {
ans[i]='0'+1;
return i;
}
co=i;

}
return co;

}
int main()
{
int a,b,n;
cin>>n;
for(int i=0;i<n;i++){
cin>>str>>str1;
a=strlen(str);
b=strlen(str1);
a=sam(a,b);
if(a>80)cout<<"overflow"<<endl;
else {
for(int j=a;j>0;j--)cout<<ans[j];
cout<<endl;
}
}

}

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

using namespace std;

int main(void){
	int n;

	cin >> n;
	for(int i=0;i<n;i++){
		int len,mlen=0;
		char val[2][81]={0},tmp[81],crr=0;

		for(int j=0;j<2;j++){
			cin >> tmp;
			len = strlen(tmp);
			mlen = mlen>len?mlen:len;
			for(int k=0;k<len;k++)
				val[j][len-1-k]=tmp[k]-0x30;
		}

		for(int j=0;j<mlen;j++){
			val[0][j]+=val[1][j]+crr;
			crr=val[0][j]/10;
			val[0][j]%=10;

			if(j==mlen-1&&crr)
				mlen++;
		}

		if(!val[0][80]){
			for(int j=0;j<mlen;j++)
				tmp[j]=val[0][mlen-1-j]+0x30;
			tmp[mlen]='\0';
		}
		else
			strcpy(tmp,"overflow");

		cout << tmp << endl;
	}

	return 0;
}