

class 			_SCREAMING_SNAKE_CASE      :







						def __init__(			self							)->							None:
													# 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        _snake_case				(			self     ,						_SCREAMING_SNAKE_CASE     ,						_SCREAMING_SNAKE_CASE							)->							list[int]:
													if isinstance(_SCREAMING_SNAKE_CASE     ,						(range, str)							):
																				lowerCamelCase_								=list(_SCREAMING_SNAKE_CASE							)
													elif not isinstance(_SCREAMING_SNAKE_CASE     ,						_SCREAMING_SNAKE_CASE							):
																				raise TypeError(
																				    """binary_search_delete() only accepts either a list, range or str"""							)

													lowerCamelCase_								=0
													lowerCamelCase_								=len(_SCREAMING_SNAKE_CASE							) - 1

													while low <= high:
																				lowerCamelCase_								=(low + high) // 2
																				if array[mid] == item:
																											array.pop(_SCREAMING_SNAKE_CASE							)
																											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        _snake_case				(			self     ,						_SCREAMING_SNAKE_CASE     ,						_SCREAMING_SNAKE_CASE							)->							list[int]:
													if isinstance(_SCREAMING_SNAKE_CASE     ,						(range, str)							):
																				lowerCamelCase_								=list(_SCREAMING_SNAKE_CASE							)
													elif not isinstance(_SCREAMING_SNAKE_CASE     ,						_SCREAMING_SNAKE_CASE							):
																				raise TypeError(
																				    """binary_search_insert() only accepts either a list, range or str"""							)

													lowerCamelCase_								=0
													lowerCamelCase_								=len(_SCREAMING_SNAKE_CASE							) - 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     ,						_SCREAMING_SNAKE_CASE							)
																											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(_SCREAMING_SNAKE_CASE     ,						_SCREAMING_SNAKE_CASE							)
													return array







						def        _snake_case				(			self     ,						_SCREAMING_SNAKE_CASE     ,						_SCREAMING_SNAKE_CASE							)->							None:
													# 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]     ,						_SCREAMING_SNAKE_CASE							)

        # 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]     ,						_SCREAMING_SNAKE_CASE							)







						def        _snake_case				(			self     ,						_SCREAMING_SNAKE_CASE							)->							int:
													return self.numbermap.get(_SCREAMING_SNAKE_CASE     ,						[-1]							)[0]


if __name__ == "__main__":
	import doctest

	doctest.testmod()



def        __UpperCamelCase     (      _A					:							str		)				->int:



							"""simple docstring"""
							lowerCamelCase_								=lowerCamelCase_								=0
							for letter in data:
														lowerCamelCase_								=(hash_ << 4) + ord(_A		)
														lowerCamelCase_								=hash_ & 0XF0000000
														if x != 0:
																					hash_ ^= x >> 24
														hash_ &= ~x
							return hash_


if __name__ == "__main__":
	import doctest

	doctest.testmod()
