import string

import numpy
def  snake_case						(__lowercase ,      __lowercase						)	->	int:

      '''simple docstring'''



      return b if a == 0 else greatest_common_divisor(b % a ,      _lowercase						)



class        lowercase_   :
       _lowerCamelCase						=		string.ascii_uppercase + string.digits
       # This cipher takes alphanumerics into account
       # i.e. a total of 36 characters

       # take x and return x % len(key_string)
       _lowerCamelCase						=		numpy.vectorize(lambda __snake_case		: x % 36		)

       _lowerCamelCase						=		numpy.vectorize(__snake_case		)



       def __init__(						self				,    lowercase_    ):
             _snake_case						:					str    =   self.modulus(__A    )  # mod36 calc's on the encrypt key
             self.check_determinant()  # validate the determinant of the encryption key
             _snake_case						:					Optional[Any]    =   encrypt_key.shape[0]



       def 	UpperCamelCase	(						self				,    lowercase_    ):
             return self.key_string.index(__A    )



       def 	UpperCamelCase	(						self				,    lowercase_    ):
             return self.key_string[round(__A    )]



       def 	UpperCamelCase	(						self    ):
             _snake_case						:					int    =   round(numpy.linalg.det(self.encrypt_key    )    )

             if det < 0:
                   _snake_case						:					List[str]    =   det % len(self.key_string    )

             _snake_case						:					str    =   len(self.key_string    )
             if greatest_common_divisor(__A				,    len(self.key_string    )    ) != 1:
                   _snake_case						:					Optional[int]    =   (
                       f"""determinant modular {req_l} of encryption key({det}) """
                       f"""is not co prime w.r.t {req_l}.\nTry another key."""
                   )
                   raise ValueError(__A    )



       def 	UpperCamelCase	(						self				,    lowercase_    ):
             _snake_case						:					Tuple    =   [char for char in text.upper() if char in self.key_string]

             _snake_case						:					Optional[Any]    =   chars[-1]
             while len(__A    ) % self.break_key != 0:
                   chars.append(__A    )

             return "".join(__A    )



       def 	UpperCamelCase	(						self				,    lowercase_    ):
             _snake_case						:					Any    =   self.process_text(text.upper()    )
             _snake_case						:					List[str]    =   ""

             for i in range(0				,    len(__A    ) - self.break_key + 1				,    self.break_key    ):
                   _snake_case						:					Any    =   text[i : i + self.break_key]
                   _snake_case						:					Dict    =   [self.replace_letters(__A    ) for char in batch]
                   _snake_case						:					Optional[int]    =   numpy.array([vec]    ).T
                   _snake_case						:					int    =   self.modulus(self.encrypt_key.dot(__A    )    ).T.tolist()[
                       0
                   ]
                   _snake_case						:					List[str]    =   "".join(
                       self.replace_digits(__A    ) for num in batch_encrypted    )
                   encrypted += encrypted_batch

             return encrypted



       def 	UpperCamelCase	(						self    ):
             _snake_case						:					int    =   round(numpy.linalg.det(self.encrypt_key    )    )

             if det < 0:
                   _snake_case						:					List[str]    =   det % len(self.key_string    )
             _snake_case						:					Optional[Any]    =   None
             for i in range(len(self.key_string    )    ):
                   if (det * i) % len(self.key_string    ) == 1:
                         _snake_case						:					Optional[Any]    =   i
                         break

             _snake_case						:					List[str]    =   (
                 det_inv
                 * numpy.linalg.det(self.encrypt_key    )
                 * numpy.linalg.inv(self.encrypt_key    )
             )

             return self.to_int(self.modulus(__A    )    )



       def 	UpperCamelCase	(						self				,    lowercase_    ):
             _snake_case						:					int    =   self.make_decrypt_key()
             _snake_case						:					Dict    =   self.process_text(text.upper()    )
             _snake_case						:					Union[str, Any]    =   ""

             for i in range(0				,    len(__A    ) - self.break_key + 1				,    self.break_key    ):
                   _snake_case						:					Optional[Any]    =   text[i : i + self.break_key]
                   _snake_case						:					Any    =   [self.replace_letters(__A    ) for char in batch]
                   _snake_case						:					List[Any]    =   numpy.array([vec]    ).T
                   _snake_case						:					Dict    =   self.modulus(decrypt_key.dot(__A    )    ).T.tolist()[0]
                   _snake_case						:					List[Any]    =   "".join(
                       self.replace_digits(__A    ) for num in batch_decrypted    )
                   decrypted += decrypted_batch

             return decrypted




def  snake_case						()	->	str:

      '''simple docstring'''



      _snake_case						:					Dict    =   int(input("Enter the order of the encryption key: "						)						)
      _snake_case						:					Tuple    =   []

      print("Enter each row of the encryption key with space separated integers"						)
      for _ in range(_lowercase						):
            _snake_case						:					List[Any]    =   [int(_lowercase						) for x in input().split()]
            hill_matrix.append(_lowercase						)

      _snake_case						:					Optional[Any]    =   HillCipher(numpy.array(_lowercase						)						)

      print("Would you like to encrypt or decrypt some text? (1 or 2)"						)
      _snake_case						:					Any    =   input("\n1. Encrypt\n2. Decrypt\n"						)
      if option == "1":
            _snake_case						:					List[str]    =   input("What text would you like to encrypt?: "						)
            print("Your encrypted text is:"						)
            print(hc.encrypt(_lowercase						)						)
      elif option == "2":
            _snake_case						:					Any    =   input("What text would you like to decrypt?: "						)
            print("Your decrypted text is:"						)
            print(hc.decrypt(_lowercase						)						)


if __name__ == "__main__":
    import doctest

    doctest.testmod()

    main()
from __future__ import annotations
def  snake_case						(__lowercase ,      __lowercase						)	->	float:

						'''simple docstring'''



						_snake_case						:					Any    =   sorted(numsa + numsa						)
						_snake_case    ,_snake_case						:					Any    =   divmod(len(__lowercase						) ,      2						)
						if mod == 1:
												return all_numbers[div]
						else:
												return (all_numbers[div] + all_numbers[div - 1]) / 2


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				__SCREAMING_SNAKE_CASE						:   Union[str, Any]         =			[float(x) for x in input('Enter the elements of first array: ').split()]
				__SCREAMING_SNAKE_CASE						:   List[Any]         =			[float(x) for x in input('Enter the elements of second array: ').split()]
				print(F'''The median of two arrays is: {median_of_two_arrays(array_a, array_a)}''')