

"""simple docstring"""





class      _lowercase :


      def __init__(    self				:	List[str]							,   a				:	Any							,   a				:	Optional[int]						):





            """simple docstring"""







            __snake_case      :    Optional[Any]  			=name
            __snake_case      :    Union[str, Any]  			=val


      def __str__(    self				:	str						):





            """simple docstring"""







            return f'''{self.__class__.__name__}({self.name}, {self.val})'''







      def __lt__(    self				:	Optional[int]							,   a				:	Any						):





            """simple docstring"""







            return self.val < other.val



class      _lowercase :


      def __init__(    self				:	Union[str, Any]							,   a				:	Tuple						):





            """simple docstring"""







            __snake_case      :    int  			={}
            __snake_case      :    Union[str, Any]  			={}
            __snake_case      :    Optional[int]  			=self.build_heap(UpperCamelCase_						)


      def __getitem__(    self				:	Optional[int]							,   a				:	Union[str, Any]						):





            """simple docstring"""







            return self.get_value(UpperCamelCase_						)


      def _UpperCamelCase						(    self				:	Tuple							,   a				:	Union[str, Any]						):





            """simple docstring"""







            return (idx - 1) // 2


      def _UpperCamelCase						(    self				:	str							,   a				:	str						):





            """simple docstring"""







            return idx * 2 + 1


      def _UpperCamelCase						(    self				:	Dict							,   a				:	Any						):





            """simple docstring"""







            return idx * 2 + 2


      def _UpperCamelCase						(    self				:	Tuple							,   a				:	Union[str, Any]						):





            """simple docstring"""







            return self.heap_dict[key]


      def _UpperCamelCase						(    self				:	int							,   a				:	Optional[int]						):





            """simple docstring"""







            __snake_case      :    List[Any]  			=len(UpperCamelCase_						) - 1
            __snake_case      :    Tuple  			=self.get_parent_idx(UpperCamelCase_						)

            for idx, i in enumerate(UpperCamelCase_						):
                  __snake_case      :    int  			=idx
                  __snake_case      :    str  			=i.val

            for i in range(UpperCamelCase_							,   -1							,   -1						):
                  self.sift_down(UpperCamelCase_							,   UpperCamelCase_						)
            return array


      def _UpperCamelCase						(    self				:	List[Any]							,   a				:	Tuple							,   a				:	Tuple						):





            """simple docstring"""







            while True:
                  __snake_case      :    Union[str, Any]  			=self.get_left_child_idx(UpperCamelCase_						)  # noqa: E741
                  __snake_case      :    List[str]  			=self.get_right_child_idx(UpperCamelCase_						)

                  __snake_case      :    str  			=idx
                  if l < len(UpperCamelCase_						) and array[l] < array[idx]:
                        __snake_case      :    Tuple  			=l
                  if r < len(UpperCamelCase_						) and array[r] < array[smallest]:
                        __snake_case      :    Optional[int]  			=r

                  if smallest != idx:
                        __snake_case			,				__snake_case      :    List[str]  			=array[smallest], array[idx]
                        (
                            (
                            __snake_case     
                        )			,				(
                            __snake_case     
                        )			,				     
                        )      :    Union[str, Any]  			=(
                            self.idx_of_element[array[smallest]],
                            self.idx_of_element[array[idx]],
                        )
                        __snake_case      :    List[Any]  			=smallest
                  else:
                        break


      def _UpperCamelCase						(    self				:	Any							,   a				:	Dict						):





            """simple docstring"""







            __snake_case      :    Optional[int]  			=self.get_parent_idx(UpperCamelCase_						)
            while p >= 0 and self.heap[p] > self.heap[idx]:
                  __snake_case			,				__snake_case      :    Optional[int]  			=self.heap[idx], self.heap[p]
                  __snake_case			,				__snake_case      :    List[str]  			=(
                      self.idx_of_element[self.heap[idx]],
                      self.idx_of_element[self.heap[p]],
                  )
                  __snake_case      :    List[Any]  			=p
                  __snake_case      :    str  			=self.get_parent_idx(UpperCamelCase_						)


      def _UpperCamelCase						(    self				:	Tuple						):





            """simple docstring"""







            return self.heap[0]


      def _UpperCamelCase						(    self				:	List[str]						):





            """simple docstring"""







            __snake_case			,				__snake_case      :    List[str]  			=self.heap[-1], self.heap[0]
            __snake_case			,				__snake_case      :    str  			=(
                self.idx_of_element[self.heap[-1]],
                self.idx_of_element[self.heap[0]],
            )

            __snake_case      :    List[Any]  			=self.heap.pop()
            del self.idx_of_element[x]
            self.sift_down(0							,   self.heap						)
            return x


      def _UpperCamelCase						(    self				:	Union[str, Any]							,   a				:	str						):





            """simple docstring"""







            self.heap.append(UpperCamelCase_						)
            __snake_case      :    str  			=len(self.heap						) - 1
            __snake_case      :    int  			=node.val
            self.sift_up(len(self.heap						) - 1						)


      def _UpperCamelCase						(    self				:	List[str]						):





            """simple docstring"""







            return len(self.heap						) == 0







      def _UpperCamelCase						(    self				:	List[Any]							,   a				:	str							,   a				:	Dict						):





            """simple docstring"""







            assert (
                self.heap[self.idx_of_element[node]].val > new_value
            ), "newValue must be less that current value"
            __snake_case      :    int  			=new_value
            __snake_case      :    Any  			=new_value
            self.sift_up(self.idx_of_element[node]						)



UpperCamelCase_	:				str										= Node("""R""", -1)
UpperCamelCase_	:				Dict										= Node("""B""", 6)
UpperCamelCase_	:				Dict										= Node("""A""", 3)
UpperCamelCase_	:				str										= Node("""X""", 1)
UpperCamelCase_	:				Optional[int]										= Node("""E""", 4)

# Use one of these two ways to generate Min-Heap

# Generating Min-Heap from array
UpperCamelCase_	:				Any										= MinHeap([r, b, a, x, e])

# Generating Min-Heap by Insert method
# myMinHeap.insert(a)
# myMinHeap.insert(b)
# myMinHeap.insert(x)
# myMinHeap.insert(r)
# myMinHeap.insert(e)

# Before
print("""Min Heap - before decrease key""")
for i in my_min_heap.heap:
    print(i)

print("""Min Heap - After decrease key of node [B -> -17]""")
my_min_heap.decrease_key(b, -17)

# After
for i in my_min_heap.heap:
    print(i)

if __name__ == "__main__":
    import doctest

    doctest.testmod()










"""simple docstring"""





def     __lowercase					(    a :				int       ,		a :				int )					->					int:
      return x if y == 0 else greatest_common_divisor(a       ,		x % y )



def     __lowercase					(    a :				int       ,		a :				int )					->					int:
      return (x * y) // greatest_common_divisor(a       ,		a )



def     __lowercase					(    a :				int = 20 )					->					int:
      __snake_case      :    Optional[Any]  			=1
      for i in range(1       ,		n + 1 ):
            __snake_case      :    Optional[int]  			=lcm(a       ,		a )
      return g


if __name__ == "__main__":
    print(F'''{solution() = }''')


