Language: C++

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

#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)

using ll = long long;
using ull = unsigned long long;

// ローリングハッシュ
// h = 2^64にすることでmod不要
using ull = unsigned long long;
vector<ll> rolling_hash_search(string s, string t)
{
    vector<ll> index_list;
    ll SL = s.size();
    ll TL = t.size();

    ull b = 1e8 + 7;

    // 蟻本でいう、bのm乗
    ull a = 1;
    FOR(i, 0, TL) { a *= b; }

    // 先頭のローリングハッシュ
    ull s_hash = 0;
    FOR(i, 0, TL) { s_hash = s_hash * b + s[i]; }

    ull t_hash = 0;
    FOR(i, 0, TL) { t_hash = t_hash * b + t[i]; }

    // sの始点を1つずつ進めながらハッシュ値をチェック
    FOR(i, 0, SL - TL + 1)
    {
        if (s_hash == t_hash) {
            index_list.push_back(i);
        }

        if (i + TL < SL) {
            s_hash = s_hash * b - s[i] * a + s[i + TL];
        }
    }

    return index_list;
}

int main()
{
    int N;
    cin >> N;

    string S;
    cin >> S;

    ll ma = 0;

    for (int i = 1; i < N; i++) {
        string L = S.substr(0, i);
        string R = S.substr(i);
        cerr << L << " " << R << '\n';
        vector<ll> v = rolling_hash_search(L, R);
        if (v.size() != 0) {
            ma = max(ma, L.size());
        }
    }

    std::cout << ma << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:21: error: no matching function for call to 'max(ll&, std::__cxx11::basic_string<char>::size_type)'
   62 |             ma = max(ma, L.size());
      |                  ~~~^~~~~~~~~~~~~~
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:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:62:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   62 |             ma = max(ma, L.size());
      |                  ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303: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:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:62:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   62 |             ma = max(ma, L.size());
      |                  ~~~^~~~~~~~~~~~~~