



from __future__ import annotations



class 		_lowercase		:

			def __init__(      self			:       Tuple							,   __lowerCAmelCase			:       int = 0							)       ->				str:


				"""simple docstring"""






				a						=		key

			def 		A							(      self			:       Any							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       int							)       ->				list[str]:


				"""simple docstring"""






				assert isinstance(_UpperCamelCase							,   _UpperCamelCase							) and isinstance(_UpperCamelCase							,   _UpperCamelCase							)

				a						=		key or self.__key or 1

				# make sure key is an appropriate size
				key %= 255

				return [chr(ord(_UpperCamelCase							) ^ key							) for ch in content]

			def 		A							(      self			:       str							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       int							)       ->				list[str]:


				"""simple docstring"""






				assert isinstance(_UpperCamelCase							,   _UpperCamelCase							) and isinstance(_UpperCamelCase							,   _UpperCamelCase							)

				a						=		key or self.__key or 1

				# make sure key is an appropriate size
				key %= 255

				return [chr(ord(_UpperCamelCase							) ^ key							) for ch in content]

			def 		A							(      self			:       List[str]							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       int = 0							)       ->				str:


				"""simple docstring"""






				assert isinstance(_UpperCamelCase							,   _UpperCamelCase							) and isinstance(_UpperCamelCase							,   _UpperCamelCase							)

				a						=		key or self.__key or 1

				# make sure key can be any size
				while key > 255:
					key -= 255

				# This will be returned
				a						=		""""""

				for ch in content:
					ans += chr(ord(_UpperCamelCase							) ^ key							)

				return ans

			def 		A							(      self			:       Optional[Any]							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       int = 0							)       ->				str:


				"""simple docstring"""






				assert isinstance(_UpperCamelCase							,   _UpperCamelCase							) and isinstance(_UpperCamelCase							,   _UpperCamelCase							)

				a						=		key or self.__key or 1

				# make sure key can be any size
				while key > 255:
					key -= 255

				# This will be returned
				a						=		""""""

				for ch in content:
					ans += chr(ord(_UpperCamelCase							) ^ key							)

				return ans

			def 		A							(      self			:       Optional[int]							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       int = 0							)       ->				bool:


				"""simple docstring"""






				assert isinstance(_UpperCamelCase							,   _UpperCamelCase							) and isinstance(_UpperCamelCase							,   _UpperCamelCase							)

				try:
					with open(_UpperCamelCase							) as fin, open("encrypt.out"							,   "w+"							) as fout:
						# actual encrypt-process
						for line in fin:
							fout.write(self.encrypt_string(_UpperCamelCase							,   _UpperCamelCase							)							)

				except OSError:
					return False

				return True




			def 		A							(      self			:       List[Any]							,   __lowerCAmelCase			:       str							,   __lowerCAmelCase			:       int							)       ->				bool:


				"""simple docstring"""






				assert isinstance(_UpperCamelCase							,   _UpperCamelCase							) and isinstance(_UpperCamelCase							,   _UpperCamelCase							)

				try:
					with open(_UpperCamelCase							) as fin, open("decrypt.out"							,   "w+"							) as fout:
						# actual encrypt-process
						for line in fin:
							fout.write(self.decrypt_string(_UpperCamelCase							,   _UpperCamelCase							)							)

				except OSError:
					return False

				return True


# Tests
# crypt = XORCipher()
# key = 67

# # test encrypt
# print(crypt.encrypt("hallo welt",key))
# # test decrypt
# print(crypt.decrypt(crypt.encrypt("hallo welt",key), key))

# # test encrypt_string
# print(crypt.encrypt_string("hallo welt",key))

# # test decrypt_string
# print(crypt.decrypt_string(crypt.encrypt_string("hallo welt",key),key))

# if (crypt.encrypt_file("test.txt",key)):
#       print("encrypt successful")
# else:
#       print("encrypt unsuccessful")

# if (crypt.decrypt_file("encrypt.out",key)):
#       print("decrypt successful")
# else:
#       print("decrypt unsuccessful")






A_		:     Any        =     [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
A_		:     Tuple        =     [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
A_		:     Optional[int]        =     {
    0: '''Sunday''',
    1: '''Monday''',
    2: '''Tuesday''',
    3: '''Wednesday''',
    4: '''Thursday''',
    5: '''Friday''',
    6: '''Saturday''',
}


def 	UpperCAmelCase__      (      UpperCAmelCase__ :int ,					UpperCAmelCase__ :int ,					UpperCAmelCase__ :int					):






 '''simple docstring'''

 assert len(str(UpperCAmelCase__					)					) > 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:
 a						=		year // 1_00
 a						=		(5 * (century % 4) + 2) % 7
 a						=		year % 1_00
 a						=		centurian % 12
 a						=		(
     (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
 ) % 7
 a						=		(
     DOOMSDAY_NOT_LEAP[month - 1]
     if (year % 4 != 0) or (centurian == 0 and (year % 4_00) == 0)
     else DOOMSDAY_LEAP[month - 1]
 )
 a						=		(dooms_day + day - day_anchor) % 7
 return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
     import doctest

     doctest.testmod()

