
"""simple docstring"""







import unicodedata
from dataclasses import dataclass
from typing import Optional, Union

import numpy as np

from transformers.data.data_collator import DataCollatorMixin
from transformers.file_utils import PaddingStrategy
from transformers.tokenization_utils_base import PreTrainedTokenizerBase




def       A_      (       lowercase    ,			lowercase    ,			lowercase    ,			lowercase   )  ->				Optional[int]:


     """simple docstring"""







     if isinstance(lowercase    ,			lowercase   ):
          UpperCAmelCase_    :     Any            =	np.full((len(lowercase   ), sequence_length, 2)    ,			lowercase   )
     else:
          UpperCAmelCase_    :     Any            =	np.full((len(lowercase   ), sequence_length)    ,			lowercase   )

     for i, tensor in enumerate(lowercase   ):
          if padding_side == "right":
               if isinstance(lowercase    ,			lowercase   ):
                    UpperCAmelCase_    :     List[Any]            =	tensor[:sequence_length]
               else:
                    UpperCAmelCase_    :     int            =	tensor[:sequence_length]
          else:
               if isinstance(lowercase    ,			lowercase   ):
                    UpperCAmelCase_    :     Optional[int]            =	tensor[:sequence_length]
               else:
                    UpperCAmelCase_    :     List[Any]            =	tensor[:sequence_length]

     return out_tensor.tolist()




def       A_      (       lowercase   )  ->				List[Any]:


     """simple docstring"""







     UpperCAmelCase_    :     Optional[int]            =	ord(lowercase   )
     if (cp >= 33 and cp <= 47) or (cp >= 58 and cp <= 64) or (cp >= 91 and cp <= 96) or (cp >= 123 and cp <= 126):
          return True
     UpperCAmelCase_    :     List[str]            =	unicodedata.category(lowercase   )
     if cat.startswith("""P"""   ):
          return True
     return False



@dataclass
class 		UpperCAmelCase_						(lowerCamelCase_    ):
 """simple docstring"""




 UpperCamelCase_    :  PreTrainedTokenizerBase
 UpperCamelCase_    :  Union[bool, str, PaddingStrategy]					 =     True
 UpperCamelCase_    :  Optional[int]					 =     None
 UpperCamelCase_    :  Optional[int]					 =     None
 UpperCamelCase_    :  int					 =     -100
 UpperCamelCase_    :  str					 =     "pt"




 def 	a   (			self							:			str  , a_							:			Optional[int]			)->       Dict:



      """simple docstring"""

      import torch

      UpperCAmelCase_    :     Tuple            =	"""label""" if """label""" in features[0].keys() else """labels"""
      UpperCAmelCase_    :     Optional[Any]            =	[feature[label_name] for feature in features] if label_name in features[0].keys() else None
      UpperCAmelCase_    :     Union[str, Any]            =	self.tokenizer.pad(
          a_  , padding=self.padding  , max_length=self.max_length  , pad_to_multiple_of=self.pad_to_multiple_of  , return_tensors="""pt""" if labels is None else None  , )

      if labels is None:
           return batch

      UpperCAmelCase_    :     Dict            =	torch.tensor(batch["""entity_ids"""]			).shape[1]
      UpperCAmelCase_    :     int            =	self.tokenizer.padding_side
      if padding_side == "right":
           UpperCAmelCase_    :     Optional[int]            =	[
               list(a_			) + [self.label_pad_token_id] * (sequence_length - len(a_			)) for label in labels
           ]
      else:
           UpperCAmelCase_    :     Tuple            =	[
               [self.label_pad_token_id] * (sequence_length - len(a_			)) + list(a_			) for label in labels
           ]

      UpperCAmelCase_    :     Tuple            =	[feature["""ner_tags"""] for feature in features]
      UpperCAmelCase_    :     Optional[int]            =	padding_tensor(a_  , -1  , a_  , a_			)
      UpperCAmelCase_    :     Any            =	[feature["""original_entity_spans"""] for feature in features]
      UpperCAmelCase_    :     Optional[Any]            =	padding_tensor(a_  , (-1, -1)  , a_  , a_			)
      UpperCAmelCase_    :     int            =	{k: torch.tensor(a_  , dtype=torch.intaa			) for k, v in batch.items()}

      return batch



"""simple docstring"""







def       A_      (       lowercase   )  ->				int:


     """simple docstring"""







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




def       A_      (       lowercase   )  ->				bool:


     """simple docstring"""







     UpperCAmelCase_    :     str            =	0
     UpperCAmelCase_    :     Union[str, Any]            =	number
     while duplicate > 0:
          UpperCAmelCase_       ,UpperCAmelCase_    :     Tuple            =	divmod(lowercase    ,			10   )
          fact_sum += factorial(lowercase   )
     return fact_sum == number


if __name__ == "__main__":
       print("Program to check whether a number is a Krisnamurthy Number or not.")
       lowercase_         =       int(input("Enter number: ").strip())
       print(
           f"""{number} is {'' if krishnamurthy(number) else 'not '}a Krishnamurthy Number."""
       )

