"""simple docstring"""
def 		__a  (      _SCREAMING_SNAKE_CASE						,	_SCREAMING_SNAKE_CASE  )      ->List[Any]:
  a__:	Tuple     				=      len(_SCREAMING_SNAKE_CASE  )
  # Create a stack and push index of fist element to it
  a__:	List[str]     				=      []
  st.append(0  )

  # Span value of first element is always 1
  a__:	List[Any]     				=      1

  # Calculate span values for rest of the elements
  for i in range(1						,	_SCREAMING_SNAKE_CASE  ):
    # Pop elements from stack while stack is not
    # empty and top of stack is smaller than price[i]
    while len(_SCREAMING_SNAKE_CASE  ) > 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
    a__:	Optional[int]     				=      i + 1 if len(_SCREAMING_SNAKE_CASE  ) <= 0 else (i - st[0])

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







def 		__a  (      _SCREAMING_SNAKE_CASE						,	_SCREAMING_SNAKE_CASE  )      ->Any:
  for i in range(0						,	_SCREAMING_SNAKE_CASE  ):
    print(arr[i]						,	end=' '  )


# Driver program to test above function
lowercase__   			=      [10, 4, 5, 90, 120, 80]
lowercase__   			=      [0 for i in range(len(price) + 1)]

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


print_array(S, len(price))



'''simple docstring'''
import numpy as np
from PIL import Image







def 				__UpperCamelCase (					__UpperCAmelCase  :					np.array			)							->	np.array:
  lowercase				,      lowercase				,      lowercase				:							Dict									=   rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
  return 0.2989 * r + 0.5870 * g + 0.1140 * b







def 				__UpperCamelCase (					__UpperCAmelCase  :					np.array			)							->	np.array:
  return (gray > 127) & (gray <= 255)







def 				__UpperCamelCase (					__UpperCAmelCase  :					np.array ,   __UpperCAmelCase  :					np.array			)							->	np.array:
  lowercase				:							str									=   np.zeros_like(__UpperCAmelCase			)
  lowercase				:							Tuple									=   np.zeros(
      (image.shape[0] + kernel.shape[0] - 1, image.shape[1] + kernel.shape[1] - 1)			)

  # Copy image to padded image
  lowercase				:							int									=   image

  # Iterate over image & apply kernel
  for x in range(image.shape[1]			):
    for y in range(image.shape[0]			):
      lowercase				:							str									=   (
          kernel * image_padded[y : y + kernel.shape[0], x : x + kernel.shape[1]]
      ).sum()
      lowercase				:							Tuple									=   int(summation == 5			)
  return output


# kernel to be applied
_A		:      Union[str, Any]						   =np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])

if __name__ == "__main__":
 # read original image
 _A		:      Optional[int]						   =np.array(Image.open(r'''..\image_data\lena.jpg'''))
 # Apply erosion operation to a binary image
 _A		:      Optional[int]						   =erosion(grayabinary(rgbagray(image)), structuring_element)
 # Save the output image
 _A		:      int						   =Image.fromarray(output).convert('''RGB''')
 pil_img.save('''result_erosion.png''')