




import warnings
from typing import List, Optional, Union

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType
class      _UpperCamelCase (			lowerCAmelCase						):
      UpperCAmelCase_            =						["""image_processor""", """tokenizer"""]
      UpperCAmelCase_            =						"""LayoutLMv2ImageProcessor"""
      UpperCAmelCase_            =						("""LayoutLMv2Tokenizer""", """LayoutLMv2TokenizerFast""")
      def __init__(     self				:Optional[int]	, lowerCamelCase				:List[Any]=None	, lowerCamelCase				:List[str]=None	, **lowerCamelCase				:List[Any] )       ->     Optional[int]:
       UpperCAmelCase__								=  None
       if "feature_extractor" in kwargs:
        warnings.warn(
            "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
            " instead."	, lowerCamelCase	, )
        UpperCAmelCase__								=  kwargs.pop("feature_extractor" )

       UpperCAmelCase__								=  image_processor if image_processor is not None else feature_extractor
       if image_processor is None:
        raise ValueError("You need to specify an `image_processor`." )
       if tokenizer is None:
        raise ValueError("You need to specify a `tokenizer`." )

       super().__init__(lowerCamelCase	, lowerCamelCase )
      def __call__(     self				:Tuple	, lowerCamelCase				:str	, lowerCamelCase				:Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]] = None	, lowerCamelCase				:Optional[Union[PreTokenizedInput, List[PreTokenizedInput]]] = None	, lowerCamelCase				:Union[List[List[int]], List[List[List[int]]]] = None	, lowerCamelCase				:Optional[Union[List[int], List[List[int]]]] = None	, lowerCamelCase				:bool = True	, lowerCamelCase				:Union[bool, str, PaddingStrategy] = False	, lowerCamelCase				:Union[bool, str, TruncationStrategy] = False	, lowerCamelCase				:Optional[int] = None	, lowerCamelCase				:int = 0	, lowerCamelCase				:Optional[int] = None	, lowerCamelCase				:Optional[bool] = None	, lowerCamelCase				:Optional[bool] = None	, lowerCamelCase				:bool = False	, lowerCamelCase				:bool = False	, lowerCamelCase				:bool = False	, lowerCamelCase				:bool = False	, lowerCamelCase				:bool = True	, lowerCamelCase				:Optional[Union[str, TensorType]] = None	, **lowerCamelCase				:List[str]	, )       ->     BatchEncoding:
       # verify input
       if self.image_processor.apply_ocr and (boxes is not None):
        raise ValueError(
            "You cannot provide bounding boxes if you initialized the image processor with apply_ocr set to True." )

       if self.image_processor.apply_ocr and (word_labels is not None):
        raise ValueError(
            "You cannot provide word labels if you initialized the image processor with apply_ocr set to True." )

       if return_overflowing_tokens is True and return_offsets_mapping is False:
        raise ValueError("You cannot return overflowing tokens without returning the offsets mapping." )

       # first, apply the image processor
       UpperCAmelCase__								=  self.image_processor(images=lowerCamelCase	, return_tensors=lowerCamelCase )

       # second, apply the tokenizer
       if text is not None and self.image_processor.apply_ocr and text_pair is None:
        if isinstance(lowerCamelCase	, lowerCamelCase ):
         UpperCAmelCase__								=  [text]  # add batch dimension (as the image processor always adds a batch dimension)
        UpperCAmelCase__								=  features["words"]

       UpperCAmelCase__								=  self.tokenizer(
           text=text if text is not None else features["words"]	, text_pair=text_pair if text_pair is not None else None	, boxes=boxes if boxes is not None else features["boxes"]	, word_labels=lowerCamelCase	, add_special_tokens=lowerCamelCase	, padding=lowerCamelCase	, truncation=lowerCamelCase	, max_length=lowerCamelCase	, stride=lowerCamelCase	, pad_to_multiple_of=lowerCamelCase	, return_token_type_ids=lowerCamelCase	, return_attention_mask=lowerCamelCase	, return_overflowing_tokens=lowerCamelCase	, return_special_tokens_mask=lowerCamelCase	, return_offsets_mapping=lowerCamelCase	, return_length=lowerCamelCase	, verbose=lowerCamelCase	, return_tensors=lowerCamelCase	, **lowerCamelCase	, )

       # add pixel values
       UpperCAmelCase__								=  features.pop("pixel_values" )
       if return_overflowing_tokens is True:
        UpperCAmelCase__								=  self.get_overflowing_images(lowerCamelCase	, encoded_inputs["overflow_to_sample_mapping"] )
       UpperCAmelCase__								=  images

       return encoded_inputs
      def 		UpperCAmelCase_  (     self				:Dict	, lowerCamelCase				:Optional[int]	, lowerCamelCase				:str )       ->     Optional[int]:
       # in case there's an overflow, ensure each `input_ids` sample is mapped to its corresponding image
       UpperCAmelCase__								=  []
       for sample_idx in overflow_to_sample_mapping:
        images_with_overflow.append(images[sample_idx] )

       if len(lowerCamelCase ) != len(lowerCamelCase ):
        raise ValueError(
            "Expected length of images to be the same as the length of `overflow_to_sample_mapping`, but got"
            f''' {len(lowerCamelCase )} and {len(lowerCamelCase )}''' )

       return images_with_overflow
      def 		UpperCAmelCase_  (     self				:Any	, *lowerCamelCase				:Optional[Any]	, **lowerCamelCase				:Union[str, Any] )       ->     Dict:
       return self.tokenizer.batch_decode(*lowerCamelCase	, **lowerCamelCase )
      def 		UpperCAmelCase_  (     self				:int	, *lowerCamelCase				:List[Any]	, **lowerCamelCase				:int )       ->     Dict:
       return self.tokenizer.decode(*lowerCamelCase	, **lowerCamelCase )
      @property
      def 		UpperCAmelCase_  (     self				:Tuple )       ->     Dict:
       return ["input_ids", "bbox", "token_type_ids", "attention_mask", "image"]
      @property
      def 		UpperCAmelCase_  (     self				:int )       ->     Optional[Any]:
       warnings.warn(
           "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."	, lowerCamelCase	, )
       return self.image_processor_class







      @property
      def 		UpperCAmelCase_  (     self				:int )       ->     Optional[int]:
       warnings.warn(
           "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."	, lowerCamelCase	, )
       return self.image_processor











from collections import defaultdict



def   lowerCAmelCase						(						_lowerCAmelCase							:				int = 5		):




 """simple docstring"""







 UpperCAmelCase__								=  defaultdict(_lowerCAmelCase		)
 UpperCAmelCase__								=  0

 while True:
  UpperCAmelCase__								=  get_digits(_lowerCAmelCase		)
  freqs[digits].append(_lowerCAmelCase		)

  if len(freqs[digits]		) == max_base:
   UpperCAmelCase__								=  freqs[digits][0] ** 3
   return base

  num += 1



def   lowerCAmelCase						(						_lowerCAmelCase							:				int		):




 """simple docstring"""







 return "".join(sorted(str(num**3		)		)		)


if __name__ == "__main__":
  print(F'''{solution() = }''')





