Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull B = 100000007;

ull hash[3000010];
ull po[3000010];


int main(){
    
    string s; cin >> s;
    int n = (int)s.size();
    
    hash[0] = 0;
    po[0] = 1;

    for(int i = 1; i <= n; i++){
        po[i] = po[i - 1] * B;
        hash[i] = hash[i - 1] * B + (ull)(s[i - 1] - 'a' + 1);
    }

    

    for(int i = (n - 2) / 3; i >= 0; i--){
        if((n - 3 * i) % 2 == 1) continue;

        int j = ((n - 3 * i) / 2);
        //cout << i << " " << j << endl;
        ull H1 = hash[i] - hash[0] * po[i];
        ull H2 = hash[i + j] - hash[i] * po[j];
        ull H3 = hash[2 * i + j] - hash[i + j] * po[i];
        ull H4 = hash[2 * i + 2 * j] - hash[2 * i + j] * po[j];
        ull H5 = hash[n] - hash[2 * i + 2 * j] * po[n - (2 * i + 2 * j)];

        
        if(H1 == H3 && H3 == H5 && H2 == H4){
            string A = s.substr(0, i);
            string B = s.substr(i, j);
            cout << "Love " << A + B << "!" << endl;
            return 0;
        }
    }

    cout << "mitomerarenaiWA" << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: reference to 'hash' is ambiguous
   15 |     hash[0] = 0;
      |     ^~~~
In file included from /usr/include/c++/14/string_view:50,
                 from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:20:9: error: reference to 'hash' is ambiguous
   20 |         hash[i] = hash[i - 1] * B + (ull)(s[i - 1] - 'a' + 1);
      |         ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:20:19: error: reference to 'hash' is ambiguous
   20 |         hash[i] = hash[i - 1] * B + (ull)(s[i - 1] - 'a' + 1);
      |                   ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:30:18: error: reference to 'hash' is ambiguous
   30 |         ull H1 = hash[i] - hash[0] * po[i];
      |                  ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:30:28: error: reference to 'hash' is ambiguous
   30 |         ull H1 = hash[i] - hash[0] * po[i];
      |                            ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:31:18: error: reference to 'hash' is ambiguous
   31 |         ull H2 = hash[i + j] - hash[i] * po[j];
      |                  ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:31:32: error: reference to 'hash' is ambiguous
   31 |         ull H2 = hash[i + j] - hash[i] * po[j];
      |                                ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:32:18: error: reference to 'hash' is ambiguous
   32 |         ull H3 = hash[2 * i + j] - hash[i + j] * po[i];
      |                  ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:32:36: error: reference to 'hash' is ambiguous
   32 |         ull H3 = hash[2 * i + j] - hash[i + j] * po[i];
      |                                    ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:33:18: error: reference to 'hash' is ambiguous
   33 |         ull H4 = hash[2 * i + 2 * j] - hash[2 * i + j] * po[j];
      |                  ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:33:40: error: reference to 'hash' is ambiguous
   33 |         ull H4 = hash[2 * i + 2 * j] - hash[2 * i + j] * po[j];
      |                                        ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:34:18: error: reference to 'hash' is ambiguous
   34 |         ull H5 = hash[n] - hash[2 * i + 2 * j] * po[n - (2 * i + 2 * j)];
      |                  ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~
a.cc:34:28: error: reference to 'hash' is ambiguous
   34 |         ull H5 = hash[n] - hash[2 * i + 2 * j] * po[n - (2 * i + 2 * j)];
      |                            ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:6:5: note:                 'ull hash [3000010]'
    6 | ull hash[3000010];
      |     ^~~~