






'''simple docstring'''







from typing import Dict, List, Optional, Tuple, Union

import numpy as np

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


if is_torch_available():
		import torch


__lowerCAmelCase       		=      logging.get_logger(__name__)





class 	SCREAMING_SNAKE_CASE					(					SCREAMING_SNAKE_CASE_       ):
			snake_case__  =				["pixel_values"]






			def __init__( self      :			List[Any]  ,						__SCREAMING_SNAKE_CASE      :			bool = True  ,						__SCREAMING_SNAKE_CASE      :			Optional[Dict[str, int]] = None  ,						__SCREAMING_SNAKE_CASE      :			PILImageResampling = PILImageResampling.BILINEAR  ,						__SCREAMING_SNAKE_CASE      :			bool = True  ,						__SCREAMING_SNAKE_CASE      :			Dict[str, int] = None  ,						__SCREAMING_SNAKE_CASE      :			bool = True  ,						__SCREAMING_SNAKE_CASE      :			Union[int, float] = 1 / 255  ,						__SCREAMING_SNAKE_CASE      :			bool = True  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[float, List[float]]] = None  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[float, List[float]]] = None  ,						**__SCREAMING_SNAKE_CASE      :			Dict  ,						)			->			None:
							super().__init__(**__SCREAMING_SNAKE_CASE					)
							a_		:  Tuple											=      size if size is not None else {'''shortest_edge''': 256}
							a_		:  str											=      get_size_dict(__SCREAMING_SNAKE_CASE  ,						default_to_square=__SCREAMING_SNAKE_CASE					)
							a_		:  Dict											=      crop_size if crop_size is not None else {'''height''': 224, '''width''': 224}
							a_		:  str											=      get_size_dict(__SCREAMING_SNAKE_CASE  ,						param_name='''crop_size'''					)
							a_		:  Tuple											=      do_resize
							a_		:  str											=      size
							a_		:  Any											=      resample
							a_		:  Optional[Any]											=      do_center_crop
							a_		:  Union[str, Any]											=      crop_size
							a_		:  List[Any]											=      do_rescale
							a_		:  Dict											=      rescale_factor
							a_		:  Tuple											=      do_normalize
							a_		:  Optional[int]											=      image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
							a_		:  str											=      image_std if image_std is not None else IMAGENET_STANDARD_STD






			def 			SCREAMING_SNAKE_CASE      ( self      :			Any  ,						__SCREAMING_SNAKE_CASE      :			np.ndarray  ,						__SCREAMING_SNAKE_CASE      :			Dict[str, int]  ,						__SCREAMING_SNAKE_CASE      :			PILImageResampling = PILImageResampling.BICUBIC  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[str, ChannelDimension]] = None  ,						**__SCREAMING_SNAKE_CASE      :			int  ,						)			->			np.ndarray:
							a_		:  List[Any]											=      get_size_dict(__SCREAMING_SNAKE_CASE  ,						default_to_square=__SCREAMING_SNAKE_CASE					)
							if "shortest_edge" not in size:
											raise ValueError(f'The `size` parameter must contain the key `shortest_edge`. Got {size.keys()}'					)
							a_		:  str											=      get_resize_output_image_size(__SCREAMING_SNAKE_CASE  ,						size=size['''shortest_edge''']  ,						default_to_square=__SCREAMING_SNAKE_CASE					)
							return resize(__SCREAMING_SNAKE_CASE  ,						size=__SCREAMING_SNAKE_CASE  ,						resample=__SCREAMING_SNAKE_CASE  ,						data_format=__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Union[str, Any]  ,						__SCREAMING_SNAKE_CASE      :			np.ndarray  ,						__SCREAMING_SNAKE_CASE      :			Dict[str, int]  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[str, ChannelDimension]] = None  ,						**__SCREAMING_SNAKE_CASE      :			List[Any]  ,						)			->			np.ndarray:
							a_		:  Dict											=      get_size_dict(__SCREAMING_SNAKE_CASE					)
							if "height" not in size or "width" not in size:
											raise ValueError(f'The `size` parameter must contain the keys `height` and `width`. Got {size.keys()}'					)
							return center_crop(__SCREAMING_SNAKE_CASE  ,						size=(size['''height'''], size['''width'''])  ,						data_format=__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Optional[int]  ,						__SCREAMING_SNAKE_CASE      :			np.ndarray  ,						__SCREAMING_SNAKE_CASE      :			float  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[str, ChannelDimension]] = None  ,						**__SCREAMING_SNAKE_CASE      :			str					)			->			np.ndarray:
							return rescale(__SCREAMING_SNAKE_CASE  ,						scale=__SCREAMING_SNAKE_CASE  ,						data_format=__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Optional[int]  ,						__SCREAMING_SNAKE_CASE      :			np.ndarray  ,						__SCREAMING_SNAKE_CASE      :			Union[float, List[float]]  ,						__SCREAMING_SNAKE_CASE      :			Union[float, List[float]]  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[str, ChannelDimension]] = None  ,						**__SCREAMING_SNAKE_CASE      :			Tuple  ,						)			->			np.ndarray:
							return normalize(__SCREAMING_SNAKE_CASE  ,						mean=__SCREAMING_SNAKE_CASE  ,						std=__SCREAMING_SNAKE_CASE  ,						data_format=__SCREAMING_SNAKE_CASE  ,						**__SCREAMING_SNAKE_CASE					)






			def 			SCREAMING_SNAKE_CASE      ( self      :			Tuple  ,						__SCREAMING_SNAKE_CASE      :			ImageInput  ,						__SCREAMING_SNAKE_CASE      :			Optional[bool] = None  ,						__SCREAMING_SNAKE_CASE      :			Dict[str, int] = None  ,						__SCREAMING_SNAKE_CASE      :			PILImageResampling = None  ,						__SCREAMING_SNAKE_CASE      :			bool = None  ,						__SCREAMING_SNAKE_CASE      :			Dict[str, int] = None  ,						__SCREAMING_SNAKE_CASE      :			Optional[bool] = None  ,						__SCREAMING_SNAKE_CASE      :			Optional[float] = None  ,						__SCREAMING_SNAKE_CASE      :			Optional[bool] = None  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[float, List[float]]] = None  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[float, List[float]]] = None  ,						__SCREAMING_SNAKE_CASE      :			Optional[Union[str, TensorType]] = None  ,						__SCREAMING_SNAKE_CASE      :			Union[str, ChannelDimension] = ChannelDimension.FIRST  ,						**__SCREAMING_SNAKE_CASE      :			List[str]  ,						)			->			Union[str, Any]:
							a_		:  Optional[int]											=      do_resize if do_resize is not None else self.do_resize
							a_		:  Tuple											=      size if size is not None else self.size
							a_		:  List[Any]											=      get_size_dict(__SCREAMING_SNAKE_CASE  ,						default_to_square=__SCREAMING_SNAKE_CASE					)
							a_		:  str											=      resample if resample is not None else self.resample
							a_		:  Tuple											=      do_center_crop if do_center_crop is not None else self.do_center_crop
							a_		:  Optional[int]											=      crop_size if crop_size is not None else self.crop_size
							a_		:  List[str]											=      get_size_dict(__SCREAMING_SNAKE_CASE  ,						param_name='''crop_size'''					)
							a_		:  Union[str, Any]											=      do_rescale if do_rescale is not None else self.do_rescale
							a_		:  List[str]											=      rescale_factor if rescale_factor is not None else self.rescale_factor
							a_		:  Optional[int]											=      do_normalize if do_normalize is not None else self.do_normalize
							a_		:  str											=      image_mean if image_mean is not None else self.image_mean
							a_		:  Union[str, Any]											=      image_std if image_std is not None else self.image_std

							a_		:  Dict											=      make_list_of_images(__SCREAMING_SNAKE_CASE					)

							if not valid_images(__SCREAMING_SNAKE_CASE					):
											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_center_crop and crop_size is None:
											raise ValueError('''Crop size must be specified if do_center_crop is True.'''					)

							if do_rescale and rescale_factor is None:
											raise ValueError('''Rescale factor must be specified if do_rescale 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.
							a_		:  Union[str, Any]											=      [to_numpy_array(__SCREAMING_SNAKE_CASE					) for image in images]

							if do_resize:
											a_		:  List[str]											=      [self.resize(image=__SCREAMING_SNAKE_CASE  ,						size=__SCREAMING_SNAKE_CASE  ,						resample=__SCREAMING_SNAKE_CASE					) for image in images]

							if do_center_crop:
											a_		:  List[Any]											=      [self.center_crop(image=__SCREAMING_SNAKE_CASE  ,						size=__SCREAMING_SNAKE_CASE					) for image in images]

							if do_rescale:
											a_		:  List[Any]											=      [self.rescale(image=__SCREAMING_SNAKE_CASE  ,						scale=__SCREAMING_SNAKE_CASE					) for image in images]

							if do_normalize:
											a_		:  Dict											=      [self.normalize(image=__SCREAMING_SNAKE_CASE  ,						mean=__SCREAMING_SNAKE_CASE  ,						std=__SCREAMING_SNAKE_CASE					) for image in images]

							a_		:  Optional[Any]											=      [to_channel_dimension_format(__SCREAMING_SNAKE_CASE  ,						__SCREAMING_SNAKE_CASE					) for image in images]

							a_		:  Optional[Any]											=      {'''pixel_values''': images}
							return BatchFeature(data=__SCREAMING_SNAKE_CASE  ,						tensor_type=__SCREAMING_SNAKE_CASE					)







			def 			SCREAMING_SNAKE_CASE      ( self      :			Union[str, Any]  ,						__SCREAMING_SNAKE_CASE      :			int  ,						__SCREAMING_SNAKE_CASE      :			List[Tuple] = None					)			->			Dict:
							a_		:  List[str]											=      outputs.logits

							# Resize logits and compute semantic segmentation maps
							if target_sizes is not None:
											if len(__SCREAMING_SNAKE_CASE					) != len(__SCREAMING_SNAKE_CASE					):
															raise ValueError(
															    '''Make sure that you pass in as many target sizes as the batch dimension of the logits'''					)

											if is_torch_tensor(__SCREAMING_SNAKE_CASE					):
															a_		:  Tuple											=      target_sizes.numpy()

											a_		:  str											=      []

											for idx in range(len(__SCREAMING_SNAKE_CASE					)					):
															a_		:  Any											=      torch.nn.functional.interpolate(
															    logits[idx].unsqueeze(dim=0					)  ,						size=target_sizes[idx]  ,						mode='''bilinear'''  ,						align_corners=__SCREAMING_SNAKE_CASE					)
															a_		:  List[str]											=      resized_logits[0].argmax(dim=0					)
															semantic_segmentation.append(__SCREAMING_SNAKE_CASE					)
							else:
											a_		:  List[str]											=      logits.argmax(dim=1					)
											a_		:  Union[str, Any]											=      [semantic_segmentation[i] for i in range(semantic_segmentation.shape[0]					)]

							return semantic_segmentation












'''simple docstring'''







import sys

__lowerCAmelCase       		=      (
    '73167176531330624919225119674426574742355349194934'
    '96983520312774506326239578318016984801869478851843'
    '85861560789112949495459501737958331952853208805511'
    '12540698747158523863050715693290963295227443043557'
    '66896648950445244523161731856403098711121722383113'
    '62229893423380308135336276614282806444486645238749'
    '30358907296290491560440772390713810515859307960866'
    '70172427121883998797908792274921901699720888093776'
    '65727333001053367881220235421809751254540594752243'
    '52584907711670556013604839586446706324415722155397'
    '53697817977846174064955149290862569321978468622482'
    '83972241375657056057490261407972968652414535100474'
    '82166370484403199890008895243450658541227588666881'
    '16427171479924442928230863465674813919123162824586'
    '17866458359124566529476545682848912883142607690042'
    '24219022671055626321111109370544217506941658960408'
    '07198403850962455444362981230987879927244284909188'
    '84580156166097919133875499200524063689912560717606'
    '05886116467109405077541002256983155200055935729725'
    '71636269561882670428252483600823257530420752963450'
)





def 		_UpperCAmelCase   (							__A							:   str      ):
				a_		:  Tuple											=      1
				for digit in s:
								product *= int(__A      )
				return product





def 		_UpperCAmelCase   (							__A							:   str = N      ):
				a_		:  Dict											=      -sys.maxsize - 1
				a_		:  Optional[int]											=      n[:13]
				a_		:  str											=      13
				while cur_index < len(__A      ) - 13:
								if int(n[cur_index]      ) >= int(substr[0]      ):
												a_		:  Tuple											=      substr[1:] + n[cur_index]
												cur_index += 1
								else:
												a_		:  Dict											=      max(__A						,		str_eval(__A      )      )
												a_		:  List[str]											=      n[cur_index : cur_index + 13]
												cur_index += 13
				return largest_product


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




