



"""simple docstring"""






import json
from typing import List, Optional, Tuple

from tokenizers import pre_tokenizers, processors

from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roberta import RobertaTokenizer


_lowercase			:			int										=						logging.get_logger(__name__)

_lowercase			:			Tuple										=						{"vocab_file": "vocab.json", "merges_file": "merges.txt", "tokenizer_file": "tokenizer.json"}

_lowercase			:			Union[str, Any]										=						{
    "vocab_file": {
        "roberta-base": "https://huggingface.co/roberta-base/resolve/main/vocab.json",
        "roberta-large": "https://huggingface.co/roberta-large/resolve/main/vocab.json",
        "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/vocab.json",
        "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/vocab.json",
        "roberta-base-openai-detector": "https://huggingface.co/roberta-base-openai-detector/resolve/main/vocab.json",
        "roberta-large-openai-detector": (
            "https://huggingface.co/roberta-large-openai-detector/resolve/main/vocab.json"
        ),
    },
    "merges_file": {
        "roberta-base": "https://huggingface.co/roberta-base/resolve/main/merges.txt",
        "roberta-large": "https://huggingface.co/roberta-large/resolve/main/merges.txt",
        "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/merges.txt",
        "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/merges.txt",
        "roberta-base-openai-detector": "https://huggingface.co/roberta-base-openai-detector/resolve/main/merges.txt",
        "roberta-large-openai-detector": (
            "https://huggingface.co/roberta-large-openai-detector/resolve/main/merges.txt"
        ),
    },
    "tokenizer_file": {
        "roberta-base": "https://huggingface.co/roberta-base/resolve/main/tokenizer.json",
        "roberta-large": "https://huggingface.co/roberta-large/resolve/main/tokenizer.json",
        "roberta-large-mnli": "https://huggingface.co/roberta-large-mnli/resolve/main/tokenizer.json",
        "distilroberta-base": "https://huggingface.co/distilroberta-base/resolve/main/tokenizer.json",
        "roberta-base-openai-detector": (
            "https://huggingface.co/roberta-base-openai-detector/resolve/main/tokenizer.json"
        ),
        "roberta-large-openai-detector": (
            "https://huggingface.co/roberta-large-openai-detector/resolve/main/tokenizer.json"
        ),
    },
}

_lowercase			:			Optional[int]										=						{
    "roberta-base": 5_1_2,
    "roberta-large": 5_1_2,
    "roberta-large-mnli": 5_1_2,
    "distilroberta-base": 5_1_2,
    "roberta-base-openai-detector": 5_1_2,
    "roberta-large-openai-detector": 5_1_2,
}

