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;
		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<iostream>
#include<string>

using namespace std;

int main() {

	int n;

	cin >> n;

	for (int i = 0; i < n; ++i) {
		bool carry = false;
		string first, second;
		cin >> first >> second;

		string sum;

		auto it1 = first.rbegin();
		auto it2 = second.rbegin();
		while (it1 != first.rend() || it2 != second.rend()) {

			int temp1 = (it1 != first.rend()) ? (*it1++) - '0' : 0;
			int temp2 = (it2 != second.rend()) ? (*it2++) - '0' : 0;
			int temp_sum = temp1 + temp2 + (carry ? 1 : 0);
			if (temp_sum / 10 != 0) {
				carry = true;
				temp_sum %= 10;
			}
			else {
				carry = false;
			}

			sum.insert(0, to_string(temp_sum));
		}
		if (carry == true) {
			sum.insert(0, 1, '1');
		}

		if (first.length() > 80 || second.length() > 80 || sum.length() > 80) {
			cout << "overflow" << endl;
		}
		else {
			cout << sum << 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);
		fill(res, res + size, 0);
		scanf("%s", str1);
		scanf("%s", str2);
		
		//char -> int
		for(leng1 = 0; (int)str1[leng1 + 1] >= 48 && (int)str1[leng1 + 1] <= 57 && leng1 + 1 < size + 10; leng1++);//length of str1
		for(leng2 = 0; (int)str2[leng2 + 1] >= 48 && (int)str2[leng2 + 1] <= 57 && leng2 + 1 < size + 10; 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]);
				}
			}
			if(!output) printf("0");
			printf("\n");
		}
	}
	return 0;
}

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

int charToInt(char);
string sumStr(string, string);

int charToInt(char c) {
  return (int)c - (int)'0';
}

string sumStr(string a, string b) {
  int pa = a.length()-1, pb = b.length()-1;
  string str(81, '0');
  int pstr = str.length()-1;
  int next = 0;
  while(pa >= 0 && pb >= 0) {
    int temp = charToInt(a[pa]) + charToInt(b[pb]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pa--;
    pb--;
    pstr--;
  }
  while(pa >= 0) {
    int temp = charToInt(a[pa]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pa--;
    pstr--;
  }
  while(pb >= 0) {
    int temp = charToInt(b[pb]) + next;
    next = temp / 10;
    str[pstr] = (char)(temp%10+(int)'0');

    pb--;
    pstr--;
  }
  str[pstr] = (char)(next + (int)'0');

  for(int i = 0; i < str.length(); i++) {
    if(str[i] != '0') {
      return str.substr(i, str.length()-i);
    }
  }
  return "0";
}

int main(void) {
  int N;
  cin >> N;
  for(int i = 0; i < N; i++) {
    bool overflow = false;
    int data[N][8];
    string sum;
    for(int j = 0; j < 2; j++) {
      string str;
      cin >> str;

      if(!overflow) {
	if(j == 0) sum = str;
	else       sum = sumStr(sum, str);
        if(sum.length() > 80) overflow = true;
      }
    }

    if(overflow) cout << "overflow" << endl;
    else         cout << sum << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
int main(){
    int hand[6]={0};
    while(cin>>hand[0],hand[0]){
            int flg[5]={0};
        for(int i=1;i<5;i++)cin>>hand[i];
        for(int i=0;i<5;i++){
            if(hand[i]==1)flg[1]=1;
            if(hand[i]==2)flg[2]=1;
            if(hand[i]==3)flg[3]=1;
        }
        if(flg[1]==1&&flg[2]==1&&flg[3]==1)for(int i=0;i<5;i++)cout<<"3"<<endl;
        else if(flg[1]==1&&flg[2]==1){
            for(int i=0;i<5;i++){
                if(hand[i]==1)cout<<"1"<<endl;
                else cout<<"2"<<endl;
            }
        }
        else if(flg[2]==1&&flg[3]==1){
            for(int i=0;i<5;i++){
                if(hand[i]==2)cout<<"1"<<endl;
                else cout<<"2"<<endl;
            }
        }
        else if(flg[1]==1&&flg[3]==1){
            for(int i=0;i<5;i++){
                if(hand[i]==3)cout<<"1"<<endl;
                else cout<<"2"<<endl;
            }
        }
        else if(flg[1]==1)for(int i=0;i<5;i++)cout<<"3"<<endl;
        else if(flg[2]==1)for(int i=0;i<5;i++)cout<<"3"<<endl;
        else if(flg[3]==1)for(int i=0;i<5;i++)cout<<"3"<<endl;
    }
    return 0;
}

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

class bigdata
{
public:
  list < int >data;
  string to_str ()
  {
    string str (data.size (), '0');
    int i = 0;
    auto it = data.begin ();
    while (it != data.end ())
      {
	string buf = to_string (*it);
	  str[i] = buf[0];
	  it++;
	  i++;
      }
    return str;
  }
  bigdata & operator= (string str)
  {
    for (int i = 0; i < str.length (); i++)
      data.push_back (stoi (str.substr (i, 1)));
  }
  bigdata & operator+ (bigdata & obj)
  {
    if (this->data.size () < obj.data.size ())
      {
	int buf = obj.data.size () - this->data.size ();
	for (int i = 1; i <= buf; i++)
	  this->data.push_front (0);
      }
    if (this->data.size () > obj.data.size ())
      {
	int buf = this->data.size () - obj.data.size ();
	for (int i = 1; i <= buf; i++)
	  obj.data.push_front (0);
      }
    this->data.push_front (0);
    obj.data.push_front (0);

    auto it_a = this->data.begin ();
    auto it_b = obj.data.begin ();

    while (it_a != this->data.end ())
      {
	*it_a += *it_b;
	auto bufit = it_a;
	for (int i = 0; i < this->data.size () - 1; i++)
	  {
	    if (*bufit >= 10)
	      {
		bufit--;
		*bufit += 1;
		++bufit;
		*bufit -= 10;
		bufit--;
	      }
	  }
	it_a++;
	it_b++;
      }
    it_a = this->data.begin ();
    if (*it_a == 0)
      this->data.pop_front ();
    return *this;
  }
};

int
main ()
{
  string s1, s2;
  while (cin >> s1 >> s2)
    {
      bigdata data1, data2;
      data1 = s1;
      data2 = s2;
      data1 = data1 + data2;
      cout << data1.to_str () << endl;
    }
}