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

#include <iostream>
#include <map>
#include <queue>
using namespace std;
typedef long long int ll;
ll n, x[110000], l, numq, a, b, nexth[110000], table[30][110000];

void build_sparse()
{
	for (int i = 0; i < 20; i++)
	{
		if ((1 << i) >= n)
			break;
		for (int j = 0; j < n; j++)
		{
			if (i == 0)
			{
				table[i][j] = nexth[j];
			}
			else if (table[i - 1][j] == -1)
			{
				table[i][j] = -1;
			}
			else
			{
				if (table[i - 1][table[i - 1][j]] == -1)
					table[i][j] = -1;
				else
					table[i][j] = table[i - 1][table[i - 1][j]];
			}
		}
	}
}

int solve(int x1, int y1)
{
	if (x1 >= y1)
		return 0;
	int j;
	for (j = 0; j < 20; j++)
	{
		if (table[j][x1] > y1 || table[j][x1] == -1)
			break;
	}
	j--;
	if (j == -1)
		return 1;
	return (solve(table[j][x1], y1) + (1<<j));
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> x[i];
	cin >> l;

	queue<int> q;
	q.push(0);

	for (int i = 1; i < n; i++)
	{
		int temp = x[q.front()];
		while (x[i]-temp > l)
		{
			nexth[q.front()] = i - 1;
			q.pop();
			temp = x[q.front()];
		}
		q.push(i);
	}

	while (!q.empty())
	{
		nexth[q.front()] = n - 1;
		q.pop();
	}

	nexth[n - 1] = -1;

	memset(table, -1, sizeof(table));
	build_sparse();

	cin >> numq;

	for (int i = 0; i < numq; i++)
	{
		cin >> a >> b;
		if (a > b)
		{
			int temp = a;
			a = b;
			b = temp;
		}
		a--; b--;

		int ans = solve(a, b);
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:9: error: 'memset' was not declared in this scope
   81 |         memset(table, -1, sizeof(table));
      |         ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#include<stack>
#include<vector>
using namespace std;
const int N=1e5+50;
const int INF=0x3f3f3f;
long long num[N];
int main()
{
    long long n;
    long long l;
    int q,a,b，ber;
    scanf("%lld",&n);
    for(long long i=1;i<=n;i++)
        scanf("%lld",&num[i]);
    num[n+1]=INF;
    scanf("%lld%d",&l,&q);
    while(q--)
    {
        long long sum=0;
        scanf("%d%d",&a,&b);
        long long x=min(a,b);
        int endd=max(a,b);
        long long cnt=num[x]+l;
        ber=1;
        while(ber<endd)
        {
         ber=upper_bound(num,num+n+1,cnt)-num-1;

            sum++;
            cnt=num[ber]+l;
        }
        sum++;
        printf("%lld\n",sum);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:26: error: 'b' was not declared in this scope
   25 |         scanf("%d%d",&a,&b);
      |                          ^
a.cc:29:9: error: 'ber' was not declared in this scope; did you mean 'bzero'?
   29 |         ber=1;
      |         ^~~
      |         bzero
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#include<stack>
#include<vector>
using namespace std;
const int N=1e5+50;
const int INF=0x3f3f3f;
long long num[N];
int main()
{
    long long n;
    long long l;
    int q,a,b;
    scanf("%lld",&n);
    for(long long i=1;i<=n;i++)
        scanf("%lld",&num[i]);
    num[n+1]=INF;
    scanf("%lld%d",&l,&q);
    while(q--)
    {
        long long sum=0;
        scanf("%d%d",&a,&b);
        long long x=min(a,b);
        int endd=max(a,b);
        long long cnt=num[x]+l;
        while(ber<endd)
        {
        int ber=upper_bound(num,num+n+1,cnt)-num-1;
            sum++;
            cnt=num[ber]+l;
        }
        sum++;
        printf("%lld\n",sum);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: 'ber' was not declared in this scope
   29 |         while(ber<endd)
      |               ^~~
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  int x[N];
  for(int i = 0; i < N; ++i) cin >> x[i];
  int L;
  cin >> L;
  //Doubling
  int table[N][30];
  for(int i = 0; i < N; ++i){
    fill(table[i],table[i]+30,0);
    table[i][0] = upper_bound(x,x+N,x[i]+L) - x - 1;
  }

  for(int j = 1; j < 30; ++j){
    for(int i = 0; i < N; ++i){
      table[i][j] = table[table[i][j-1]][j-1];
    }
  }
  /*
  for(int i = 0; i < N; ++i){
    cout << i << " | ";
    for(int j = 0; j < 30; ++j){
      cout << table[i][j] << " ";
    }cout << endl;
  }
  */
  //Query
  int Q;
  cin >> Q;
  int a, b;
  for(int i = 0; i < Q; ++i){
    cin >> a >> b;
    if(a > b) swap(a,b);
    --a;--b;
    int ans = 0, r = 29;
    while(r > 0){
      while(r >= 0 && table[a][r] >= b) --r;
      //cout << r << " ";
      if(r >= 0)
	ans += 1<<r;
      a = table[a][r];
    }
    ++ans;
    cout << ans << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: 'upper_bound' was not declared in this scope
   15 |     table[i][0] = upper_bound(x,x+N,x[i]+L) - x - 1;
      |                   ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int n,q,l,a[111111],x,y,pos,prev,cnt;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	scanf("%d%d",&l,&q);
	while(q--)
	{
		scanf("%d%d",&x,&y);
		if (x>y) swap(x,y);
		pos=x;cnt=0;
		while(pos<y)
		{
			prev=pos;
			while(pos<=y && a[pos]-a[prev]<=l) pos++;
			pos--;
			cnt++;
		}
		printf("%d\n",cnt);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: reference to 'prev' is ambiguous
   17 |                         prev=pos;
      |                         ^~~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:4:29: note:                 'int prev'
    4 | int n,q,l,a[111111],x,y,pos,prev,cnt;
      |                             ^~~~
a.cc:18:50: error: reference to 'prev' is ambiguous
   18 |                         while(pos<=y && a[pos]-a[prev]<=l) pos++;
      |                                                  ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:4:29: note:                 'int prev'
    4 | int n,q,l,a[111111],x,y,pos,prev,cnt;
      |                             ^~~~
Language: C++

#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
 
#define P 1000000007
 
using namespace std;
 
int fastpow(int e, int x) {
  if(x == 0) {
    return 1;
  }
  if(x % 2 == 0) {
    return fastpow(e*e, x / 2);
  } else {
    return e * fastpow(e, x - 1);
  }
}
 
int main() {
  int n;
  cin >> n;
  vector<long long> x;
  x.resize(n);
  for(int i = 0; i < n; i++) cin >> x[i];
 
  long long l;
  int q;
  cin >> l >> q;
  vector<pair<int, int>> query;
  query.resize(q);
  for(int i = 0; i < q; i++) {
    cin >> query[i].first >> query[i].second;
    if(query[i].first > query[i].second) {
      int tmp = query[i].first;
      query[i].first = query[i].second;
      query[i].second = tmp;
    }
    query[i].first--;
    query[i].second--;
  }
  vector<vector<long long>> path;
  path.resize(n);
  for(int i = 0; i < n; i++) {
    auto it = lower_bound(x.begin(), x.end(), x[i] + l);
    if(it - x.begin() == i) {
      path[i].push_back(i);
      comtinue;
    }
    it--;
    path[i].push_back(it - x.begin());
  }
  for(int k = 1; k < n; k *= 2) {
    for(int i = 0 ; i < n; i++) {
      path[i].push_back(path[path[i][k - 1]][k - 1]);
    }
  }
 
  for(int i = 0; i < q; i++) {
    long long ans = 0;
    int now = query[i].first;
    while(true) {
      auto p = upper_bound(path[now].begin(), path[now].end(), query[i].second);
      if(p == path[now].begin()) {
        ans++;
        break;
      }
      p--;
      ans += p - path[now].begin() + 1;
      now = *p;
    }
  }
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:7: error: 'comtinue' was not declared in this scope
   55 |       comtinue;
      |       ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
typedef long long lli;
lli n;
vector<lli> x;
lli l;
lli q;
vector<lli> a;
vector<lli> b;
lli k;
vector<vector<lli> > r;
void query(lli a,lli b){
    lli ans = 0;
    if(a > b) swap(a,b);
    while(a < b){
        lli t = upper_bound(r[a].begin(),r[a].end(),b) - r[a].begin() - 1;
        ans += pow((lli)2,t);
        a = r[a][t];
    }
    cout << ans << endl;
}
int main(int argc, char const *argv[]) {
    cin >> n;
    for(lli m = 1;m < n;m <<= 1) k++;
    x = vector<lli> (n+1);
    r = vector<vector<lli> > (n+1,vector<lli>(k+1));
    for(lli i = 1;i <= n;i++) cin >> x[i];
    cin >> l;
    cin >> q;
    for(lli i = 1;i <= n;i++){
        r[i][0] = upper_bound(x.begin(),x.end(),x[i]+l) - x.begin() - 1;
    }
    for(lli i = 1;i <= k;i++){
        for(lli j = 1;j <= n;j++){
            r[j][i] = r[r[j][i-1]][i-1];
        }
    }
    a = vector<lli> (q);
    b = vector<lli> (q);
    for(lli i = 0;i < q;i++) cin >> a[i] >> b[i];
    for(lli i = 0;i < q;i++){
        query(a[i],b[i]);
    }

    return 0;
}


Compiler output:
a.cc: In function 'void query(lli, lli)':
a.cc:18:17: error: 'upper_bound' was not declared in this scope
   18 |         lli t = upper_bound(r[a].begin(),r[a].end(),b) - r[a].begin() - 1;
      |                 ^~~~~~~~~~~
a.cc: In function 'int main(int, const char**)':
a.cc:33:19: error: 'upper_bound' was not declared in this scope
   33 |         r[i][0] = upper_bound(x.begin(),x.end(),x[i]+l) - x.begin() - 1;
      |                   ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<cfloat>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<map>
#include<functional>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
const int mod = 1e9+7;
const int INFINT = INT_MAX/2;
typedef long long ll;
typedef unsigned long long ull;
int dp[40][100000];

void makeDoubling(vector<ull> &xs, ull L){
    int N = xs.size();
    for (int i=0;i<N;i++){
        dp[0][i] = lower_bound(xs.begin(), xs.end(), xs[i]+L+1) - xs.begin() - 1;
    }
    for (int i=1;i<40;i++){
        for (int j=0;j<N;j++){
            dp[i][j] = dp[i-1][dp[i-1][j]];
        }
    }
    return;
}

int MinimumDays(int a, int b){
    if(a > b) swap(a, b);
    int now = a;
    int res = 0;
    for (int i=39;i>=0;i--){
        if(dp[i][now] < b){
            now = dp[i][now];
            res += 1<<i;
        }
    }
    res++;
    return res;
}

int main(){
    int N, x;
    cin >> N;
    vector<ull> xs(N);
    for(int i=0;i<N;i++){
        cin >> x;
        xs[i] = x;
    }
    ull L, a, b;
    int Q, a, b;
    cin >> L >> Q;
    makeDoubling(xs, L);

    for (int i=0;i<Q;i++){
        cin >> a >> b;
        cout << MinimumDays(a-1, b-1) << endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:59:12: error: conflicting declaration 'int a'
   59 |     int Q, a, b;
      |            ^
a.cc:58:12: note: previous declaration as 'ull a'
   58 |     ull L, a, b;
      |            ^
a.cc:59:15: error: conflicting declaration 'int b'
   59 |     int Q, a, b;
      |               ^
a.cc:58:15: note: previous declaration as 'ull b'
   58 |     ull L, a, b;
      |               ^
Language: C++

//	Author:	Mohib Manva
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int rig[30][111111];
int n, q, l, u, v;
int x[111111];
 
int main(void)
{
	scanf("%d",&n);
	int i, j;
	for(i=0 ; i<n ; i++)
	{
		scanf("%d",&x[i]);
	}
	scanf("%d %d",&l,&q);
	for(i=0 ; i<n ; i++)
	{
		int lo = i+1,high = n-1;
		int last = i+(i!=(n-1));
		while(lo<=high){
			int mi = (lo+high)>>1;
			if(a[mi]-a[i]<=l)
				lo = mi+1,last = mi;
			else
				high = mi-1;
		}
		dp[0][i]=last;
	}
	for(i=1;  i<=29 ; i++)
	{
		for(j=0 ; j<n ; j++)
		{
			dp[i][j]=dp[i-1][dp[i-1][j]];
		}
	}
	while(q--)
	{
		scanf("%d %d",&u,&v);
		u--; v--;
		if(u>v)
		{
			int temp=v;
			v=u;
			u=temp;
		}
		int ans=1e9;
		int cur=0;
		for(i=29 ; i>=0 ; i--)
		{
			if(dp[i][u]>=v)
			{
				ans=min(ans,cur+(1<<i));
			}
			else
			{
				cur+=(1<<i);
				u=dp[i][u];
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:28: error: 'a' was not declared in this scope
   24 |                         if(a[mi]-a[i]<=l)
      |                            ^
a.cc:29:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |                 dp[0][i]=last;
      |                 ^~
      |                 dup
a.cc:35:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   35 |                         dp[i][j]=dp[i-1][dp[i-1][j]];
      |                         ^~
      |                         dup
a.cc:52:28: error: 'dp' was not declared in this scope; did you mean 'dup'?
   52 |                         if(dp[i][u]>=v)
      |                            ^~
      |                            dup
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
 
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
int nxt[20][100010];
int inp[100010];
int main(){
    ios::sync_with_stdio(0);
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>inp[i];
    }
    int l;
    cin>>l;
    for(int j=0;j<20;j++){
        for(int i=0;i<100010;i++){
            nxt[j][i]=100005;
        }
        nxt[j][100005]=100005;
    }
    int lst = n-1;
    for(int i=n-2;i>=0;i--){
        while(inp[lst]-inp[i]>l){
            lst--;
        }
        nxt[0][i]=lst;
    }
 
    for(int j=1;j<20;j++){
        for(int i=0;i<n;i++){
            nxt[j][i]=nxt[j-1][nxt[j-1][i]];
        }
    }
 
    int q;
    cin>>q;
    while(q--){
        int a,b;
        cin>>a>>b;
        a--;b--;
        if(a==b){
            cout<<0<<endl;
            continue;
        }
        if(a>b) swap(a,b);
        int ans = 0;
        for(int j=19;j>=0;j--){
            if(nxt[j][a]<b){
                a=nxt[j][a];
                ans+=(1<<j);
            }
            else if(nxt[j][a]==b){
                ans+=(1<<j);
                break;
            }
        }
        if(j==-1) ans++;
        cout<<ans<<endl;
    }
 
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:12: error: 'j' was not declared in this scope
   68 |         if(j==-1) ans++;
      |            ^
Language: C++

#include <iostream>
using namespace std;

#define MAX_N 100000

int tab[40][MAX_N];

// mid日でaからbまで行けるか
bool C(int a, int b, int mid){
	int pos = a;
	int cnt = 0;
	while(mid != 0){
		if(mid & 1){
			pos = tab[cnt][pos];
		}
		mid >>= 1;
		cnt++;
	}
	if(pos >= b) return true;
	else return false;
}


int solve(int a, int b){
	if(a > b) swap(a, b);

	int ub = 100000;
	int lb = 0;
	while(ub - lb > 1){
		int mid = lb + (ub - lb) / 2;
		if(C(a, b, mid)) ub = mid;
		else lb = mid;
	}
	return ub;
}

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

	int N, L, Q;
	int x[MAX_N];

	cin >> N;
	for(int i=0; i<N; i++) cin >> x[i];
	cin >> L >> Q;


	int y[MAX_N];

	for(int i=0; i<N; i++){
		tab[0][i]  = upper_bound(x, x+N, x[i]+L) - x - 1;
	}

	for(int k=0; k<40; k++){
		for(int i=0; i<N; i++){
			tab[k+1][i] = tab[k][min(N-1, tab[k][i])];
		}
	}

	for(int i=0; i<Q; i++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		cout << solve(a, b) << endl;
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:30: error: 'upper_bound' was not declared in this scope
   52 |                 tab[0][i]  = upper_bound(x, x+N, x[i]+L) - x - 1;
      |                              ^~~~~~~~~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
const int maxn = 1e5 + 10;
int s[maxn], n, L, Q;
int cnt[maxn], c[maxn];

int main(){
	s[0]=0;
	while(~scanf("%d", &n)){
		for(int i=1; i<=n; i++) scanf("%d", &s[i]);
		scanf("%d", &L);
		
		for(int i=1; i<n; i++){
			int tmp=cnt[i-1];
			while(s[tmp]-s[i]<=L && tmp <=n) tmp++;
			cnt[i]=tmp-1;
		}
		int day=1,st=n;
		while(day<=1000&&st>0){
			int ss=st+1;
			while(s[ss]-s[st-1]<=L&&st>=1) {
				c[st]=n;
				st--;
			}
			day++;			
		}
		while(st>0){
			c[st]=c[cnt[st]];
			int v=c[st];
			while(s[c[st]]-s[v]<=L)	v--;
			c[st]=v+1;	st--;
		}
		scanf("%d", &Q);
		while(Q--){
			int a, b, ans=0;
			scanf("%d%d", &a, &b);
			if(a>b) swap(a,b);
			int tmp=a, sum=0;
			while(c[a]<b){
				a=c[a];
				ans+=1000;
			}
			while(a<b){
				a=cnt[a];
				ans++;
			}
			printf("%d\n", ans);
		}
	}
	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:55:18: error: expected '}' at end of input
   55 |         return 0;
      |                  ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C++

#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef pair<int,int> P;
typedef long long int lnt;
const lnt INF 0xffffffffffffff;
lnt n,x[100000],l,q,a[100000],b[100000];
lnt lca[20][100000];
lnt aaa,bbb;
int main()
{
	cin>>n;
	for(lnt i=0;i<n;i++){
		cin>>x[i];
	}
	cin>>l>>q;
	for(lnt i=0;i<q;i++){
		cin>>aaa>>bbb;
		a[i]=min(aaa-1,bbb-1);
		b[i]=max(aaa-1,bbb-1);
	}
	for(lnt i=0;i<20;i++){
		for(lnt j=0;j<100000;j++) lca[i][j]=INF;
	}
	for(lnt i=0;i<n-1;i++){
		if(x[i]+l>=x[n-1]){
			lca[0][i]=n-1;
			continue;
		}
		lca[0][i]=upper_bound(x,x+n,x[i]+l)-x-1;
	}
	lnt now,ans=0;
	for(lnt i=0;i<q;i++){
		ans=0;
		now=a[i];
		while(now<b[i]){
			now=lca[0][now];
			ans++;
		}
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc:14:15: error: expected initializer before numeric constant
   14 | const lnt INF 0xffffffffffffff;
      |               ^~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:31:53: error: 'INF' was not declared in this scope
   31 |                 for(lnt j=0;j<100000;j++) lca[i][j]=INF;
      |                                                     ^~~
Language: C++

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
  int n,l,q;
  std::cin >> n;
  vi x(n);
  rep(i,n) std::cin >> x[i];
  std::cin >> l >> q;
  long long a,q,ans,w,s,t;
  rep(i,q){
    ans=w=0;
    std::cin >> a >> q;
    loop(j,a-1,q){
      w+=x[j+1]-x[j];
      if(w>l){
        w=x[j+1]-x[j];
        ans++;
      }
    }
    std::cout << ans << std::endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: conflicting declaration 'long long int q'
   34 |   long long a,q,ans,w,s,t;
      |               ^
a.cc:29:11: note: previous declaration as 'int q'
   29 |   int n,l,q;
      |           ^
Language: C++

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(ull i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

#define clr(a,i) memset((a), (i) ,sizeof(a))

int main(){
  int n,l,q;
  std::cin >> n;
  vi x(n);
  rep(i,n) std::cin >> x[i];
  std::cin >> l >> q;
  long long a,q,ans,w-0,s,t;
  rep(i,q){
    ans=w=0;
    std::cin >> a >> q;
    loop(j,a-1,q){
      w+=x[j+1]-x[j];
      if(w>l){
        w=x[j+1]-x[j];
        ans++;
      }
    }
    std::cout << ans << std::endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: conflicting declaration 'long long int q'
   34 |   long long a,q,ans,w-0,s,t;
      |               ^
a.cc:29:11: note: previous declaration as 'int q'
   29 |   int n,l,q;
      |           ^
a.cc:34:22: error: expected initializer before '-' token
   34 |   long long a,q,ans,w-0,s,t;
      |                      ^
a.cc:36:9: error: 'w' was not declared in this scope
   36 |     ans=w=0;
      |         ^
Language: C++

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

int _tmain(int argc, _TCHAR* argv[])
{
	int N, Q, L;
	vector<int> loc(1);
	cin >> N;
	int t;
	for (int i = 0; i < N; ++i){
		cin >> t;
		loc.push_back(t);
	}
	cin >> L >> Q;
	vector<vector<pair<int, int>>> days(N + 1, vector<pair<int, int>>(N + 1, { 0, 0 }));
	for (int i = 1; i <= N; ++i){
		for (int j = i; j <= N; ++j){
			int dist = loc[j] - loc[j - 1];
			if (days[i][j - 1].second>=dist){
				days[i][j] = { days[i][j - 1].first, days[i][j - 1].second - dist };
			}
			else{
				days[i][j] = { days[i][j - 1].first + 1, L - dist };
			}
		}
	}
	vector<int> a(Q), b(Q);
	for (int i = 0; i < Q; ++i){
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < Q; ++i){
		if (a[i] <= b[i]){
			cout << days[a[i]][b[i]].first << endl;
		}
		else{
			cout << days[b[i]][a[i]].first << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:5:22: error: '_TCHAR' has not been declared
    5 | int _tmain(int argc, _TCHAR* argv[])
      |                      ^~~~~~
Language: C++

場合分けはできた
文字列アルゴリズムに思考が行かなかったのはまずい
それはそうと思いついたかはわからない

Compiler output:
a.cc:1:1: error: '\U00005834\U00005408\U00005206\U00003051\U0000306f\U00003067\U0000304d\U0000305f' does not name a type
    1 | 場合分けはできた
      | ^~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#define maxn 500005
using namespace std;
bool same(string s) {
	char base = s[0];
	for (char c : s)
		if (c != base)
			return false;
	return true;
}
int f[2][maxn];
bool good[2][maxn];
void kmp(string s, int* f, bool* good) {
	f[0] = -1;
	for (int i = 1, j = -1; i < (int)s.size(); i++) {
		while (j != -1 && s[i] != s[j + 1])	j = f[j];
		if (s[i] == s[j + 1])	j++;
		f[i] = j;
	}
	good[0] = true;
	for (int i = 1; i < (int)s.size(); i++)
		if (f[i] == -1 || (i + 1) % (i - f[i]) != 0)
			good[i] = true;
}
int main() {
	string s; cin >> s;
	if (same(s)) {
		cout << (int)s.size() << endl << 1 << endl;
	}
	else {
		kmp(s, f[0], good[0]);
		if (good[0][(int)s.size() - 1]) {
			cout << 1 << endl << 1 << endl;
		}
		else {
			reverse(s.begin(), s.end());
			kmp(s, f[1], good[1]);
			int ans = 0;
			for (int i = 0; i < (int)s.size() - 1; i++)
				if (good[0][i] && good[1][(int)s.size() - 1 - (i + 1)])
					ans++;
			cout << 2 << endl << ans << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:25: error: 'reverse' was not declared in this scope
   36 |                         reverse(s.begin(), s.end());
      |                         ^~~~~~~
Language: C++

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

constexpr int mod = 1000000007;

bool isprime(int n) {
        for (int i = 2; i * i <= n; i++) {
                if (n % i == 0) return (false);
        }
        return (true);
}

int main()
{
        string W;

        cin >> W;
        int n = W.size();
        vector < int > vec;

        for (int i = 1; i * i <= n; i++) {
                if (n % i == 0) {
                        if (isprime(i)) vec.push_back(i);
                        if (n / i != i && i != 1 && isprime(n / i)) vec.push_back(n / i);
                }
        }

        for (auto &value : vec) {
                if (W.substr(0, n - value) == W.substr(value, n - value)) {
                        if (value == 1) {
                                cout << n << endl << 1 << endl;
                                return (0);
                        }
                        flag = true;
                        if (value % 2 == 0 && value == n / 2) cout << n - 1 << endl;
                        else cout << n - 1 - (n / value - 1) << endl;
                        return (0);
                }
        }

        cout << 1 << endl << 1 << endl;
        return ( 0 );
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:25: error: 'flag' was not declared in this scope
   34 |                         flag = true;
      |                         ^~~~
Language: C++

#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int, int >
#define F first
#define S second
#define int  long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
using namespace std;
/// khodaya komak kon

/// ba z_func hatman dafe baad bezan
const int MAX_N = 5e5 + 5;
char a[MAX_N];
int N, pre[MAX_N], nxt[MAX_N];
bool check(int pos) {
	bool f1 = (!pre[pos]) || (pos % (pos - pre[pos]));
	bool f2 = (nxt[pos + 1] == N + 1) || (N - pos) % (N - pos - (N - nxt[pos + 1] + 1));
	if (f1 && f2) return 1;
	else return 0;
}
int main () {
	scanf("%s", a + 1);
	N = strlen(a + 1);
	pre[1] = 0;
	for (int i = 2, j = 0; i <= N; i++) {
		while (j && a[j + 1] != a[i]) j = pre[j];
		if (a[j + 1] == a[i]) ++j;
		pre[i] = j;
	}
	nxt[N] = N + 1;
	for (int i = N - 1, j = N + 1; i; i--) {
		while (j <= N && a[j - 1] != a[i]) j = nxt[j];
		if (a[j - 1] == a[i]) --j;
		nxt[i] = j;
	}
	if (!pre[N] || N % (N - pre[N])) return puts("1\n1") & 0;
	if (pre[N] == N - 1) return printf("%d\n1\n", N) & 0;
	int ans = 0;
	for (int i = 1; i < N; i++) ans += check(i);
	printf("2\n%d\n", ans);
    return 0;
}


Compiler output:
a.cc:8:24: error: '::main' must return 'int'
    8 | #define int  long long int
      |                        ^~~
a.cc:25:1: note: in expansion of macro 'int'
   25 | int main () {
      | ^~~
Language: C++

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

struct RollingHash {
    using ull = unsigned long long;
    string S_;
    vector<ull> hash, power;
    RollingHash(){}
    RollingHash(const string &S, const ull base = 1000000007LL) : S_(S) {
        int n = (int)S.size();
        hash.assign(n+1, 0);
        power.assign(n+1, 0);
        for (int i = 0; i < n; ++i) {
            hash[i+1] = hash[i] * base + S[i];
            power[i+1] = power[i] * base;
        }
    }
    // get hash of S[left:right]
    ull get(int left, int right) const {
        return hash[right] - hash[left] * power[right-left];
    }
    // get lcp of S[a:] and S[b:]
    int getLCP(int a, int b) const {
        int len = min((int)S_.size() - a, (int)S_.size() - b);
        int low = -1, high = len + 1;
        while (high - low > 1) {
            int mid = (low + high) / 2;
            if (get(a, a+mid) == get(b, b+mid)) low = mid;
            else high = mid;
        }
        return low;
    }
    // get lcp of S[a:] and T[b:]
    int getLCP(const RollingHash &t, int a, int b) const {
        int len = min((int)S_.size()-a, (int)t.S_.size()-b);
        int low = -1, high = len + 1;
        while (high - low > 1) {
            int mid = (low + high) / 2;
            if (get(a, a+mid) == t.get(b, b+mid)) low = mid;
            else high = mid;
        }
        return low;
    }
};


vector<long long> divisor(long long n) {
    vector<long long> res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n%i == 0LL) {
            res.push_back(i);
            long long temp = n/i;
            if (i != temp) res.push_back(temp);
        }
    }
    sort(res.begin(), res.end());
    return res;
}
    
int main() {
    string str; cin >> str;
    int n = (int)str.size();
    vector<long long> divs = divisor(n);
    long long syuuki = n;
    for (auto d : divs) {
        bool ok = true;
        for (int j = 0; j + d < n; ++j) {
            if (str[j] != str[j+d]) ok = false;
        }
        if (ok) syuuki = min(syuuki, d);
    }
    if (syuuki == n) cout << 1 << endl << 1 << endl;
    else if (syuuki == 1) cout << n << endl << 1 << endl;
    else {
        vector<int> cannot_cut(n*2, 0);

        RollingHash rh(str);
        for (int d = 1; d < n; ++d) {
            for (int dd = d; dd < n; dd += d) {
                int lcp = rh.getLCP(0, dd);
                if (lcp < d) break;
                cannot_cut[dd + d] = true;
            }
            for (int dd = n-d*2; dd >= 0; dd -= d) {
                int lcp = rh.getLCP(dd, n-d);
                if (lcp < d) break;
                cannot_cut[dd] = true;
            }
        }
        int con = 0;
        for (int i = 1; i < n; ++i) if (!cannot_cut[i]) ++con;
        cout << 2 << endl << con << endl;
    }
}


Compiler output:
a.cc: In function 'std::vector<long long int> divisor(long long int)':
a.cc:58:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   58 |     sort(res.begin(), res.end());
      |     ^~~~
      |     short
Language: C++

#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cassert>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
#include<functional>
using namespace std;
int fail[500005];
string s;
int gnext(string s,char c,int j)
{
	if(j==-1||s[j]==c)
		return j+1;
	else
		return gnext(s,c,fail[j]);
}
void gfail(string s)
{
	fail[0]=-1;
	int j=0;
	for(int i=1;i<s.size();i++)
	{
		fail[i]=j;
		j=gnext(s,s[i],j);
	}
}
int main()
{
	cin>>s;
	gfail(s);
	int n=s.size();
	int k=n-1-fail[n-1];
	if(n%k!=0)
		cout<<1<<endl<<1;
	else if(k!=1)
	{
		cout<<2<<endl;
		if(n/k!=2)
			cout<<n-1-(n/k)+1;
		else
			cout<<n-1;
	} 
	else
		cout<<n<<endel<<1;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:59:26: error: 'endel' was not declared in this scope
   59 |                 cout<<n<<endel<<1;
      |                          ^~~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
using namespace std;
#define N 500050
char w[N];
int nxt[N],n,txn[N];
bool check1(int x) {
	if(x<2) return 1;
	int t=x-nxt[x];
	return t==x||x%t>0;
}
bool check2(int x) {
	if(x>n-1) return 1;
	int t=(n-x+1)-(n-txn[x]+1);
	return t==(n-x+1)||(n-x+1)%t>0;
}
int main() {
	fread(w+1,500005,stdin);
	n=strlen(w+1)-1;
	if(n==1) {puts("1\n1\n"); return 0;}
	if(n==2) {
		if(w[1]==w[2]) puts("2\n1\n");
		else puts("1\n1\n");
		return 0;
	}
	int i;
	int flg=0;
	for(i=2;i<=n;i++) if(w[i]!=w[i-1]) {flg=1;break;}
	if(!flg) {printf("%d\n1\n",n); return 0;}
	nxt[1]=0;
	int j=0;
	for(i=2;i<=n;i++) {
		for(;j&&w[i]!=w[j+1];j=nxt[j]) ;
		if(w[i]==w[j+1]) j++;
		nxt[i]=j;
	}
	int t=n-nxt[n];
	if(t==n||n%t) {
		printf("1\n1\n"); return 0;
	}
	printf("%d\n",2);
	txn[n]=n+1;
	j=n+1;
	for(i=n-1;i;i--) {
		for(;j<=n&&w[i]!=w[j-1];j=txn[j]) ;
		if(w[i]==w[j-1]) j--;
		txn[i]=j;
	}
	int ans=0;
	for(i=1;i<n;i++) {
		if(check1(i)&&check2(i+1)) ans++;
	}
	printf("%d\n",ans);
}


Compiler output:
In file included from /usr/include/c++/14/cstdio:42,
                 from a.cc:1:
a.cc: In function 'int main()':
a.cc:20:26: error: invalid conversion from 'FILE*' to 'size_t' {aka 'long unsigned int'} [-fpermissive]
   20 |         fread(w+1,500005,stdin);
      |                          ^~~~~
      |                          |
      |                          FILE*
a.cc:20:14: error: too few arguments to function 'size_t fread(void*, size_t, size_t, FILE*)'
   20 |         fread(w+1,500005,stdin);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/stdio.h:728:15: note: declared here
  728 | extern size_t fread (void *__restrict __ptr, size_t __size,
      |               ^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

#define rep(i, l, r) for (int i = l; i <= r; i ++)
#define dwn(i, r, l) for (int i = r; i >= l; i --)
#define repG(u, i) for (int i = hd[u]; i; i = e[i].nxt)
#define ev e[i].v
#define ec e[i].c
#define sqr(x) (x)*(x)
#define rlxX(x, y) x = max(x, y)
#define rlxN(x, y) x = min(x, y)
#define clr(a, b) memset(a, b, sizeof(a))
#define gc getchar()

typedef long long LL;
typedef double db;
const int N = 1e5 + 5, INF = 1e9 + 7;

int rd() {
	char ch = gc; int ret = 0;
	while (ch < '0' || ch > '9') ch = gc;
	while (ch >= '0' && ch <= '9') ret = ret*10 + ch-'0', ch = gc;
	return ret;
}

int n, n0[N], n1[N];
char str0[N], str1[N];

void getnext(char str[], int next[]) {
	//cout << str+1 << endl;
	int j = 0; next[1] = 0;
	rep(i, 2, n) {
		while (j && str[j+1] != str[i]) j = next[j];
		if (str[j+1] == str[i]) j ++;
		next[i] = j;
	}
	//cout << n << endl;
	//rep(i, 1, n) printf("%d ", next[i]); puts("");
}

bool can(int x, int y) {return x==y || x%y;}

int main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	scanf("%s", str0+1);
	n = strlen(str0+1);
	getnext(str0, n0);
	//cout << n0[n] << endl;

	if (can(n, n-n0[n])) {puts("1\n1"); return 0;}
	if (n-n0[n] == 1) {printf("%d\n1\n", n); return 0;}
	strcpy(str1+1, str0+1);
	//cout << str1+1 << endl;
	strrev(str1+1);
	getnext(str1, n1);
	int ans = 0;
	rep(i, 1, n-1) 
		if (can(i, i-n0[i]) && can(n-i, n-i-n1[n-i])) ans ++;
	printf("%d\n%d\n", 2, ans);
	
	return 0;
}
/*

*/



Compiler output:
a.cc: In function 'int main()':
a.cc:67:9: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
   67 |         strrev(str1+1);
      |         ^~~~~~
      |         strsep
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

#define rep(i, l, r) for (int i = l; i <= r; i ++)
#define dwn(i, r, l) for (int i = r; i >= l; i --)
#define repG(u, i) for (int i = hd[u]; i; i = e[i].nxt)
#define ev e[i].v
#define ec e[i].c
#define sqr(x) (x)*(x)
#define rlxX(x, y) x = max(x, y)
#define rlxN(x, y) x = min(x, y)
#define clr(a, b) memset(a, b, sizeof(a))
#define gc getchar()

typedef long long LL;
typedef double db;
const int N = 1e5 + 5, INF = 1e9 + 7;

int rd() {
	char ch = gc; int ret = 0;
	while (ch < '0' || ch > '9') ch = gc;
	while (ch >= '0' && ch <= '9') ret = ret*10 + ch-'0', ch = gc;
	return ret;
}

int n, n0[N], n1[N];
char str0[N], str1[N];

void getnext(char str[], int next[]) {
	//cout << str+1 << endl;
	int j = 0; next[1] = 0;
	rep(i, 2, n) {
		while (j && str[j+1] != str[i]) j = next[j];
		if (str[j+1] == str[i]) j ++;
		next[i] = j;
	}
	//cout << n << endl;
	//rep(i, 1, n) printf("%d ", next[i]); puts("");
}

bool can(int x, int y) {return x==y || x%y;}

int main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	scanf("%s", str0+1);
	n = strlen(str0+1);
	getnext(str0, n0);
	//cout << n0[n] << endl;

	if (can(n, n-n0[n])) {puts("1\n1"); return 0;}
	if (n-n0[n] == 1) {printf("%d\n1\n", n); return 0;}
	strcpy(str1+1, str0+1);
	//cout << str1+1 << endl;
	strrev(str1+1);
	getnext(str1, n1);
	int ans = 0;
	rep(i, 1, n-1) 
		if (can(i, i-n0[i]) && can(n-i, n-i-n1[n-i])) ans ++;
	printf("%d\n%d\n", 2, ans);
	
	return 0;
}
/*

*/



Compiler output:
a.cc: In function 'int main()':
a.cc:66:9: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
   66 |         strrev(str1+1);
      |         ^~~~~~
      |         strsep
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;

#define rep(i, l, r) for (int i = l; i <= r; i ++)
#define dwn(i, r, l) for (int i = r; i >= l; i --)
#define repG(u, i) for (int i = hd[u]; i; i = e[i].nxt)
#define ev e[i].v
#define ec e[i].c
#define sqr(x) (x)*(x)
#define rlxX(x, y) x = max(x, y)
#define rlxN(x, y) x = min(x, y)
#define clr(a, b) memset(a, b, sizeof(a))
#define gc getchar()

typedef long long LL;
typedef double db;
const int N = 1e5 + 5, INF = 1e9 + 7;

int rd() {
	char ch = gc; int ret = 0;
	while (ch < '0' || ch > '9') ch = gc;
	while (ch >= '0' && ch <= '9') ret = ret*10 + ch-'0', ch = gc;
	return ret;
}

int n, n0[N], n1[N];
char str0[N], str1[N];

void getnext(char str[], int next[]) {
	//cout << str+1 << endl;
	int j = 0; next[1] = 0;
	rep(i, 2, n) {
		while (j && str[j+1] != str[i]) j = next[j];
		if (str[j+1] == str[i]) j ++;
		next[i] = j;
	}
	//cout << n << endl;
	//rep(i, 1, n) printf("%d ", next[i]); puts("");
}

bool can(int x, int y) {return x==y || x%y;}

int main(){
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	scanf("%s", str0+1);
	n = strlen(str0+1);
	getnext(str0, n0);
	//cout << n0[n] << endl;

	if (can(n, n-n0[n])) {puts("1\n1"); return 0;}
	if (n-n0[n] == 1) {printf("%d\n1\n", n, 1); return 0;}
	strcpy(str1+1, str0+1);
	//cout << str1+1 << endl;
	strrev(str1+1);
	getnext(str1, n1);
	int ans = 0;
	rep(i, 1, n-1) 
		if (can(i, i-n0[i]) && can(n-i, n-i-n1[n-i])) ans ++;
	printf("%d\n%d\n", 2, ans);
	
	return 0;
}
/*

*/



Compiler output:
a.cc: In function 'int main()':
a.cc:66:9: error: 'strrev' was not declared in this scope; did you mean 'strsep'?
   66 |         strrev(str1+1);
      |         ^~~~~~
      |         strsep
Language: C++

#include<cstdio>
#include<vector>
#include<cstring>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;
const long long MAXN=500005,MOD=1e9+7,p=131;
long long hash[MAXN];
long long bitp[MAXN];
char s[MAXN];
long long l[MAXN],r[MAXN],len;
long long Hash(long long x,long long y)
{
	return ((hash[y]-hash[x-1]*bitp[y-x+1])%MOD+MOD)%MOD;
}
bool check()
{
	for(long long i=2;i<=len;i++)
		if(s[i]!=s[i-1])
			return 0;
	return 1;
}
int main()
{
	scanf("%s",s+1);
	len=strlen(s+1);
	if(check())
	{
		printf("%lld\n1\n",len);
		return 0;
	}
	bitp[0]=1;
	for(long long i=1;i<=len;i++)
	{
		hash[i]=(hash[i-1]*p+s[i])%MOD;
		bitp[i]=(bitp[i-1]*p)%MOD;
	}
	for(long long d=1;d<=len;d++)
		for(long long i=2*d;i<=len;i+=d)
			if(Hash(1,i-d)==Hash(d+1,i))
				l[i]=1;
	for(long long d=1;d<=len;d++)
		for(long long i=len-2*d+1;i>=1;i-=d)
			if(Hash(i+d,len)==Hash(i,len-d))
				r[i]=1;
	long long ans=0;
	for(long long i=1;i<=len;i++)
	{
		if(!l[i]&&!r[i+1])
			ans++;
	}
	if(!l[len])
		printf("1\n1\n");
	else
		printf("2\n%lld\n",ans);
}

Compiler output:
a.cc: In function 'long long int Hash(long long int, long long int)':
a.cc:15:18: error: reference to 'hash' is ambiguous
   15 |         return ((hash[y]-hash[x-1]*bitp[y-x+1])%MOD+MOD)%MOD;
      |                  ^~~~
In file included from /usr/include/c++/14/bits/stl_bvector.h:65,
                 from /usr/include/c++/14/vector:67,
                 from a.cc:2:
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:11: note:                 'long long int hash [500005]'
    9 | long long hash[MAXN];
      |           ^~~~
a.cc:15:26: error: reference to 'hash' is ambiguous
   15 |         return ((hash[y]-hash[x-1]*bitp[y-x+1])%MOD+MOD)%MOD;
      |                          ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:11: note:                 'long long int hash [500005]'
    9 | long long hash[MAXN];
      |           ^~~~
a.cc: In function 'int main()':
a.cc:36:17: error: reference to 'hash' is ambiguous
   36 |                 hash[i]=(hash[i-1]*p+s[i])%MOD;
      |                 ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:11: note:                 'long long int hash [500005]'
    9 | long long hash[MAXN];
      |           ^~~~
a.cc:36:26: error: reference to 'hash' is ambiguous
   36 |                 hash[i]=(hash[i-1]*p+s[i])%MOD;
      |                          ^~~~
/usr/include/c++/14/bits/functional_hash.h:59:12: note: candidates are: 'template<class _Tp> struct std::hash'
   59 |     struct hash;
      |            ^~~~
a.cc:9:11: note:                 'long long int hash [500005]'
    9 | long long hash[MAXN];
      |           ^~~~
Language: C++

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

struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;


struct RollingHash{
  typedef unsigned long long ull;
  string S;
  ull B;
  Int len;
  vector<ull> hash,p;
  RollingHash(){}
  RollingHash(string S_,ull B_=1000000007LL):
    S(S_),B(B_),len(S.length()),hash(len+1),p(len+1){
    hash[0]=0;p[0]=1;
    for(Int i=0;i<len;i++){
      hash[i+1]=hash[i]*B+S[i];
      p[i+1]=p[i]*B;
    }
  }
  //S[l,r)
  ull find(Int l,Int r){
    return hash[r]-hash[l]*p[r-l];
  }
};
//INSERT ABOVE HERE
signed main(){
  string s;
  cin>>s;
  Int n=s.size();
  {
    string t(s);
    t.erase(unique(t.begin(),t.end()),t.end());
    if(t.size()==1u){
      cout<<n<<endl<<1<<endl;
      return 0;
    }
  }

  vector<vector<Int> > v(n+1);
  for(Int i=1;i<=n;i++)
    for(Int j=i+i;j<=n;j+=i)
      v[j].emplace_back(i);

  RollingHash  rh1(s);
  RollingHash2 rh2(s);
  auto check=[&](Int l,Int r)->Int{
    for(Int x:v[r-l])
      if(rh1.find(l,r-x)==rh1.find(l+x,r)) return 0;
    return 1;
  };
  
  if(check(0,n)){
    cout<<1<<endl<<1<<endl;
    return 0;
  }

  //assert(0);
  assert(check(0,n-1));
  cout<<2<<endl;
  
  Int ans=0;
  for(Int i=1;i<n;i++)
    ans+=check(0,i)&&check(i,n);
  
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:3: error: 'RollingHash2' was not declared in this scope; did you mean 'RollingHash'?
   53 |   RollingHash2 rh2(s);
      |   ^~~~~~~~~~~~
      |   RollingHash
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

vector<ll> z_algorithm(string S){
  const ll n=S.length();
  vector<ll> A(n);
  A[0] = n;
  int i = 1, j = 0;
  while (i < n) {
    while (i+j < n && S[j] == S[i+j]) ++j;
    A[i] = j;
    if (j == 0) { ++i; continue;}
    ll k = 1;
    while (i+k < n && k+A[k] < j) A[i+k] = A[k], ++k;
    i += k; j -= k;
  }
  return A;
}

string s;
bool g[501010];

int main(){
	cin>>s;
  ll n=s.size();
  {
    bool same=true;
    rep(i,n-1)if(s[i]!=s[i+1])same=false;
    if(same){
      cout<<n<<endl;
      cout<<1<<endl;
      return 0;
    }
  }
  vector<ll> ds;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ds.push_back(i);
      if(n/i!=i)ds.push_back(n/i);
    }
  }
  sort(all(ds));
  ll minc=-1;
  for(ll len : ds){
    set<string> st;
    for(ll i=0;i<=n-len;i+=len){
      st.insert(s.substr(i,len));
    }
    if(st.size()==1){
      minc=len;
      break;
    }
  }
  if(minc==n){
    cout<<1<<endl;
    cout<<1<<endl;
    return 0;
  }
  cout<<2<<endl;
  vector<ll> z=z_algorithm(s);
  repl(i,1,n+1)g[i]=true;
  repl(i,1,n){
    for(ll k=2;(k-1)*i<=z[i];k++)g[i*k]=false;
  }
  repl(i,1,n+1)if(!g[i])res++;
  cout<<res<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:85:25: error: 'res' was not declared in this scope; did you mean 'rep'?
   85 |   repl(i,1,n+1)if(!g[i])res++;
      |                         ^~~
      |                         rep
a.cc:86:9: error: 'res' was not declared in this scope; did you mean 'rep'?
   86 |   cout<<res<<endl;
      |         ^~~
      |         rep
Language: C++

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 500010
int c[2][N];
int n;
string s;

void ZAlgo(string &s, vector<int> &z){
	int n = s.size();
	z = vector<int>(n);
	z[0] = n;
	int i = 1, j = 0;
	while(i < n){
		while(i+j < n && s[j]==s[i+j]) j++;
		z[i] = j;
		if(j==0){
			i++;
			continue;
		}
		int k = 1;
		while(i+k < n && k+a[k]<j) z[i+k] = z[k], k++;
		i += k;
		j -= k;
	}
}

int main(){
	cin>>s;
	n = s.size();
	rep(k, 2){
		vector<int> z;
		ZAlgo(s, z);
		for(int i = 1; i <= n/2; i++){
			if(c[i]) continue;
			for(int j = 2*i; j <= n; j+=i){
				if(z[j-i]>=i) c[k][j] = 1;
				else break;
			}
		}
		reverse(all(s));
	}

	reverse(c[1], c[1]+n+1);

	if(!c[n]){
		cout<<1<<endl;
		cout<<1<<endl;
	} else if(s==string(n, s[0])){
		cout<<n<<endl;
		cout<<1<<endl;
	} else {
		cout<<2<<endl;
		int sum = 0;
		for(int i = 0; i <= n; i++) if(!c[i]&&!c2[i]) sum++;
		cout<<sum<<endl;
		//for(int i = 0; i <= n; i++) cout<<c[i]<<" "<<c2[i]<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'void ZAlgo(std::string&, std::vector<int>&)':
a.cc:59:36: error: 'a' was not declared in this scope
   59 |                 while(i+k < n && k+a[k]<j) z[i+k] = z[k], k++;
      |                                    ^
a.cc: In function 'int main()':
a.cc:92:56: error: 'c2' was not declared in this scope; did you mean 'c'?
   92 |                 for(int i = 0; i <= n; i++) if(!c[i]&&!c2[i]) sum++;
      |                                                        ^~
      |                                                        c