





"""simple docstring"""





from __future__ import annotations
def  __A   (_SCREAMING_SNAKE_CASE     ,   _SCREAMING_SNAKE_CASE			)					->bool:





  """simple docstring"""


  lowerCAmelCase__			:List[str]											=							get_failure_array(_lowerCAmelCase			)

  # 2) Step through text searching for pattern
  lowerCAmelCase__			:Optional[int]											=							0, 0  # index into text, pattern
  while i < len(_lowerCAmelCase			):
    if pattern[j] == text[i]:
      if j == (len(_lowerCAmelCase			) - 1):
        return True
      j += 1

    # if this is a prefix in our pattern
    # just go back far enough to continue
    elif j > 0:
      lowerCAmelCase__			:Optional[Any]											=							failure[j - 1]
      continue
    i += 1
  return False
def  __A   (_SCREAMING_SNAKE_CASE			)					->list[int]:





  """simple docstring"""


  lowerCAmelCase__			:str											=							[0]
  lowerCAmelCase__			:Tuple											=							0
  lowerCAmelCase__			:List[Any]											=							1
  while j < len(_lowerCAmelCase			):
    if pattern[i] == pattern[j]:
      i += 1
    elif i > 0:
      lowerCAmelCase__			:str											=							failure[i - 1]
      continue
    j += 1
    failure.append(_lowerCAmelCase			)
  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]





'''simple docstring'''





_UpperCamelCase											=						tuple[float, float, float]
_UpperCamelCase											=						tuple[float, float, float]

def        a_     (							_lowerCAmelCase       ,_lowerCAmelCase       )      ->      Vectorad:
  __lowerCamelCase       :       Any           = end_pointa[0] - end_pointa[0]
  __lowerCamelCase       :       str           = end_pointa[1] - end_pointa[1]
  __lowerCamelCase       :       Tuple           = end_pointa[2] - end_pointa[2]
  return (x, y, z)

def        a_     (							_lowerCAmelCase       ,_lowerCAmelCase       )      ->      Vectorad:
  __lowerCamelCase       :       List[str]           = ab[1] * ac[2] - ab[2] * ac[1]  # *i
  __lowerCamelCase       :       Dict           = (ab[0] * ac[2] - ab[2] * ac[0]) * -1  # *j
  __lowerCamelCase       :       List[Any]           = ab[0] * ac[1] - ab[1] * ac[0]  # *k
  return (x, y, z)

def        a_     (							_lowerCAmelCase       ,_lowerCAmelCase       )      ->      bool:
  return tuple(round(_lowerCAmelCase       ,_lowerCAmelCase       ) for x in vector       ) == (0, 0, 0)


def        a_     (							_lowerCAmelCase       ,_lowerCAmelCase       ,_lowerCAmelCase       ,_lowerCAmelCase = 10       )      ->      bool:
  __lowerCamelCase       :       str           = create_vector(_lowerCAmelCase       ,_lowerCAmelCase       )
  __lowerCamelCase       :       Dict           = create_vector(_lowerCAmelCase       ,_lowerCAmelCase       )
  return is_zero_vector(get_ad_vectors_cross(_lowerCAmelCase       ,_lowerCAmelCase       )       ,_lowerCAmelCase       )






