Language: C++

#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;

ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
	}
	
	mod& operator=(const ll & tx) {
		x = tx;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return (x + m2.x) % MOD;
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return (x - m2.x + MOD) % MOD;
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return (x * m2.x) % MOD;
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return mod(((*this).x * (*this).inv().x) % MOD);
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}

/* TEMPLATE ENDS HERE */

#define H 15 

#define MAXN (1 << 13)

//vector<int> h[MAXN][MAXN];
vector<pair<vector<int>, pair<int, int> > > v;
int hv[H];
int n;
string s;

int main() {
	cout << fixed << setprecision(12);	
	
	cin >> n;
	cin >> s;
	srand(566);
	for (int i = 0; i < H; i++) {
		hv[i] = rand() % 1000000000;
	}
	for (int i = 0; i < n; i++) {
		int prev = 0;
		for (int j = i; j < n; j++) {
			vector<int> curv;
			for (int k = 0; k < H; k++) {
				int cur = prev;
				cur *= hv[k];
				cur += s[j] - 'a' + 1;
				curv.push_back(cur);
			}
			v.push_back(make_pair(h[i][j], make_pair(j - i + 1, i)));
			prev = cur;
		}
	}
	sort(v.begin(), v.end());
	int best = 0;
	for (int i = 1; i < v.size(); i++) {
		if (v[i].first == v[i - 1].first) {
			int i1 = v[i].second.second;
			int j1 = i1 + v[i].second.first - 1;
			int i2 = v[i - 1].second.second;
			int j2 = i2 + v[i - 1].second.first - 1;
			if (i2 > j1 || i1 > j2) {
				best = max(best, v[i].second.first);
			}
		}
	}
	cout << best << endl;

/*
	int best = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
			int len = j - i + 1;
			int si = j + 1;
			int sj = si + len - 1;
			if (sj >= n) {
				continue;
			}
			bool ok = true;
			for (int k = 0; k < H; k++) {
				ok &= (h[i][j][k] == h[si][sj][k]);
			}
			if (ok) {
				best = max(best, len);
			}
		}
	}
	cout << best << endl;
*/
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:139:47: error: 'h' was not declared in this scope
  139 |                         v.push_back(make_pair(h[i][j], make_pair(j - i + 1, i)));
      |                                               ^
a.cc:140:32: error: 'cur' was not declared in this scope; did you mean 'curv'?
  140 |                         prev = cur;
      |                                ^~~
      |                                curv