





from __future__ import annotations




def 		lowerCAmelCase_    (  __UpperCAmelCase:			int		,   __UpperCAmelCase:			int      )      ->	list[list[int]]:
    UpperCamelCase__							:				list[list[int]]          =      []
    create_all_state(1		,   __UpperCAmelCase		,   __UpperCAmelCase		,   []		,   __UpperCAmelCase      )
    return result




def 		lowerCAmelCase_    (  __UpperCAmelCase:			int		,   __UpperCAmelCase:			int		,   __UpperCAmelCase:			int		,   __UpperCAmelCase:			list[int]		,   __UpperCAmelCase:			list[list[int]]		,   )      ->	None:
    if level == 0:
        total_list.append(current_list[:]      )
        return

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




def 		lowerCAmelCase_    (  __UpperCAmelCase:			list[list[int]]      )      ->	None:
    for i in total_list:
        print(*__UpperCAmelCase      )


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








import random




def 		lowerCAmelCase_    (  __UpperCAmelCase:			list		,   __UpperCAmelCase:			Optional[int]      )      ->	tuple:
    UpperCamelCase__   ,UpperCamelCase__   ,UpperCamelCase__							:				List[Any]          =      [], [], []
    for element in data:
        if element < pivot:
            less.append(__UpperCAmelCase      )
        elif element > pivot:
            greater.append(__UpperCAmelCase      )
        else:
            equal.append(__UpperCAmelCase      )
    return less, equal, greater





def 		lowerCAmelCase_    (  __UpperCAmelCase:			list		,   __UpperCAmelCase:			int      )      ->	List[str]:
    # index = len(items) // 2 when trying to find the median
    #   (value of index when items is sorted)

    # invalid input
    if index >= len(__UpperCAmelCase      ) or index < 0:
        return None

    UpperCamelCase__							:				List[str]          =      items[random.randint(0		,   len(__UpperCAmelCase      ) - 1      )]
    UpperCamelCase__							:				List[Any]          =      0
    UpperCamelCase__   ,UpperCamelCase__   ,UpperCamelCase__							:				int          =      _partition(__UpperCAmelCase		,   __UpperCAmelCase      )
    UpperCamelCase__							:				Union[str, Any]          =      len(__UpperCAmelCase      )
    UpperCamelCase__							:				Dict          =      len(__UpperCAmelCase      )

    # index is the pivot
    if m <= index < m + count:
        return pivot
    # must be in smaller
    elif m > index:
        return quick_select(__UpperCAmelCase		,   __UpperCAmelCase      )
    # must be in larger
    else:
        return quick_select(__UpperCAmelCase		,   index - (m + count)      )

