

from __future__ import annotations


class 				SCREAMING_SNAKE_CASE__ :





    def __init__(				self						,       a):
         lowercase__   :       Dict				=	order

         # a_{0} ... a_{k}
         lowercase__   :       str				=	[1.0] + [0.0] * order
         # b_{0} ... b_{k}
         lowercase__   :       Tuple				=	[1.0] + [0.0] * order

         # x[n-1] ... x[n-k]
         lowercase__   :       Optional[Any]				=	[0.0] * self.order
         # y[n-1] ... y[n-k]
         lowercase__   :       Optional[Any]				=	[0.0] * self.order





    def 				snake_case_    (				self						,       a						,       a):
         if len(a) < self.order:
              lowercase__   :       str				=	[1.0, *a_coeffs]

         if len(a) != self.order + 1:
              lowercase__   :       Optional[int]				=	(
                  f"""Expected a_coeffs to have {self.order + 1} elements """
                  f"""for {self.order}-order filter, got {len(a)}"""
              )
              raise ValueError(a)

         if len(a) != self.order + 1:
              lowercase__   :       List[str]				=	(
                  f"""Expected b_coeffs to have {self.order + 1} elements """
                  f"""for {self.order}-order filter, got {len(a)}"""
              )
              raise ValueError(a)

         lowercase__   :       List[Any]				=	a_coeffs
         lowercase__   :       Optional[int]				=	b_coeffs





    def 				snake_case_    (				self						,       a):
         lowercase__   :       Tuple				=	0.0

         # Start at index 1 and do index 0 at the end.
         for i in range(1						,       self.order + 1):
              result += (
                  self.b_coeffs[i] * self.input_history[i - 1]
                  - self.a_coeffs[i] * self.output_history[i - 1]
              )

         lowercase__   :       Union[str, Any]				=	(result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

         lowercase__   :       Any				=	self.input_history[:-1]
         lowercase__   :       Optional[int]				=	self.output_history[:-1]

         lowercase__   :       Union[str, Any]				=	sample
         lowercase__   :       Any				=	result

         return result




import math
import sys

def      snake_case__      (   SCREAMING_SNAKE_CASE_		:   int      ):



     '''simple docstring'''





     if number != int(SCREAMING_SNAKE_CASE_      ):
          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__   :       Tuple				=	[-1] * (number + 1)
     lowercase__   :       Tuple				=	0
     for i in range(1     ,					number + 1      ):
          lowercase__   :       Tuple				=	sys.maxsize
          lowercase__   :       str				=	int(math.sqrt(SCREAMING_SNAKE_CASE_      )      )
          for j in range(1     ,					root + 1      ):
               lowercase__   :       List[Any]				=	1 + answers[i - (j**2)]
               lowercase__   :       str				=	min(SCREAMING_SNAKE_CASE_     ,					SCREAMING_SNAKE_CASE_      )
          lowercase__   :       List[str]				=	answer
     return answers[number]


if __name__ == "__main__":
       import doctest

       doctest.testmod()

