

def       lowercase					(	__A :					Tuple ,    __A :					Optional[int]		)				->			Optional[int]:





    '''simple docstring'''




    snake_case							:		List[Any]        =		[1]
    for i in range(2 ,    __A		):
        factorials.append(factorials[-1] * i		)
    assert 0 <= k < factorials[-1] * n, "k out of bounds"

    snake_case							:		List[str]        =		[]
    snake_case							:		Optional[Any]        =		list(range(__A		)		)

    # Find permutation
    while factorials:
        snake_case							:		str        =		factorials.pop()
        snake_case      ,		snake_case							:		str        =		divmod(__A ,    __A		)
        permutation.append(elements[number]		)
        elements.remove(elements[number]		)
    permutation.append(elements[0]		)

    return permutation


if __name__ == "__main__":
     import doctest

     doctest.testmod()








'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


lowerCAmelCase:   List[str]					=		{
    'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     lowerCAmelCase:   str					=		[
         'FALCON_PRETRAINED_MODEL_ARCHIVE_LIST',
         'FalconForCausalLM',
         'FalconModel',
         'FalconPreTrainedModel',
         'FalconForSequenceClassification',
         'FalconForTokenClassification',
         'FalconForQuestionAnswering',
     ]


if TYPE_CHECKING:
     from .configuration_falcon import FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP, FalconConfig

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_falcon import (
              FALCON_PRETRAINED_MODEL_ARCHIVE_LIST,
              FalconForCausalLM,
              FalconForQuestionAnswering,
              FalconForSequenceClassification,
              FalconForTokenClassification,
              FalconModel,
              FalconPreTrainedModel,
          )


else:
     import sys

     lowerCAmelCase:   Optional[int]					=		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)