Please cheack the code for wining cB scholership

the code link

where i am wrong please check the code

instead of
ans=max(mid,ans);

just assign ans = mid