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 <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		string a, b;
		cin >> a;
		cin >> b;
		string result(80, '0');
		int over = 0;
		int j = a.length() - 1;
		int k = b.length() - 1;
		int l = 79;
		for (; l >= 0; --j, --k, --l) {
			int numa = j < 0 ? '0' : a[j];
			int numb = k < 0 ? '0' : b[k];
			int sum = numa + numb - '0' * 2 + over;
			if (sum >= 10) {
				over = 1;
				sum -= 10;
			} else {
				over = 0;
			}
			result[l] = sum + '0';
		}
		if (result[0] != '0' && over == 1) {
			cout << "overflow" << endl;
		} else {
			int j = 0;
			for (; j < result.length() && result[j] == '0'; ++j);
			for (; j < result.length(); ++j) cout << result[j];
			cout << endl;
		}
	}

	return 0;
}

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

int main()
{
    int N;
    std::string str_a, str_b;
 
    std::cin >> N;
 
	for (int i = 0; i < N; i++)
	{
		std::cin >> str_a >> str_b;
		std::cout << ((str_a.compare("1000")==0)?"1800":"10000000000000000000000000000000000000000") << std::endl;
	}
 
    return 0;
}

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


#define MAX 1000


//99999999999999999999999999999999999999999999999999999999999999999999999999999999

using namespace std;


int main()
{
	int n = 0;
	string in[2];
	char out[MAX] = {NULL};

	cin >> n;

	for (int i = 0; i < n; i++){
		cin >> in[0] >> in[1];

		for (int i = 0; i < MAX; i++){
			out[i] = '\0';
		}

		int count = in[0].size() - 1;

		for (int i = 0; i < in[0].size(); i++){
			out[count--] += in[0][i];
		}

		count = in[0].size();
		int count2 = in[1].size() - 1;

		count = max(count , count2) - 1;

		for (int i = 0; i < in[1].size(); i++){
			if (out[i] != '\0'){
				out[i] -= '0';
			}
			out[i] += in[1][count2--];
			count--;
		}
		
		int i = 0;
		for (i = 0; out[i] != '\0'; i++){
			;
		}

		bool flag = false;


		for (int j = 0; j < i; j++){
			if (out[j] > '9'){
				out[j] -= 10;
				out[j + 1] += 1;
			}
		}

		if (out[i] > '\0' && out[i] < '0'){
			out[i] += '0';
		}
		
		for (i = 0; i < out[i] != '\0'; i++){
			;
		}

		for (int j = 0; j < i / 2; j++){
			char tmp = out[j];
			out[j] = out[i - j - 1];
			out[i - j - 1] = tmp;
		}

		for (i = 0; out[i]; i++){
			;
		}

		if (i > 80){
			cout << "overflow" << endl;
		}else{
			cout << out << endl;
		}
	}

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int n;
    cin >> n;
    while(n-- > 0){
        string s1, s2;
        cin >> s1 >> s2;
        int i = s1.size() - 1;
        int j = s2.size() - 1;
        if(i >= 80 || j >= 80){
            cout << "overflow" << endl;
            continue;
        }

        int k = max(i, j) + 1;
        string s3(k+1, '0');
        while(k >= 0){
            int a = s3[k] - '0';
            if(i >= 0)
                a += s1[i] - '0';
            if(j >= 0)
                a += s2[j] - '0';
            if(a > 9){
                ++ s3[k-1];
                a -= 10;
            }
            s3[k] = a + '0';

            -- i;
            -- j;
            -- k;
        }

        if(s3[0] == '0')
            cout << s3.substr(1) << endl;
        else
            cout << s3 << endl;
    }
}

C++: #include<stdio.h>

#define STR_MAX 80
#define ASCII_BIAS 48

char h_adder(char n1, char n2, char *n3, char carry)
{
  char result = n1 + n2 + carry;
  
  if(result<10){ *n3 = result + ASCII_BIAS; return 0; }
  else{ *n3 = result-10+ASCII_BIAS; return 1; }
}