class 	__SCREAMING_SNAKE_CASE     (				lowerCAmelCase_       ):


					'''simple docstring'''





					_a             =							VOCAB_FILES_NAMES
					_a             =							PRETRAINED_VOCAB_FILES_MAP
					_a             =							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
					_a             =							['input_ids', 'attention_mask']
					_a             =							RobertaTokenizer



					def __init__(	self							:  List[str],  lowerCamelCase							:  Any=None,  lowerCamelCase							:  int=None,  lowerCamelCase							:  Optional[Any]=None,  lowerCamelCase							:  List[str]="replace",  lowerCamelCase							:  Union[str, Any]="<s>",  lowerCamelCase							:  str="</s>",  lowerCamelCase							:  str="</s>",  lowerCamelCase							:  List[str]="<s>",  lowerCamelCase							:  List[str]="<unk>",  lowerCamelCase							:  Optional[int]="<pad>",  lowerCamelCase							:  Any="<mask>",  lowerCamelCase							:  Dict=False,  lowerCamelCase							:  Optional[int]=True,  **lowerCamelCase							:  List[str],  )-> str:
								super().__init__(
								    lowerCamelCase,  lowerCamelCase,  tokenizer_file=lowerCamelCase,  errors=lowerCamelCase,  bos_token=lowerCamelCase,  eos_token=lowerCamelCase,  sep_token=lowerCamelCase,  cls_token=lowerCamelCase,  unk_token=lowerCamelCase,  pad_token=lowerCamelCase,  mask_token=lowerCamelCase,  add_prefix_space=lowerCamelCase,  trim_offsets=lowerCamelCase,  **lowerCamelCase,  )

								lowerCamelCase__		:		Optional[int]		     =json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__()					)
								if pre_tok_state.get('''add_prefix_space''',  lowerCamelCase					) != add_prefix_space:
											lowerCamelCase__		:		List[Any]		     =getattr(lowerCamelCase,  pre_tok_state.pop('''type'''					)					)
											lowerCamelCase__		:		Tuple		     =add_prefix_space
											lowerCamelCase__		:		int		     =pre_tok_class(**lowerCamelCase					)

								lowerCamelCase__		:		str		     =add_prefix_space

								lowerCamelCase__		:		Tuple		     ='''post_processor'''
								lowerCamelCase__		:		Optional[int]		     =getattr(self.backend_tokenizer,  lowerCamelCase,  lowerCamelCase					)
								if tokenizer_component_instance:
											lowerCamelCase__		:		Optional[int]		     =json.loads(tokenizer_component_instance.__getstate__()					)

											# The lists 'sep' and 'cls' must be cased in tuples for the object `post_processor_class`
											if "sep" in state:
														lowerCamelCase__		:		Optional[Any]		     =tuple(state['''sep''']					)
											if "cls" in state:
														lowerCamelCase__		:		Optional[int]		     =tuple(state['''cls''']					)

											lowerCamelCase__		:		List[str]		     =False

											if state.get('''add_prefix_space''',  lowerCamelCase					) != add_prefix_space:
														lowerCamelCase__		:		List[str]		     =add_prefix_space
														lowerCamelCase__		:		Optional[int]		     =True

											if state.get('''trim_offsets''',  lowerCamelCase					) != trim_offsets:
														lowerCamelCase__		:		Tuple		     =trim_offsets
														lowerCamelCase__		:		str		     =True

											if changes_to_apply:
														lowerCamelCase__		:		List[str]		     =getattr(lowerCamelCase,  state.pop('''type'''					)					)
														lowerCamelCase__		:		List[str]		     =component_class(**lowerCamelCase					)
														setattr(self.backend_tokenizer,  lowerCamelCase,  lowerCamelCase					)



					@property
					def 		snake_case	(	self							:  Tuple					)-> str:
								if self._mask_token is None:
											if self.verbose:
														logger.error('''Using mask_token, but it is not set yet.'''					)
											return None
								return str(self._mask_token					)



					@mask_token.setter
					def 		snake_case	(	self							:  Optional[int],  lowerCamelCase							:  Union[str, Any]					)-> str:
								lowerCamelCase__		:		List[str]		     =AddedToken(lowerCamelCase,  lstrip=lowerCamelCase,  rstrip=lowerCamelCase					) if isinstance(lowerCamelCase,  lowerCamelCase					) else value
								lowerCamelCase__		:		Dict		     =value



					def 		snake_case	(	self							:  int,  *lowerCamelCase							:  Optional[Any],  **lowerCamelCase							:  Tuple					)-> BatchEncoding:
								lowerCamelCase__		:		List[Any]		     =kwargs.get('''is_split_into_words''',  lowerCamelCase					)
								assert self.add_prefix_space or not is_split_into_words, (
								    F'''You need to instantiate {self.__class__.__name__} with add_prefix_space=True '''
								    "to use it with pretokenized inputs."
								)

								return super()._batch_encode_plus(*lowerCamelCase,  **lowerCamelCase					)



					def 		snake_case	(	self							:  int,  *lowerCamelCase							:  List[Any],  **lowerCamelCase							:  str					)-> BatchEncoding:
								lowerCamelCase__		:		Union[str, Any]		     =kwargs.get('''is_split_into_words''',  lowerCamelCase					)

								assert self.add_prefix_space or not is_split_into_words, (
								    F'''You need to instantiate {self.__class__.__name__} with add_prefix_space=True '''
								    "to use it with pretokenized inputs."
								)

								return super()._encode_plus(*lowerCamelCase,  **lowerCamelCase					)



					def 		snake_case	(	self							:  List[str],  lowerCamelCase							:  str,  lowerCamelCase							:  Optional[str] = None					)-> Tuple[str]:
								lowerCamelCase__		:		Dict		     =self._tokenizer.model.save(lowerCamelCase,  name=lowerCamelCase					)
								return tuple(lowerCamelCase					)



					def 		snake_case	(	self							:  List[str],  lowerCamelCase							:  Union[str, Any],  lowerCamelCase							:  Union[str, Any]=None					)-> List[str]:
								lowerCamelCase__		:		int		     =[self.bos_token_id] + token_ids_a + [self.eos_token_id]
								if token_ids_a is None:
											return output

								return output + [self.eos_token_id] + token_ids_a + [self.eos_token_id]




					def 		snake_case	(	self							:  List[str],  lowerCamelCase							:  List[int],  lowerCamelCase							:  Optional[List[int]] = None					)-> List[int]:
								lowerCamelCase__		:		Optional[int]		     =[self.sep_token_id]
								lowerCamelCase__		:		Any		     =[self.cls_token_id]

								if token_ids_a is None:
											return len(cls + token_ids_a + sep					) * [0]
								return len(cls + token_ids_a + sep + sep + token_ids_a + sep					) * [0]









"""simple docstring"""






from collections import defaultdict

class 	__SCREAMING_SNAKE_CASE     :


					'''simple docstring'''





					def __init__(	self							:  Union[str, Any],  lowerCamelCase							:  List[Any],  lowerCamelCase							:  List[str]					)-> Optional[int]:
								lowerCamelCase__		:		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
								lowerCamelCase__		:		Optional[Any]		     =[
								    [-1 for i in range(total + 1					)] for j in range(2 ** len(lowerCamelCase					)					)
								]

								lowerCamelCase__		:		Any		     =defaultdict(lowerCamelCase					)  # 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
								lowerCamelCase__		:		List[Any]		     =(1 << len(lowerCamelCase					)) - 1



					def 		snake_case	(	self							:  int,  lowerCamelCase							:  str,  lowerCamelCase							:  Any					)-> Any:
								# if mask == self.finalmask all persons are distributed tasks, return 1
								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
								lowerCamelCase__		:		Optional[int]		     =self.count_ways_until(lowerCamelCase,  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.
								lowerCamelCase__		:		int		     =total_ways_util

								return self.dp[mask][task_no]




					def 		snake_case	(	self							:  Dict,  lowerCamelCase							:  Dict					)-> int:
								# Store the list of persons for each task
								for i in range(len(lowerCamelCase					)					):
											for j in task_performed[i]:
														self.task[j].append(lowerCamelCase					)

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

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




