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 <cstdio>
#include <cstdlib>
using namespace std;

int main(){
	int n;
	cin >> n;
	for(int j=0;j<n;j++){
		char a[81],b[81],c[81];
		int ka = 0;
		int kb = 0;
		int kc = 0;
		bool ovf = false;
		cin >> a[ka];
		ka++;
		while(1){
			scanf("%c",&a[ka]);
			if(ka==80 and a[ka]!='\n') ovf = true;
			if(a[ka]=='\n' or ovf) break;
			ka++;
		}
		while(1){
			scanf("%c",&b[kb]);
			if(kb==80 and b[kb]!='\n') ovf = true;
			if(b[kb]=='\n' or ovf) break;
			kb++;
		}
		int k = 0;
		char t;
		for(int i=0;i<81;i++){
			if(i==80 and k==1) ovf = true;
			if((ka<=i and kb<=i) or ovf) break;
			int ia = 0;
			t = a[ka-i-1];
			if(ka>=i) ia = atoi(&t);
			int ib = 0;
			t = b[kb-i-1];
			if(kb>=i) ib = atoi(&t);
			int s = ia + ib + k;
			k = 0;
			if(s>9){ k = 1; s = s%10;}
			sprintf(&c[i],"%d",s);
			kc++;
		}
		if(ovf) cout << "overflow" << endl;
		else{
			for(int i=kc-1;i>=0;i--) cout << c[i];
			cout << endl;
		}
	}
}

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

using namespace std;

