Holiday Accomodation

I have tried the problem on spoj. There the online judge is showing TLE.
PLease help me to optimise the code.

The link to problem (SPOJ) : - https://www.spoj.com/problems/HOLI/

The link to my solution :- https://ide.codingblocks.com/s/228964