Why this code gives wrong answer (PLAYFIT)..plz help

the code solves all the testcases . if i am missing any pease tell me.
problem link:
solution code