criyle/codenet-compile-errors huggingface dataset:
Language: C++


	
vector < ll > xc,yc;
ll x,y,k,s;
cin>>k>>x>>y;
ll ox,oy;
ox=x;oy=y;
x=abs(x);y=abs(y);
 if((abs(x)+abs(y))<k)cout<<-1;
 else {
 	if(((x+y)%k)%2!=0)cout<<-1;
 	else {

 s=(abs(x)+abs(y))/k;
 
ll df=s*k-(x+y);
if(df!=0){
s=s+2;
xc.PB(df/2);yc.PB(k-(df)/2);
xc.PB(df/2);yc.PB((df/2)-k);}
ll r;r=(x-df)/k;
for(ll i=1;i<=r;i++)
{
	xc.PB(df+k*i);yc.PB(0);
}
if(xc.size()!=s){
xc.PB(x);yc.PB(k-x+df-k*r);
ll yt=k-x+df-k*r;
 if(xc.size()!=s){
 	ll r;r=(y-yt)/k;
for(ll i=1;i<=r;i++)
{
	xc.PB(x);yc.PB(yt+i*k);
}}}
 
 }
 cout<<s<<endl;
 for(ll i=0;i<xc.size();i++)
 {
 	ll g,h;
 	g=xc[i];h=yc[i];
 	if(ox<0)g=-g;
 	if(oy<0)h=-h;
 	cout<<g<<" "<<h;
 }
 
 
 
 
 }
 
 
 

Compiler output:
a.cc:3:1: error: 'vector' does not name a type
    3 | vector < ll > xc,yc;
      | ^~~~~~
a.cc:4:1: error: 'll' does not name a type
    4 | ll x,y,k,s;
      | ^~
a.cc:5:1: error: 'cin' does not name a type
    5 | cin>>k>>x>>y;
      | ^~~
a.cc:6:1: error: 'll' does not name a type
    6 | ll ox,oy;
      | ^~
a.cc:7:1: error: 'ox' does not name a type
    7 | ox=x;oy=y;
      | ^~
a.cc:7:6: error: 'oy' does not name a type
    7 | ox=x;oy=y;
      |      ^~
a.cc:8:1: error: 'x' does not name a type
    8 | x=abs(x);y=abs(y);
      | ^
a.cc:8:10: error: 'y' does not name a type
    8 | x=abs(x);y=abs(y);
      |          ^
a.cc:9:2: error: expected unqualified-id before 'if'
    9 |  if((abs(x)+abs(y))<k)cout<<-1;
      |  ^~
