The code for prata; some test cases have wrong answer

#include
#include
using namespace std;

int kitnebnaye(int rank, int time)
{
int t=0, y=1, p=0;
while(t<=time)
{
t+=rank*y;
y++;
p++;
}
return p-1;
}
bool bnapaaye(int rank[], int time, int p, int c)
{
int prata=0;
for(int i=0; i<c; i++)
{
prata += kitnebnaye(rank[i], time);
}
if(prata>p)
return true;
else
return false;
}

int main()
{
int t;
cin>>t;
while(t–)
{
int p;
cin>>p;
int c;
cin>>c;
int rank[c];
for(int i=0; i<c; i++)
{
cin>>rank[i];
}
int s=0;
int e=100;
int ans;
while(s<=e)
{
int mid = (s+e)/2;
if(bnapaaye(rank, mid, p, c))
{
ans = mid;
e = mid-1;
}
else
s = mid+1;
}
cout<<ans<<endl;
}
}

@igarg145 in bnapaaye() function it should be prata**>=**p , you missed ‘=’ sign

For initial value of end in binary search, you should take it as the time taken by the fastest chef to do all the prata work because our answer will always be less than that or for simplification you can also take some large value like 10^7.

@igarg145 From next time please provide the ide link of your code with proper indentation, it easy to read and understand other people code.

Also please mark this doubt as resolved if you understood this.