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>
using namespace std;

#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
int main() {
	int n;
	cin >> n;
	while(n--) {
		char a[84], b[84];
		int x[84], y[84], s[84], max;
		cin >> a >> b;
		int i = 0, j = 0;
		for(; a[i] != '\0'; ++i) {
			x[i] = a[i] - '0';
		}
		for(; b[j] != '\0'; ++j) {
			y[j] = b[j] - '0';
		}
		if(i > j) {
			for(int k = j - 1; k >= 0; k--) {
				y[i-j+k] = y[k];
			}
			rep(k,i-j) {
				y[k] = 0;
			}
			max = i;
		} else if(i < j) {
			for(int k = i - 1; k >= 0; k--) {
				x[j-i+k] = x[k];
			}
			rep(k,j-i) {
				x[k] = 0;
			}
			max = j;
		}
		bool f = 0;
		for(int k = max - 1; k >= 0; k--) {
			int c = x[k] + y[k];
			if(f) c++;
			if(c >= 10) {
				f = 1, c -= 10;
			} else f = 0;
			s[k] = c;
		}
		if(f) {
			max++;
		}
		if(max > 80) cout << "overflow" << endl;
		else {
			if(f) {
				cout << "1";
				max--;
			}
			rep(k,max) {
				cout << s[k] + '0';
			}
			cout << endl;
		}
	}
	return 0;
}

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

int main()
{
  int N;
  char str1[81];
  char str2[81];
  char s1[81];
  char s2[81];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> str1;
    cin >> str2;
    int m1 = strlen(str1), m2 = strlen(str2);
    if(m1 > 80 || m2 > 80)
      cout << "overflow" << endl;
    else{
      if(m1 > m2){
	for(int i = 0; i < m1 - m2 + 1; i++)
	  s1[i] = '0';
	s1[m1 - m2] = '\0';
	strcat(s1, str2);
	strcpy(s2, str1);
      }else if(m2 > m1){
	for(int i = 0; i < m2 - m1; i++)
	  s2[i] = '0';
	s2[m2 - m1] = '\0';
	strcat(s2, str1);
	strcpy(s1, str2);
      }else{
	strcpy(s1, str2);
	strcpy(s2, str1);
      }
      int ans[81];
      for(int i = ((m1 > m2) ? m1 : m2) - 1; i >= 0; i--)
	if((s1[i] - '0') + (s2[i] - '0') >= 10){
	  s1[i - 1] = s1[i - 1] + 1;
	  ans[i] = (s1[i] - '0') + (s2[i] - '0') - 10;
	}else
	  ans[i] = (s1[i] - '0') + (s2[i] - '0');
      if((s1[0] - '0') + (s2[0] - '0') >= 10)
     	cout << "1";
      for(int i = 0; i < ((m1 > m2) ? m1 : m2); i++)
	cout << ans[i];
    }
    cout << endl;
  }
}

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;
		if( num1.size() > 80 || num2.size() > 80 ){
			cout << "overflow" << endl;
			continue;
		}
		int 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]-'0';
		}
		int d;
		for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){
			int now;
			if( i < num2.size() ){
				now = sum[100-i] + (int)num2[num2.size()-i-1]-(int)('0') + degit;
			}else{
				now = sum[100-i] + degit;
			}
			sum[100-i] = (now%10);
			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<cstdio>
#include<cmath>
using namespace std;

int main(){
	int n,t,i;
	char a[100],b[100],x[100],y[100];
	scanf("%d",&n);
	for(int o=0;o<n;o++){
		t=0;
		scanf("%s %s",a,b);
		for(i=0;a[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			x[j]=a[i-j-1];
		}
		for(;i<100;i++){
			x[i]='0';
		}
		for(i=0;b[i]!='\0';i++){}
		for(int j=0;j<i;j++){
			y[j]=b[i-j-1];
		}
		for(;i<100;i++){
			y[i]='0';
		}
		for(i=0;i<99;i++){
			x[i]+=y[i]-'0';
			if(x[i]>'9'){
				x[i]-=10;
				x[i+1]+=1;
			}
		}
		for(i=99;i>=0;i--){
			if(x[i]!='0' || t){
				if(i>79){
					printf("overflow\n");
					break;
				}
				printf("%c",x[i]);
				t=1;
			}
		}
		printf("\n");
	}
	return 0;
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	
	while(n-- > 0){
	
	string str1;
	cin >> str1;
	
	string str2;
	cin >> str2;
	
	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());
	
	int check;
	if(str1.size() > str2.size()){
		check = 1;
	}
	else if(str1.size() == str2.size()){
		check = 2;
	}
	else {
		check = 3;
	}
	
	int ans[100];
	bool next = false;
	int short_ = min(str1.size(), str2.size());
	int long_ = max(str1.size(), str2.size());	
	if(long_ >= 79){
		cout << "overflow" << endl;
		continue;
	}

	for(int i = 0; i < short_; ++i){
		int num = 0;
		num += (str1[i] - '0') + (str2[i] - '0');
		if(next){
			num++;
		}
		ans[i] = num;
		next = false;	
		if(num >= 10){
			num -= 10;
			ans[i] -= 10;
			next = true;
		}
		//cout << num << endl;
	}
	/*for(int i = 0; i < min(str1.size(), str2.size()); ++i){
		cout << ans[i];
	}
	cout << endl;*/
	
	if(check == 1){
		for(int i = str2.size(); i < str1.size(); ++i){
			int num = str1[i] - '0';
			if(next){
				num++;
			}
			ans[i] = num;
			next = false;	
			if(num >= 10){
				num -= 10;
				ans[i] -= 10;
				next = true;
			}
		}
		if(next){
			ans[str1.size()] = 1;
			long_ ++;
		}
	}	
	
	if(check == 3){
		for(int i = str1.size(); i < str2.size(); ++i){
			int num = str2[i] - '0';
			if(next){
				num++;
			}
			ans[i] = num;
			next = false;	
			if(num >= 10){
				num -= 10;
				ans[i] -= 10;
				next = true;
			}
		}
		if(next){
			ans[str2.size()] = 1;
			long_ ++;
		}
	}
	
	if(long_ >= 80){
		cout << "overflow" << endl;
		continue;
	}

	for(int i = long_ - 1; i >= 0; --i){
		cout << ans[i];
	}/*
	for(int i = 0; i < min(str1.size(), str2.size()) + 1; ++i){
		cout << ans[i];
	}*/

	cout << endl;
	//reverse(ans.begin(), ans.end());
	//cout << ans << endl;
	}
		
	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[80];
	char num2[80];

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

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