a.cc:10:2: error: expected unqualified-id before 'else'
   10 |  else {
      |  ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;

int main()
{
	ll K; cin >> K;
	ll X, Y; cin >> X >> Y;
	bool mX = false, mY = false;
	if (X < 0)
	{
		mX = true;
		X = -X;
	}
	if (Y < 0)
	{
		mY = true;
		Y = -Y;
	}

	vector<pair<ll, ll>>ans;

	ll nx = X/K;
	for(int i=0;i<nx;i++)ans.push_back(make_pair(K, 0));
	X%=K;

	bool flag = false;

	if (K % 2 == 0 && (X + Y) % 2)
	{
		cout<<-1<<endl;
		return 0;
	}

	ll s = ceil(1.*(X+Y)/K);
	for (int a = s; a <= s + 1;a++)
	{
		if ((a * K - X - Y) % 2 == 0)
		{
			int k = (a * K - X - Y)/2;
			ans.push_back(make_pair(X + k, K - X - k));
			ans.push_back(make_pair(-k, K - k));

			Y -= K - X - k + K - k;
			X = 0;
			break;
		}
	}

	ll ny = abs(Y) / K;
	for (int i = 0; i < ny; i++)ans.push_back(make_pair(0, (Y<0?-K:K)));


	cout << ans.size() << endl;
	ll x = 0, y = 0;
	for (int i = 0; i < ans.size(); i++)
	{
		if (mX)ans[i].first = -ans[i].first;
		if (mY)ans[i].second = -ans[i].second;

		x += ans[i].first;
		y += ans[i].second;

		cout << x << " " << y << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:16: error: 'ceil' was not declared in this scope
   39 |         ll s = ceil(1.*(X+Y)/K);
      |                ^~~~
Language: C++

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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;

ll divceil(ll x, ll y) {
    assert(y);
    return (x+y-1)/y;
}

void concat(string& to, string s) {
    for (char c: s) to += c;
}


string unit(string s) {
    int n = s.length();
    int len = n;

    auto strstr = [&](int m, string s) {
	int n = s.length();
	if (n%m) return false;
	for (int i=0; i<n; i++) {
	    if (s[i] != s[i%m]) return false;
	}
	return true;
    };
    
    for (int i=1; i*i<=n; i++) {
	if (n%i==0) {
	    if (strstr(i, s)) {
		len = min(len, i);
	    }
	    if (i>1 && n/i!=i && substr(n/i, s)) {
		len = min(len, n/i);
	    }
	}
    }

    return s.substr(0,len);
}

bool contained(string s, string t) {
    s = unit(s);
    t = unit(t);
    int n = s.length();
    int m = t.length();
    if (n%m) return false;

    for (int i=0; i<n; i++) {
	if (s[i] != t[i%m]) return false;
    }
    return true;
}


bool test(string S, string T, int cnt) {
    string t;
    while (cnt--) {
	concat(t, T);
    }

    if (S.find(t) != string::npos) return true;
    return false;
}

string S, T;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    assert(unit("aaaa")=="a");
    assert(unit("abab")=="ab");
    assert(unit("abcab")=="abcab");

    cin>>S>>T;
    

    if (contained(S, T)) {
	out(-1);
    }

    {
	string s = S;
	while (S.length() < T.length()) {
	    concat(S, s);
	}
    }


    S = S + S;
    int n = S.length();
    int m = T.length();

    int lo = 0;
    int hi = divceil(n, m);

    while (hi-lo>1) {
	int mid = (lo+hi)/2;
	if (test(S, T, mid)) {
	    lo = mid;
	} else {
	    hi = mid;
	}
    }
    cout<<lo<<endl;    
    return 0;
}


Compiler output:
a.cc: In function 'std::string unit(std::string)':
a.cc:45:34: error: 'substr' was not declared in this scope; did you mean 'strstr'?
   45 |             if (i>1 && n/i!=i && substr(n/i, s)) {
      |                                  ^~~~~~
      |                                  strstr
Language: C++

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

#define int long long

const int BASE = 571;
const int M1 = 998244353;
const int M2 = 1e9+7;

string s,t;
int m;
int ht,hs[2000005],p[500005];
int ee,h[1000005],nex[1000005],to[1000005];
int du[1000005],dis[1000005],ans;

void addedge(int x,int y)
{
	nex[++ee] = h[x];
	to[ee] = y;
	h[x] = ee;
}

void topo()
{
	queue<int> q;
	for(int i=1;i<=m;i++)
		if(du[i]==0)
			q.push(i);
	if(q.empty())
		puts("-1"), exit(0);
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		for(int i=h[x];i;i=nex[i])
		{
			dis[to[i]] = max(dis[to[i]],dis[x]+1);
			if((--du[to[i]])==0)
				q.push(to[i]);
		}
	}
}

signed main()
{
	cin>>s>>t;
	p[0] = 1;
	for(int i=1;i<=t.length();p[i]=p[i-1]*BASE,i++);
	while(s.length()<t.length())
		s += s;
	m = s.length();
	s += s;
	for(int i=0;i<t.length();i++)
		ht = ht*BASE+t[i];
	hs[0] = s[0];
	for(int i=1;i<s.length();i++)
		hs[i] = hs[i-1]*BASE+s[i];
	if(hs[t.length()-1]%M1==ht%M1 && hs[t.length()-1]%M2==ht%M2)
		addedge(1%m+1,(t.length()+1)%m+1), du[(t.length()+1)%m+1]++;
	for(int l=1;l+t.length()-1<m+t.length()-1;l++)
	{
		int r=l+t.length()-1;
		int res=hs[r]-hs[l-1]*p[t.length()];
		if((res%M1==ht%M1 && res%M2==ht%M2)
			addedge((l+1)%m+1,(r+2)%m+1), du[(r+2)%m+1]++;
	}
	topo();
	for(int i=1;i<=m;i++)
		ans = max(ans,dis[i]);
	cout<<ans<<endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:52: error: expected ';' before 'addedge'
   67 |                 if((res%M1==ht%M1 && res%M2==ht%M2)
      |                                                    ^
      |                                                    ;
   68 |                         addedge((l+1)%m+1,(r+2)%m+1), du[(r+2)%m+1]++;
      |                         ~~~~~~~                     
a.cc:69:9: error: expected primary-expression before '}' token
   69 |         }
      |         ^
a.cc:68:71: error: expected ')' before '}' token
   68 |                         addedge((l+1)%m+1,(r+2)%m+1), du[(r+2)%m+1]++;
      |                                                                       ^
      |                                                                       )
   69 |         }
      |         ~                                                              
a.cc:67:19: note: to match this '('
   67 |                 if((res%M1==ht%M1 && res%M2==ht%M2)
      |                   ^
a.cc:69:9: error: expected primary-expression before '}' token
   69 |         }
      |         ^
Language: C++

#include <bits/stdc++.h>
#define int long long
#define maxn 10000005
#define inf 2000000000000000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
const double PI = acos(-1);
using namespace std;

string s,t,ls; int n,m;
int hs[maxn],ht[maxn];
int base = 31;
int fastmul(int x,int so){
	if (so==0) return 1; if (so==1) return x%mod;
	int t=fastmul(x,so/2); t=(t*t)%mod;
	if (so%2==1) t=(t*x)%mod;
	return t;
}
int hash (int l, int r){
	int val = hs[r]-hs[l-1]*fastmul(base,r-l+1);
	val%=mod; val=(val+mod)%mod;
	
}
bool ok (int x){
	string lt; int i,j;
	if (m*x >=ls.size()) return false;
	for (i=1;i<=x;i++){
		lt+=t;
	}
	int hlt=0;
	for (i=0;i<lt.size();i++){
		hlt=hlt*base+lt[i]-96; hlt%=mod;
	}
	for (i=0;i<=ls.size()-lt.size();i++){
		int val = hash(i,i+lt.size()-1);
		if (val==hlt) return true;
	}
	return false;
}
int binsTnum(int lo,int hi){
	int daps=0;
	while (lo<=hi){
		int mid=(lo+hi)/2;
		if (ok(mid)){
			daps=max(daps,mid);
			lo=mid+1;
		}
		else hi=mid-1;
	}
	return daps;
}

main(){
	ios::sync_with_stdio(false); cin.tie(0); srand(time(NULL));
	//freopen("inp.txt","r",stdin); //freopen("out.txt","w",stdout);
	//freopen(".inp","r",stdin); freopen(".out","w",stdout);
	cin>>s>>t; n=s.size(); m=t.size();
	int i,j,k;
	ls = s+s+s;
	while (ls.size()<=t.size()) ls+=s;
	
	hs[0]=ls[0]-96;
	for (i=1;i<ls.size();i++){
		hs[i]=hs[i-1]*base+ls[i]-96;
		hs[i]%=mod;
	}
	//cout<<ls<<'\n';
	ht[0]=t[0]-96;
	for (i=1;i<t.size();i++){
		ht[i]=ht[i-1]*base+t[i]-96;
		ht[i]%=mod;
	}
	int ans1= binsTnum(1,500000);
	ls=ls+ls+ls;
	hs[0]=t[0]-96;
	for (i=1;i<ls.size();i++){
		hs[i]=hs[i-1]*base+ls[i]-96;
		hs[i]%=mod;
	}
	int ans2=binsTnum(1,500000);
	//cout<<ans1<<' '<<ans2<<'\n';
	if (ans1==ans2){
		cout<<ans1; return 0;
	}
	else{
		cout<<-1; return 0;
	}
	
	
}

Compiler output:
a.cc: In function 'long long int hash(long long int, long long int)':
a.cc:24:1: warning: no return statement in function returning non-void [-Wreturn-type]
   24 | }
      | ^
a.cc: In function 'bool ok(long long int)':
a.cc:36:27: error: reference to 'hash' is ambiguous
   36 |                 int val = hash(i,i+lt.size()-1);
      |                           ^~~~
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:20:5: note:                 'long long int hash(long long int, long long int)'
   20 | int hash (int l, int r){
      |     ^~~~
a.cc: At global scope:
a.cc:54:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   54 | main(){
      | ^~~~
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
#define int long long
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; }

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 + s;
	for(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 < 3 * 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:
cc1plus: error: '::main' must return 'int'
Language: C++

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

string s="", t, kmpinp="", inps=, inp2="";
int selfkmptmp;

vector<int> KMP(string S)
{
	vector<int> pi(S.length()+1, 0);
	for(int i = 1; i < S.length(); i++)
	{
		int j = pi[i-1];
		while(S[j]!=S[i] && j)
		{
			j=pi[j-1];
		}
		pi[i]= j + (S[i]==S[j]);
	}
	vector<int> occ;
	for(int i = 0; i < S.length(); i++)
	{
		if(pi[i]==t.length())
		{
			occ.pb(i);
		}
	}
	return occ;
}
int solve(vector<int> occ)
{
	vector<int> dp(occ.size() + 1);
	int ptr=0;
	int ret = (occ.size()>0);
	dp[0] = (occ.size()>0);
	for(int i = 1; i < occ.size(); i++)
	{
		while(occ[i]-occ[ptr]>t.length()) ptr++;
		if(occ[i]-occ[ptr]==t.length())
		{
			dp[i]=dp[ptr]+1;
			ret=max(ret, dp[i]);
		}
		else
		{
			dp[i] = 1;
		}
	}
	return ret;
}
int main()
{
	cin >> inps >> t;
	while(inp2.length() < t.length())
	{
		inp2+=inps;
	}
	s+=inp2;
	s+=inp2;
	kmpinp+=t;
	kmpinp+="#";
	kmpinp+=s;
	//cout << kmpinp << endl;
	vector<int> occ1 = KMP(kmpinp);
	// for(auto v: occ1) cout << v << " ";
	// 	cout << endl;
	kmpinp+=inp2;
	//cout << kmpinp << endl;
	vector<int> occ2 = KMP(kmpinp);
	// for(auto v: occ2) cout << v << " ";
	// 	cout << endl;
	int pow1=solve(occ1), pow2=solve(occ2);
	if(pow2>pow1) 
	{	
		cout << -1;
		return 0;
	}
	cout << pow1;
}

Compiler output:
a.cc:5:33: error: expected primary-expression before ',' token
    5 | string s="", t, kmpinp="", inps=, inp2="";
      |                                 ^
a.cc: In function 'int main()':
a.cc:54:15: error: 'inp2' was not declared in this scope; did you mean 'inps'?
   54 |         while(inp2.length() < t.length())
      |               ^~~~
      |               inps
a.cc:58:12: error: 'inp2' was not declared in this scope; did you mean 'inps'?
   58 |         s+=inp2;
      |            ^~~~
      |            inps
Language: C++

#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define cst first
#define dur second
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 1e7 + 5, M = 2 * N + 5;

vector<int> res;
void KMP(const string &s, const string &k){
    res.clear();
    if (k.empty())
        return ;
    vector<int> tmp(k.size(), 0);
    for (int i = 1, j = 0; i < k.size(); ++i){
        while (j && k[j] != k[i])
            j = tmp[j - 1];
        if (k[j] == k[i])
            ++j;
        tmp[i] = j;
    }
    for (int i = 0, j = 0; i < s.size(); ++i){
        while (j && k[j] != s[i])
            j = tmp[j - 1];
        if (k[j] == s[i])
            ++j;
        if (j == k.size())
            res.push_back(i - j + 1);
    }
}

int n, m;

string a, b;

int f(){
    n = res.size();
    int mx = 0;
    int len = a.size();
    vector<int> sum(len, 0);
    for(auto i : res){
        if(i - m >= 0)
            sum[i] = sum[i - m] + 1;
        else sum[i] = 1;
        mx = max(mx, sum[i]);
    }
    return mx;
}


int main(){
    IO;
    cin >> a >> b;
    set<int> st;
    for(auto i : a)st.insert(i);
    for(auto i : b)st.insert(i);
    if(st.size())return cout << -1 << endl, 0;
    m = b.size();
    while(a.size() <= m)
        a += a;
    a += a;
    a += a;
    KMP(a, b);
    if(n == 0)return cout << n << endl, 0;
    cout << hna << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:13: error: 'hna' was not declared in this scope
   66 |     cout << hna << endl;
      |             ^~~
Language: C++

#include <vector>
#include <iostream>
using namespace std;

vector<int> Z_algorithm(string S){
  // cerr << S << endl;
  int c = 0, n = S.length();
  vector<int> Z(n,0);
  for(int i = 1; i < n; ++i){
    int l = i - c;
    if(i + Z[l] < c + Z[c]){
      Z[i] = Z[l];
    }else{
      int j = max(0, c + Z[c] - i);
      while(i + j < n && S[j] == S[i+j]) ++j;
      Z[i] = j;
      c = i;
    }
  }
  return Z;
}

string min_cycle(string S){
  vector<int> Z = Z_algorithm(S+S);
  int L = S.length();
  // for(auto e : Z) cerr << e << " ";
  // cerr << endl;
  for(int i = 0; i < L; ++i){
    if(Z[i] >= L){
      return S.substr(0,i);
    }
  }
  return S;
}

int main(){
  string S, T;
  cin >> S >> T;
  {
    string sc = min_cycle(T), st = min_cycle(S);
    cerr << sc << " " << st << endl;
    if(sc.length() == st.lzength()){
      string sc_ = sc + sc;
      vector<int> Z = Z_algorithm(st+"#"+sc_);
      // for(auto e : Z)
      //   cerr << e << " ";
      // cerr << endl;
      for(size_t i = st.length(); i < Z.size(); ++i){
        if(Z[i] >= (int)st.length()){
          // cerr << i << " " << Z[i] << endl;
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }
  string S_ = S;
  while(S.length() <= T.length()) S += S_;
  S += S;
  string U = T + "#" + S;
  vector<int> Z = Z_algorithm(U);
  int N = Z.size(), M = T.length();
  vector<int> dp(N+1,0);
  int ans = 0;
  for(int i = M+1; i < N; ++i){
    ans = max(ans,dp[i]);
    if(Z[i] >= M) dp[i+M] = dp[i]+1;
    ans = max(ans,dp[i+1]);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lzength'; did you mean 'length'?
   42 |     if(sc.length() == st.lzength()){
      |                          ^~~~~~~
      |                          length
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>
#include <cassert>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

vector<int> z_algorithm(string s){
	// z[i] : s[i]から始まるtの部分列でsのprefixと一致するもののうち最長のものの長さ
	int n = s.length();
	vector<int> z(n,0);

	int l=0,r=0;
	z[0] = n;
	for (int i = 1; i < n; i++){
		if(i>r){
			l=i,r=i;
			while(r<n && s[r]==s[r-l]) r++;
			z[i]=r-l;
			r--;
		}else{
			int k = i-l;
			if(z[k]<r-i+1){
				z[i]=z[k];
			}else{
				l=i;
				while(r<n && s[r]==s[r-l]) r++;
				z[i]=r-l;
				r--;
			}
		}
	}
	return z;
}

P toporogical_sort(const vector<vector<int> > g){
	int n = g.size();
	vector<int> in_degree(n,0);
	for(int i = 0; i < n; i++){
		for(int j = 0; j < g[i].size(); j++){
			in_degree[g[i][j]]++;
		}
	}

	vector<int> res,length(n);
	stack<int> S;
	for(int i = 0; i < n; i++){
		if(in_degree[i]==0) S.push(i),length[i]=0;
	}

	while(!S.empty()){
		int p = S.top();
		S.pop();
		res.push_back(p);
		for(int i = 0; i < g[p].size(); i++){
			in_degree[g[p][i]]--;
			if(in_degree[g[p][i]]==0) S.push(g[p][i]),length[g[p][i]]=length[p]+1;
		}
	}

	return P(res.size(),*max_element(all(length)));
}

int main()
{
	string s,t;
	cin>>s>>t;

	int n = s.size(), m = t.size();
	string res=s;
	for (int cnt = 0; cnt < m/n; cnt++){
		res += s;
	}
	s=res;
	s += s;

	s = t + '0' + s;

	vector<int> z = z_algorithm(s);
	g.resize(n,vector<int>());
	set<P> edge;
	for (int i = m+1; i < s.size(); i++){
		if(z[i]==t.size()) edge.insert(P((i-(m+1))%n, (i-(m+1)+z[i])%n));
	}

	deg.resize(n,0);
	for(auto x: edge){
		g[x.first].push_back(x.second);
		deg[x.second]++;
	}


	P ans = toporogical_sort(g);
	cout<<(ans.first==n?ans.second:-1)<<endl;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:101:9: error: 'g' was not declared in this scope
  101 |         g.resize(n,vector<int>());
      |         ^
a.cc:107:9: error: 'deg' was not declared in this scope
  107 |         deg.resize(n,0);
      |         ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cassert>

using namespace std;

using ll =  long long;

constexpr int S_MAX = 500000;
constexpr int T_MAX = 500000;
constexpr int INF = 1<<30;

int z[T_MAX+4*S_MAX];

void z_algorithm(string s, int *z) {
    int n = s.length(), k = 0;
    for(int i=1;i<n;++i) {
        if(i + z[i-k] < k + z[k]) {
            z[i] = z[i-k];
        } else {
            int j = max(0, k + z[k] - i);
            while(i + j < n && s[i+j] == s[j]) ++j;
            z[i] = j;
            k = i;
        }
    }
    z[0] = n;
}

int calc_period(string s, int n) {
    int s_period = INF;
    for(int i=1;i<=sqrt(n+1);++i) {
        if(n % i) continue;
        bool is_period = true;
        for(int j=0;j<n;++j) {
            if(s[j] != s[j%i]) {
                is_period = false;
                break;
            }
        }
        if(is_period) {
            s_period = min(s_period, i);
        }
        is_period = true;
        for(int j=0;j<n;++j) {
            if(s[j] != s[j%(n/i)]) {
                is_period = false;
                break;
            }
        }
        if(is_period) {
            s_period = min(s_period, n/i);
        }
    }
    return s_period;
}

int main() {
    string _s, s,t;
    cin >> _s >> t;
    int _n = _s.length(), n, m = t.length();
    s = _s;
    n = _n;

    // 答えが -1 の場合をここでふるい落とす
    // 周期が同じで，周期内の文字列が同じなら -1
    int s_period = calc_period(s, n), t_period = calc_period(t, m);
    assert(0 < s_period && s_period <= n)
    if(s_period == t_period) {
        bool are_same = true;
        for(int i=0;i<s_period;++i) {
            if(s[i] != t[i]) {
                are_same = false;
            }
        }
        if(are_same) {
            cout << -1 << endl;
            return 0;
        }
    }
    
    while(n < m) {
        s += _s;
        n += _n;
    }

    string tss = t + s + s;
    z_algorithm(tss, z);

    vector<int> gap(m, 0); // KMP法のずらしテーブルみたいなやつ
    {
        int j = 0;
        for(int i=0;i<m;++i) {
            gap[i] = j;
            if(t[i] == t[j]) {
                ++j;
            } else {
                j = 0;
            }
        }
    }
    
    vector<int> ans(m+n+n, 0);
    for(int i=m;i<m+n+n;++i) {
        if(z[i] < m) continue;
        int j = i+m, tmp_ans = 0;
        while(j < m+n+n && z[j] >= m) j += m;
        ans[i] = (j-i)/m;
        i = j-1 - gap[m-1];
    }
    cout << *max_element(ans.begin(), ans.end()) << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:5: error: expected ';' before 'if'
   72 |     if(s_period == t_period) {
      |     ^~
Language: C++

#pragma GCC optimize "03"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 2e6 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
bool f; 
int lps[N], g[N], dis[N];
 
int calc(int cur, int org){
    if(cur == org)  {
        f = 1;
        return -1;
    }
    if(dis[cur] != -1)
        return dis[cur];
    if(g[cur] == -1)
        return dis[cur] = 0;
    dis[cur] = 1 + calc(g[cur], org);
    return dis[cur];
}
 
signed main() {
    IOS;
    #ifdef LOCAL
        freopen("input.txt","r", stdin);
        freopen("output.txt","w",stdout);
    #endif
    string s, t;
    cin >> s >> t;
    int tl = t.length();
    for(int i = 1, l = 0; i < tl; i++){
        while(l > 0 && t[i] != t[l])
            l = lps[l-1];
        if(t[i] == t[l])
            lps[i] = l + 1, l++;
    }   
    /*int i = 1, l = 0;
    while(i < tl){
        if(t[i] == t[l]){
            l++;
            lps[i] = l;
            i++;
        }
        else{
            if(l != 0)
                l = lps[l-1];
            else
                lps[i] = 0, i++;
        }
    }  */
    string tmp = s;
    while(tmp.length() < tl)
        tmp += s;
    s = tmp + tmp;
    int sl = (s.length());
    i = 0; l = 0;
    for(int i = 0; i < sl; i++)
        g[i] = dis[i] = -1;
    while(i < sl){
        if(s[i] == t[l])
            i++, l++;
        if(l == tl){
            int u = (i-l)%sl;
            int v = (i)%(sl>>1);
            if(u < (sl >> 1)){
                g[u] = v;
            }
            l = lps[l-1];
        }
        else if(i < sl && t[l] != s[i]){
            if(l != 0)
                l = lps[l-1];
            else
                i += 1;
        }
    }
    int ans = 0;
    for(int i = 0; i < (sl >> 1); i++){
        if(g[i] != -1){
            f = 0;
            int x = calc(g[i], i);
            if(f)
                return cout << -1, 0;
            dis[i] = 1 + x;
            ans = max(ans, dis[i]);
        }
    }
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:5: error: 'i' was not declared in this scope
   70 |     i = 0; l = 0;
      |     ^
a.cc:70:12: error: 'l' was not declared in this scope; did you mean 'sl'?
   70 |     i = 0; l = 0;
      |            ^
      |            sl
Language: C++

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

#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)

#define INF 2e9
#define ll long long

vector<int> kmp(string s){
    vector<int> a(n+1); /* それぞれの区切りでの答え */
    a[0] = -1;
    int j = -1;
    for(int i=0; i<s.size(); i++){
        while(j>=0 && s[i] != s[j]){
            j = a[j];
        }
        j++;
        if(s[i+1]==s[j]){
            a[i] = a[j];
        }
        else{
            a[i+1] = j;
        }
    }
    return a;
}

int main(){

    string s, t;
    cin>>s>>t;
    
    int n=s.size();
    int m=t.size();

    /* sのi文字目からi+t-1文字目までの部分文字列がtと一致するか否か */
    vector<bool> match(n);

    for(int i=0; i<n+m; i++){   /* わかる */
        while(u != -1 && t[u] != s[i%n]){   /* わからない */
            u = pre[u];
        }
        u++;
        if(u==m){
            match[(i+1-m)%n] = true;
        }
    }

/* #6583256 */


    return 0;
    
}

Compiler output:
a.cc: In function 'std::vector<int> kmp(std::string)':
a.cc:12:19: error: 'n' was not declared in this scope
   12 |     vector<int> a(n+1); /* それぞれの区切りでの答え */
      |                   ^
a.cc: In function 'int main()':
a.cc:42:15: error: 'u' was not declared in this scope
   42 |         while(u != -1 && t[u] != s[i%n]){   /* わからない */
      |               ^
a.cc:43:17: error: 'pre' was not declared in this scope; did you mean 'pread'?
   43 |             u = pre[u];
      |                 ^~~
      |                 pread
a.cc:45:9: error: 'u' was not declared in this scope
   45 |         u++;
      |         ^
Language: C++

#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
void fin(int n){
  cout<<n<<endl;
  exit(0);
}
const int inf=1e7
//main
signed main(){
  string s,t;cin>>s>>t;
  int S=s.size(),T=t.size();
  string K;while(K.size()<T)K+=s;K=t+"#"+K+s;
  //cout<<K<<endl;
  std::vector<int> A(inf,-1);
  int j=-1;
  for(int i=0;i<K.size();i++){
    while(j>=0&&K[i]!=K[j])j=A[j];
    j++;
    A[i+1]=j;
  }
  std::vector<int> match(inf,0);
  for(int i=0;i<S;i++)if(A[2*T+S+i]==T)match[i]++;
  std::vector<int> d(inf),edge[inf];
  for(int i=0;i<S;i++)if(match[i])edge[i].push_back((i+T)%S);
  std::vector<int> si(inf,0);
  for(int i=0;i<S;i++)for(int p:edge[i])si[p]++;
  queue<int> que;
  for(int i=0;i<S;i++)if(si[i]==0)que.push(i);
  int ans=0;
  while(que.size()){
    int p=que.front();que.pop();
    for(int q:edge[p]){
      d[q]=max(d[q],d[p]+1);ans=max(ans,d[q]);
      if(--si[q]==0)que.push(q);
    }
  }
  //for(int i=0;i<30;i++)cout<<A[i]<<" ";cout<<endl;
  //for(int i=0;i<S;i++)for(int p:edge[i])cout<<i<<" "<<p<<endl;
  for(int i=0;i<S;i++)if(si[i])fin(-1);
  fin(ans);
}


Compiler output:
a.cc:15:1: error: expected ',' or ';' before 'signed'
   15 | signed main(){
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>
#include <iostream>
#include <string>

#include <boost/algorithm/searching/boyer_moore.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, e) for (int i = (s); i < (int)(e); ++i)
using namespace std;
using ll = long long;

int solve(const string &s, const string &t, unsigned long ls, unsigned long lt) {
  int ret = 0;
  vector<bool> seen(ls, false);

  int i = -1;
  while (++i < ls) {
    i = boost::algorithm::boyer_moore_search(
        s.begin() + i, s.end(), t.begin(), t.end()).first - s.begin();
    if (i > ls) break;
    if (seen[i]) continue;

    int j = 0;
    while (true) {
      int p = boost::algorithm::boyer_moore_search(
          s.begin() + i + j * lt, s.end(), t.begin(), t.end()).first - s.begin();
      if (p - (i + j * lt) != 0) {
        break;
      }
      if (p < ls) seen[p] = true;
      if (j * lt >= ls) return -1;

      j += 1;
    }
    ret = max(ret, j);
  }
  return ret;
}

int main() {
  string s, t;
  cin >> s >> t;

  unsigned long ls, lt;
  ls = s.size();
  lt = t.size();

  do {
    s += s;
  } while (s.size() < t.size() * 3);
  int ret = solve(s, t, ls, lt);
  cout << ret << endl;
}


Compiler output:
a.cc:5:10: fatal error: boost/algorithm/searching/boyer_moore.hpp: No such file or directory
    5 | #include <boost/algorithm/searching/boyer_moore.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int table[500500];
string target;
string pattern;
bool match[500500];

void createTable() {
    table[0] = 0;
    int j = 0;
    for (int i = 1; i < pattern.length(); ++i) {
        if (pattern[i] == pattern[j]) {
            table[i] = j++;
        } else {
            table[i] = j;
            j = 0;
        }
    }
    for (int i = 1; i < pattern.length(); ++i) {
        if (i > pattern.length() / 2)return 1;
        //pattern[i:n]==pattern[0:n-i]?
        bool flag = false;
        for (int j = pattern.length() - 1; j >= i; --j) {
            if (pattern[j] != pattern[j - i]) {
                flag = true;
                break;
            }
        }
        if (flag)continue;
        table[pattern.length()] = pattern.length() - 1 - i;
        break;
    }
}

int Gcd(int a, int b) {
    if (b == 0)return a;
    return Gcd(b, a % b);
}

signed main() {
    cin >> target >> pattern;
    createTable();
    int i = 0, p = 0;
    while (i - (int) pattern.length() < (int) target.length()) {
        if (target[i % target.length()] == pattern[p]) {
            i++;
            p++;
        } else if (p == 0) {
            //パターン先頭文字が不一致
            i++;
        } else {
            p = table[p];
        }
        if (p == pattern.length()) {
            match[i - p] = true;
            p = table[p] + 1;
        }
    }

    int ans = 0;
    int gcd = Gcd(pattern.length(), target.length());

    for (int start = 0; start < gcd; ++start) {
        int cnt = 0;
        int maxv = 0;
        for (int at = start; at != start + 2 * target.length() * pattern.length() / gcd; at += pattern.length()) {
            if (match[at % target.length()]) {
                cnt++;
                maxv = max(maxv, cnt);
            } else {
                cnt = 0;
            }
        }
        if (maxv == 2 * target.length() / gcd) {
            cout << -1 << endl;
            return 0;
        }
        ans = max(ans, maxv);
    }

    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'void createTable()':
a.cc:28:45: error: return-statement with a value, in function returning 'void' [-fpermissive]
   28 |         if (i > pattern.length() / 2)return 1;
      |                                             ^
Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <queue>
#include <tuple>
#include <assert.h>

using namespace std;
typedef long long ll;

// http://www.prefield.com/algorithm/string/knuth_morris_pratt.html
int* buildFail(const char* p) {
	int m = strlen(p);
	int* fail = new int[m + 1];
	int j = fail[0] = -1;
	for (int i = 1; i <= m; ++i) {
		while (j >= 0 && p[j] != p[i - 1]) j = fail[j];
		fail[i] = ++j;
	}
	return fail;
}
int match(const char* t, const char* p, const int* fail, int* found) {
	int n = strlen(t), m = strlen(p);
	int count = 0;
	for (int i = 0, k = 0; i < n; ++i) {
		while (k >= 0 && p[k] != t[i]) k = fail[k];
		if (++k >= m) {
			found[i-m+1] = true;
			++count; // match at t[i-m+1 .. i]
			k = fail[k];
		}
	}
	return count;
}


int main(int argc, char** argv) {
	string s, t;
	cin >> s >> t;

	while (s.length() < t.length()) {
		s = s + s;
	}
	auto slen = s.length();
	s = s + s;

	vector<int> found(s.length());


	auto fail = buildFail(t.c_str());
	match(s.c_str(), t.c_str(), fail, &found[0]);

	int ans = 0;

	for (int i = 0; i < slen; i++) {
		int rep = 0;
		int k = i;
		while (found[k]) {
			k = (k + t.length()) % slen;
			rep++;
			if (k == i) {
				cout << -1 << endl;
				return 0;
			}
		}
		ans = max(ans, rep);
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int* buildFail(const char*)':
a.cc:15:17: error: 'strlen' was not declared in this scope
   15 |         int m = strlen(p);
      |                 ^~~~~~
a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <assert.h>
  +++ |+#include <cstring>
    9 | 
a.cc: In function 'int match(const char*, const char*, const int*, int*)':
a.cc:25:17: error: 'strlen' was not declared in this scope
   25 |         int n = strlen(t), m = strlen(p);
      |                 ^~~~~~
a.cc:25:17: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:29:28: error: 'm' was not declared in this scope
   29 |                 if (++k >= m) {
      |                            ^
Language: C++

#include <bits/stdc++.h>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>

int main() {
    using namespace std;
    using namespace boost::algorithm;
    string s, t;
    cin >> s >> t;
    unsigned long loop{1}, M{t.size()};
    {
        auto tt = t + t;
        auto it = knuth_morris_pratt_search(tt.begin() + 1, tt.end() - 1, t.begin(), t.end()).first;
        if(it != tt.end() - 1){
            auto l = it - tt.begin();
            t = string(tt.begin(), it);
            loop = M / l;
            M = l;
        }
    }
    {
        auto ss = s + s;
        auto it = knuth_morris_pratt_search(ss.begin() + 1, ss.end() - 1, s.begin(), s.end()).first;
        if(it != ss.end() - 1)s = string(ss.begin(), it);
    }
    unsigned long N{s.size()};
    {
        unsigned long n{(N + M - 1) / N};
        string ss(s.begin(), s.end());
        while(n){
            if(n & 1)s += ss;
            ss += ss;
            n >>= 1;
        }
    }

    vector<unsigned long> morris_pratt_search_result;
    auto morris_pratt_search_all = [&morris_pratt_search_result](auto s, auto t){
        string Q(t + "_" + s);
        unsigned long N{s.size()}, M{t.size()}, L{Q.size()};
        vector<unsigned long> MP(L + 1);
        for(unsigned long i = 1, j = 0; i <= L; MP[i++] = j){
            while(j > 0 && Q[i - 1] != Q[j - 1])j = MP[j - 1];
            if(++j > M && i >= j + M && i < j + N + M)morris_pratt_search_result.push_back(i - j - M);
        }
    };

    morris_pratt_search_all(s, t);
    vector<unsigned long> idx(N);
    for(const auto& i : morris_pratt_search_result)if(i < N)idx[i] = ~0UL;

    auto f = [rec = [&idx, &M, &N](auto f, unsigned long i, unsigned long t, unsigned long k) -> unsigned long{
        if(!idx[i])return 0;
        if(i == t && k)idx[i] = 2 * N;
        else if(!~idx[i])idx[i] = f(f, (i + M) % N, t, 1) + 1;
        return idx[i];
    }](unsigned long n){rec(rec, n, n, 0);};
    for(unsigned long i = 0; i < N; ++i)f(i);

    unsigned long ans{*max_element(idx.begin(), idx.end())};
    if(ans > N)puts("-1");
    else cout << ans / loop << endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/algorithm/searching/knuth_morris_pratt.hpp: No such file or directory
    2 | #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>

int main() {
    using namespace std;
    using namespace boost::algorithm;
    string s, t;
    cin >> s >> t;
    unsigned long loop = 1;
    {
        auto p = knuth_morris_pratt<decltype(t.begin())>(t.begin(), t.end());
        string tt{t + t};
        auto it = p(tt.begin() + 1, tt.end() - 1).first;
        if(it != tt.end() - 1){
            loop = t.size() / (it - tt.begin());
            t = string(tt.begin(), it);
        }
    }
    {
        auto p = knuth_morris_pratt<decltype(s.begin())>(s.begin(), s.end());
        string ss{s + s};
        auto it = p(ss.begin() + 1, ss.end() - 1).first;
        if(it != ss.end() - 1)s = string(ss.begin(), it);
    }
    auto p = knuth_morris_pratt<decltype(t.begin())>(t.begin(), t.end());
    while(s.size() < t.size())s += s;
    unsigned long N = s.size(), M = t.size();
    s += s;

    vector<unsigned long> idx(N);
    auto it = p(s.begin(), s.end()).first;
    while(it - s.begin() < N){
        idx[(it - s.begin()) % N] = ~0UL;
        it = p(it + 1, s.end()).first;
    }

    auto f = [rec = [&idx, &M, &N](auto f, unsigned long i, unsigned long t, unsigned long k) -> unsigned long{
        if(!idx[i])return 0;
        if(i == t && k)idx[i] = 2 * N;
        else if(!~idx[i])idx[i] = f(f, (i + M) % N, t, 1) + 1;
        return idx[i];
    }](unsigned long n){rec(rec, n, n, 0);};
    for(unsigned long i = 0; i < N; ++i)f(i);

    unsigned long ans = *max_element(idx.begin(), idx.end());
    if(ans > N)puts("-1");
    else cout << ans / loop << endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/algorithm/searching/knuth_morris_pratt.hpp: No such file or directory
    2 | #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>

int main() {
    using namespace std;
    using namespace boost::algorithm;
    string s, t;
    cin >> s >> t;
    unsigned long loop = 1;
    {
        string tt{t + t};
        tt.pop_back();
        auto it = knuth_morris_pratt_search(tt.begin() + 1, tt.end() - 1, t.begin(), t.end()).first;
        if(it != tt.end() - 1){
            loop = t.size() / (it - tt.begin());
            t = string(tt.begin(), it);
        }
    }
    while(s.size() < t.size())s += s;
    unsigned long N = s.size(), M = t.size();
    s += s;

    vector<unsigned long> idx(N);
    auto it = knuth_morris_pratt_search(s.begin(), s.end(), t.begin(), t.end()).first;
    while(it - s.begin() < N){
        idx[(it - s.begin()) % N] = ~0UL;
        it = knuth_morris_pratt_search(it + 1, s.end(), t.begin(), t.end()).first;
    }

    auto f = [rec = [&idx, &M, &N](auto f, unsigned long i, unsigned long t, unsigned long k) -> unsigned long{
        if(!idx[i])return 0;
        if(i == t && k)idx[i] = 2 * N;
        else if(!~idx[i])idx[i] = f(f, (i + M) % N, t, 1) + 1;
        return idx[i];
    }](unsigned long n){rec(rec, n, n, 0);};
    for(unsigned long i = 0; i < N; ++i)f(i);

    unsigned long ans = *max_element(idx.begin(), idx.end());
    if(ans > N)puts("-1");
    else cout << ans / loop << endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/algorithm/searching/knuth_morris_pratt.hpp: No such file or directory
    2 | #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <boost/algorithm/searching/knuth_morris_pratt.hpp>

int main() {
    using namespace std;
    using namespace boost::algorithm;
    string s, t;
    cin >> s >> t;
    while(s.size() < t.size())s += s;
    unsigned long N = s.size(), M = t.size();
    s += s;

    vector<unsigned long> idx(N);
    auto it = knuth_morris_pratt_search(s.begin(), s.end(), t.begin(), t.end()).first;
    while(it - s.begin() < N){
        idx[(it - s.begin()) % N] = ~0UL;
        it = knuth_morris_pratt_search(it + 1, s.end(), t.begin(), t.end()).first;
    }

    auto f = [rec = [&idx, &M, &N](auto f, unsigned long i, unsigned long t, unsigned long k) -> unsigned long{
        if(!idx[i])return 0;
        if(i == t && k)idx[i] = 2 * N;
        else if(!~idx[i])idx[i] = f(f, (i + M) % N, t, 1) + 1;
        return idx[i];
    }](unsigned long n){rec(rec, n, n, 0);};
    for(unsigned long i = 0; i < N; ++i)f(i);

    unsigned long ans = *max_element(idx.begin(), idx.end());
    if(ans > N)puts("-1");
    else cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:2:10: fatal error: boost/algorithm/searching/knuth_morris_pratt.hpp: No such file or directory
    2 | #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

import java.util.*;

public class Main {
	boolean test = false;
	
	Scanner sc;
	String s;
	String t;
	
/*-------------
 * constructor
 */
	public Main() {
	}
	
/*------------------
 * instance methods
 */
	void out(Object o) {
		System.out.println(o);
		System.out.flush();
	}
	
	String append(String s, int n) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append(s);
		}
		return sb.toString();
	}
	
	public void exec(String input) throws Exception {
		sc = new Scanner(input);
		execImpl();
	}
	
	
	public void exec() throws Exception {
		sc = new Scanner(System.in);
		execImpl();
	}
	
	public void execImpl() throws Exception {
		s = sc.next();
		t = sc.next();
		
		int al = s.length();
		int bl = t.length();
		
		if (al >= bl) {
			// A>B となるケース
			// BB.B (length は A 以下) がAAに含まれる => 有限個
			// ただし、AAに含まれた次からもBB,B となっていた場合、無限個
			int nb = al/bl+1;
			String AAA = append(s, 3);
			for (; nb >= 0; nb--) {
				if (AAA.contains(append(t, nb))) break;
			}
			if (nb == al/bl+1) out(-1);
			else out(nb);
		} else {
			// A<B となるケース
			// AA.A に B が含まれる => 有限個
			// ただし、含まれた次も B になっていたら(AA.Ax2 が BB を含む)無限個
			int na = bl/al+1;
			String AAA = append(s, na);
			if ((AAA+AAA).contains(append(t,2))) out(-1);
			else if (AAA.contains(t)) out(1);
			else out(0);
		}
	}
	
/*------
 * main
 */
	public static void main(String[] args) throws Exception {
		Main m = new Main();
		m.exec();
	}
}



Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m,nxt[1000010],ret,ans;
char s[500010],t[500010],a[1000010];
bool ok[1000010];
void make_nxt()
{
	int j;
	nxt[0]=-1;
	if(t[0]==t[1])
		nxt[1]=1;
	for(int i=2;i<m;i++)
	{
		j=nxt[i-1];
		while(t[j]!=t[j-1]&&j!=-1)
			j=nxt[j];
		nxt[i]=j+1;
	}
}
void cmp()
{
	int j;
	for(int i=0;i<=n;)
	{
		for(j=0;j<m;j++)
			if(a[i+j]!=t[j])
			{
				i+=j-nxt[j];
				j=m+1;
			}
		if(j==m)
		{
			ok[i]=true;
			i++;
		}
	}
}
void find()
{
	for(int i=0;i<m;i++)
		for(int j=i;j<=n;j+=m)
			if(ok[j])
				ret++;
			else
			{
				ans=max(ans,ret);
				ret=0;
			}
	if(ans)
		ans=max(ans,ret);
}
int gcd(int x,int y)
{
	return((y==0)?x:gcd(y,x%y));
}
void check_if_negative1()
{
	int d=gcd(n,m);
	for(int i=0;i<n;i++)
		if(s[i]!=s[i%d])
			return;
	for(int i=0;i<m;i++)
		if(t[i]!=t[i%d])
			return;
	printf("-1\n");
	exit(0);
}
int main()
{
	gets(s);
	gets(t);
	n=strlen(s);
	m=strlen(t);
	check_if_negative1();
	for(int i=0;i<n+m;i++)
		a[i]=s[i%n];
	make_nxt();
	cmp();
	find();
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   70 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include <iostream>
#include <vector>

using namespace std;

// 蟻本でみた、ローリングハッシュを試してみる
vector<bool> check_eq(string s, string t) {
  int s_size = s.size();
  int t_size = t.size();
  vector<bool> result(s_size);
  uint64_t b = 100000007;
  uint64_t bn = 1;
  uint64_t s_hash = 0;
  uint64_t t_hash = 0;
  
  for (int i = 0; i < t_size; i++) {
    bn *= b;
  }
  
  for(const char& c : t) {
    t_hash = t_hash * b + c;
  }
  
  for(int start = 0; start < s_size + t_size - 1; start++) { // ループして反映するので、終了条件がちょっと違う
    int end = start - t_size + 1;
    s_hash = s_hash * b + s[start%s_size];
    if (start < t_size-1) {
      // hashに使う長さがt_sizeに達するまでは使用できない
      continue;
    }

    if (end > 0) {
      // hashに使う長さがt_sizeを超えたら先頭を削除
      s_hash -= s[end-1] * bn;
    }
    
    result[end] = s_hash == t_hash;
  }
  
  return result;
}

int main() {
  string s,t,s_origin;
  cin >> s >> t;
  s_origin = s;
  
  while(s.size() < t.size()+s_origin.size()) {
    s += s_origin;
  }
  
  vector<bool> eqs = check_eq(s,t);
  
  int s_origin_size = s_origin.size();
  int t_size = t.size();

  for (int i = 0; i < s_origin_size; i++) {
    if (eqs[i] && (s.substr(i, t_size) != t)) {
      cout << s_origin << " " << s << " " << t << " " << i << " " << (s.substr(i, t_size)) << " " << t << " " << eqs[i] << endl;
      throw 1;
    }
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'std::vector<bool> check_eq(std::string, std::string)':
a.cc:11:3: error: 'uint64_t' was not declared in this scope
   11 |   uint64_t b = 100000007;
      |   ^~~~~~~~
a.cc:3:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    2 | #include <vector>
  +++ |+#include <cstdint>
    3 | 
a.cc:12:11: error: expected ';' before 'bn'
   12 |   uint64_t bn = 1;
      |           ^~~
      |           ;
a.cc:13:11: error: expected ';' before 's_hash'
   13 |   uint64_t s_hash = 0;
      |           ^~~~~~~
      |           ;
a.cc:14:11: error: expected ';' before 't_hash'
   14 |   uint64_t t_hash = 0;
      |           ^~~~~~~
      |           ;
a.cc:17:5: error: 'bn' was not declared in this scope
   17 |     bn *= b;
      |     ^~
a.cc:17:11: error: 'b' was not declared in this scope
   17 |     bn *= b;
      |           ^
a.cc:21:5: error: 't_hash' was not declared in this scope
   21 |     t_hash = t_hash * b + c;
      |     ^~~~~~
a.cc:21:23: error: 'b' was not declared in this scope
   21 |     t_hash = t_hash * b + c;
      |                       ^
a.cc:26:5: error: 's_hash' was not declared in this scope
   26 |     s_hash = s_hash * b + s[start%s_size];
      |     ^~~~~~
a.cc:26:23: error: 'b' was not declared in this scope
   26 |     s_hash = s_hash * b + s[start%s_size];
      |                       ^
a.cc:34:28: error: 'bn' was not declared in this scope
   34 |       s_hash -= s[end-1] * bn;
      |                            ^~
a.cc:37:29: error: 't_hash' was not declared in this scope
   37 |     result[end] = s_hash == t_hash;
      |                             ^~~~~~