"""simple docstring"""


from __future__ import annotations






def     __UpperCAmelCase					(			lowercase   ,lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      []
  create_all_state(1   ,lowercase   ,lowercase   ,[]   ,lowercase		)
  return result






def     __UpperCAmelCase					(			lowercase   ,lowercase   ,lowercase   ,lowercase   ,lowercase   ,):







  """simple docstring"""
  if level == 0:
    total_list.append(current_list[:]		)
    return

  for i in range(lowercase   ,total_number - level + 2		):
    current_list.append(lowercase		)
    create_all_state(i + 1   ,lowercase   ,level - 1   ,lowercase   ,lowercase		)
    current_list.pop()






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  for i in total_list:
    print(*lowercase		)


if __name__ == "__main__":
    UpperCAmelCase__  		=						4
    UpperCAmelCase__  		=						2
    UpperCAmelCase__  		=						generate_all_combinations(n, k)
    print_all_state(total_list)



"""simple docstring"""


from __future__ import annotations

from random import choice






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  return choice(lowercase		)






def     __UpperCAmelCase					(			lowercase   ,lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      random_pivot(lowercase		)

  # partition based on pivot
  # linear time
  _UpperCAmelCase						 =      [e for e in lst if e < pivot]
  _UpperCAmelCase						 =      [e for e in lst if e > pivot]

  # if we get lucky, pivot might be the element we want.
  # we can easily see this:
  # small (elements smaller than k)
  # + pivot (kth element)
  # + big (elements larger than k)
  if len(lowercase		) == k - 1:
    return pivot
  # pivot is in elements bigger than k
  elif len(lowercase		) < k - 1:
    return kth_number(lowercase   ,k - len(lowercase		) - 1		)
  # pivot is in elements smaller than k
  else:
    return kth_number(lowercase   ,lowercase		)


if __name__ == "__main__":
    import doctest

    doctest.testmod()
