Wrong answer on spoj

i have submitted my solution on spoj for this problem(BAILIFE)
but it is showing me WA . please help me out.
link–> https://ide.codingblocks.com/s/220693

Hey @Yash-Mittal-2335533069896503
Your approach is incorrect
please look at my code it got AC on SPOJ


You can cross verify your approach with this