void solve()
{
	int n;
	cin >> n;
	while(n--)
	{
		string l, s;
		cin >> l >> s;
		if(l.size() < s.size())
		{
			swap(l, s);
		}
		reverse(l.begin(), l.end());
		reverse(s.begin(), s.end());
		string sum;
		
		int sizel = l.size();
		int sizes = s.size();
		int buf = 0;
		for(int i = 0; i < sizes; ++i)
		{
			sum += (l[i] + s[i] - '0' - '0' + buf) % 10 + '0';
			buf = (l[i] + s[i] - 2 * '0' + buf) / 10;
		}
		for(int i = sizes; i < sizel; ++i)
		{
			sum += (l[i] - '0' + buf) % 10 + '0';
			buf = (l[i] - '0' + buf) / 10;
		}
		if(buf > 0)
		{
			sum += buf + '0';
		}
		int size = sum.size();
		if(size > 80)
		{
			cout << "overflow" << endl;
			continue;
		}
		for(int i = size - 1; i >= 0; --i)
		{
			cout << sum[i];
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){

	int sn;
	int i;
	int j,k;
	int flg;
	char in_a[82];
	char in_b[82];
	char str_a[82];
	char str_b[82];
	char str_sum[82];
	char c;
	char cs[3];
	char *p;
	int a,b,carry;

	scanf("%d",&sn);

	for(i=1;i<=sn;i++){

		scanf("%81s%*[^\n]",in_a);
		scanf("%81s%*[^\n]",in_b);

		flg=0;
		//chk a
		if(strlen(in_a)>80)flg=1;
		if(strlen(in_b)>80)flg=1;


		if(!flg){
			sprintf(str_a,"%81s",in_a);
			sprintf(str_b,"%81s",in_b);
//printf("in_a  %s\nstr_a  %s\nin_b  %s\nstr_b  %s\n",in_a,str_a,in_b,str_b);
//printf("in_a  %d\nstr_a  %d\nin_b  %d\nstr_b  %d\n",strlen(in_a),strlen(str_a),strlen(in_b),strlen(str_b));
			carry=0;
			for(j=80;j>0;j--){
				cs[0]=str_a[j];
				cs[1]='\0';
				a=atoi(cs);
				cs[0]=str_b[j];
				cs[1]='\0';
				b=atoi(cs);
				sprintf(cs,"%02d",a+b+carry);
				if(cs[0]=='0')carry=0;
				if(cs[0]=='1')carry=1;
				str_sum[j]=cs[1];
			}
			str_sum[0]='0';
			str_sum[81]='\0';
			if(carry){
				flg=1;
				str_sum[0]='1';
			}
			p=str_sum;
			while(*p=='0'&&p!=&str_sum[80])p++;
			//printf("%81s\n%81s\n%81s\n",str_a,str_b,str_sum);
		}
		flg?printf("overflow\n"):printf("%s\n",p);
	}

	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <string.h>
#include <stdio.h>
using namespace std;

void checkArray(char str[])
// 配列の内容確認(テスト用)
{
	int size = strlen(str);
	for(int i = 0; i < size; ++i)
	{
		cout << "str[" << i << "]: " << str[i] << endl;
	}
}
void str_reverse(char s[])
// 文字列を反転する
{
     int i, l = strlen(s);
     char t;
     for(i = 0; i < l/2; i++) {
         t = s[i]; s[i] = s[l-i-1]; s[l-i-1] = t;
     }
}
void add(char num1[], char num2[])
// 足し算した結果を文字列として返す
{
	char res[82];;
	bool carry = false; //繰り上がりの有無
	int maxlen = (strlen(num1) > strlen(num2)) ? strlen(num1) : strlen(num2);
	int flag1 = 0, flag2 = 0;

	str_reverse(num1);
	str_reverse(num2);

	for(int i = 0; i < maxlen+1; ++i){
		// '\n'以降は値を0とする
		if(num1[i] == '\0') flag1 = 1;
		if(num2[i] == '\0') flag2 = 1;
		res[i] = carry;
		if(!flag1)	res[i] += num1[i]-48;
		if(!flag2)	res[i] += num2[i]-48;
		carry = res[i] / 10;
		res[i] = res[i] % 10 + 48;
	}
	// 終端文字をつける
	if(res[maxlen] == '0')
		res[maxlen] = '\0';
	else res[maxlen+1] = '\0';

	// 元に戻す
	str_reverse(num1);
	str_reverse(num2);
	str_reverse(res);
	if(strlen(res) > 80)
		cout << "overflow" << endl;
	else
		cout << res << endl;
}

int main() {
	int dataset;
	char num1[81];
	char num2[81];

	cin >> dataset; // データセットの個数

	for(int i = 0; i < dataset; ++i){
			// 80桁以下の数字を入力
			cin  >> num1;
			cin  >> num2;
			if(strlen(num1) > 80 || strlen(num2) > 80){
				cout << "overflow" << endl;
				return 0;
			}
			// 足し算した結果を表示
			add(num1, num2);
	}
	return 0;
}

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


int main(){
	int i, j, n, na, nb, flg;
//	long a[10], b[10];
	char a[1000]={'\0'}, b[1000]={'\0'}, tp;

	scanf("%d", &n);
	while(n--){
	scanf("%s", a);
	na=strlen(a);
	for(i=0, j=na; i<na/2; i++, j--){
		tp=a[i]; a[i]=a[j-1]; a[j-1]=tp;
	}
	scanf("%s", b);
	nb=strlen(b);
	for(i=0, j=nb; i<nb/2; i++, j--){
		tp=b[i]; b[i]=b[j-1]; b[j-1]=tp;
	}
	if(na>80 || nb>80){ printf("overflow\n"); break;}

	if(na>nb){
 		for(i=0, flg=0; i<nb; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}	
		for(i=nb; i<na; i++){
			flg+=a[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}
	else {
		for(i=0, flg=0; i<na; i++){
			flg+=a[i]-'0'+b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}			
		for(i=na; i<nb; i++){
			flg+=b[i]-'0';
			a[i]=flg%10+'0';
			flg/=10;
	}
		if(flg) a[i]='1';
	}


	j=strlen(a);
		if(j>80){ printf("overflow\n"); break;}
	for(i=j; i>0; i--) printf("%c",a[i-1]);
	printf("\n");
	}
	return 0;
}

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

using namespace std;

int main(void){
	int n;

	cin >> n;
	while(n--){
		int len,big;
		string val[2];
		bool crr=false;

		for(int j=0;j<2;j++){
			cin >> val[j];
			reverse(val[j].begin(),val[j].end());
		}

		big=val[0].size()>=val[1].size()?0:1;
		val[1-big].append((len=val[big].size())-val[1-big].size(),'0');

		if(len<=80){
			for(int j=0;j<len;j++){
				val[0][j]+=val[1][j]+crr-0x60;
				crr=val[0][j]/10;
				val[0][j]%=10;
				val[0][j]+=0x30;
			}

			if(crr){
				val[0].append(1,'1');
				len++;
			}
		}

		if(len<=80)
			reverse(val[0].begin(),val[0].end());
		else
			val[0]="overflow";

		cout << val[0] << endl;
	}

	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	for (int counter = 0; counter < n; counter++){
		string a, b;
		cin >> a >> b;
		if (a.length() >80 || b.length() > 80){
			cout << "overflow" << endl;
			continue;
		}
		int inta[82], intb[82], sum[82];
		fill(inta, inta + 82, 0);
		fill(intb, intb + 82, 0);
		fill(sum, sum + 82, 0);
		for (int i = 0; i < (signed)a.length(); i++){
			inta[i] = a[a.length() - i - 1] - '0';
		}
		for (int i = 0; i < (signed)b.length(); i++){
			intb[i] = b[b.length() - i - 1] - '0';
		}
		
		int over = 0;
		for (int i = 0; i < 82; i++){
			sum[i] = inta[i] + intb[i] + over;
			if (sum[i] >= 10){
				sum[i] -= 10;
				over = 1;
			}
			else{
				over = 0;
			}
		}

		for (int i = 81;; i--){
			if (sum[i] != 0){
				if (i >= 80){
					cout << "overflow" << endl;
					break;
				}
				for (int j = i; j >= 0; j--){
					cout << sum[j];
				}
				cout << endl;
				break;
			}
		}
	}
	return 0;
}