Stack and Queue :- Histogram

How the area of 0th bar is coming as 80?

This code given below is giving right answers in my ide but not in online ide https://ide.codingblocks.com/s/79632

What is going wrong with this code?

Hi Avin,
Use long instead of int also while taking input use sc.nextInt() in place of sc.nextLine() as input is not given as string.