



"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


A:   Tuple								=		logging.get_logger(__name__)

A:   List[Any]								=		{
    "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json",
    # See all Donut models at https://huggingface.co/models?filter=donut-swin
}



class       SCREAMING_SNAKE_CASE__  (					UpperCAmelCase__ ):
   __lowerCAmelCase  :   Union[str, Any]						=						'donut-swin'

   __lowerCAmelCase  :   int						=						{
       'num_attention_heads': 'num_heads',
       'num_hidden_layers': 'num_layers',
   }

   def __init__(   self      ,     _SCREAMING_SNAKE_CASE=224      ,     _SCREAMING_SNAKE_CASE=4      ,     _SCREAMING_SNAKE_CASE=3      ,     _SCREAMING_SNAKE_CASE=96      ,     _SCREAMING_SNAKE_CASE=[2, 2, 6, 2]      ,     _SCREAMING_SNAKE_CASE=[3, 6, 12, 24]      ,     _SCREAMING_SNAKE_CASE=7      ,     _SCREAMING_SNAKE_CASE=4.0      ,     _SCREAMING_SNAKE_CASE=True      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=0.0      ,     _SCREAMING_SNAKE_CASE=0.1      ,     _SCREAMING_SNAKE_CASE="gelu"      ,     _SCREAMING_SNAKE_CASE=False      ,     _SCREAMING_SNAKE_CASE=0.02      ,     _SCREAMING_SNAKE_CASE=1E-5      ,     **_SCREAMING_SNAKE_CASE      ,     )  ->      Any:





    '''simple docstring'''




    super().__init__(**_SCREAMING_SNAKE_CASE						)

    UpperCAmelCase	:					Any	=	image_size
    UpperCAmelCase	:					Optional[Any]	=	patch_size
    UpperCAmelCase	:					Any	=	num_channels
    UpperCAmelCase	:					int	=	embed_dim
    UpperCAmelCase	:					Tuple	=	depths
    UpperCAmelCase	:					Any	=	len(_SCREAMING_SNAKE_CASE						)
    UpperCAmelCase	:					Optional[int]	=	num_heads
    UpperCAmelCase	:					Optional[int]	=	window_size
    UpperCAmelCase	:					List[str]	=	mlp_ratio
    UpperCAmelCase	:					Any	=	qkv_bias
    UpperCAmelCase	:					int	=	hidden_dropout_prob
    UpperCAmelCase	:					List[str]	=	attention_probs_dropout_prob
    UpperCAmelCase	:					List[str]	=	drop_path_rate
    UpperCAmelCase	:					List[str]	=	hidden_act
    UpperCAmelCase	:					Any	=	use_absolute_embeddings
    UpperCAmelCase	:					List[Any]	=	layer_norm_eps
    UpperCAmelCase	:					Tuple	=	initializer_range
    # we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
    # this indicates the channel dimension after the last stage of the model
    UpperCAmelCase	:					Optional[int]	=	int(embed_dim * 2 ** (len(_SCREAMING_SNAKE_CASE						) - 1)						)




'''simple docstring'''
from collections import defaultdict
class    lowercase	:

		"""simple docstring"""

		def __init__(		self    ,   UpperCamelCase_    ,   UpperCamelCase_							):

							'''simple docstring'''


							UpperCamelCase__   :List[Any]												= total  # total no of tasks (N)

							# DP table will have a dimension of (2^M)*N
							# initially all values are set to -1
							UpperCamelCase__   :Union[str, Any]												= [
							    [-1 for i in range(total + 1							)] for j in range(2 ** len(UpperCamelCase_							)							)
							]

							UpperCamelCase__   :str												= defaultdict(UpperCamelCase_							)  # stores the list of persons for each task

							# final_mask is used to check if all persons are included by setting all bits
							# to 1
							UpperCamelCase__   :Optional[int]												= (1 << len(UpperCamelCase_							)) - 1




		def     lowerCAmelCase__				(		self    ,   UpperCamelCase_    ,   UpperCamelCase_							):

							'''simple docstring'''


							if mask == self.final_mask:
												return 1

							# if not everyone gets the task and no more tasks are available, return 0
							if task_no > self.total_tasks:
												return 0

							# if case already considered
							if self.dp[mask][task_no] != -1:
												return self.dp[mask][task_no]

							# Number of ways when we don't this task in the arrangement
							UpperCamelCase__   :str												= self.count_ways_until(UpperCamelCase_    ,   task_no + 1							)

							# now assign the tasks one by one to all possible persons and recursively
							# assign for the remaining tasks.
							if task_no in self.task:
												for p in self.task[task_no]:
																	# if p is already given a task
																	if mask & (1 << p):
																						continue

																	# assign this task to p and change the mask value. And recursively
																	# assign tasks with the new mask value.
																	total_ways_util += self.count_ways_until(mask | (1 << p)    ,   task_no + 1							)

        # save the value.
							UpperCamelCase__   :Optional[int]												= total_ways_util

							return self.dp[mask][task_no]




		def     lowerCAmelCase__				(		self    ,   UpperCamelCase_							):

							'''simple docstring'''


							for i in range(len(UpperCamelCase_							)							):
												for j in task_performed[i]:
																	self.task[j].append(UpperCamelCase_							)

        # call the function to fill the DP table, final answer is stored in dp[0][1]
							return self.count_ways_until(0    ,   1							)


if __name__ == "__main__":
		__snake_case							      =     5  # total no of tasks (the value of N)

		# the list of tasks that can be done by M persons.
		__snake_case							      =     [[1, 3, 4], [1, 2, 5], [3, 4]]
		print(
		    AssignmentUsingBitmask(task_performed, total_tasks).count_no_of_ways(
		        task_performed
		    )
		)