Go: package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	const maxCapacity = 512 * 1024
	buf := make([]byte, maxCapacity)
	scanner.Buffer(buf, maxCapacity)

	n := nextInt()
	maxint, _ := new(big.Int).SetString("100000000000000000000000000000000000000000000000000000000000000000000000000000000", 10)

	for i := 0; i < n; i++ {
		aStr := nextString()
		bStr := nextString()

		a, _ := new(big.Int).SetString(aStr, 10)
		b, _ := new(big.Int).SetString(bStr, 10)
		c := big.NewInt(0).Add(a, b)

		if c.Cmp(maxint) < 0 {
			fmt.Println(c)
		} else {
			fmt.Println("overflow")
		}
	}
}

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

using namespace std;

int main()
{
	int N; cin >> N;
	int a[80], b[80], c[80];
	string s, t, m;

	for(int i=0; i<N; i++){
		fill(a,a+80,0); fill(b,b+80,0); fill(c,c+80,0);
		cin >> s >> t;
		for(int j=s.length()-1, k=0; j>=0; j--, k++){
			m=s.substr(k,1);
			if(m=="0"){ a[j]=0;}
			else if(m=="1"){ a[j]=1;}
			else if(m=="2"){ a[j]=2;}
			else if(m=="3"){ a[j]=3;}
			else if(m=="4"){ a[j]=4;}
			else if(m=="5"){ a[j]=5;}
			else if(m=="6"){ a[j]=6;}
			else if(m=="7"){ a[j]=7;}
			else if(m=="8"){ a[j]=8;}
			else{ a[j]=9;}
		}
		for(int j=t.length()-1, k=0; j>=0; j--,k++){
			m=t.substr(k,1);
			if(m=="0"){ b[j]=0;}
			else if(m=="1"){ b[j]=1;}
			else if(m=="2"){ b[j]=2;}
			else if(m=="3"){ b[j]=3;}
			else if(m=="4"){ b[j]=4;}
			else if(m=="5"){ b[j]=5;}
			else if(m=="6"){ b[j]=6;}
			else if(m=="7"){ b[j]=7;}
			else if(m=="8"){ b[j]=8;}
			else{ b[j]=9;}
		}

		for(int j=79; j>=0; j--){
			cout << a[j];
		}
		cout << endl;
		for(int j=79; j>=0; j--){
			cout << b[j];
		}
		cout << endl;
		/*		
		int d=0;
		bool flag=false;
		for(int j=0; j<80; j++){
			c[j] = (a[j]+b[j]+d)%10;
			d = (a[j]+b[j]+d)/10;
			if(j==79 && d>0){ flag=true;}
		}
		
		if(flag){cout << "overflow";}		
		else{
				flag = false;
				for(int j=79; j>=0; j--){
					if(flag){ cout << c[j];}
					else if(c[j] != 0){ cout << c[j]; flag=true;}
				}
		}
		cout << endl;*/
	}

	return 0;
}

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

typedef std::vector<char> TLongInt;
TLongInt Decode(const std::string& Code)
{
    std::vector<char> Value(100, 0);
    for(int i = 0; i < Code.size(); ++i){
        Value[i] = Code[Code.size() -1 -i] - 48;
    }
    return Value;
}
TLongInt Add(const TLongInt& A, const TLongInt& B)
{
    assert(A.size() == B.size());
    TLongInt C(A.size(), 0);
    int kuriagari = 0;
    for(int i = 0; i < A.size(); ++i){
        int V = A[i] + B[i] + kuriagari;
        C[i] = V % 10;
        kuriagari = V / 10;
    }
    return C;
}

void Print(const TLongInt& Value, std::ostream& out)
{
    bool Left = true;
    for(int i = Value.size() - 1; i >= 0; --i){
        if(Value[i] == 0 && Left) continue;
        if(i >= 80){
            out << "overflow" << std::endl;
            return;
        }
        Left = false;
        out << int(Value[i]);
    }
    out << std::endl;
}

int main()
{
    int N;
    std::cin >> N;
    for(int i = 0; i < N; ++i){
        std::string first, second;
        std::cin >> first;
        std::cin >> second;
        Print(Add(Decode(first), Decode(second)), std::cout);
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std;
const int DIGIT=9;

int main() {
  int n;
  char buf[82];
  int l, x[2], y, z;
  char buf_part[DIGIT+1];
  int a[2][9];
  int b[9];
  bool overflow_flg;

  cin >> n;
  while (n--) {
    overflow_flg = false;
    for (int i=0; i<2; i++) {
      fscanf(stdin, "%81s", buf);
      l = strlen(buf);
      if (l > 80) {
        overflow_flg = true;
        while (getchar() != '\n');
        continue;
      }
      x[i] = (l+DIGIT-1)/DIGIT;
      y = (l-1)%DIGIT+1;
      for (int j=0; j<9; j++) {
        a[i][j] = 0;
      }
      for (int j=0; j<x[i]; j++) {
        if (!j) {
          memcpy(buf_part, buf, y);
          buf_part[y] = '\0';
        } else {
          memcpy(buf_part, &buf[y+DIGIT*(j-1)], DIGIT);
          buf_part[DIGIT] = '\0';
        }
        a[i][x[i]-j-1] = atoi(buf_part);
      }
    }
    if (overflow_flg) {
      cout << "overflow" << endl;
      continue;
    }

    for (int i=0; i<9; i++) b[i] = 0;
    z = (x[0] > x[1]) ? x[0] : x[1];
    for (int i=0; i<z; i++) {
      b[i] = a[0][i] + a[1][i];
      if (b[i] >= 1000000000) {
        a[0][i+1]++;
        b[i] -= 1000000000;
      }
    }
    if (z<9 && a[0][z]) {
      b[z] = a[0][z]+a[1][z];
      ++z;
    }
    if (b[8] >= 100000000) {
      cout << "overflow" << endl;
    } else {
      cout << b[z-1];
      for (int i=z-2; i>=0; i--) {
        cout.fill('0');
        cout.width(DIGIT);
        cout << b[i];
      }
      cout << 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++){

		in[0].resize(0);
		in[1].resize(0);

		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>

std::string add(std::string a, std::string b)
{
    while(a.size() < b.size()) a.insert(0, "0");
    while(b.size() < a.size()) b.insert(0, "0");
    int n = a.size();
    std::string res(n, ' ');
    for(int i=n-1, d=0; i>=0; --i)
    {
        int p   = a[i] - '0';
        int q   = b[i] - '0';
        int r   = p+q+d;
        d       = r/10;
        res[i]  = r%10 + '0';
        if(i == 0 && d != 0) res.insert(0, std::string(1, d+'0'));
    }
    return res;
}

int main()
{
    int wordsNum;
    std::cin >> wordsNum;
    for(int i=0; i<wordsNum; i++)
    {
        std::string a, b;
        std::cin >> a >> b;
        std::string tmp = add(a, b);
        if(tmp.size() > 80) std::cout << "overflow" << std::endl;
        else std::cout << tmp << std::endl;
        
    }
    return 0;
}