

'''simple docstring'''
from __future__ import annotations

from collections.abc import Iterator
from typing import Any







class 							A__					:





  def __init__(	self   :			int							,      _a   :			Any				)			->					None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE												=data
       _SCREAMING_SNAKE_CASE												=None





  def __str__(	self   :			Optional[int]				)			->					str:





       '''simple docstring'''






       return f"{self.data}"







class 							A__					:





  def __init__(	self   :			int				)			->					None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE												=None
       _SCREAMING_SNAKE_CASE												=None





  def __iter__(	self   :			Dict				)			->					Iterator[Any]:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE												=self.front
       while node:
            yield node.data
            _SCREAMING_SNAKE_CASE												=node.next





  def __len__(	self   :			int				)			->					int:





       '''simple docstring'''






       return len(tuple(iter(self				)				)				)





  def __str__(	self   :			List[Any]				)			->					str:





       '''simple docstring'''






       return " <- ".join(str(_a				) for item in self				)





  def 		A						(	self   :			Dict				)			->					bool:





       '''simple docstring'''






       return len(self				) == 0





  def 		A						(	self   :			Tuple							,      _a   :			Any				)			->					None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE												=Node(_a				)
       if self.is_empty():
            _SCREAMING_SNAKE_CASE												=_SCREAMING_SNAKE_CASE												=node
       else:
            assert isinstance(self.rear							,      _a				)
            _SCREAMING_SNAKE_CASE												=node
            _SCREAMING_SNAKE_CASE												=node





  def 		A						(	self   :			Union[str, Any]				)			->					Any:





       '''simple docstring'''






       if self.is_empty():
            raise IndexError('dequeue from empty queue'				)
       assert isinstance(self.front							,      _a				)
       _SCREAMING_SNAKE_CASE												=self.front
       _SCREAMING_SNAKE_CASE												=self.front.next
       if self.front is None:
            _SCREAMING_SNAKE_CASE												=None
       return node.data





  def 		A						(	self   :			List[str]				)			->					None:





       '''simple docstring'''






       _SCREAMING_SNAKE_CASE												=_SCREAMING_SNAKE_CASE												=None


if __name__ == "__main__":
     from doctest import testmod

     testmod()



'''simple docstring'''
def  _lowerCAmelCase      (		_UpperCamelCase		:  Optional[int]							,				_UpperCamelCase		:  Optional[Any]       )   ->    Tuple:
     """simple docstring"""




     _SCREAMING_SNAKE_CASE												=len(_UpperCamelCase       )
     # Create a stack and push index of fist element to it
     _SCREAMING_SNAKE_CASE												=[]
     st.append(0       )

     # Span value of first element is always 1
     _SCREAMING_SNAKE_CASE												=1

     # Calculate span values for rest of the elements
     for i in range(1							,				_UpperCamelCase       ):
          # Pop elements from stack while stack is not
          # empty and top of stack is smaller than price[i]
          while len(_UpperCamelCase       ) > 0 and price[st[0]] <= price[i]:
               st.pop()

          # If stack becomes empty, then price[i] is greater
          # than all elements on left of it, i.e. price[0],
          # price[1], ..price[i-1]. Else the price[i]  is
          # greater than elements after top of stack
          _SCREAMING_SNAKE_CASE												=i + 1 if len(_UpperCamelCase       ) <= 0 else (i - st[0])

          # Push this element to stack
          st.append(_UpperCamelCase       )


def  _lowerCAmelCase      (		_UpperCamelCase		:  Any							,				_UpperCamelCase		:  str       )   ->    Any:
     """simple docstring"""




     for i in range(0							,				_UpperCamelCase       ):
          print(arr[i]							,				end=' '       )


# Driver program to test above function
lowerCamelCase				:   str      				=  [1_0, 4, 5, 9_0, 1_2_0, 8_0]
lowerCamelCase				:   str      				=  [0 for i in range(len(price) + 1)]

# Fill the span values in array S[]
calculation_span(price, S)







print_array(S, len(price))
