




from __future__ import annotations




class       __lowerCAmelCase				:






       def __init__(      self:    Optional[Any]				,    _lowerCAmelCase:    int = 0 ):
         lowercase			:List[str]							=  key






       def     SCREAMING_SNAKE_CASE			(      self:    Tuple				,    _lowerCAmelCase:    str				,    _lowerCAmelCase:    int ):
         assert isinstance(_lowerCAmelCase				,    _lowerCAmelCase ) and isinstance(_lowerCAmelCase				,    _lowerCAmelCase )

         lowercase			:str							=  key or self.__key or 1

         # make sure key is an appropriate size
         key %= 2_55

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






       def     SCREAMING_SNAKE_CASE			(      self:    List[str]				,    _lowerCAmelCase:    str				,    _lowerCAmelCase:    int ):
         assert isinstance(_lowerCAmelCase				,    _lowerCAmelCase ) and isinstance(_lowerCAmelCase				,    _lowerCAmelCase )

         lowercase			:Tuple							=  key or self.__key or 1

         # make sure key is an appropriate size
         key %= 2_55

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






       def     SCREAMING_SNAKE_CASE			(      self:    Dict				,    _lowerCAmelCase:    str				,    _lowerCAmelCase:    int = 0 ):
         assert isinstance(_lowerCAmelCase				,    _lowerCAmelCase ) and isinstance(_lowerCAmelCase				,    _lowerCAmelCase )

         lowercase			:Dict							=  key or self.__key or 1

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

         # This will be returned
         lowercase			:Dict							=  ""

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

         return ans






       def     SCREAMING_SNAKE_CASE			(      self:    Optional[int]				,    _lowerCAmelCase:    str				,    _lowerCAmelCase:    int = 0 ):
         assert isinstance(_lowerCAmelCase				,    _lowerCAmelCase ) and isinstance(_lowerCAmelCase				,    _lowerCAmelCase )

         lowercase			:List[Any]							=  key or self.__key or 1

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

         # This will be returned
         lowercase			:List[Any]							=  ""

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

         return ans






       def     SCREAMING_SNAKE_CASE			(      self:    Union[str, Any]				,    _lowerCAmelCase:    str				,    _lowerCAmelCase:    int = 0 ):
         assert isinstance(_lowerCAmelCase				,    _lowerCAmelCase ) and isinstance(_lowerCAmelCase				,    _lowerCAmelCase )

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

         except OSError:
           return False

         return True






       def     SCREAMING_SNAKE_CASE			(      self:    List[Any]				,    _lowerCAmelCase:    str				,    _lowerCAmelCase:    int ):
         assert isinstance(_lowerCAmelCase				,    _lowerCAmelCase ) and isinstance(_lowerCAmelCase				,    _lowerCAmelCase )

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

         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")









import math
import sys



def 					UpperCAmelCase__     (   lowerCamelCase      ):
  if number != int(lowerCamelCase      ):
    raise ValueError("the value of input must be a natural number"      )
  if number < 0:
    raise ValueError("the value of input must not be a negative number"      )
  if number == 0:
    return 1
  lowercase			:Dict							=  [-1] * (number + 1)
  lowercase			:Optional[Any]							=  0
  for i in range(1,	number + 1      ):
    lowercase			:Optional[int]							=  sys.maxsize
    lowercase			:Any							=  int(math.sqrt(lowerCamelCase      )      )
    for j in range(1,	root + 1      ):
      lowercase			:Any							=  1 + answers[i - (j**2)]
      lowercase			:Dict							=  min(lowerCamelCase,	lowerCamelCase      )
    lowercase			:Union[str, Any]							=  answer
  return answers[number]


if __name__ == "__main__":
     import doctest

     doctest.testmod()



