






'''simple docstring'''





from __future__ import annotations






def    lowerCamelCase_     (    lowercase__				,     lowercase__				,     lowercase__				,     lowercase__):
	if (direction == 1 and array[indexa] > array[indexa]) or (
	    direction == 0 and array[indexa] < array[indexa]
	):
		lowerCamelCase__  ,	lowerCamelCase__  =     array[indexa], array[indexa]






def    lowerCamelCase_     (    lowercase__				,     lowercase__				,     lowercase__				,     lowercase__):
	if length > 1:
		lowerCamelCase__  =     int(length / 2)
		for i in range(lowercase__				,     low + middle):
			comp_and_swap(lowercase__				,     lowercase__				,     i + middle				,     lowercase__)
		bitonic_merge(lowercase__				,     lowercase__				,     lowercase__				,     lowercase__)
		bitonic_merge(lowercase__				,     low + middle				,     lowercase__				,     lowercase__)






def    lowerCamelCase_     (    lowercase__				,     lowercase__				,     lowercase__				,     lowercase__):
	if length > 1:
		lowerCamelCase__  =     int(length / 2)
		bitonic_sort(lowercase__				,     lowercase__				,     lowercase__				,     1)
		bitonic_sort(lowercase__				,     low + middle				,     lowercase__				,     0)
		bitonic_merge(lowercase__				,     lowercase__				,     lowercase__				,     lowercase__)


if __name__ == "__main__":
	__A							:							Any  							=		input("""Enter numbers separated by a comma:\n""").strip()
	__A							:							int  							=		[int(item.strip()) for item in user_input.split(""",""")]

	bitonic_sort(unsorted, 0, len(unsorted), 1)
	print("""\nSorted array in ascending order is: """, end="""""")
	print(*unsorted, sep=""", """)

	bitonic_merge(unsorted, 0, len(unsorted), 0)
	print("""Sorted array in descending order is: """, end="""""")
	print(*unsorted, sep=""", """)









'''simple docstring'''





from __future__ import annotations
class 				lowercase       :


    '''simple docstring'''

    def __init__(					self     :     Optional[int]				,     __lowerCamelCase     :     int     )							->							None:

     '''simple docstring'''




     lowerCamelCase__  =     order

     # a_{0} ... a_{k}
     lowerCamelCase__  =     [1.0] + [0.0] * order
     # b_{0} ... b_{k}
     lowerCamelCase__  =     [1.0] + [0.0] * order

     # x[n-1] ... x[n-k]
     lowerCamelCase__  =     [0.0] * self.order
     # y[n-1] ... y[n-k]
     lowerCamelCase__  =     [0.0] * self.order

    def    a__				(					self     :     Dict				,     __lowerCamelCase     :     list[float]				,     __lowerCamelCase     :     list[float]     )							->							None:

     '''simple docstring'''




     if len(__lowerCamelCase     ) < self.order:
      lowerCamelCase__  =     [1.0, *a_coeffs]

     if len(__lowerCamelCase     ) != self.order + 1:
      lowerCamelCase__  =     (
          f'''Expected a_coeffs to have {self.order + 1} elements '''
          f'''for {self.order}-order filter, got {len(__lowerCamelCase     )}'''
      )
      raise ValueError(__lowerCamelCase     )

     if len(__lowerCamelCase     ) != self.order + 1:
      lowerCamelCase__  =     (
          f'''Expected b_coeffs to have {self.order + 1} elements '''
          f'''for {self.order}-order filter, got {len(__lowerCamelCase     )}'''
      )
      raise ValueError(__lowerCamelCase     )

     lowerCamelCase__  =     a_coeffs
     lowerCamelCase__  =     b_coeffs




    def    a__				(					self     :     Dict				,     __lowerCamelCase     :     float     )							->							float:

     '''simple docstring'''




     lowerCamelCase__  =     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]
      )

     lowerCamelCase__  =     (result + self.b_coeffs[0] * sample) / self.a_coeffs[0]

     lowerCamelCase__  =     self.input_history[:-1]
     lowerCamelCase__  =     self.output_history[:-1]

     lowerCamelCase__  =     sample
     lowerCamelCase__  =     result

     return result

