Carvans getting wrong answer

https://www.codechef.com/viewsolution/30966586

plz look where my code is wrong

There is an error in the link.
Can you explain me your approach for this question?

thank u so much for reverting back.
my solution was got accepted.
i was missing long long int for temp variable

Its Wonderful to hear that your solution is accepted.

why did you need a long long int, while the largest input is 10,000, and problem statement says 32-bit integer is enough?

Thanks :slight_smile:

You don’t need long long int. I got AC without using long long.

Can you please explain me in detail what you are trying to tell me ?