






class      __SCREAMING_SNAKE_CASE       :






						def __init__(						self ):






												"""simple docstring"""
												# numbermap keys are the number and its values are lists of indexes sorted
												# in ascending order
												lowerCAmelCase__         =    {}
												# indexmap keys are an index and it's values are the number at that index
												lowerCAmelCase__         =    {}






						def    UpperCamelCase__   (						self  ,    _UpperCamelCase  ,    _UpperCamelCase ):






												"""simple docstring"""
												if isinstance(_UpperCamelCase  ,    (range, str) ):
																		lowerCAmelCase__         =    list(_UpperCamelCase )
												elif not isinstance(_UpperCamelCase  ,    _UpperCamelCase ):
																		raise TypeError(
																		    'binary_search_delete() only accepts either a list, range or str' )

												lowerCAmelCase__         =    0
												lowerCAmelCase__         =    len(_UpperCamelCase ) - 1

												while low <= high:
																		lowerCAmelCase__         =    (low + high) // 2
																		if array[mid] == item:
																								array.pop(_UpperCamelCase )
																								return array
																		elif array[mid] < item:
																								lowerCAmelCase__         =    mid + 1
																		else:
																								lowerCAmelCase__         =    mid - 1
												raise ValueError(
												    'Either the item is not in the array or the array was unsorted' )






						def    UpperCamelCase__   (						self  ,    _UpperCamelCase  ,    _UpperCamelCase ):






												"""simple docstring"""
												if isinstance(_UpperCamelCase  ,    (range, str) ):
																		lowerCAmelCase__         =    list(_UpperCamelCase )
												elif not isinstance(_UpperCamelCase  ,    _UpperCamelCase ):
																		raise TypeError(
																		    'binary_search_insert() only accepts either a list, range or str' )

												lowerCAmelCase__         =    0
												lowerCAmelCase__         =    len(_UpperCamelCase ) - 1

												while low <= high:
																		lowerCAmelCase__         =    (low + high) // 2
																		if array[mid] == index:
																								# If the item already exists in the array,
																								# insert it after the existing item
																								array.insert(mid + 1  ,    _UpperCamelCase )
																								return array
																		elif array[mid] < index:
																								lowerCAmelCase__         =    mid + 1
																		else:
																								lowerCAmelCase__         =    mid - 1

        # If the item doesn't exist in the array, insert it at the appropriate position
												array.insert(_UpperCamelCase  ,    _UpperCamelCase )
												return array






						def    UpperCamelCase__   (						self  ,    _UpperCamelCase  ,    _UpperCamelCase ):






												"""simple docstring"""
												# Remove previous index
												if index in self.indexmap:
																		lowerCAmelCase__         =    self.indexmap[index]
																		if len(self.numbermap[n] ) == 1:
																								del self.numbermap[n]
																		else:
																								lowerCAmelCase__         =    self.binary_search_delete(self.numbermap[n]  ,    _UpperCamelCase )

        # Set new index
												lowerCAmelCase__         =    number

												# Number not seen before or empty so insert number value
												if number not in self.numbermap:
																		lowerCAmelCase__         =    [index]

												# Here we need to perform a binary search insertion in order to insert
												# The item in the correct place
												else:
																		lowerCAmelCase__         =    self.binary_search_insert(
																		    self.numbermap[number]  ,    _UpperCamelCase )







						def    UpperCamelCase__   (						self  ,    _UpperCamelCase ):






												"""simple docstring"""
												return self.numbermap.get(_UpperCamelCase  ,    [-1] )[0]


if __name__ == "__main__":
					import doctest

					doctest.testmod()






def SCREAMING_SNAKE_CASE					(  lowercase_:						int					):
       return n * (2 * n - 1)


def SCREAMING_SNAKE_CASE					(  lowercase_:						int					):
       _UpperCamelCase  :							str	    =	(1 + 24 * n) ** 0.5
       return ((1 + root) / 6) % 1 == 0


def SCREAMING_SNAKE_CASE					(  lowercase_:						int = 144					):
       _UpperCamelCase  :							Optional[Any]	    =	start
       _UpperCamelCase  :							List[str]	    =	hexagonal_num(lowercase_					)
       while not is_pentagonal(lowercase_					):
              n += 1
              _UpperCamelCase  :							Optional[int]	    =	hexagonal_num(lowercase_					)
       return num


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



