stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

using namespace std;

long long int A[100005];

int main()

{

	long long int n, k, q, m;

	while(cin >> n >> k >> q)

	{

		memset(A, 0, sizeof(A));

		for(long long int i = 1; i <= n; i++) A[i] = k - q;

		for(long long int i = 1; i <= q; i++)

		{

			scanf("%lld", &m);

			A[m]++;

		}

		for(long long int i = 1; i <= n; i++)

			if(A[i] <= 0) cout << "No" << endl;

			else cout << "Yes" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8188822838978569x):
/******************************************

* AUTHOR : RAJAGOPALAN *

* NICK : ARNO *

* INSTITUTION : VIT *

******************************************/

#include <bits/stdc++.h>

#include <ext/pb_ds/detail/standard_policies.hpp>

#define ll long long

#define ull unsigned long long

#define pb push_back

#define mp make_pair

#define all(x) (x).begin(),(x).end()

#define alli(a, n, k) (a+k),(a+n+k)

#define FP(i, a, b, k) for(__typeof(a) i = a;i < b;i += k)

#define FS(i, a, b, k) for(__typeof(a) i = a;i > b;i -= k)

#define IT(it, a) for(__typeof(a.begin()) it = a.begin();it != a.end(); ++it)

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define eps 1e-6

#define pi 3.141592653589793

using namespace std;

using namespace __gnu_pbds;



template<class T> inline T gcd(T x, T y) { if (!y) return x; return gcd(y, x%y);}

typedef vector<int> VII;

typedef vector<ll> VLL;

typedef pair<int, int> PII;

typedef vector< pair<int, int> > VPII;

typedef vector< pair<int, PII > > VPPI;

const int MOD = 1e9 + 7;

const int INF = 1e9;



inline ll modulo(ll a, ll m)

{

    return (a % m + m) % m;

}



inline ll modInverse(ll a, ll m)

{

    assert(__gcd(a, m) == 1);

    ll m0 = m;

    ll y = 0, x = 1;



    if (m == 1)

        return 0;



    while (a > 1)

    {

        ll q = a / m;

        ll t = m;



        m = a % m, a = t;

        t = y;



        y = x - q * y;

        x = t;

    }



    if (x < 0)

        x += m0;



    return x;

}



inline ll modPow(ll x, ll y, ll m)

{ //x^y % m

    if (y == 0)

        return 1LL;

    else if (y == 1)

        return x;

    else

    {

        ll ans = modPow(x, y / 2, m) % m;

        if (y & 1)

        {

            return (((ans * ans) % m) * x) % m;

        }

        else

        {

            return (ans * ans) % m;

        }

    }

}



int main(int argc, char* argv[])

{

    ios::sync_with_stdio(false);

    cin.tie(NULL);

    int n,k,q;

    cin>>n>>k>>q;

    VII s(n+1,k);

    for(int i=0;i<q;++i)

    {

        int x;

        cin>>x;

        s[x]++;

    }

    for(int i=1;i<=n;++i)

    {

        if(s[i]-q>0)

        cout<<"Yes\n";



        else cout<<"No\n";

    }





    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int n,k,q,a[100010]={0};

    cin>>n>>k>>q;

    for(int i=1;i<=q;i++)

    {

        int x;

        cin>>x;

        a[x]++;

    }

    for(int i=1;i<=n;i++)

        if(k-(q-a[i])<=0)

            cout<<"No"<<endl;

        else

            cout<<"Yes"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.3818655928387753x):
#include <bits/stdc++.h>

using namespace std;



int main(){

    int i,j,x,t,n,k,q,a[100000];

    cin>>n>>k>>q;

    for(i=0;i<n;i++){

        a[i]=k-q;

    }

    for(i=0;i<q;i++){

        cin>>x;

        a[x-1]++;

    }

    for(i=0;i<n;i++){

        if(a[i]>0){cout<<"Yes"<<endl;}

        else{cout<<"No"<<endl;}

    }

    return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<math.h>

#include<algorithm>

using namespace std;

int main()

{

int N;

long long K,Q;

long long a[500005]={0};

cin>>N;

cin>>K;

cin>>Q;

for(int i=1;i<=N;i++)

{a[i]+=K; a[i]-=Q; }

for(int i=1;i<=Q;i++)

{

    int op;

    cin>>op;

    a[op]++;

}

for(int j=1;j<=N;j++)

{

    if(a[j]>0)

        printf("Yes\n");

    else

        printf("No\n");

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.054443483626566x):
#include <bits/stdc++.h>

using namespace std;



int main(){

    int i,j,x,t,n,k,q,a[100000];

    cin>>n>>k>>q;

    for(i=0;i<n;i++){

        a[i]=k-q;

    }

    for(i=0;i<q;i++){

        cin>>x;

        a[x-1]++;

    }

    for(i=0;i<n;i++){

        if(a[i]>0){cout<<"Yes"<<endl;}

        else{cout<<"No"<<endl;}

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

using namespace std;

long long int A[100005];

int main()

{

	long long int n, k, q, m;

	while(cin >> n >> k >> q)

	{

		memset(A, 0, sizeof(A));

		for(long long int i = 1; i <= n; i++) A[i] = k - q;

		for(long long int i = 1; i <= q; i++)

		{

			scanf("%lld", &m);

			A[m]++;

		}

		for(long long int i = 1; i <= n; i++)

			if(A[i] <= 0) cout << "No" << endl;

			else cout << "Yes" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.828076869473287x):
#include <bits/stdc++.h>

using namespace std;



int main(){

    int i,j,x,t,n,k,q,a[100000];

    cin>>n>>k>>q;

    for(i=0;i<n;i++){

        a[i]=k-q;

    }

    for(i=0;i<q;i++){

        cin>>x;

        a[x-1]++;

    }

    for(i=0;i<n;i++){

        if(a[i]>0){cout<<"Yes"<<endl;}

        else{cout<<"No"<<endl;}

    }

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int n,k,q,a[100010]={0};

    cin>>n>>k>>q;

    for(int i=1;i<=q;i++)

    {

        int x;

        cin>>x;

        a[x]++;

    }

    for(int i=1;i<=n;i++)

        if(k-(q-a[i])<=0)

            cout<<"No"<<endl;

        else

            cout<<"Yes"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.4027711828971208x):
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define co cout

#define ci cin

#define sf1(n) scanf("%lld",&n);

#define sf2(n,m) scanf("%lld %lld",&n,&m);

#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);

#define en cout<<endl;

#define pb push_back

#define coy cout<< "YES"<<endl;

#define con cout<< "NO"<<endl;

#define For(a,b) for(ll a=0;a<b;a++)

#define br break;

#define i64 long long

i64 M=10000000;

//ll b[805],ans[805];

map< ll,pair<ll,ll> >mp;



int main()

{

    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;

    ci>>n>>m>>k;

    ll a[n];

    memset(a,0,sizeof(a));

    for(ll i=0;i<k;i++)

    {

        ci>>g;

        a[g-1]++;

    }

    if(k<m)

    {

        for(ll i=0;i<n;i++) co<<"Yes"<<endl;

    }

    else

    {

        mx=k-m;

        for(ll i=0;i<n;i++)

        {

            if(a[i]>mx) co<< "Yes"<<endl;

            else co<< "No"<<endl;

        }

    }

}
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<math.h>

#include<algorithm>

using namespace std;

int main()

{

int N;

long long K,Q;

long long a[500005]={0};

cin>>N;

cin>>K;

cin>>Q;

for(int i=1;i<=N;i++)

{a[i]+=K; a[i]-=Q; }

for(int i=1;i<=Q;i++)

{

    int op;

    cin>>op;

    a[op]++;

}

for(int j=1;j<=N;j++)

{

    if(a[j]>0)

        printf("Yes\n");

    else

        printf("No\n");

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.128492490294073x):
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define co cout

#define ci cin

#define sf1(n) scanf("%lld",&n);

#define sf2(n,m) scanf("%lld %lld",&n,&m);

#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);

#define en cout<<endl;

#define pb push_back

#define coy cout<< "YES"<<endl;

#define con cout<< "NO"<<endl;

#define For(a,b) for(ll a=0;a<b;a++)

#define br break;

#define i64 long long

i64 M=10000000;

//ll b[805],ans[805];

map< ll,pair<ll,ll> >mp;



int main()

{

    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;

    ci>>n>>m>>k;

    ll a[n];

    memset(a,0,sizeof(a));

    for(ll i=0;i<k;i++)

    {

        ci>>g;

        a[g-1]++;

    }

    if(k<m)

    {

        for(ll i=0;i<n;i++) co<<"Yes"<<endl;

    }

    else

    {

        mx=k-m;

        for(ll i=0;i<n;i++)

        {

            if(a[i]>mx) co<< "Yes"<<endl;

            else co<< "No"<<endl;

        }

    }

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

using namespace std;

long long int A[100005];

int main()

{

	long long int n, k, q, m;

	while(cin >> n >> k >> q)

	{

		memset(A, 0, sizeof(A));

		for(long long int i = 1; i <= n; i++) A[i] = k - q;

		for(long long int i = 1; i <= q; i++)

		{

			scanf("%lld", &m);

			A[m]++;

		}

		for(long long int i = 1; i <= n; i++)

			if(A[i] <= 0) cout << "No" << endl;

			else cout << "Yes" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.850708553815034x):
#include<bits/stdc++.h>

using namespace std;

#define ll long long int

#define co cout

#define ci cin

#define sf1(n) scanf("%lld",&n);

#define sf2(n,m) scanf("%lld %lld",&n,&m);

#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);

#define en cout<<endl;

#define pb push_back

#define coy cout<< "YES"<<endl;

#define con cout<< "NO"<<endl;

#define For(a,b) for(ll a=0;a<b;a++)

#define br break;

#define i64 long long

i64 M=10000000;

//ll b[805],ans[805];

map< ll,pair<ll,ll> >mp;



int main()

{

    ll t,n,g,k,m,mx=0,mn=1e9,res,c1,x,y,c2;

    ci>>n>>m>>k;

    ll a[n];

    memset(a,0,sizeof(a));

    for(ll i=0;i<k;i++)

    {

        ci>>g;

        a[g-1]++;

    }

    if(k<m)

    {

        for(ll i=0;i<n;i++) co<<"Yes"<<endl;

    }

    else

    {

        mx=k-m;

        for(ll i=0;i<n;i++)

        {

            if(a[i]>mx) co<< "Yes"<<endl;

            else co<< "No"<<endl;

        }

    }

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int n,k,q,a[100010]={0};

    cin>>n>>k>>q;

    for(int i=1;i<=q;i++)

    {

        int x;

        cin>>x;

        a[x]++;

    }

    for(int i=1;i<=n;i++)

        if(k-(q-a[i])<=0)

            cout<<"No"<<endl;

        else

            cout<<"Yes"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.4031426989299316x):
#include <iostream>



using namespace std;



int main()

{

    int n,k,q,r;

    cin>>n>>k>>q;

    int p=q;

    int a[n];

    for(int i=0; i<n; i++)

    a[i]=k;



        while(p--)

        {

            cin>>r;

            a[r-1]=a[r-1]+1;

        }

    for(int i=0; i<n; i++)

    {

        if(a[i]-q>0)

            cout<<"Yes"<<endl;

        else

            cout<<"No"<<endl;

    }



    return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<math.h>

#include<algorithm>

using namespace std;

int main()

{

int N;

long long K,Q;

long long a[500005]={0};

cin>>N;

cin>>K;

cin>>Q;

for(int i=1;i<=N;i++)

{a[i]+=K; a[i]-=Q; }

for(int i=1;i<=Q;i++)

{

    int op;

    cin>>op;

    a[op]++;

}

for(int j=1;j<=N;j++)

{

    if(a[j]>0)

        printf("Yes\n");

    else

        printf("No\n");

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.129850742593183x):
#include <iostream>



using namespace std;



int main()

{

    int n,k,q,r;

    cin>>n>>k>>q;

    int p=q;

    int a[n];

    for(int i=0; i<n; i++)

    a[i]=k;



        while(p--)

        {

            cin>>r;

            a[r-1]=a[r-1]+1;

        }

    for(int i=0; i<n; i++)

    {

        if(a[i]-q>0)

            cout<<"Yes"<<endl;

        else

            cout<<"No"<<endl;

    }



    return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

using namespace std;

long long int A[100005];

int main()

{

	long long int n, k, q, m;

	while(cin >> n >> k >> q)

	{

		memset(A, 0, sizeof(A));

		for(long long int i = 1; i <= n; i++) A[i] = k - q;

		for(long long int i = 1; i <= q; i++)

		{

			scanf("%lld", &m);

			A[m]++;

		}

		for(long long int i = 1; i <= n; i++)

			if(A[i] <= 0) cout << "No" << endl;

			else cout << "Yes" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.851198703533096x):
#include <iostream>



using namespace std;



int main()

{

    int n,k,q,r;

    cin>>n>>k>>q;

    int p=q;

    int a[n];

    for(int i=0; i<n; i++)

    a[i]=k;



        while(p--)

        {

            cin>>r;

            a[r-1]=a[r-1]+1;

        }

    for(int i=0; i<n; i++)

    {

        if(a[i]-q>0)

            cout<<"Yes"<<endl;

        else

            cout<<"No"<<endl;

    }



    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int n,k,q,a[100010]={0};

    cin>>n>>k>>q;

    for(int i=1;i<=q;i++)

    {

        int x;

        cin>>x;

        a[x]++;

    }

    for(int i=1;i<=n;i++)

        if(k-(q-a[i])<=0)

            cout<<"No"<<endl;

        else

            cout<<"Yes"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.3927155395412465x):
#include<iostream>

#include<stdio.h>

#include<algorithm>

#include<string>

#define ios ios::sync_with_stdio(false)

using namespace std;

typedef long long ll;

const int maxn=1e5+100;

int a[maxn];

int main()

{

	ios;

	int N,K,Q;

	cin>>N>>K>>Q;

	while(Q--){

		int t; cin>>t;

		if(t==1){

			a[2]--;

		}

		else if(t==N){

			a[1]--;

			a[N]++;

		}

		else {

			a[1]--; a[t]++;

			a[t+1]--;

		}

	}

	for(int i=1;i<=N;i++){

		a[i]+=a[i-1];

		if(a[i]+K<=0) puts("No");

		else puts("Yes");

	}

	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<math.h>

#include<algorithm>

using namespace std;

int main()

{

int N;

long long K,Q;

long long a[500005]={0};

cin>>N;

cin>>K;

cin>>Q;

for(int i=1;i<=N;i++)

{a[i]+=K; a[i]-=Q; }

for(int i=1;i<=Q;i++)

{

    int op;

    cin>>op;

    a[op]++;

}

for(int j=1;j<=N;j++)

{

    if(a[j]>0)

        printf("Yes\n");

    else

        printf("No\n");

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.09172933742607x):
#include<iostream>

#include<stdio.h>

#include<algorithm>

#include<string>

#define ios ios::sync_with_stdio(false)

using namespace std;

typedef long long ll;

const int maxn=1e5+100;

int a[maxn];

int main()

{

	ios;

	int N,K,Q;

	cin>>N>>K>>Q;

	while(Q--){

		int t; cin>>t;

		if(t==1){

			a[2]--;

		}

		else if(t==N){

			a[1]--;

			a[N]++;

		}

		else {

			a[1]--; a[t]++;

			a[t+1]--;

		}

	}

	for(int i=1;i<=N;i++){

		a[i]+=a[i-1];

		if(a[i]+K<=0) puts("No");

		else puts("Yes");

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

using namespace std;

long long int A[100005];

int main()

{

	long long int n, k, q, m;

	while(cin >> n >> k >> q)

	{

		memset(A, 0, sizeof(A));

		for(long long int i = 1; i <= n; i++) A[i] = k - q;

		for(long long int i = 1; i <= q; i++)

		{

			scanf("%lld", &m);

			A[m]++;

		}

		for(long long int i = 1; i <= n; i++)

			if(A[i] <= 0) cout << "No" << endl;

			else cout << "Yes" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8374419103312445x):
#include<iostream>

#include<stdio.h>

#include<algorithm>

#include<string>

#define ios ios::sync_with_stdio(false)

using namespace std;

typedef long long ll;

const int maxn=1e5+100;

int a[maxn];

int main()

{

	ios;

	int N,K,Q;

	cin>>N>>K>>Q;

	while(Q--){

		int t; cin>>t;

		if(t==1){

			a[2]--;

		}

		else if(t==N){

			a[1]--;

			a[N]++;

		}

		else {

			a[1]--; a[t]++;

			a[t+1]--;

		}

	}

	for(int i=1;i<=N;i++){

		a[i]+=a[i-1];

		if(a[i]+K<=0) puts("No");

		else puts("Yes");

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

    int n,k,q,a[100010]={0};

    cin>>n>>k>>q;

    for(int i=1;i<=q;i++)

    {

        int x;

        cin>>x;

        a[x]++;

    }

    for(int i=1;i<=n;i++)

        if(k-(q-a[i])<=0)

            cout<<"No"<<endl;

        else

            cout<<"Yes"<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.4091915072576333x):
#include<iostream>

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#include<algorithm>

#include<map>

using namespace std;

map<int,int>mp;

int main(){

	int N,K,Q;

	scanf("%d %d %d",&N,&K,&Q);

	mp.clear();

	int a=Q+1-K;

	while(Q){

		int x;

		scanf("%d",&x);

		mp[x]++;

		Q--;

	}

	for(int i=1;i<=N;i++){

		if(mp[i]>=a){

			printf("Yes");

		}

		else printf("No");

		if(i!=N) printf("\n");

	}

	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<math.h>

#include<algorithm>

using namespace std;

int main()

{

int N;

long long K,Q;

long long a[500005]={0};

cin>>N;

cin>>K;

cin>>Q;

for(int i=1;i<=N;i++)

{a[i]+=K; a[i]-=Q; }

for(int i=1;i<=Q;i++)

{

    int op;

    cin>>op;

    a[op]++;

}

for(int j=1;j<=N;j++)

{

    if(a[j]>0)

        printf("Yes\n");

    else

        printf("No\n");

}

return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.151965017866345x):
#include<iostream>

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#include<algorithm>

#include<map>

using namespace std;

map<int,int>mp;

int main(){

	int N,K,Q;

	scanf("%d %d %d",&N,&K,&Q);

	mp.clear();

	int a=Q+1-K;

	while(Q){

		int x;

		scanf("%d",&x);

		mp[x]++;

		Q--;

	}

	for(int i=1;i<=N;i++){

		if(mp[i]>=a){

			printf("Yes");

		}

		else printf("No");

		if(i!=N) printf("\n");

	}

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

using namespace std;

long long int A[100005];

int main()

{

	long long int n, k, q, m;

	while(cin >> n >> k >> q)

	{

		memset(A, 0, sizeof(A));

		for(long long int i = 1; i <= n; i++) A[i] = k - q;

		for(long long int i = 1; i <= q; i++)

		{

			scanf("%lld", &m);

			A[m]++;

		}

		for(long long int i = 1; i <= n; i++)

			if(A[i] <= 0) cout << "No" << endl;

			else cout << "Yes" << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8591790366401286x):
#include<iostream>

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#include<algorithm>

#include<map>

using namespace std;

map<int,int>mp;

int main(){

	int N,K,Q;

	scanf("%d %d %d",&N,&K,&Q);

	mp.clear();

	int a=Q+1-K;

	while(Q){

		int x;

		scanf("%d",&x);

		mp[x]++;

		Q--;

	}

	for(int i=1;i<=N;i++){

		if(mp[i]>=a){

			printf("Yes");

		}

		else printf("No");

		if(i!=N) printf("\n");

	}

	return 0;

}
// Slower C++ solution:
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>

#include <cstdio>

#include <cstring>

#include <ctime>

#include <string>

#include <vector>

#include <algorithm>

#include <cmath>

#include <sstream>

#include <utility>

using namespace std;

typedef long long ll;

typedef vector<int> vi;

typedef vector<vi> vvi;

typedef pair<int,int> pii;

#define all(c) (c).begin(), (c).end()

#define loop(i,a,b) for(ll i=a; i<ll(b); i++)

#define rep(i,b) loop(i,0,b)

#define each(e,c) for(auto&e:c)

#define pb push_back

#define eb emplace_back

#define mp make_pair

#define mt make_tuple

#define lb lower_bound

#define ub upper_bound

#ifdef DEBUG

#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)

struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};

#else

#define dump(...)

#endif

template<class T> ostream& operator<<(ostream& os, vector<T> const& v){

    rep(i,v.size()) os << v[i] << (i+1==v.size()?"":" ");

    return os;

}



int main(){

    string s;

    while(cin>>s){

    int n = s.size();

    vi l(n);

    l[0] = 1;

    rep(i,n-1){

        if(s[i+1]==s[i]) l[i+1]=l[i]+1;

        else l[i+1] = 1;

    }

    int ans = 0;

    dump(s);

    dump(l);

    loop(i,1,n-1){

        if(s[i]=='O' && s[i+1]!='O' && i+l[i]<n && i-l[i] >= 0 && l[i+l[i]]>=l[i] && l[i-l[i]]>=l[i] && s[i+l[i]]=='I' && s[i-l[i]]=='J'){

            ans = max(ans,l[i]);

        }

    }

    cout << ans << endl;

}

}

// Faster C++ solution for the same problem (measured speedup: 5.315773794161241x):
#include <cstring>

#include <cstdio>

#include <algorithm>

using namespace std;

#define loop(i,a,b) for(int i=a; i<int(b); i++)

#define rep(i,b) loop(i,0,b)



char s[1000100];

int l[1000100];

int main(){

    scanf("%s",s);

    int n = strlen(s);

    l[0] = 1;

    rep(i,n-1){

        if(s[i+1]==s[i]) l[i+1]=l[i]+1;

        else l[i+1] = 1;

    }

    int ans = 0;

    loop(i,1,n-1){

        if(s[i]=='O' && s[i+1]!='O' && i+l[i]<n && i-l[i] >= 0 && l[i+l[i]]>=l[i] && l[i-l[i]]>=l[i] && s[i+l[i]]=='I' && s[i-l[i]]=='J'){

            ans = max(ans,l[i]);

        }

    }

    printf("%d\n",ans);

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <string>

#include <algorithm>

using namespace std;

char x[1000005];

int a=0,b=0,c=0,d=0,e,f,i,j,k,maxi=0;

int main(){

	fill(x,x+1000005,'A');

	scanf("%s",x);

int leng=strlen(x);

while(1){

if(a==leng){break;}

if(x[a]!='J'){

a++;

}else{

  while(1){

    if(x[a]=='J'){

      b++;

      a++;

    }else{

       break;

}}

while(1){

if(x[a]=='O'){

c++;

a++;

}else{

break;

}}

while(1){

if(x[a]=='I'){

d++;

a++;

}else{

break;

}}

if(b>=c && c<=d){

maxi=max(maxi,c);

}

b=0;

c=0;

d=0;

}

}

printf("%d\n",maxi);scanf("%d",&a);

return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.326919747816476x):
#include <cstdio>

#include <algorithm>

#include <vector>

#include <cstring>

using namespace std;

char str[1000005];

int main()

{

  scanf("%s",&str);

  int leng=strlen(str);

  int ans=0,i=0;

 for(;;)

    {

      if(str[i]=='J')

	{

	  int a=0,b=0,c=0;

	  while(str[i]=='J' && i<leng)

	    {

	      i++; a++;

	    }

	  while(str[i]=='O' && i<leng)

	    {

	      i++;

	      b++;

	    }



	  while(str[i]=='I' && i<leng)

	    {

	      i++;

	      c++;

	    }

	  if(b<=a && b<=c)

	    {

	      ans=max(ans,b);

	    }

		if(i==leng) break;

	}else{

	    i++;

            if(i==leng) break;

	}



    }



  printf("%d\n",ans);

  return 0;

}
// Slower C++ solution:
#include <cstdio>

#include <cstring>

#include <string>

#include <algorithm>

using namespace std;

char x[1000005];

int a=0,b=0,c=0,d=0,e,f,i,j,k,maxi=0;

int main(){

	fill(x,x+1000005,'A');

	scanf("%s",x);

int leng=strlen(x);

while(1){

if(a==leng){break;}

if(x[a]!='J'){

a++;

}else{

  while(1){

    if(x[a]=='J'){

      b++;

      a++;

    }else{

       break;

}}

while(1){

if(x[a]=='O'){

c++;

a++;

}else{

break;

}}

while(1){

if(x[a]=='I'){

d++;

a++;

}else{

break;

}}

if(b>=c && c<=d){

maxi=max(maxi,c);

}

b=0;

c=0;

d=0;

}

}

printf("%d\n",maxi);scanf("%d",&a);

return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.2036191669650316x):
//Bokan ga bokka--nn!!

//Daily Lunch Special Tanoshii !!

#include <cstdio>

#include <cstring>

#include <cstdlib>

#include <cmath>

#include <string>

#include <algorithm>

#include <vector>

#include <queue>

#include <stack>

#include <functional>

#include <iostream>

#include <map>

#include <set>

using namespace std;

typedef pair<int,int> P;

typedef pair<int,P> P1;

typedef pair<P,P> P2;

typedef long long ll;

#define pu push

#define pb push_back

#define mp make_pair

#define eps 1e-7

#define INF 2000000000

#define s(x) scanf("%d",&x)

#define rep(i,x) for(int i=0;i<x;i++)

int main()

{

	string s;

	cin >> s;

	int id=0;

	int ret=0;

	while(id<s.size())

	{

		if(s[id]!='J')

		{

			id++;

			continue;

		}

		int j=0,o=0,i=0;

		while(id<s.size() && s[id]=='J') { j++; id++;}

		while(id<s.size() && s[id]=='O') { o++; id++;}

		while(id<s.size() && s[id]=='I') { i++; id++;}

		if(j<o || o>i) continue;

		ret=max(ret,o);

	}

	printf("%d\n",ret);

}