
"""simple docstring"""






from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
    get_resize_output_image_size,
    normalize,
    pad,
    rescale,
    resize,
    to_channel_dimension_format,
)
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    get_image_size,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, logging
from ...utils.import_utils import is_vision_available


__UpperCAmelCase 					=    logging.get_logger(__name__)


if is_vision_available():
				import PIL




class      _SCREAMING_SNAKE_CASE   (     A__				):
			UpperCAmelCase_    :int												=		["pixel_values"]






			def __init__(   self			,  __A = True			,  __A = None			,  __A = PILImageResampling.BILINEAR			,  __A = True			,  __A = False			,  __A = True			,  __A = True			,  __A = 1 / 255			,  __A = True			,  __A = None			,  __A = None			,  **__A			,  )     ->	None:
						super().__init__(**__A			)

						lowerCAmelCase_       :List[str]     	=    size if size is not None else {"""height""": 2560, """width""": 1920}
						if isinstance(__A			,  (tuple, list)			):
									# The previous feature extractor size parameter was in (width, height) format
									lowerCAmelCase_       :Optional[int]     	=    size[::-1]
						lowerCAmelCase_       :Union[str, Any]     	=    get_size_dict(__A			)

						lowerCAmelCase_       :Any     	=    do_resize
						lowerCAmelCase_       :int     	=    size
						lowerCAmelCase_       :str     	=    resample
						lowerCAmelCase_       :int     	=    do_thumbnail
						lowerCAmelCase_       :int     	=    do_align_long_axis
						lowerCAmelCase_       :List[Any]     	=    do_pad
						lowerCAmelCase_       :Optional[Any]     	=    do_rescale
						lowerCAmelCase_       :List[str]     	=    rescale_factor
						lowerCAmelCase_       :str     	=    do_normalize
						lowerCAmelCase_       :str     	=    image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
						lowerCAmelCase_       :Optional[int]     	=    image_std if image_std is not None else IMAGENET_STANDARD_STD






			def 					__lowerCAmelCase					(   self			,  __A			,  __A			,  __A = None			)     ->	np.ndarray:
						lowerCAmelCase_	,			lowerCAmelCase_       :Union[str, Any]     	=    get_image_size(__A			)
						lowerCAmelCase_	,			lowerCAmelCase_       :Tuple     	=    size["""height"""], size["""width"""]

						if (output_width < output_height and input_width > input_height) or (
						    output_width > output_height and input_width < input_height
						):
									lowerCAmelCase_       :Any     	=    np.rotaa(__A			,  3			)

						if data_format is not None:
									lowerCAmelCase_       :Dict     	=    to_channel_dimension_format(__A			,  __A			)

						return image






			def 					__lowerCAmelCase					(   self			,  __A			,  __A			,  __A = False			,  __A = None			,  )     ->	np.ndarray:
						lowerCAmelCase_	,			lowerCAmelCase_       :int     	=    size["""height"""], size["""width"""]
						lowerCAmelCase_	,			lowerCAmelCase_       :str     	=    get_image_size(__A			)

						lowerCAmelCase_       :Any     	=    output_width - input_width
						lowerCAmelCase_       :Optional[int]     	=    output_height - input_height

						if random_padding:
									lowerCAmelCase_       :Optional[int]     	=    np.random.randint(low=0			,  high=delta_height + 1			)
									lowerCAmelCase_       :List[str]     	=    np.random.randint(low=0			,  high=delta_width + 1			)
						else:
									lowerCAmelCase_       :Tuple     	=    delta_height // 2
									lowerCAmelCase_       :Any     	=    delta_width // 2

						lowerCAmelCase_       :List[str]     	=    delta_height - pad_top
						lowerCAmelCase_       :Tuple     	=    delta_width - pad_left

						lowerCAmelCase_       :int     	=    ((pad_top, pad_bottom), (pad_left, pad_right))
						return pad(__A			,  __A			,  data_format=__A			)






			def 					__lowerCAmelCase					(   self			,  *__A			,  **__A			)     ->	str:
						logger.info("""pad is deprecated and will be removed in version 4.27. Please use pad_image instead."""			)
						return self.pad_image(*__A			,  **__A			)






			def 					__lowerCAmelCase					(   self			,  __A			,  __A			,  __A = PILImageResampling.BICUBIC			,  __A = None			,  **__A			,  )     ->	np.ndarray:
						lowerCAmelCase_	,			lowerCAmelCase_       :Tuple     	=    get_image_size(__A			)
						lowerCAmelCase_	,			lowerCAmelCase_       :Union[str, Any]     	=    size["""height"""], size["""width"""]

						# We always resize to the smallest of either the input or output size.
						lowerCAmelCase_       :List[Any]     	=    min(__A			,  __A			)
						lowerCAmelCase_       :List[str]     	=    min(__A			,  __A			)

						if height == input_height and width == input_width:
									return image

						if input_height > input_width:
									lowerCAmelCase_       :Tuple     	=    int(input_width * height / input_height			)
						elif input_width > input_height:
									lowerCAmelCase_       :Any     	=    int(input_height * width / input_width			)

						return resize(
						    __A			,  size=(height, width)			,  resample=__A			,  reducing_gap=2.0			,  data_format=__A			,  **__A			)






			def 					__lowerCAmelCase					(   self			,  __A			,  __A			,  __A = PILImageResampling.BICUBIC			,  __A = None			,  **__A			,  )     ->	np.ndarray:
						lowerCAmelCase_       :Union[str, Any]     	=    get_size_dict(__A			)
						lowerCAmelCase_       :Dict     	=    min(size["""height"""]			,  size["""width"""]			)
						lowerCAmelCase_       :int     	=    get_resize_output_image_size(__A			,  size=__A			,  default_to_square=__A			)
						lowerCAmelCase_       :Optional[Any]     	=    resize(__A			,  size=__A			,  resample=__A			,  data_format=__A			,  **__A			)
						return resized_image






			def 					__lowerCAmelCase					(   self			,  __A			,  __A			,  __A = None			,  **__A			,  )     ->	str:
						return rescale(__A			,  scale=__A			,  data_format=__A			,  **__A			)






			def 					__lowerCAmelCase					(   self			,  __A			,  __A			,  __A			,  __A = None			,  **__A			,  )     ->	np.ndarray:
						return normalize(__A			,  mean=__A			,  std=__A			,  data_format=__A			,  **__A			)






			def 					__lowerCAmelCase					(   self			,  __A			,  __A = None			,  __A = None			,  __A = None			,  __A = None			,  __A = None			,  __A = None			,  __A = False			,  __A = None			,  __A = None			,  __A = None			,  __A = None			,  __A = None			,  __A = None			,  __A = ChannelDimension.FIRST			,  **__A			,  )     ->	PIL.Image.Image:
						lowerCAmelCase_       :Tuple     	=    do_resize if do_resize is not None else self.do_resize
						lowerCAmelCase_       :str     	=    size if size is not None else self.size
						if isinstance(__A			,  (tuple, list)			):
									# Previous feature extractor had size in (width, height) format
									lowerCAmelCase_       :Optional[Any]     	=    size[::-1]
						lowerCAmelCase_       :Any     	=    get_size_dict(__A			)
						lowerCAmelCase_       :List[str]     	=    resample if resample is not None else self.resample
						lowerCAmelCase_       :Tuple     	=    do_thumbnail if do_thumbnail is not None else self.do_thumbnail
						lowerCAmelCase_       :List[Any]     	=    do_align_long_axis if do_align_long_axis is not None else self.do_align_long_axis
						lowerCAmelCase_       :List[Any]     	=    do_pad if do_pad is not None else self.do_pad
						lowerCAmelCase_       :Dict     	=    do_rescale if do_rescale is not None else self.do_rescale
						lowerCAmelCase_       :Tuple     	=    rescale_factor if rescale_factor is not None else self.rescale_factor
						lowerCAmelCase_       :Optional[Any]     	=    do_normalize if do_normalize is not None else self.do_normalize
						lowerCAmelCase_       :List[str]     	=    image_mean if image_mean is not None else self.image_mean
						lowerCAmelCase_       :int     	=    image_std if image_std is not None else self.image_std

						lowerCAmelCase_       :str     	=    make_list_of_images(__A			)

						if not valid_images(__A			):
									raise ValueError(
									    """Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, """
									    """torch.Tensor, tf.Tensor or jax.ndarray."""			)

						if do_resize and size is None:
									raise ValueError("""Size must be specified if do_resize is True."""			)

						if do_rescale and rescale_factor is None:
									raise ValueError("""Rescale factor must be specified if do_rescale is True."""			)

						if do_pad and size is None:
									raise ValueError("""Size must be specified if do_pad is True."""			)

						if do_normalize and (image_mean is None or image_std is None):
									raise ValueError("""Image mean and std must be specified if do_normalize is True."""			)

						# All transformations expect numpy arrays.
						lowerCAmelCase_       :Any     	=    [to_numpy_array(__A			) for image in images]

						if do_align_long_axis:
									lowerCAmelCase_       :Dict     	=    [self.align_long_axis(__A			,  size=__A			) for image in images]

						if do_resize:
									lowerCAmelCase_       :str     	=    [self.resize(image=__A			,  size=__A			,  resample=__A			) for image in images]

						if do_thumbnail:
									lowerCAmelCase_       :int     	=    [self.thumbnail(image=__A			,  size=__A			) for image in images]

						if do_pad:
									lowerCAmelCase_       :List[Any]     	=    [self.pad_image(image=__A			,  size=__A			,  random_padding=__A			) for image in images]

						if do_rescale:
									lowerCAmelCase_       :str     	=    [self.rescale(image=__A			,  scale=__A			) for image in images]

						if do_normalize:
									lowerCAmelCase_       :List[Any]     	=    [self.normalize(image=__A			,  mean=__A			,  std=__A			) for image in images]

						lowerCAmelCase_       :Optional[Any]     	=    [to_channel_dimension_format(__A			,  __A			) for image in images]

						lowerCAmelCase_       :Tuple     	=    {"""pixel_values""": images}
						return BatchFeature(data=__A			,  tensor_type=__A			)








"""simple docstring"""






import math






def 		_snake_case			(      lowercase__						:    int						)    ->							int:


			'''simple docstring'''





			return sum(int(lowercase__						) for digit in str(lowercase__						)						)






def 		_snake_case			(      lowercase__						:    int = 3_0						)    ->							int:


			'''simple docstring'''





			lowerCAmelCase_       :Union[str, Any]     	=    []
			for digit in range(2 ,	1_0_0						):
						for power in range(2 ,	1_0_0						):
									lowerCAmelCase_       :Tuple     	=    int(math.pow(lowercase__ ,	lowercase__						)						)
									if digit == digit_sum(lowercase__						):
												digit_to_powers.append(lowercase__						)

			digit_to_powers.sort()
			return digit_to_powers[n - 1]


if __name__ == "__main__":
				print(solution())






