Prateek loves candy

i see the editorial and make a code according wise but getting a time limit what is the fault in this i had done as mention in editorial… but getting a time limit here is a link to my code https://ide.codingblocks.com/s/138118

@Iitianrahman https://ide.codingblocks.com/s/123281

Refer this for help. You will understand why you were getting time limit error.