
from __future__ import annotations






def 	a_		(	__lowercase       :     list[int]	, __lowercase       :     int			)			->  list[list[int]]:
			_snake_case          =      []
			_snake_case          =      []
			_snake_case          =      0
			_snake_case          =      sum(__lowercase			)
			create_state_space_tree(__lowercase	, __lowercase	, __lowercase	, __lowercase	, __lowercase	, __lowercase			)
			return result






def 	a_		(	__lowercase       :     list[int]	, __lowercase       :     int	, __lowercase       :     int	, __lowercase       :     list[int]	, __lowercase       :     list[list[int]]	, __lowercase       :     int	, )			->  None:
			if sum(__lowercase			) > max_sum or (remaining_nums_sum + sum(__lowercase			)) < max_sum:
						return
			if sum(__lowercase			) == max_sum:
						result.append(__lowercase			)
						return
			for index in range(__lowercase	, len(__lowercase			)			):
						create_state_space_tree(
						    __lowercase	, __lowercase	, index + 1	, [*path, nums[index]]	, __lowercase	, remaining_nums_sum - nums[index]	, )
_lowerCamelCase	:    List[str]          =      [3, 34, 4, 12, 5, 2]
_lowerCamelCase	:    List[Any]          =      9
_lowerCamelCase	:    Tuple          =      generate_sum_of_subsets_soln(nums, max_sum)

print(*result)

from functools import lru_cache






@lru_cache
def 	a_		(	__lowercase       :     int			)			->  int:
			if num < 0:
						raise ValueError('Number should not be negative.'			)

			return 1 if num in (0, 1) else num * factorial(num - 1			)


if __name__ == "__main__":
			import doctest

			doctest.testmod()