




'''simple docstring'''


_snake_case   :   int     							=	256
# Modulus to hash a string
_snake_case   :   List[str]     							=	1000003
def 	snake_case_					(UpperCamelCase :						str				,		UpperCamelCase :						str   ):





							'''simple docstring'''


							_a			  =       len(UpperCamelCase   )
							_a			  =       len(UpperCamelCase   )
							if p_len > t_len:
														return False

							_a			  =       0
							_a			  =       0
							_a			  =       1

							# Calculating the hash of pattern and substring of text
							for i in range(UpperCamelCase   ):
														_a			  =       (ord(pattern[i]   ) + p_hash * alphabet_size) % modulus
														_a			  =       (ord(text[i]   ) + text_hash * alphabet_size) % modulus
														if i == p_len - 1:
																					continue
														_a			  =       (modulus_power * alphabet_size) % modulus

							for i in range(0				,		t_len - p_len + 1   ):
														if text_hash == p_hash and text[i : i + p_len] == pattern:
																					return True
														if i == t_len - p_len:
																					continue
														# Calculate the https://en.wikipedia.org/wiki/Rolling_hash
														_a			  =       (
														    (text_hash - ord(text[i]   ) * modulus_power) * alphabet_size
														    + ord(text[i + p_len]   )
														) % modulus
							return False
def 	snake_case_					():





							'''simple docstring'''


							_a			  =       '''abc1abc12'''
							_a			  =       '''alskfjaldsabc1abc1abc12k23adsfabcabc'''
							_a			  =       '''alskfjaldsk23adsfabcabc'''
							assert rabin_karp(UpperCamelCase				,		UpperCamelCase   ) and not rabin_karp(UpperCamelCase				,		UpperCamelCase   )

							# Test 2)
							_a			  =       '''ABABX'''
							_a			  =       '''ABABZABABYABABX'''
							assert rabin_karp(UpperCamelCase				,		UpperCamelCase   )

							# Test 3)
							_a			  =       '''AAAB'''
							_a			  =       '''ABAAAAAB'''
							assert rabin_karp(UpperCamelCase				,		UpperCamelCase   )

							# Test 4)
							_a			  =       '''abcdabcy'''
							_a			  =       '''abcxabcdabxabcdabcdabcy'''
							assert rabin_karp(UpperCamelCase				,		UpperCamelCase   )

							# Test 5)
							_a			  =       '''Lü'''
							_a			  =       '''Lüsai'''
							assert rabin_karp(UpperCamelCase				,		UpperCamelCase   )
							_a			  =       '''Lue'''
							assert not rabin_karp(UpperCamelCase				,		UpperCamelCase   )
							print('''Success.'''   )


if __name__ == "__main__":
				test_rabin_karp()







'''simple docstring'''


_snake_case   :   Any     							=	tuple[float, float, float]
_snake_case   :   Optional[int]     							=	tuple[float, float, float]
def 	snake_case_					(UpperCamelCase :						Pointad				,		UpperCamelCase :						Pointad   ):





							'''simple docstring'''


							_a			  =       end_pointa[0] - end_pointa[0]
							_a			  =       end_pointa[1] - end_pointa[1]
							_a			  =       end_pointa[2] - end_pointa[2]
							return (x, y, z)
def 	snake_case_					(UpperCamelCase :						Vectorad				,		UpperCamelCase :						Vectorad   ):





							'''simple docstring'''


							_a			  =       ab[1] * ac[2] - ab[2] * ac[1]  # *i
							_a			  =       (ab[0] * ac[2] - ab[2] * ac[0]) * -1  # *j
							_a			  =       ab[0] * ac[1] - ab[1] * ac[0]  # *k
							return (x, y, z)
def 	snake_case_					(UpperCamelCase :						Vectorad				,		UpperCamelCase :						int   ):





							'''simple docstring'''


							return tuple(round(UpperCamelCase				,		UpperCamelCase   ) for x in vector   ) == (0, 0, 0)

def 	snake_case_					(UpperCamelCase :						Pointad				,		UpperCamelCase :						Pointad				,		UpperCamelCase :						Pointad				,		UpperCamelCase :						int = 10   ):





							'''simple docstring'''


							_a			  =       create_vector(UpperCamelCase				,		UpperCamelCase   )
							_a			  =       create_vector(UpperCamelCase				,		UpperCamelCase   )
							return is_zero_vector(get_ad_vectors_cross(UpperCamelCase				,		UpperCamelCase   )				,		UpperCamelCase   )

