

class     lowercase_       :



      def __init__(     self :							Optional[int]						)       ->	Union[str, Any]:
        _snake_case		=				[0]
        _snake_case		=				0



      def 		UpperCamelCase_						(     self :							Any     ,   A__ :							int						)       ->	None:
        _snake_case		=				self.__heap[i]
        while i // 2 > 0:
          if self.__heap[i] > self.__heap[i // 2]:
            _snake_case		=				self.__heap[i // 2]
            _snake_case		=				temporary
          i //= 2



      def 		UpperCamelCase_						(     self :							Union[str, Any]     ,   A__ :							int						)       ->	None:
        self.__heap.append(A__						)
        self.__size += 1
        self.__swap_up(self.__size						)



      def 		UpperCamelCase_						(     self :							Any     ,   A__ :							int						)       ->	None:
        while self.__size >= 2 * i:
          if 2 * i + 1 > self.__size:
            _snake_case		=				2 * i
          else:
            if self.__heap[2 * i] > self.__heap[2 * i + 1]:
              _snake_case		=				2 * i
            else:
              _snake_case		=				2 * i + 1
          _snake_case		=				self.__heap[i]
          if self.__heap[i] < self.__heap[bigger_child]:
            _snake_case		=				self.__heap[bigger_child]
            _snake_case		=				temporary
          _snake_case		=				bigger_child



      def 		UpperCamelCase_						(     self :							Union[str, Any]						)       ->	int:
        _snake_case		=				self.__heap[1]
        _snake_case		=				self.__heap[self.__size]
        self.__size -= 1
        self.__heap.pop()
        self.__swap_down(1						)
        return max_value



      @property
      def 		UpperCamelCase_						(     self :							int						)       ->	Tuple:
        return self.__heap[1:]







      def __len__(     self :							List[str]						)       ->	str:
        return self.__size


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 # create an instance of BinaryHeap
 __A     						=      BinaryHeap()
 binary_heap.insert(6)
 binary_heap.insert(10)
 binary_heap.insert(15)
 binary_heap.insert(12)
 # pop root(max-values because it is max heap)
 print(binary_heap.pop())  # 15
 print(binary_heap.pop())  # 12
 # get the list and size after operations
 print(binary_heap.get_list)
 print(len(binary_heap))




from __future__ import annotations



def  snake_case_(_UpperCamelCase					,			_UpperCamelCase					,			_UpperCamelCase	)				->      int:



  """simple docstring"""






  assert n > 1 and a > 0 and greatest_common_divisor(_UpperCamelCase					,			_UpperCamelCase	) == 1
  ((_snake_case),	(_snake_case),	(_snake_case))		=				extended_gcd(_UpperCamelCase					,			_UpperCamelCase	)  # Implemented below
  _snake_case		=				(b * s) % n
  return x



def  snake_case_(_UpperCamelCase					,			_UpperCamelCase	)				->      int:



  """simple docstring"""






  ((_snake_case),	(_snake_case))		=				extended_euclid(_UpperCamelCase					,			_UpperCamelCase	)  # Implemented below
  if b < 0:
    _snake_case		=				(b % n + n) % n
  return b



def  snake_case_(_UpperCamelCase					,			_UpperCamelCase					,			_UpperCamelCase	)				->      int:



  """simple docstring"""






  _snake_case		=				invert_modulo(_UpperCamelCase					,			_UpperCamelCase	)
  _snake_case		=				(b * s) % n
  return x



def  snake_case_(_UpperCamelCase					,			_UpperCamelCase	)				->      tuple[int, int, int]:



  """simple docstring"""






  assert a >= 0 and b >= 0

  if b == 0:
    _snake_case,	_snake_case,	_snake_case		=				a, 1, 0
  else:
    ((_snake_case),	(_snake_case),	(_snake_case))		=				extended_gcd(_UpperCamelCase					,			a % b	)
    _snake_case		=				q
    _snake_case		=				p - q * (a // b)

  assert a % d == 0 and b % d == 0
  assert d == a * x + b * y

  return (d, x, y)



def  snake_case_(_UpperCamelCase					,			_UpperCamelCase	)				->      tuple[int, int]:



  """simple docstring"""






  if b == 0:
    return (1, 0)
  ((_snake_case),	(_snake_case))		=				extended_euclid(_UpperCamelCase					,			a % b	)
  _snake_case		=				a // b
  return (y, x - k * y)



def  snake_case_(_UpperCamelCase					,			_UpperCamelCase	)				->      int:



  """simple docstring"""






  if a < b:
    _snake_case,	_snake_case		=				b, a

  while a % b != 0:
    _snake_case,	_snake_case		=				b, a % b

  return b


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

 testmod(name='''modular_division''', verbose=True)
 testmod(name='''modular_division2''', verbose=True)
 testmod(name='''invert_modulo''', verbose=True)
 testmod(name='''extended_gcd''', verbose=True)
 testmod(name='''extended_euclid''', verbose=True)
 testmod(name='''greatest_common_divisor''', verbose=True)

