



def 	_lowercase	(     UpperCAmelCase_						,   UpperCAmelCase_):




 """simple docstring"""




 if not len(lowerCAmelCase__) == len(lowerCAmelCase__) == 3:
  raise ValueError("""Please enter a valid equation.""")
 if equationa[0] == equationa[1] == equationa[0] == equationa[1] == 0:
  raise ValueError("""Both a & b of two equations can\'t be zero.""")

 # Extract the coefficients
 snake_case__							,		snake_case__							,		snake_case__				:							Any      							= equationa
 snake_case__							,		snake_case__							,		snake_case__				:							str      							= equationa

 # Calculate the determinants of the matrices
 snake_case__				:							Dict      							= aa * ba - aa * ba
 snake_case__				:							Union[str, Any]      							= ca * ba - ca * ba
 snake_case__				:							List[Any]      							= aa * ca - aa * ca

 # Check if the system of linear equations has a solution (using Cramer's rule)
 if determinant == 0:
  if determinant_x == determinant_y == 0:
   raise ValueError("""Infinite solutions. (Consistent system)""")
  else:
   raise ValueError("""No solution. (Inconsistent system)""")
 else:
  if determinant_x == determinant_y == 0:
   # Trivial solution (Inconsistent system)
   return (0.0, 0.0)
  else:
   snake_case__				:							Tuple      							= determinant_x / determinant
   snake_case__				:							Any      							= determinant_y / determinant
   # Non-Trivial Solution (Consistent system)
   return (x, y)









__snake_case     :Any			       =256
# Modulus to hash a string
__snake_case     :Optional[int]			       =1000003






def  lowerCamelCase_	(      lowerCAmelCase__	:	str			,	lowerCAmelCase__	:	str				)       ->							bool:

							'''simple docstring'''






							A      						=    len(lowerCAmelCase__				)
							A      						=    len(lowerCAmelCase__				)
							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(lowerCAmelCase__				):
														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  lowerCamelCase_	(      )       ->							None:

							'''simple docstring'''






							A      						=    'abc1abc12'
							A      						=    'alskfjaldsabc1abc1abc12k23adsfabcabc'
							A      						=    'alskfjaldsk23adsfabcabc'
							assert rabin_karp(lowerCAmelCase__			,	lowerCAmelCase__				) and not rabin_karp(lowerCAmelCase__			,	lowerCAmelCase__				)

							# Test 2)
							A      						=    'ABABX'
							A      						=    'ABABZABABYABABX'
							assert rabin_karp(lowerCAmelCase__			,	lowerCAmelCase__				)

							# Test 3)
							A      						=    'AAAB'
							A      						=    'ABAAAAAB'
							assert rabin_karp(lowerCAmelCase__			,	lowerCAmelCase__				)

							# Test 4)
							A      						=    'abcdabcy'
							A      						=    'abcxabcdabxabcdabcdabcy'
							assert rabin_karp(lowerCAmelCase__			,	lowerCAmelCase__				)

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


if __name__ == "__main__":
				test_rabin_karp()