


def 						__SCREAMING_SNAKE_CASE       (					lowercase_			,					lowercase_			)		->    Optional[int]:




						'''simple docstring'''







						__UpperCAmelCase :       int  						=  [1]
						for i in range(2			,					lowercase_			):
												factorials.append(factorials[-1] * i			)
						assert 0 <= k < factorials[-1] * n, "k out of bounds"

						__UpperCAmelCase :       Any  						=  []
						__UpperCAmelCase :       List[Any]  						=  list(range(lowercase_			)			)

						# Find permutation
						while factorials:
												__UpperCAmelCase :       Optional[Any]  						=  factorials.pop()
												__UpperCAmelCase						,			__UpperCAmelCase :       Union[str, Any]  						=  divmod(lowercase_			,					lowercase_			)
												permutation.append(elements[number]			)
												elements.remove(elements[number]			)
						permutation.append(elements[0]			)

						return permutation


if __name__ == "__main__":
				import doctest

				doctest.testmod()





from __future__ import annotations




def 						__SCREAMING_SNAKE_CASE       (					lowercase_			)		->    int:




						'''simple docstring'''







						if not nums:
												return 0
						__UpperCAmelCase :       int  						=  nums[0]
						__UpperCAmelCase :       Optional[Any]  						=  0
						for num in nums[1:]:
												__UpperCAmelCase						,			__UpperCAmelCase :       int  						=  (
												    max_excluding + num,
												    max(lowercase_			,					lowercase_			),
												)
						return max(lowercase_			,					lowercase_			)


if __name__ == "__main__":
				import doctest

				doctest.testmod()

