Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

struct RollingHash{ //ローリングハッシュ法
private:
    static const int_fast32_t mod1 = 1031326447, mod2 = 993766717;
    static const int_fast32_t base1 = 281, base2 = 383;
    vector<int_fast64_t> hash1, hash2, pow1, pow2;
public:
    string str;
    RollingHash(const string& s) : str(s) { //初期化
        int_fast32_t sz = (int_fast32_t)s.size();
        hash1.assign(sz + 1, 0); hash2.assign(sz + 1, 0);
        pow1.assign(sz + 1, 1); pow2.assign(sz + 1, 1);
        for(int_fast32_t i = 0; i < sz; i++){
            hash1[i + 1] = (hash1[i] * base1 + s[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + s[i]) % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }
    inline pair<int_fast64_t, int_fast64_t> get(int_fast32_t l, int_fast32_t r){ //[l, r)
        int_fast64_t res1 = (hash1[r] - hash1[l] * pow1[r - l]) % mod1;
        int_fast64_t res2 = (hash2[r] - hash2[l] * pow2[r - l]) % mod2;
        if(res1 < 0)res1 += mod1; if(res2 < 0)res2 += mod2;
        return { res1, res2 };
    }
    inline int_fast32_t getLCP(int_fast32_t x, int_fast32_t y){ //LCP S[a:], S[b:]
        int_fast32_t len = min((int_fast32_t)size() - x, (int_fast32_t)size() - y) + 1;
        int_fast32_t l = 0, r = len;
        while(r - l > 1){
            int_fast32_t m = (l + r) >> 1;
            if(get(x, x + m) != get(y, y + m))r = m;
            else l = m;
        }
        return l;
    }
    inline void add_str(const string& s){ //string型を連結
        int_fast32_t ns = (int_fast32_t)str.size(), ms = (int_fast32_t)s.size();
        str += s;
        hash1.resize(ns + ms + 1); hash2.resize(ns + ms + 1);
        pow1.resize(ns + ms + 1); pow2.resize(ns + ms + 1);
        for(int_fast32_t i = ns; i < ns + ms; i++){
            hash1[i + 1] = (hash1[i] * base1 + s[i - ns]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + s[i - ns]) % mod2;
            pow1[i + 1] = pow1[i] * base1 % mod1;
            pow2[i + 1] = pow2[i] * base2 % mod2;
        }
    }
    inline void add_char(const char& c){ //char型を連結
        str += c;
        hash1.push_back((hash1.back() * base1 + c) % mod1);
        hash2.push_back((hash2.back() * base2 + c) % mod2);
        pow1.push_back((pow1.back() * base1) % mod1);
        pow2.push_back((pow2.back() * base2) % mod2);
    }
    inline void add_rh(const RollingHash& rh){ //rhを連結
        add_str(rh.str);
    }
    inline size_t size(){ //strのsizeを返す
        return str.size();
    }
};

int main(){

    int N;
    cin >> N;

    string S;
    cin >> S;
    RollingHash rh(S);

    int ans = 0;
    for(int i = 0; i < N - ans; i++){
        for(int j = 0; j < i - ans; j++){
			if(S[i] != S[j])continue;
          	chmax(ans, min(rh.getLCP(i, j), i - j));
        }
    }

    cout << ans << endl;
    return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:31: error: no matching function for call to 'min(int_fast32_t, int)'
   82 |                 chmax(ans, min(rh.getLCP(i, j), i - j));
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:82:31: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   82 |                 chmax(ans, min(rh.getLCP(i, j), i - j));
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:82:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   82 |                 chmax(ans, min(rh.getLCP(i, j), i - j));
      |                            ~~~^~~~~~~~~~~~~~~~~~~~~~~~