Help me in solving CANDYSTORE problem

My issue

how to solve

My code

# cook your dish here

Learning course: Basic Math using C++
Problem Link: CodeChef: Practical coding for everyone