Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include <cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    string s, t; cin >> s >> t;
	int n = (int)s.size();
	int m = (int)t.size();
	string ss = s + s;
	rep(int i = 0; i <= m / n; ++i) {
		ss += s;
	}
	RollingHash rh(ss);
	RollingHash rht(t);
	pair<long long, long long> r = rht.get(0, m - 1);
	int cnt = 0, res = 0;
	int i = 0;
	while(i < 2 * n) {
		pair<long long, long long> p = rh.get(i, i + m - 1);
		if(p == r) {
			++cnt;
			chmax(res, cnt);
			i += m;
		} else {
			cnt = 0;
			i ++;
		}
	}
	if(res * m >= n) {
		cout << - 1 << endl;
		return 0;
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc:81:39: error: macro "rep" requires 2 arguments, but only 1 given
   81 |         rep(int i = 0; i <= m / n; ++i) {
      |                                       ^
a.cc:28:9: note: macro "rep" defined here
   28 | #define rep(i,n) for(int i=0;i<n;i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:81:9: error: 'rep' was not declared in this scope
   81 |         rep(int i = 0; i <= m / n; ++i) {
      |         ^~~
a.cc:93:25: error: 'chmax' was not declared in this scope
   93 |                         chmax(res, cnt);
      |                         ^~~~~