

from __future__ import annotations

def        lowerCamelCase__       (    _a							,	_a):
	SCREAMING_SNAKE_CASE      :					Tuple    =				get_failure_array(_a)

	# 2) Step through text searching for pattern
	SCREAMING_SNAKE_CASE   ,SCREAMING_SNAKE_CASE      :					Union[str, Any]    =				0, 0  # index into text, pattern
	while i < len(_a):
		if pattern[j] == text[i]:
			if j == (len(_a) - 1):
				return True
			j += 1

		# if this is a prefix in our pattern
		# just go back far enough to continue
		elif j > 0:
			SCREAMING_SNAKE_CASE      :					List[str]    =				failure[j - 1]
			continue
		i += 1
	return False

def        lowerCamelCase__       (    _a):
	SCREAMING_SNAKE_CASE      :					Any    =				[0]
	SCREAMING_SNAKE_CASE      :					Tuple    =				0
	SCREAMING_SNAKE_CASE      :					Optional[int]    =				1
	while j < len(_a):
		if pattern[i] == pattern[j]:
			i += 1
		elif i > 0:
			SCREAMING_SNAKE_CASE      :					Union[str, Any]    =				failure[i - 1]
			continue
		j += 1
		failure.append(_a)
	return failure


if __name__ == "__main__":
			# Test 1)
			a_     =			'abc1abc12'
			a_     =			'alskfjaldsabc1abc1abc12k23adsfabcabc'
			a_     =			'alskfjaldsk23adsfabcabc'
			assert kmp(pattern, texta) and not kmp(pattern, texta)

			# Test 2)
			a_     =			'ABABX'
			a_     =			'ABABZABABYABABX'
			assert kmp(pattern, text)

			# Test 3)
			a_     =			'AAAB'
			a_     =			'ABAAAAAB'
			assert kmp(pattern, text)

			# Test 4)
			a_     =			'abcdabcy'
			a_     =			'abcxabcdabxabcdabcdabcy'
			assert kmp(pattern, text)

			# Test 5)
			a_     =			'aabaabaaa'
			assert get_failure_array(pattern) == [0, 1, 0, 1, 2, 3, 4, 5, 2]





from __future__ import annotations

import typing
from collections.abc import Iterable

import numpy as np

_lowerCamelCase	:		str							       =   typing.Union[Iterable[float], Iterable[int], np.ndarray]  # noqa: UP007
_lowerCamelCase	:		Tuple							       =   typing.Union[np.floataa, int, float]  # noqa: UP007







def SCREAMING_SNAKE_CASE				(       lowercase_ ,				lowercase_						)   ->       VectorOut:



       """simple docstring"""

       return np.sqrt(np.sum((np.asarray(lowercase_						) - np.asarray(lowercase_						)) ** 2						)						)







def SCREAMING_SNAKE_CASE				(       lowercase_ ,				lowercase_						)   ->       VectorOut:



       """simple docstring"""

       return sum((va - va) ** 2 for va, va in zip(lowercase_ ,				lowercase_						)						) ** (1 / 2)


if __name__ == "__main__":







  def SCREAMING_SNAKE_CASE				(       )   ->       None:



         """simple docstring"""

         from timeit import timeit

         print('''Without Numpy'''						)
         print(
             timeit(
                 '''euclidean_distance_no_np([1, 2, 3], [4, 5, 6])''' ,				number=10_000 ,				globals=globals() ,				)						)
         print('''With Numpy'''						)
         print(
             timeit(
                 '''euclidean_distance([1, 2, 3], [4, 5, 6])''' ,				number=10_000 ,				globals=globals() ,				)						)
  benchmark()


