problem MAXVAC : can anyone help me out in this?

#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
long long int n,x,count=0,vac=0,pos=0,count0=0;
cin>>n>>x;
string s;
cin>>s;
for(long long int i=0;i<s.length();i++)
{
if(s[i]==‘0’)
{
count0++;
if(count==0)
pos=i;
count++;
if(count==x)
{
vac++;
count=0;
s.erase(s.begin()+pos,s.begin()+pos+x);
i-=x;
}
}
else count=0;
}
count0-=(x*vac);
pos=s.length();
vector next1(s.length());
for(long int i=s.length()-1;i>=0;i–)
{
next1[i]=pos;
if(s[i]==‘1’)
pos=i;
}
count=0;
if(count0>=x-1)
for(long long int i=0;i<s.length();i++)
{
if(s[i]==‘0’)
{
if(count==0)
pos=0;
count++;
}
else
{
if(count+next1[i]-pos>x)
{
vac++;
break;
}
count=0;
}
}
cout<<vac<<endl;
}
return 0;

}