Winning cb scholarship

here is my code

#include
#include
#include
using namespace std;
bool isPossible(int n , int m ,int x , int y , int mid)
{
if((mid*x)<=(m+(n-mid)*y))
return true;
else
return false;

}
int max_students(int n , int m , int x , int y)
{
int s=0,max_s=INT_MIN;
int e=n;
while(s<=e)
{
int mid=(s+e)/2;
if(isPossible(n,m,x,y,mid))
{
max_s=max(max_s,mid);

		s=mid+1;
		
	}
	else
	 e=mid-1;
}
return max_s;

}

int main()
{
int n , m, x,y;
cin>>n>>m>>x>>y;
cout<<max_students(n,m,x,y)<<endl;
}

its not passing all test cases . please help

hello @gulatigarvita08
use long long

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.

Hey @gulatigarvita08

As aman told you ,use long ling data type otherwise result can overflow

If that still not works then please share your code in Coding Blocks IDE

Mentioned the changes in comments : https://ide.codingblocks.com/s/365068

If this resolves your query then please mark it as resolved :slight_smile:

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.