




def 		_lowerCamelCase				(					UpperCamelCase					,     UpperCamelCase					,     UpperCamelCase							)			->		Union[str, Any]:





  """simple docstring"""





  _lowercase: str						     =    index
  _lowercase: Optional[Any]						     =    2 * index + 1
  _lowercase: List[Any]						     =    2 * index + 2
  if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
    _lowercase: List[str]						     =    left_index

  if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
    _lowercase: List[str]						     =    right_index

  if largest != index:
    _lowercase     ,					_lowercase: List[str]						     =    unsorted[index], unsorted[largest]
    heapify(UpperCamelCase					,     UpperCamelCase					,     UpperCamelCase							)


def 		_lowerCamelCase				(					UpperCamelCase							)			->		Optional[Any]:





  """simple docstring"""





  _lowercase: List[Any]						     =    len(UpperCamelCase							)
  for i in range(n // 2 - 1					,     -1					,     -1							):
    heapify(UpperCamelCase					,     UpperCamelCase					,     UpperCamelCase							)
  for i in range(n - 1					,     0					,     -1							):
    _lowercase     ,					_lowercase: List[Any]						     =    unsorted[i], unsorted[0]
    heapify(UpperCamelCase					,     0					,     UpperCamelCase							)
  return unsorted


if __name__ == "__main__":
   UpperCAmelCase__						:       Dict							=    input('Enter numbers separated by a comma:\n').strip()
   UpperCAmelCase__						:       Dict							=    [int(item) for item in user_input.split(',')]
   print(heap_sort(unsorted))






from cva import destroyAllWindows, imread, imshow, waitKey


def 		_lowerCamelCase				(					UpperCamelCase					,     UpperCamelCase							)			->		List[str]:





  """simple docstring"""





  _lowercase     ,					_lowercase: Tuple						     =    img.shape[0], img.shape[1]

  def to_grayscale(UpperCamelCase					,     UpperCamelCase					,     UpperCamelCase							):
    return 0.2_126 * red + 0.587 * green + 0.114 * blue

  def normalize(UpperCamelCase							):
    return min(UpperCamelCase					,     255							)

  for i in range(UpperCamelCase							):
    for j in range(UpperCamelCase							):
      _lowercase: Any						     =    int(to_grayscale(*img[i][j]							)							)
      _lowercase: str						     =    [
          normalize(UpperCamelCase							),
          normalize(greyscale + factor							),
          normalize(greyscale + 2 * factor							),
      ]

  return img


if __name__ == "__main__":
   # read original image
   UpperCAmelCase__						:       Optional[Any]							=    {
       percentage: imread('image_data/lena.jpg', 1) for percentage in (10, 20, 30, 40)
   }

   for percentage, img in images.items():
      make_sepia(img, percentage)

   for percentage, img in images.items():
      imshow(f'''Original image with sepia (factor: {percentage})''', img)

   waitKey(0)
   destroyAllWindows()
