


from math import isclose, sqrt

def 			_a  (				SCREAMING_SNAKE_CASE	:				float    , SCREAMING_SNAKE_CASE	:				float    , SCREAMING_SNAKE_CASE	:				float     ):







 """simple docstring"""



 UpperCamelCase__					:    Union[str, Any]          =   point_y / 4 / point_x
 UpperCamelCase__					:    List[Any]          =   2 * normal_gradient / (1 + normal_gradient * normal_gradient)
 UpperCamelCase__					:    Union[str, Any]          =   (1 - normal_gradient * normal_gradient) / (
     1 + normal_gradient * normal_gradient
 )
 UpperCamelCase__					:    List[str]          =   (sa - ca * incoming_gradient) / (ca + sa * incoming_gradient)

 # to find the next point, solve the simultaeneous equations:
 # y^2 + 4x^2 = 100
 # y - b = m * (x - a)
 # ==> A x^2 + B x + C = 0
 UpperCamelCase__					:    Union[str, Any]          =   outgoing_gradient**2 + 4
 UpperCamelCase__					:    str          =   2 * outgoing_gradient * (point_y - outgoing_gradient * point_x)
 UpperCamelCase__					:    Dict          =   (point_y - outgoing_gradient * point_x) ** 2 - 100

 UpperCamelCase__					:    Optional[int]          =   (
     -linear_term - sqrt(linear_term**2 - 4 * quadratic_term * constant_term     )
 ) / (2 * quadratic_term)
 UpperCamelCase__					:    Optional[int]          =   (
     -linear_term + sqrt(linear_term**2 - 4 * quadratic_term * constant_term     )
 ) / (2 * quadratic_term)

 # two solutions, one of which is our input point
 UpperCamelCase__					:    Optional[int]          =   x_minus if isclose(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     ) else x_plus
 UpperCamelCase__					:    Optional[int]          =   point_y + outgoing_gradient * (next_x - point_x)

 return next_x, next_y, outgoing_gradient

def 			_a  (				SCREAMING_SNAKE_CASE	:				float = 1.4    , SCREAMING_SNAKE_CASE	:				float = -9.6     ):







 """simple docstring"""



 UpperCamelCase__					:    int          =   0
 UpperCamelCase__					:    float          =   first_x_coord
 UpperCamelCase__					:    float          =   first_y_coord
 UpperCamelCase__					:    float          =   (10.1 - point_y) / (0.0 - point_x)

 while not (-0.01 <= point_x <= 0.01 and point_y > 0):
  UpperCamelCase__       ,				UpperCamelCase__       ,				UpperCamelCase__					:    Dict          =   next_point(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )
  num_reflections += 1

 return num_reflections


if __name__ == "__main__":
       print(f"{solution() = }")






__UpperCamelCase       :       List[Any]						       =				256
# Modulus to hash a string
__UpperCamelCase       :       Union[str, Any]						       =				100_0003

def 			_a  (				SCREAMING_SNAKE_CASE	:				str    , SCREAMING_SNAKE_CASE	:				str     ):







 """simple docstring"""



 UpperCamelCase__					:    Optional[int]          =   len(SCREAMING_SNAKE_CASE     )
 UpperCamelCase__					:    List[Any]          =   len(SCREAMING_SNAKE_CASE     )
 if p_len > t_len:
  return False

 UpperCamelCase__					:    Any          =   0
 UpperCamelCase__					:    str          =   0
 UpperCamelCase__					:    List[Any]          =   1

 # Calculating the hash of pattern and substring of text
 for i in range(SCREAMING_SNAKE_CASE     ):
  UpperCamelCase__					:    Any          =   (ord(pattern[i]     ) + p_hash * alphabet_size) % modulus
  UpperCamelCase__					:    List[str]          =   (ord(text[i]     ) + text_hash * alphabet_size) % modulus
  if i == p_len - 1:
   continue
  UpperCamelCase__					:    Dict          =   (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
  UpperCamelCase__					:    Optional[int]          =   (
      (text_hash - ord(text[i]     ) * modulus_power) * alphabet_size
      + ord(text[i + p_len]     )
  ) % modulus
 return False

def 			_a  (				):







 """simple docstring"""



 UpperCamelCase__					:    Tuple          =   '''abc1abc12'''
 UpperCamelCase__					:    Dict          =   '''alskfjaldsabc1abc1abc12k23adsfabcabc'''
 UpperCamelCase__					:    List[str]          =   '''alskfjaldsk23adsfabcabc'''
 assert rabin_karp(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     ) and not rabin_karp(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )

 # Test 2)
 UpperCamelCase__					:    Optional[int]          =   '''ABABX'''
 UpperCamelCase__					:    int          =   '''ABABZABABYABABX'''
 assert rabin_karp(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )

 # Test 3)
 UpperCamelCase__					:    int          =   '''AAAB'''
 UpperCamelCase__					:    str          =   '''ABAAAAAB'''
 assert rabin_karp(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )

 # Test 4)
 UpperCamelCase__					:    Union[str, Any]          =   '''abcdabcy'''
 UpperCamelCase__					:    List[str]          =   '''abcxabcdabxabcdabcdabcy'''
 assert rabin_karp(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )

 # Test 5)
 UpperCamelCase__					:    Tuple          =   '''Lü'''
 UpperCamelCase__					:    Any          =   '''Lüsai'''
 assert rabin_karp(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )
 UpperCamelCase__					:    Dict          =   '''Lue'''
 assert not rabin_karp(SCREAMING_SNAKE_CASE    , SCREAMING_SNAKE_CASE     )
 print('''Success.'''     )


if __name__ == "__main__":
       test_rabin_karp()


