Getting wrong ans on Submission in largest area in a histogram problem

on testing with custom inputs, ans for the problem Histogram is coming correctly, but in submission, it couldn’t pass even a single case. please let me know where I am doing wrong.

Here is my code.