

"""simple docstring"""


from hashlib import mda, shaaaa

__A		     =    (shaaaa, mda)





class 					snake_case			:

				def __init__(			self							:       List[str]  ,						UpperCamelCase__							:       int = 8)->     None:



						'''simple docstring'''


						__lowerCAmelCase: List[str]					   =    0B0
						__lowerCAmelCase: Any					   =    size

				def 							lowercase_  (			self							:       Dict  ,						UpperCamelCase__							:       str)->     None:



						'''simple docstring'''


						__lowerCAmelCase: Dict					   =    self.hash_(UpperCamelCase__)
						self.bitarray |= h

				def 							lowercase_  (			self							:       List[Any]  ,						UpperCamelCase__							:       str)->     bool:



						'''simple docstring'''


						__lowerCAmelCase: Optional[int]					   =    self.hash_(UpperCamelCase__)
						return (h & self.bitarray) == h

				def __contains__(			self							:       Tuple  ,						UpperCamelCase__							:       str)->     bool:



						'''simple docstring'''


						return self.exists(UpperCamelCase__)

				def 							lowercase_  (			self							:       int  ,						UpperCamelCase__							:       int)->     str:



						'''simple docstring'''


						__lowerCAmelCase: str					   =    bin(UpperCamelCase__)[2:]
						return res.zfill(self.size)

				@property
				def 							lowercase_  (			self							:       List[Any])->     str:



						'''simple docstring'''


						return self.format_bin(self.bitarray)

				def 							lowercase_  (			self							:       Optional[Any]  ,						UpperCamelCase__							:       str)->     int:



						'''simple docstring'''


						__lowerCAmelCase: int					   =    0B0
						for func in HASH_FUNCTIONS:
								__lowerCAmelCase: Union[str, Any]					   =    (
								    int.from_bytes(func(value.encode()).digest()  ,						"little") % self.size
								)
								res |= 2**position
						return res

				def 							lowercase_  (			self							:       Any  ,						UpperCamelCase__							:       str)->     str:



						'''simple docstring'''


						return self.format_bin(self.hash_(UpperCamelCase__))




				@property
				def 							lowercase_  (			self							:       str)->     float:



						'''simple docstring'''


						__lowerCAmelCase: List[Any]					   =    bin(self.bitarray).count("1")
						return (n_ones / self.size) ** len(UpperCamelCase__)





"""simple docstring"""


from __future__ import annotations






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			tuple[float, float]:
		assert (
		    c % greatest_common_divisor(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				) == 0
		)  # greatest_common_divisor(a,b) function implemented below
		((__lowerCAmelCase)   ,				(__lowerCAmelCase)   ,				(__lowerCAmelCase)): Dict					   =    extended_gcd(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)  # extended_gcd(a,b) function implemented below
		__lowerCAmelCase: Optional[int]					   =    c / d
		return (r * x, r * y)






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE = 2				)			->			None:
		((__lowerCAmelCase)   ,				(__lowerCAmelCase)): Optional[Any]					   =    diophantine(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)  # Initial value
		__lowerCAmelCase: Optional[Any]					   =    greatest_common_divisor(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)
		__lowerCAmelCase: Any					   =    a // d
		__lowerCAmelCase: str					   =    b // d

		for i in range(__SCREAMING_SNAKE_CASE				):
				__lowerCAmelCase: Dict					   =    xa + i * q
				__lowerCAmelCase: List[str]					   =    ya - i * p
				print(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			int:
		if a < b:
				__lowerCAmelCase   ,				__lowerCAmelCase: Any					   =    b, a

		while a % b != 0:
				__lowerCAmelCase   ,				__lowerCAmelCase: List[Any]					   =    b, a % b

		return b






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			tuple[int, int, int]:
		assert a >= 0 and b >= 0

		if b == 0:
				__lowerCAmelCase   ,				__lowerCAmelCase   ,				__lowerCAmelCase: List[str]					   =    a, 1, 0
		else:
				((__lowerCAmelCase)   ,				(__lowerCAmelCase)   ,				(__lowerCAmelCase)): Dict					   =    extended_gcd(__SCREAMING_SNAKE_CASE      ,				a % b				)
				__lowerCAmelCase: Dict					   =    q
				__lowerCAmelCase: int					   =    p - q * (a // b)

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

		return (d, x, y)


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

			testmod(name="diophantine", verbose=True)
			testmod(name="diophantine_all_soln", verbose=True)
			testmod(name="extended_gcd", verbose=True)
			testmod(name="greatest_common_divisor", verbose=True)


