Please check the code


this is the code for partik loves candy
every time output is TLE

Check this and read the comments. More optimizations in your code are required in order to pass all test cases.