Book allocation(problem in hackerblocks)

#include <bits/stdc++.h>
using namespace std;
int ispos(int mid,int *a,int c,int n)
{
int k=accumulate(a,a+n,0);
int m2=c-1,m3=c;
int b[m3]={0};
int i=0;
while©
{
if(b[m2]+a[i]<=mid)
{
b[m2]+=a[i];
i++;
}
else if(b[m2]+a[i]>mid)
{
m2–;
c–;
}
}
int l=accumulate(b,b+m3,0);
return (k==l);
}
int numb(int mid,int *a,int c,int n)
{
int m2=c-1,m3=c;
int b[m3]={0};
int i=0;
while©
{
if(b[m2]+a[i]<=mid)
{
b[m2]+=a[i];
i++;
}
else if(b[m2]+a[i]>mid)
{
m2–;
c–;
}
}
int l=0;
for(int i=0;i<m3;i++)
{
if(l<b[i])
{
l=b[i];
}
}
return l;
}
int main()
{
int t;cin>>t;
while(t–)
{
int n,c;cin>>n>>c;
int p[n]={0};
for(int i=0;i<n;i++)
{
cin>>p[i];
}
int *a=p;
int s=p[n-1],e=accumulate(p,p+n,0),mid=(s+e)/2,ans=INT_MAX;
while(s<=e)
{
int k=ispos(mid,a,c,n);
int k1=numb(mid,a,c,n);
if(k==1)
{
e=mid-1;
mid=(s+e)/2;
ans=(k1<ans)?k1:ans;
}
else if(k==0)
{
s=mid+1;
mid=(s+e)/2;
}

   }
 cout<<ans<<endl;

}
return 0;
}
/working fyn in code blocks ide but not working in hCKERBLOCKS,Can u help in fixing the code/

Hey @bommareddyjyothiswaroopreddy there is no need for numb function, just update answer with mid if that configuration is possible,
also you can make your program space efficient by following mentor’s approach.