from collections import defaultdict



class 				a							:







 """simple docstring"""






 def __init__(					self		,				lowerCAmelCase_		,				lowerCAmelCase_							)  ->					Tuple:
        _A        =  total  # total no of tasks (N)

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

        _A        =  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
        _A        =  (1 << len(UpperCamelCase__							)) - 1



 def      UpperCAmelCase							(					self		,				lowerCAmelCase_		,				lowerCAmelCase_							)  ->					Optional[Any]:



        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
        _A        =  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.
        _A        =  total_ways_util

        return self.dp[mask][task_no]



 def      UpperCAmelCase							(					self		,				lowerCAmelCase_							)  ->					Tuple:



        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__":
    _SCREAMING_SNAKE_CASE										=						5  # total no of tasks (the value of N)

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










import importlib
import os
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, Optional, Union

import torch

from ..utils import BaseOutput


_A     =			'''scheduler_config.json'''


class  A		(  __UpperCAmelCase     ):
		__snake_case									=   1
		__snake_case									=   2
		__snake_case									=   3
		__snake_case									=   4
		__snake_case									=   5
		__snake_case									=   6
		__snake_case									=   7
		__snake_case									=   8
		__snake_case									=   9
		__snake_case									=   10
		__snake_case									=   11
		__snake_case									=   12
		__snake_case									=   13
		__snake_case									=   14







@dataclass
class  A		(  __UpperCAmelCase     ):
		__snake_case									=   42







class  A		:
		__snake_case									=   SCHEDULER_CONFIG_NAME
		__snake_case									=   []
		__snake_case									=   True



		@classmethod
		def        SCREAMING_SNAKE_CASE__			(     cls,	UpperCamelCase__ = None,	UpperCamelCase__ = None,	UpperCamelCase__=False,	**UpperCamelCase__,	):







								"""simple docstring"""



								lowerCAmelCase_			,					lowerCAmelCase_			,					lowerCAmelCase_      			=  cls.load_config(
								    pretrained_model_name_or_path=UpperCamelCase__,	subfolder=UpperCamelCase__,	return_unused_kwargs=UpperCamelCase__,	return_commit_hash=UpperCamelCase__,	**UpperCamelCase__,	)
								return cls.from_config(UpperCamelCase__,	return_unused_kwargs=UpperCamelCase__,	**UpperCamelCase__   )



		def        SCREAMING_SNAKE_CASE__			(     self,	UpperCamelCase__,	UpperCamelCase__ = False,	**UpperCamelCase__   ):







								"""simple docstring"""



								self.save_config(save_directory=UpperCamelCase__,	push_to_hub=UpperCamelCase__,	**UpperCamelCase__   )



		@property
		def        SCREAMING_SNAKE_CASE__			(     self   ):







								"""simple docstring"""



								return self._get_compatibles()







		@classmethod
		def        SCREAMING_SNAKE_CASE__			(     cls   ):







								"""simple docstring"""



								lowerCAmelCase_      			=  list(set([cls.__name__] + cls._compatibles   )   )
								lowerCAmelCase_      			=  importlib.import_module(__name__.split('''.'''   )[0]   )
								lowerCAmelCase_      			=  [
								    getattr(UpperCamelCase__,	UpperCamelCase__   ) for c in compatible_classes_str if hasattr(UpperCamelCase__,	UpperCamelCase__   )
								]
								return compatible_classes