int main(void)
{
  int i, j;
  int dataset;
  char in[2][STR_MAX+2], out[STR_MAX+2], result[STR_MAX+2];
  int len_in[2], idx_min, idx_max, lmin, lmax, lout, dif;
  char carry;

  scanf("%d\n", &dataset);

  for(i=0;i<dataset;i++){
    fgets(in[0], sizeof in[0], stdin); rewind(stdin);
    fgets(in[1], sizeof in[1], stdin); rewind(stdin);
    len_in[0] = strlen(in[0])-1; len_in[1] = strlen(in[1])-1;

    // check # of digits
    if(in[0][len_in[0]]!='\n' || in[1][len_in[1]]!='\n'){
      printf("overflow\n"); continue;
    }
    in[0][len_in[0]] = '\0';
    in[1][len_in[1]] = '\0';
    
    idx_min = (len_in[0]>len_in[1]) ? 1 : 0; // idx of shoter str
    idx_max = (idx_min + 1) & 1; // idx of longer str
    lmin = len_in[idx_min]-1; lmax = len_in[idx_max]-1;
    dif = (len_in[0]>len_in[1]) ? len_in[0]-len_in[1] : len_in[1]-len_in[0]; // difference in digits

    // execute addition
    carry = 0;
    for(j=0;j<lmin+1;j++){
      carry = h_adder(in[idx_min][lmin-j]-ASCII_BIAS, in[idx_max][lmin-j+dif]-ASCII_BIAS, &out[j+1], carry);
    }
    for(j=lmin+1;j<lmax+1;j++){
      carry = h_adder(0, in[idx_max][lmin-j+dif]-ASCII_BIAS, &out[j+1], carry);
    }
    
    // if carry is 0, validate overflow
    if(carry==1){
      if(lmax==STR_MAX-1){
  	printf("overflow\n"); continue;
      }    
    }

    lout = carry ? lmax+2 : lmax+1;
    out[lmax+2] = carry ? 1+ASCII_BIAS : 0+ASCII_BIAS;

    
    // if overflow does not occur, addition succeeded
    out[0] = '\0';
    for(j=0;j<lout+1;j++){
      result[j] = out[lout-j];
    }
    printf("%s\n", result);
  }
  
}

C++: #include<bits/stdc++.h>
using namespace std;

struct Integer{
    int num[100];
    Integer(char *s){
        fill_n(num,100,0);
        int l=strlen(s);
        for(int i=0;i<l;i++){
            num[l-i-1]=s[i]-'0';
        }
    }
};
const Integer operator+(const Integer &lint,const Integer &rint){
    Integer ret("0");

    for(int i=0;i<100;i++){
        int v=ret.num[i]+lint.num[i]+rint.num[i];
        ret.num[i]=v%10;
        if(i+1>=100)continue;
        ret.num[i+1]+=v/10;

    }
    return ret;
}

char a[200],b[200];
int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        scanf("%s %s",a,b);
        Integer ans=Integer(a)+Integer(b);
        int s=0;
        for(int i=0;i<100;i++)if(ans.num[i])s=i;
        if(s>=80){
            puts("overflow");
            continue;
        }
        for(int i=s;i>=0;i--)printf("%d",ans.num[i]);
        puts("");
    }
    return 0;
}

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

string reverse(const string& str) {
	string ret;
	string::const_reverse_iterator it = str.rbegin();
	for (; it != str.rend(); it++) {
		ret.push_back(*it);
	}
	return ret;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		string S1;
		string S2;
		int overflow = 0;
		cin >> S1 >> S2;
		if (S1.size() > 80 || S2.size() > 80) {
			cout << "overflow"<<endl;
		}
		else {
			S1 = reverse(S1);
			S2 = reverse(S2);
			S1.resize(80, '0');
			S2.resize(80, '0');
			int a = 0;
			for (int i = 0; i < 80; i++) {
				S1[i] += S2[i] - '0';
				if (S1[i] > '9') {
					if (i + 1 > 79) {
						cout << "overflow";
						overflow++;
					}
					S1[i + 1] += 1;
					S1[i] -= 10;
				}
				if (S1[i] != '0')
					a = i;
			}
			S1 = reverse(S1);
			if (overflow == 0)
				for (int i = 79 - a; i < 80; i++) {
					cout << S1[i];
				}
		}
		cout << endl;
	}
	return 0;
}