code: 
  
  
  
  """simple docstring"""
  
  
  
  
  import os
  from typing import Optional, Union
  
  import numpy as np
  from huggingface_hub import hf_hub_download
  
  from ... import AutoTokenizer
  from ...utils import logging
  
  
  __A :		List[str]      							=    "block_records.npy"
  
  
  __A :		List[str]      							=    logging.get_logger(__name__)
  def 					A_			(		snake_case_     :       Optional[Any]						,snake_case_     :       List[str]    ):
  
  
  
  
  
  
  
      '''simple docstring'''
      import tensorflow.compat.va as tf
  
      UpperCamelCase				:   Union[str, Any]          =							tf.data.TFRecordDataset(snake_case_						,buffer_size=5_1_2 * 1_0_2_4 * 1_0_2_4    )
      UpperCamelCase				:   int          =							blocks_dataset.batch(snake_case_						,drop_remainder=snake_case_    )
      UpperCamelCase				:   Any          =							next(blocks_dataset.take(1    ).as_numpy_iterator()    )
  
      return np_record
  class 							lowerCamelCase		:
  
  
  
  
  
  
  
     def __init__(							self    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_=2    ,      SCREAMING_SNAKE_CASE_=1000    ,      SCREAMING_SNAKE_CASE_=100    ,      SCREAMING_SNAKE_CASE_=10_0000    ,      ):
         from scann.scann_ops.py.scann_ops_pybind import builder as Builder
  
         UpperCamelCase				:   List[Any]          =							Builder(db=__UpperCamelCase    ,      num_neighbors=__UpperCamelCase    ,      distance_measure="""dot_product""" )
         UpperCamelCase				:   Tuple          =							builder.tree(
             num_leaves=__UpperCamelCase    ,      num_leaves_to_search=__UpperCamelCase    ,      training_sample_size=__UpperCamelCase )
         UpperCamelCase				:   Optional[int]          =							builder.score_ah(dimensions_per_block=__UpperCamelCase )
  
         UpperCamelCase				:   Dict          =							builder.build()
  
  
  
  
  
  
  
     def       a_							(							self    ,      SCREAMING_SNAKE_CASE_ ):
         UpperCamelCase				:   int          =							self.searcher.search_batched(question_projection.detach().cpu() )
         return retrieved_block_ids.astype("""int64""" )
  
  
  
  
  
  
  
  class 							lowerCamelCase		:
  
  
  
  
  
  
  
     def __init__(							self    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_ ):
         super().__init__()
         UpperCamelCase				:   Dict          =							block_records
         UpperCamelCase				:   Dict          =							tokenizer
  
  
  
  
  
  
  
     def __call__(							self    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_=None    ,      SCREAMING_SNAKE_CASE_="pt" ):
         UpperCamelCase				:   Any          =							np.take(self.block_records    ,      indices=__UpperCamelCase    ,      axis=0 )
  
         UpperCamelCase				:   List[Any]          =							self.tokenizer.decode(question_input_ids[0]    ,      skip_special_tokens=__UpperCamelCase )
  
         UpperCamelCase				:   Union[str, Any]          =							[]
         UpperCamelCase				:   Union[str, Any]          =							[]
         for retrieved_block in retrieved_blocks:
             text.append(__UpperCamelCase )
             text_pair.append(retrieved_block.decode() )
  
         UpperCamelCase				:   Dict          =							self.tokenizer(
             __UpperCamelCase    ,      __UpperCamelCase    ,      padding=__UpperCamelCase    ,      truncation=__UpperCamelCase    ,      return_special_tokens_mask=__UpperCamelCase    ,      max_length=__UpperCamelCase )
         UpperCamelCase				:   List[Any]          =							concat_inputs.convert_to_tensors(__UpperCamelCase )
  
         if answer_ids is not None:
             return self.block_has_answer(__UpperCamelCase    ,      __UpperCamelCase ) + (concat_inputs_tensors,)
         else:
             return (None, None, None, concat_inputs_tensors)
  
  
  
  
  
  
  
     @classmethod
     def       a_							(							cls    ,      SCREAMING_SNAKE_CASE_    ,      *SCREAMING_SNAKE_CASE_    ,      **SCREAMING_SNAKE_CASE_ ):
  
  
         if os.path.isdir(__UpperCamelCase ):
             UpperCamelCase				:   List[str]          =							os.path.join(__UpperCamelCase    ,      _REALM_BLOCK_RECORDS_FILENAME )
         else:
             UpperCamelCase				:   int          =							hf_hub_download(
                 repo_id=__UpperCamelCase    ,      filename=_REALM_BLOCK_RECORDS_FILENAME    ,      **__UpperCamelCase )
         UpperCamelCase				:   int          =							np.load(__UpperCamelCase    ,      allow_pickle=__UpperCamelCase )
  
         UpperCamelCase				:   str          =							AutoTokenizer.from_pretrained(__UpperCamelCase    ,      *__UpperCamelCase    ,      **__UpperCamelCase )
  
         return cls(__UpperCamelCase    ,      __UpperCamelCase )
  
  
  
  
  
  
  
     def       a_							(							self    ,      SCREAMING_SNAKE_CASE_ ):
         np.save(os.path.join(__UpperCamelCase    ,      _REALM_BLOCK_RECORDS_FILENAME )    ,      self.block_records )
         # save tokenizer
         self.tokenizer.save_pretrained(__UpperCamelCase )
  
  
  
  
  
  
  
     def       a_							(							self    ,      SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_ ):
         UpperCamelCase				:   Tuple          =							[]
         UpperCamelCase				:   str          =							[]
         UpperCamelCase				:   Tuple          =							[]
         UpperCamelCase				:   Any          =							0
  
         for input_id in concat_inputs.input_ids:
             UpperCamelCase				:   int          =							input_id.tolist()
             # Check answers between two [SEP] tokens
             UpperCamelCase				:   Tuple          =							input_id_list.index(self.tokenizer.sep_token_id )
             UpperCamelCase				:   List[Any]          =							first_sep_idx + 1 + input_id_list[first_sep_idx + 1 :].index(self.tokenizer.sep_token_id )
  
             start_pos.append([] )
             end_pos.append([] )
             for answer in answer_ids:
                 for idx in range(first_sep_idx + 1    ,      __UpperCamelCase ):
                     if answer[0] == input_id_list[idx]:
                         if input_id_list[idx : idx + len(__UpperCamelCase )] == answer:
                             start_pos[-1].append(__UpperCamelCase )
                             end_pos[-1].append(idx + len(__UpperCamelCase ) - 1 )
  
             if len(start_pos[-1] ) == 0:
                 has_answers.append(__UpperCamelCase )
             else:
                 has_answers.append(__UpperCamelCase )
                 if len(start_pos[-1] ) > max_answers:
                     UpperCamelCase				:   Union[str, Any]          =							len(start_pos[-1] )
  
          # Pad -1 to max_answers
         for start_pos_, end_pos_ in zip(__UpperCamelCase    ,      __UpperCamelCase ):
             if len(start_pos_ ) < max_answers:
                 UpperCamelCase				:   int          =							[-1] * (max_answers - len(start_pos_ ))
                 start_pos_ += padded
                 end_pos_ += padded
         return has_answers, start_pos, end_pos
  
  
  
  
  
style_context: 
  
  
  
  
  """simple docstring"""
  
  
  
  
  def 					A_			(		snake_case_     :       Tuple						,snake_case_     :       Optional[Any]						,snake_case_     :       Optional[Any]    ):
  
  
  
  
  
  
  
      '''simple docstring'''
      assert b != 0, "This cannot accept modulo that is == 0"
      if n == 0:
          return 1
  
      if n % 2 == 1:
          return (bin_exp_mod(snake_case_						,n - 1						,snake_case_    ) * a) % b
  
      UpperCamelCase				:   List[Any]          =							bin_exp_mod(snake_case_						,n / 2						,snake_case_    )
      return (r * r) % b
  
  
  if __name__ == "__main__":
    try:
      __A :		Any      							=    int(input('''Enter Base : ''').strip())
      __A :		Any      							=    int(input('''Enter Power : ''').strip())
      __A :		List[Any]      							=    int(input('''Enter Modulo : ''').strip())
    except ValueError:
      print('''Invalid literal for integer''')
  
    print(bin_exp_mod(BASE, POWER, MODULO))
  
  
  
  
  