All my test cases is not passing plzzz help me

#include
using namespace std;
#define long int as int
bool isvalidconfig(int boards[],int n,int k,int answer)
{
int painter=1;
int current_board=0;
for(int i=0;i<n;i++)
{
if(current_board+boards[i]>answer)
{
current_board=boards[i];
painter++;
if(painter>k)
{
return false;
}
}
else
{
current_board+=boards[i];
}
}
return true;
}
int binarysearch(int boards[],int n,int k)
{
int s=0;
int total_boards=0;
int e=0;
for(int i=0;i<n;i++)
{
total_boards+=boards[i];
s=max(s,boards[i]);
}
e=total_boards;
int mid=(s+e)/2;
int answer;

while(s<=e)
{
    mid=(s+e)/2;
    if(isvalidconfig(boards,n,k,mid))
    {
        answer=mid;
        e=mid-1;

    }
    else
    {
        s=mid+1;
    }
    
}
return answer;

}
int main() {
int n,k,t;
cin>>n>>k>>t;
int boards[n];
for(int i=0;i<n;i++)
{
cin>>boards[i];
}
cout<<(((binarysearch(boards,n,k))*t)%10000003);

}

Hey @Bhavit_Singla
Sorry for the earlier confusion. That was another question. Your code is fine. For reference you can even see https://ide.codingblocks.com/s/189935. Issue is with use of int. You answer is beyond range of int. Please use long long everywhere. It’ll help with overflow issues.

Please send your code on CB IDE from next time onwards. Helps solve the doubts better.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.