Histogram stack problem

my code seems to be correct but i dont know why its showing wrong answer for each of test case i’ve tried many times to resubmit the code

link to the code:

approach is correct
only change you have to do is
use long long int instead of int

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning:
if you have more doubts regarding this feel free to ask