






'''simple docstring'''







from collections.abc import Callable

class _lowercase	:




							def __init__(							self:				Dict			,							UpperCamelCase__:				Callable | None = None     ):
														# Stores actual heap items.
														lowerCamelCase__					:	list         =       []
														# Stores indexes of each item for supporting updates and deletion.
														lowerCamelCase__					:	dict         =       {}
														# Stores current size of heap.
														lowerCamelCase__					:	Optional[Any]         =       0
														# Stores function used to evaluate the score of an item on which basis ordering
														# will be done.
														lowerCamelCase__					:	Optional[Any]         =       key or (lambda UpperCamelCase__     : x)




							def 		lowerCamelCase_				(							self:				Any			,							UpperCamelCase__:				int     ):
														return int((i - 1) / 2     ) if i > 0 else None




							def 		lowerCamelCase_				(							self:				Tuple			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	Any         =       int(2 * i + 1     )
														return left if 0 < left < self.size else None




							def 		lowerCamelCase_				(							self:				str			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	Union[str, Any]         =       int(2 * i + 2     )
														return right if 0 < right < self.size else None




							def 		lowerCamelCase_				(							self:				Optional[Any]			,							UpperCamelCase__:				int			,							UpperCamelCase__:				int     ):
														lowerCamelCase__  ,		lowerCamelCase__					:	Union[str, Any]         =       (
														    self.pos_map[self.arr[j][0]],
														    self.pos_map[self.arr[i][0]],
														)
														# Then swap the items in the list.
														lowerCamelCase__  ,		lowerCamelCase__					:	int         =       self.arr[j], self.arr[i]




							def 		lowerCamelCase_				(							self:				List[str]			,							UpperCamelCase__:				int			,							UpperCamelCase__:				int     ):
														return self.arr[i][1] < self.arr[j][1]




							def 		lowerCamelCase_				(							self:				Optional[Any]			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	str         =       self._left(UpperCamelCase__     )
														lowerCamelCase__					:	Optional[int]         =       self._right(UpperCamelCase__     )
														lowerCamelCase__					:	List[Any]         =       i

														if left is not None and not self._cmp(UpperCamelCase__			,							UpperCamelCase__     ):
																					lowerCamelCase__					:	Optional[Any]         =       left
														if right is not None and not self._cmp(UpperCamelCase__			,							UpperCamelCase__     ):
																					lowerCamelCase__					:	Union[str, Any]         =       right

														return valid_parent




							def 		lowerCamelCase_				(							self:				Dict			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	Any         =       self._parent(UpperCamelCase__     )
														while parent is not None and not self._cmp(UpperCamelCase__			,							UpperCamelCase__     ):
																					self._swap(UpperCamelCase__			,							UpperCamelCase__     )
																					lowerCamelCase__  ,		lowerCamelCase__					:	Dict         =       parent, self._parent(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				List[str]			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	Tuple         =       self._get_valid_parent(UpperCamelCase__     )
														while valid_parent != index:
																					self._swap(UpperCamelCase__			,							UpperCamelCase__     )
																					lowerCamelCase__  ,		lowerCamelCase__					:	Optional[int]         =       valid_parent, self._get_valid_parent(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				Dict			,							UpperCamelCase__:				int			,							UpperCamelCase__:				int     ):
														if item not in self.pos_map:
																					return
														lowerCamelCase__					:	Optional[Any]         =       self.pos_map[item]
														lowerCamelCase__					:	List[str]         =       [item, self.key(UpperCamelCase__     )]
														# Make sure heap is right in both up and down direction.
														# Ideally only one of them will make any change.
														self._heapify_up(UpperCamelCase__     )
														self._heapify_down(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				Dict			,							UpperCamelCase__:				int     ):
														if item not in self.pos_map:
																					return
														lowerCamelCase__					:	int         =       self.pos_map[item]
														del self.pos_map[item]
														lowerCamelCase__					:	Any         =       self.arr[self.size - 1]
														lowerCamelCase__					:	int         =       index
														self.size -= 1
														# Make sure heap is right in both up and down direction. Ideally only one
														# of them will make any change- so no performance loss in calling both.
														if self.size > index:
																					self._heapify_up(UpperCamelCase__     )
																					self._heapify_down(UpperCamelCase__     )




							def 		lowerCamelCase_				(							self:				Union[str, Any]			,							UpperCamelCase__:				int			,							UpperCamelCase__:				int     ):
														lowerCamelCase__					:	List[str]         =       len(self.arr     )
														if arr_len == self.size:
																					self.arr.append([item, self.key(UpperCamelCase__     )]     )
														else:
																					lowerCamelCase__					:	Any         =       [item, self.key(UpperCamelCase__     )]
														lowerCamelCase__					:	Optional[int]         =       self.size
														self.size += 1
														self._heapify_up(self.size - 1     )




							def 		lowerCamelCase_				(							self:				Any     ):
														return self.arr[0] if self.size else None




							def 		lowerCamelCase_				(							self:				Tuple     ):
														lowerCamelCase__					:	List[str]         =       self.get_top()
														if top_item_tuple:
																					self.delete_item(top_item_tuple[0]     )
														return top_item_tuple





def  SCREAMING_SNAKE_CASE_       ()      ->       None:
							pass


if __name__ == "__main__":
			import doctest

			doctest.testmod()







"""simple docstring"""






import math







def      _snake_case			(				lowercase__		):
				return math.sqrt(lowercase__		) * math.sqrt(lowercase__		) == num







def      _snake_case			(				lowercase__		):
				_lowerCamelCase     :			Optional[int]    =    0
				_lowerCamelCase     :			List[Any]    =    n
				while left <= right:
								_lowerCamelCase     :			str    =    (left + right) // 2
								if mid**2 == n:
												return True
								elif mid**2 > n:
												_lowerCamelCase     :			str    =    mid - 1
								else:
												_lowerCamelCase     :			Optional[int]    =    mid + 1
				return False


if __name__ == "__main__":
			import doctest

			doctest.testmod()