Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5 + 10;
const ll MOD = 1e9 + 7;
const int B = 12711;
const int B1 = 1007;
int n;
string s;
ll h1[N], f1[N];
ll h0[N], f0[N];
int geth(int l, int r, int* h, int* f) {
    ll res = ((h[r] - h[l-1] * f[r-l+1]) % MOD + MOD) % MOD;
    return res;
}
int main() {
    cin >> n >> s;
    f[0] = 1;
    for(int i = 0; i < n; i++) {
        h0[i+1] = (h0[i] * B + s[i] - 'a') % MOD;
        f0[i+1] = f0[i] * B % MOD;
        h1[i+1] = (h1[i] * B1 + s[i] - 'a') % MOD;
        f1[i+1] = f1[i] * B1 % MOD;
    }
    int l = 1, r = n, ans = 0;
    while(l <= r) {
        int mid = (l + r) / 2;
        int f = 0;
        for(int i = 1; i+mid-1 <= n && !f; i++) {
            for(int j = i+mid; j+mid-1 <= n; j++) {
                if(geth(i,i+mid-1, h0, f0) == geth(j,j+mid-1, h0, f0) && geth(i,i+mid-1, h1, f1) == geth(j,j+mid-1, h1, f1)) {
                    f = 1;
                    break;
                }
            }
        }
        if(f) {
            ans = mid;
            l = mid + 1;
        } else {
            r = mid - 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'f' was not declared in this scope
   18 |     f[0] = 1;
      |     ^
a.cc:31:36: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   31 |                 if(geth(i,i+mid-1, h0, f0) == geth(j,j+mid-1, h0, f0) && geth(i,i+mid-1, h1, f1) == geth(j,j+mid-1, h1, f1)) {
      |                                    ^~
      |                                    |
      |                                    ll* {aka long long int*}
a.cc:12:29: note:   initializing argument 3 of 'int geth(int, int, int*, int*)'
   12 | int geth(int l, int r, int* h, int* f) {
      |                        ~~~~~^
a.cc:31:63: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   31 |                 if(geth(i,i+mid-1, h0, f0) == geth(j,j+mid-1, h0, f0) && geth(i,i+mid-1, h1, f1) == geth(j,j+mid-1, h1, f1)) {
      |                                                               ^~
      |                                                               |
      |                                                               ll* {aka long long int*}
a.cc:12:29: note:   initializing argument 3 of 'int geth(int, int, int*, int*)'
   12 | int geth(int l, int r, int* h, int* f) {
      |                        ~~~~~^
a.cc:31:90: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   31 |                 if(geth(i,i+mid-1, h0, f0) == geth(j,j+mid-1, h0, f0) && geth(i,i+mid-1, h1, f1) == geth(j,j+mid-1, h1, f1)) {
      |                                                                                          ^~
      |                                                                                          |
      |                                                                                          ll* {aka long long int*}
a.cc:12:29: note:   initializing argument 3 of 'int geth(int, int, int*, int*)'
   12 | int geth(int l, int r, int* h, int* f) {
      |                        ~~~~~^
a.cc:31:117: error: cannot convert 'll*' {aka 'long long int*'} to 'int*'
   31 |                 if(geth(i,i+mid-1, h0, f0) == geth(j,j+mid-1, h0, f0) && geth(i,i+mid-1, h1, f1) == geth(j,j+mid-1, h1, f1)) {
      |                                                                                                                     ^~
      |                                                                                                                     |
      |                                                                                                                     ll* {aka long long int*}
a.cc:12:29: note:   initializing argument 3 of 'int geth(int, int, int*, int*)'
   12 | int geth(int l, int r, int* h, int* f) {
      |                        ~~~~~^