





"""simple docstring"""


# Algorithm for the pigeonhole sorting









def 					lowercase__    (					lowercase_			)					->		int:




      """simple docstring"""

      _UpperCamelCase      :	List[str]						=       min(_lowerCAmelCase			)  # min() finds the minimum value
      _UpperCamelCase      :	List[Any]						=       max(_lowerCAmelCase			)  # max() finds the maximum value

      _UpperCamelCase      :	Union[str, Any]						=       max_val - min_val + 1  # size is difference of max and min values plus one

      # list of pigeonholes of size equal to the variable size
      _UpperCamelCase      :	List[Any]						=       [0] * size

      # Populate the pigeonholes.
      for x in a:
            assert isinstance(_lowerCAmelCase		,_lowerCAmelCase			), "integers only please"
            holes[x - min_val] += 1

      # Putting the elements back into the array in an order.
      _UpperCamelCase      :	Union[str, Any]						=       0
      for count in range(_lowerCAmelCase			):
            while holes[count] > 0:
                  holes[count] -= 1
                  _UpperCamelCase      :	Dict						=       count + min_val
                  i += 1




def 					lowercase__    (					)					->		Optional[Any]:




      """simple docstring"""

      _UpperCamelCase      :	Optional[Any]						=       [8, 3, 2, 7, 4, 6, 8]
      pigeonhole_sort(_lowerCAmelCase			)
      print("Sorted order is:"		," ".join(_lowerCAmelCase			)			)


if __name__ == "__main__":
  main()







"""simple docstring"""


class      __SCREAMING_SNAKE_CASE    :







  '''simple docstring'''


  def __init__(		self   :       Optional[Any]					,   __a   :       list[int]	)		->				None:
        _UpperCamelCase      :	Tuple						=       len(__a	)
        _UpperCamelCase      :	Dict						=       [0] * len_array

        if len_array > 0:
              _UpperCamelCase      :	Optional[Any]						=       array[0]

        for i in range(1					,   __a	):
              _UpperCamelCase      :	Tuple						=       self.prefix_sum[i - 1] + array[i]

  def    __SCREAMING_SNAKE_CASE				(		self   :       Dict					,   __a   :       int					,   __a   :       int	)		->				int:
        if start == 0:
              return self.prefix_sum[end]

        return self.prefix_sum[end] - self.prefix_sum[start - 1]


  def    __SCREAMING_SNAKE_CASE				(		self   :       Optional[Any]					,   __a   :       int	)		->				bool:
        _UpperCamelCase      :	int						=       {0}
        for sum_item in self.prefix_sum:
              if sum_item - target_sum in sums:
                    return True

              sums.add(__a	)

        return False


if __name__ == "__main__":
  import doctest

  doctest.testmod()
