
"""simple docstring"""



from math import factorial
def 					_UpperCAmelCase      ( __lowerCamelCase   :       int ,					__lowerCamelCase   :       int ,					__lowerCamelCase   :       float		)     ->					float:
  if successes > trials:
    raise ValueError('''successes must be lower or equal to trials'''		)
  if trials < 0 or successes < 0:
    raise ValueError('''the function is defined for non-negative integers'''		)
  if not isinstance(__lowerCamelCase ,					__lowerCamelCase		) or not isinstance(__lowerCamelCase ,					__lowerCamelCase		):
    raise ValueError('''the function is defined for non-negative integers'''		)
  if not 0 < prob < 1:
    raise ValueError('''prob has to be in range of 1 - 0'''		)
  _snake_case					     =       (prob**successes) * ((1 - prob) ** (trials - successes))
  # Calculate the binomial coefficient: n! / k!(n-k)!
  _snake_case					     =       float(factorial(__lowerCamelCase		)		)
  coefficient /= factorial(__lowerCamelCase		) * factorial(trials - successes		)
  return probability * coefficient


if __name__ == "__main__":
 from doctest import testmod

 testmod()
 print('Probability of 2 successes out of 4 trails')
 print('with probability of 0.75 is:', end=' ')
 print(binomial_distribution(2, 4, 0.75))





"""simple docstring"""



from __future__ import annotations

from bisect import bisect_left
from functools import total_ordering
from heapq import merge

@total_ordering
class       lowerCAmelCase__				(						A_	):







     def __lt__(							self			:			Any    ,      _lowerCamelCase			:			int			):
       return self[-1] < other[-1]







     def __eq__(							self			:			int    ,      _lowerCamelCase			:			Optional[Any]			):
       return self[-1] == other[-1]






def 					_UpperCAmelCase      ( __lowerCamelCase   :       list		)     ->					list:
  _snake_case					     =       []
  # sort into stacks
  for element in collection:
    _snake_case					     =       Stack([element]		)
    _snake_case					     =       bisect_left(__lowerCamelCase ,					__lowerCamelCase		)
    if i != len(__lowerCamelCase		):
      stacks[i].append(__lowerCamelCase		)
    else:
      stacks.append(__lowerCamelCase		)

    # use a heap-based merge to merge stack efficiently
  _snake_case					     =       merge(*(reversed(__lowerCamelCase		) for stack in stacks)		)
  return collection


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



