Stock Span Problem

https://ide.codingblocks.com/#/s/15882

This is my code for the problem below

https://hack.codingblocks.com/contests/c/471/404

Third test case is failing… !

Do a dry run for input as
6
10 4 5 90 120 80
I have modified your code as there were few errors and added comments
https://ide.codingblocks.com/#/s/15885