Language: C++

#include<bits/stdc++.h>
using namespace std;
//万合以致，向阳而生——背叛时代，忠于时间//
#pragma GCC optimize(3,"Ofast","inline")
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef unsigned long long ull;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(register int i=0; i<n; i++)
#define Forn(i, n) for(register int i=1; i<=n; i++)
#define foreach(it, a) for(__typeof((a).begin()) it=(a).begin(); it!=(a).end(); it++)
#define Foreach(it, a) for(__typeof((a).rbegin()) it=(a).rbegin(); it!=(a).rend(); it++)
#define mid l+r>>1
#define lid id<<1|1
#define rid (id<<1)+2
#define lson lid, l, mid
#define rson rid, mid, r

inline int in()
{
    char c=getchar();
    int neg=1, x=0;
    while(!isdigit(c)) (c=='-')?neg=-1, c=getchar():c=getchar();
    while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48), c=getchar();
    return neg*x;
}
inline int lcm(int a, int b){return a*b/__gcd(a, b);}

const int MAX=20e5+5;

int N, M, ret, ptr, mark[MAX], v[MAX];
char tmp;
set<int> tmp;
string s, t;

struct Hash
{
        int val, mod, seed;
        Hash(int _m=1e9+7, int _s=61):val(0), mod(_m), seed(_s){}
        inline int update(int x)
        { 
            val=(1LL*val*seed+x)%mod; 
            return val;
        }
        inline int v(){ return val; }
}h;

struct Hash_suff// const int MAX=???
{
        Hash a;
        int ptr, mod, hash[MAX], base[MAX];
        Hash_suff() {}
        inline void init(int _m, int _p)
        {
            ptr=0;
            mod=a.mod=_m, a.seed=_p, a.val=0;
            base[0]=1;
            Forn(i, MAX-1)
                base[i]=1LL*base[i-1]*_p%_m;
        }
        inline void update(int x)
        { hash[++ptr]=a.update(x); }
        inline int get(int l, int r)// (l,r]
        { return (hash[r]-1LL*hash[l]*base[r-l]%mod+mod)%mod; }
        inline int getl(int l1, int r1, int l2, int r2)
        {
            int t1=get(l1, r1), t2=get(l2, r2);
            return (1LL*t1*base[r2-l2]+t2)%mod;
        }
}H;

int main()
{
    memset(mark, -1, sizeof(mark));
    H.init(1e9+7, 61);
    scanf("%s", tmp); s=tmp;
    scanf("%s", tmp); t=tmp;
    while(s.size()<t.size()) s+=s;
    N=s.size(), M=t.size();
    s+=s;
    forn(i, N*2) H.update(s[i]-'a'+1);
    forn(i, M) h.update(t[i]-'a'+1);
//    forn(i, N-M+1) cout<<H.get(i, i+M)<<" "<<h.v()<<endl;
    forn(i, N) if(mark[i]==-1)
    {
        int p=i, c=0;
        tmp.clear();
//        cout<<" "<<i<<endl;
        while(H.get(p, p+M)==h.v())
        {
//            cout<<p<<endl;
            if(tmp.count(p))
            {
                puts("-1");
                return 0;
            }
            if(~mark[p])
            {
                c=mark[p];
                break;
            }
            v[ptr++]=p, tmp.insert(p);
            p=(p+M)%N;
        }
        if(!ptr) mark[i]=0;
        else
        {
            c++;
            while(ptr>0)
                mark[v[ptr-1]]=c,
                c++, ptr--;
            ret=max(ret, c-1);
        }
    }
    printf("%d\n", ret); 
    return 0;
}
// baaab
//abaaba


Compiler output:
a.cc:38:10: error: conflicting declaration 'std::set<int> tmp'
   38 | set<int> tmp;
      |          ^~~
a.cc:37:6: note: previous declaration as 'char tmp'
   37 | char tmp;
      |      ^~~
a.cc: In member function 'void Hash_suff::init(int, int)':
a.cc:63:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   63 |             Forn(i, MAX-1)
      |                  ^
a.cc:15:37: note: in definition of macro 'Forn'
   15 | #define Forn(i, n) for(register int i=1; i<=n; i++)
      |                                     ^
a.cc: In function 'int main()':
a.cc:86:10: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   86 |     forn(i, N*2) H.update(s[i]-'a'+1);
      |          ^
a.cc:14:37: note: in definition of macro 'forn'
   14 | #define forn(i, n) for(register int i=0; i<n; i++)
      |                                     ^
a.cc:87:10: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   87 |     forn(i, M) h.update(t[i]-'a'+1);
      |          ^
a.cc:14:37: note: in definition of macro 'forn'
   14 | #define forn(i, n) for(register int i=0; i<n; i++)
      |                                     ^
a.cc:89:10: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   89 |     forn(i, N) if(mark[i]==-1)
      |          ^
a.cc:14:37: note: in definition of macro 'forn'
   14 | #define forn(i, n) for(register int i=0; i<n; i++)
      |                                     ^
a.cc:92:13: error: request for member 'clear' in 'tmp', which is of non-class type 'char'
   92 |         tmp.clear();
      |             ^~~~~
a.cc:97:20: error: request for member 'count' in 'tmp', which is of non-class type 'char'
   97 |             if(tmp.count(p))
      |                    ^~~~~
a.cc:107:29: error: request for member 'insert' in 'tmp', which is of non-class type 'char'
  107 |             v[ptr++]=p, tmp.insert(p);
      |                             ^~~~~~