






__UpperCamelCase					:		int	  =						[4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
__UpperCamelCase					:		Optional[Any]	  =						[3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
__UpperCamelCase					:		Union[str, Any]	  =						{
    0: """Sunday""",
    1: """Monday""",
    2: """Tuesday""",
    3: """Wednesday""",
    4: """Thursday""",
    5: """Friday""",
    6: """Saturday""",
}
def      a_ (      _A      ,   _A      ,   _A  )			->			str:







				"""simple docstring"""
				assert len(str(_A  )  ) > 2, "year should be in YYYY format"
				assert 1 <= month <= 12, "month should be between 1 to 12"
				assert 1 <= day <= 31, "day should be between 1 to 31"

				# Doomsday algorithm:
				snake_case__									=     year // 100
				snake_case__									=     (5 * (century % 4) + 2) % 7
				snake_case__									=     year % 100
				snake_case__									=     centurian % 12
				snake_case__									=     (
				    (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
				) % 7
				snake_case__									=     (
				    DOOMSDAY_NOT_LEAP[month - 1]
				    if (year % 4 != 0) or (centurian == 0 and (year % 400) == 0)
				    else DOOMSDAY_LEAP[month - 1]
				)
				snake_case__									=     (dooms_day + day - day_anchor) % 7
				return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
							import doctest

							doctest.testmod()












__UpperCamelCase					:		List[str]	  =						256
# Modulus to hash a string
__UpperCamelCase					:		int	  =						1000003
def      a_ (      _A      ,   _A  )			->			bool:







				"""simple docstring"""
				snake_case__									=     len(_A  )
				snake_case__									=     len(_A  )
				if p_len > t_len:
								return False

				snake_case__									=     0
				snake_case__									=     0
				snake_case__									=     1

				# Calculating the hash of pattern and substring of text
				for i in range(_A  ):
								snake_case__									=     (ord(pattern[i]  ) + p_hash * alphabet_size) % modulus
								snake_case__									=     (ord(text[i]  ) + text_hash * alphabet_size) % modulus
								if i == p_len - 1:
												continue
								snake_case__									=     (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
								snake_case__									=     (
								    (text_hash - ord(text[i]  ) * modulus_power) * alphabet_size
								    + ord(text[i + p_len]  )
								) % modulus
				return False
def      a_ (      )			->			None:







				"""simple docstring"""
				snake_case__									=     'abc1abc12'
				snake_case__									=     'alskfjaldsabc1abc1abc12k23adsfabcabc'
				snake_case__									=     'alskfjaldsk23adsfabcabc'
				assert rabin_karp(_A      ,   _A  ) and not rabin_karp(_A      ,   _A  )

				# Test 2)
				snake_case__									=     'ABABX'
				snake_case__									=     'ABABZABABYABABX'
				assert rabin_karp(_A      ,   _A  )

				# Test 3)
				snake_case__									=     'AAAB'
				snake_case__									=     'ABAAAAAB'
				assert rabin_karp(_A      ,   _A  )

				# Test 4)
				snake_case__									=     'abcdabcy'
				snake_case__									=     'abcxabcdabxabcdabcdabcy'
				assert rabin_karp(_A      ,   _A  )

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


if __name__ == "__main__":
							test_rabin_karp()




