


"""simple docstring"""






def        A_					(					UpperCAmelCase__       ,   UpperCAmelCase__				)     ->     int:
   if a < b:
      return gcd(UpperCAmelCase__       ,   UpperCAmelCase__				)
   if a % b == 0:
      return b
   return gcd(UpperCAmelCase__       ,   a % b				)




def        A_					(					UpperCAmelCase__       ,   UpperCAmelCase__       ,   UpperCAmelCase__				)     ->     int:
   if y == 0:
      return 1
   a   :	List[str]						=    power(UpperCAmelCase__       ,   y // 2       ,   UpperCAmelCase__				) % mod
   a   :	Optional[int]						=    (temp * temp) % mod
   if y % 2 == 1:
      a   :	Optional[Any]						=    (temp * x) % mod
   return temp




def        A_					(					UpperCAmelCase__				)     ->     bool:
   a   :	List[str]						=    2
   while b < n:
      if gcd(UpperCAmelCase__       ,   UpperCAmelCase__				) == 1 and power(UpperCAmelCase__       ,   n - 1       ,   UpperCAmelCase__				) != 1:
         return False
      b += 1
   return True


if __name__ == "__main__":
 SCREAMING_SNAKE_CASE__				:  Tuple						= int(input("Enter number: ").strip())
 if is_carmichael_number(number):
  print(F'{number} is a Carmichael Number.')
 else:
  print(F'{number} is not a Carmichael Number.')









"""simple docstring"""






import os
from typing import List, Union

import tensorflow as tf
from tensorflow_text import BertTokenizer as BertTokenizerLayer
from tensorflow_text import FastBertTokenizer, ShrinkLongestTrimmer, case_fold_utfa, combine_segments, pad_model_inputs

from .tokenization_bert import BertTokenizer


class 	A_       (     tf.keras.layers.Layer   ):





  """simple docstring"""

  def __init__(						self  ,					__UpperCAmelCase  ,					__UpperCAmelCase  ,					__UpperCAmelCase = None  ,					__UpperCAmelCase = None  ,					__UpperCAmelCase = None  ,					__UpperCAmelCase = "longest"  ,					__UpperCAmelCase = True  ,					__UpperCAmelCase = 5_12  ,					__UpperCAmelCase = None  ,					__UpperCAmelCase = True  ,					__UpperCAmelCase = True  ,					__UpperCAmelCase = True  ,					**__UpperCAmelCase  ,					)				->					Union[str, Any]:
     super().__init__()
     if use_fast_bert_tokenizer:
        a   :	int						=    FastBertTokenizer(
            __UpperCAmelCase  ,					token_out_type=tf.intaa  ,					lower_case_nfd_strip_accents=__UpperCAmelCase  ,					**__UpperCAmelCase						)
     else:
        a   :	Optional[Any]						=    tf.lookup.StaticVocabularyTable(
            tf.lookup.KeyValueTensorInitializer(
                keys=__UpperCAmelCase  ,					key_dtype=tf.string  ,					values=tf.range(tf.size(__UpperCAmelCase  ,					out_type=tf.intaa						)  ,					dtype=tf.intaa						)  ,					value_dtype=tf.intaa  ,					)  ,					num_oov_buckets=1  ,					)
        a   :	str						=    BertTokenizerLayer(
            __UpperCAmelCase  ,					token_out_type=tf.intaa  ,					lower_case=__UpperCAmelCase  ,					**__UpperCAmelCase						)

     a   :	str						=    vocab_list
     a   :	Dict						=    do_lower_case
     a   :	Dict						=    cls_token_id or vocab_list.index('[CLS]'						)
     a   :	Tuple						=    sep_token_id or vocab_list.index('[SEP]'						)
     a   :	Optional[Any]						=    pad_token_id or vocab_list.index('[PAD]'						)
     a   :	Tuple						=    ShrinkLongestTrimmer(max_length - 3  ,					axis=1						)  # Allow room for special tokens
     a   :	Union[str, Any]						=    max_length
     a   :	Tuple						=    padding
     a   :	List[Any]						=    truncation
     a   :	Union[str, Any]						=    pad_to_multiple_of
     a   :	List[Any]						=    return_token_type_ids
     a   :	Optional[int]						=    return_attention_mask
  @classmethod
  def 							lowercase_     (						cls  ,					__UpperCAmelCase  ,					**__UpperCAmelCase						)				->					Tuple:  # noqa: F821
     a   :	List[Any]						=    kwargs.pop('do_lower_case'  ,					__UpperCAmelCase						)
     a   :	str						=    tokenizer.do_lower_case if do_lower_case is None else do_lower_case
     a   :	List[Any]						=    kwargs.pop('cls_token_id'  ,					__UpperCAmelCase						)
     a   :	int						=    tokenizer.cls_token_id if cls_token_id is None else cls_token_id
     a   :	Tuple						=    kwargs.pop('sep_token_id'  ,					__UpperCAmelCase						)
     a   :	Optional[int]						=    tokenizer.sep_token_id if sep_token_id is None else sep_token_id
     a   :	List[Any]						=    kwargs.pop('pad_token_id'  ,					__UpperCAmelCase						)
     a   :	Any						=    tokenizer.pad_token_id if pad_token_id is None else pad_token_id

     a   :	Optional[Any]						=    tokenizer.get_vocab()
     a   :	Optional[Any]						=    sorted([(wordpiece, idx) for wordpiece, idx in vocab.items()]  ,					key=lambda __UpperCAmelCase						: x[1]						)
     a   :	Optional[Any]						=    [entry[0] for entry in vocab]
     return cls(
         vocab_list=__UpperCAmelCase  ,					do_lower_case=__UpperCAmelCase  ,					cls_token_id=__UpperCAmelCase  ,					sep_token_id=__UpperCAmelCase  ,					pad_token_id=__UpperCAmelCase  ,					**__UpperCAmelCase  ,					)
  @classmethod
  def 							lowercase_     (						cls  ,					__UpperCAmelCase  ,					*__UpperCAmelCase  ,					**__UpperCAmelCase						)				->					Tuple:
     try:
        a   :	Dict						=    BertTokenizer.from_pretrained(__UpperCAmelCase  ,					*__UpperCAmelCase  ,					**__UpperCAmelCase						)
     except:  # noqa: E722
        from .tokenization_bert_fast import BertTokenizerFast

        a   :	Tuple						=    BertTokenizerFast.from_pretrained(__UpperCAmelCase  ,					*__UpperCAmelCase  ,					**__UpperCAmelCase						)
     return cls.from_tokenizer(__UpperCAmelCase  ,					**__UpperCAmelCase						)
  def 							lowercase_     (						self  ,					__UpperCAmelCase						)				->					List[Any]:
     if self.do_lower_case:
        a   :	int						=    case_fold_utfa(__UpperCAmelCase						)
     a   :	Union[str, Any]						=    self.tf_tokenizer.tokenize(__UpperCAmelCase						)
     return tokens.merge_dims(1  ,					-1						)
  def 							lowercase_     (						self  ,					__UpperCAmelCase  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					__UpperCAmelCase=None  ,					)				->					Optional[int]:
     if padding is None:
        a   :	List[Any]						=    self.padding
     if padding not in ("longest", "max_length"):
        raise ValueError('Padding must be either \'longest\' or \'max_length\'!'						)
     if max_length is not None and text_pair is not None:
        # Because we have to instantiate a Trimmer to do it properly
        raise ValueError('max_length cannot be overridden at call time when truncating paired texts!'						)
     if max_length is None:
        a   :	Any						=    self.max_length
     if truncation is None:
        a   :	Any						=    self.truncation
     if pad_to_multiple_of is None:
        a   :	Optional[int]						=    self.pad_to_multiple_of
     if return_token_type_ids is None:
        a   :	str						=    self.return_token_type_ids
     if return_attention_mask is None:
        a   :	Dict						=    self.return_attention_mask
     if not isinstance(__UpperCAmelCase  ,					tf.Tensor						):
        a   :	List[str]						=    tf.convert_to_tensor(__UpperCAmelCase						)
     if text_pair is not None and not isinstance(__UpperCAmelCase  ,					tf.Tensor						):
        a   :	Any						=    tf.convert_to_tensor(__UpperCAmelCase						)
     if text_pair is not None:
        if text.shape.rank > 1:
           raise ValueError('text argument should not be multidimensional when a text pair is supplied!'						)
        if text_pair.shape.rank > 1:
           raise ValueError('text_pair should not be multidimensional!'						)
     if text.shape.rank == 2:
        a	, a   :	Union[str, Any]						=    text[:, 0], text[:, 1]
     a   :	Union[str, Any]						=    self.unpaired_tokenize(__UpperCAmelCase						)
     if text_pair is None:  # Unpaired text
        if truncation:
           a   :	List[Any]						=    text[:, : max_length - 2]  # Allow room for special tokens
        a	, a   :	Dict						=    combine_segments(
            (text,)  ,					start_of_sequence_id=self.cls_token_id  ,					end_of_segment_id=self.sep_token_id						)
     else:  # Paired text
        a   :	Optional[Any]						=    self.unpaired_tokenize(__UpperCAmelCase						)
        if truncation:
           a	, a   :	List[str]						=    self.paired_trimmer.trim([text, text_pair]						)
        a	, a   :	List[Any]						=    combine_segments(
            (text, text_pair)  ,					start_of_sequence_id=self.cls_token_id  ,					end_of_segment_id=self.sep_token_id						)
     if padding == "longest":
        a   :	List[Any]						=    input_ids.bounding_shape(axis=1						)
        if pad_to_multiple_of is not None:
           # No ceiling division in tensorflow, so we negate floordiv instead
           a   :	Optional[int]						=    pad_to_multiple_of * (-tf.math.floordiv(-pad_length  ,					__UpperCAmelCase						))
     else:
        a   :	Any						=    max_length

     a	, a   :	Any						=    pad_model_inputs(__UpperCAmelCase  ,					max_seq_length=__UpperCAmelCase  ,					pad_value=self.pad_token_id						)
     a   :	Optional[Any]						=    {'input_ids': input_ids}
     if return_attention_mask:
        a   :	Tuple						=    attention_mask
     if return_token_type_ids:
        a	, a   :	int						=    pad_model_inputs(
            __UpperCAmelCase  ,					max_seq_length=__UpperCAmelCase  ,					pad_value=self.pad_token_id						)
        a   :	Union[str, Any]						=    token_type_ids
     return output






  def 							lowercase_     (						self						)				->					List[str]:
     return {
         "vocab_list": self.vocab_list,
         "do_lower_case": self.do_lower_case,
         "cls_token_id": self.cls_token_id,
         "sep_token_id": self.sep_token_id,
         "pad_token_id": self.pad_token_id,
     }





