Magical Candy Bags

Qn Link-https://hack.codingblocks.com/contests/c/511/1625
Code-https://ide.codingblocks.com/s/33856
Showing TLE in one and wrong ans in second test case…

https://ide.codingblocks.com/s/33874

i have made the required changes and added the comments.

Thanks!! It worked…