






'''simple docstring'''



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

import numpy as np

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


if is_torch_available():
 import torch

if is_vision_available():
 import PIL


__UpperCamelCase   :							int         =   logging.get_logger(__name__)



def  __UpperCAmelCase						(					SCREAMING_SNAKE_CASE__:						np.ndarray,       SCREAMING_SNAKE_CASE__:						Union[int, Iterable[int]],       SCREAMING_SNAKE_CASE__:						bool,       SCREAMING_SNAKE_CASE__:						int     )	->      Tuple[int, int]:

   """simple docstring"""
   def constraint_to_multiple_of(SCREAMING_SNAKE_CASE__:						Tuple,       SCREAMING_SNAKE_CASE__:						str,       SCREAMING_SNAKE_CASE__:						Union[str, Any]=0,       SCREAMING_SNAKE_CASE__:						Optional[Any]=None     ):
      __a					  =     round(val / multiple     ) * multiple

      if max_val is not None and x > max_val:
         __a					  =     math.floor(val / multiple     ) * multiple

      if x < min_val:
         __a					  =     math.ceil(val / multiple     ) * multiple

      return x

   __a					  =     (output_size, output_size) if isinstance(SCREAMING_SNAKE_CASE__,       SCREAMING_SNAKE_CASE__     ) else output_size

   __a  ,      __a					  =     get_image_size(SCREAMING_SNAKE_CASE__     )
   __a  ,      __a					  =     output_size

   # determine new height and width
   __a					  =     output_height / input_height
   __a					  =     output_width / input_width

   if keep_aspect_ratio:
      # scale as little as possible
      if abs(1 - scale_width     ) < abs(1 - scale_height     ):
         # fit width
         __a					  =     scale_width
      else:
         # fit height
         __a					  =     scale_height

   __a					  =     constraint_to_multiple_of(scale_height * input_height,       multiple=SCREAMING_SNAKE_CASE__     )
   __a					  =     constraint_to_multiple_of(scale_width * input_width,       multiple=SCREAMING_SNAKE_CASE__     )

   return (new_height, new_width)



class 				__SCREAMING_SNAKE_CASE							(				_lowerCAmelCase  ):
      __a	       =["pixel_values"]




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



         '''simple docstring'''
         super().__init__(**lowerCamelCase   )
         __a					  =     size if size is not None else {'height': 384, 'width': 384}
         __a					  =     get_size_dict(lowerCamelCase   )
         __a					  =     do_resize
         __a					  =     size
         __a					  =     keep_aspect_ratio
         __a					  =     ensure_multiple_of
         __a					  =     resample
         __a					  =     do_rescale
         __a					  =     rescale_factor
         __a					  =     do_normalize
         __a					  =     image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
         __a					  =     image_std if image_std is not None else IMAGENET_STANDARD_STD




      def 			__UpperCamelCase				(	self			, lowerCamelCase			, lowerCamelCase			, lowerCamelCase = False			, lowerCamelCase = 1			, lowerCamelCase = PILImageResampling.BICUBIC			, lowerCamelCase = None			, **lowerCamelCase			, )				->np.ndarray:



         '''simple docstring'''
         __a					  =     get_size_dict(lowerCamelCase   )
         if "height" not in size or "width" not in size:
            raise ValueError(F"""The size dictionary must contain the keys 'height' and 'width'. Got {size.keys()}"""   )
         __a					  =     get_resize_output_image_size(
             lowerCamelCase			, output_size=(size['height'], size['width'])			, keep_aspect_ratio=lowerCamelCase			, multiple=lowerCamelCase			, )
         return resize(lowerCamelCase			, size=lowerCamelCase			, resample=lowerCamelCase			, data_format=lowerCamelCase			, **lowerCamelCase   )




      def 			__UpperCamelCase				(	self			, lowerCamelCase			, lowerCamelCase			, lowerCamelCase = None			, **lowerCamelCase			, )				->List[str]:



         '''simple docstring'''
         return rescale(lowerCamelCase			, scale=lowerCamelCase			, data_format=lowerCamelCase			, **lowerCamelCase   )




      def 			__UpperCamelCase				(	self			, lowerCamelCase			, lowerCamelCase			, lowerCamelCase			, lowerCamelCase = None			, **lowerCamelCase			, )				->np.ndarray:



         '''simple docstring'''
         return normalize(lowerCamelCase			, mean=lowerCamelCase			, std=lowerCamelCase			, data_format=lowerCamelCase			, **lowerCamelCase   )




      def 			__UpperCamelCase				(	self			, lowerCamelCase			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = None			, lowerCamelCase = ChannelDimension.FIRST			, **lowerCamelCase			, )				->PIL.Image.Image:



         '''simple docstring'''
         __a					  =     do_resize if do_resize is not None else self.do_resize
         __a					  =     size if size is not None else self.size
         __a					  =     get_size_dict(lowerCamelCase   )
         __a					  =     keep_aspect_ratio if keep_aspect_ratio is not None else self.keep_aspect_ratio
         __a					  =     ensure_multiple_of if ensure_multiple_of is not None else self.ensure_multiple_of
         __a					  =     resample if resample is not None else self.resample
         __a					  =     do_rescale if do_rescale is not None else self.do_rescale
         __a					  =     rescale_factor if rescale_factor is not None else self.rescale_factor
         __a					  =     do_normalize if do_normalize is not None else self.do_normalize
         __a					  =     image_mean if image_mean is not None else self.image_mean
         __a					  =     image_std if image_std is not None else self.image_std

         __a					  =     make_list_of_images(lowerCamelCase   )

         if not valid_images(lowerCamelCase   ):
            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 or resample is None:
            raise ValueError('Size and resample 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_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					  =     [to_numpy_array(lowerCamelCase   ) for image in images]

         if do_resize:
            __a					  =     [self.resize(image=lowerCamelCase			, size=lowerCamelCase			, resample=lowerCamelCase   ) for image in images]

         if do_rescale:
            __a					  =     [self.rescale(image=lowerCamelCase			, scale=lowerCamelCase   ) for image in images]

         if do_normalize:
            __a					  =     [self.normalize(image=lowerCamelCase			, mean=lowerCamelCase			, std=lowerCamelCase   ) for image in images]

         __a					  =     [to_channel_dimension_format(lowerCamelCase			, lowerCamelCase   ) for image in images]

         __a					  =     {'pixel_values': images}
         return BatchFeature(data=lowerCamelCase			, tensor_type=lowerCamelCase   )






      def 			__UpperCamelCase				(	self			, lowerCamelCase			, lowerCamelCase = None   )				->List[Any]:



         '''simple docstring'''
         __a					  =     outputs.logits

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

            if is_torch_tensor(lowerCamelCase   ):
               __a					  =     target_sizes.numpy()

            __a					  =     []

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

         return semantic_segmentation







'''simple docstring'''



import sys

__UpperCamelCase   :							List[str]         =   (
    """73167176531330624919225119674426574742355349194934"""
    """96983520312774506326239578318016984801869478851843"""
    """85861560789112949495459501737958331952853208805511"""
    """12540698747158523863050715693290963295227443043557"""
    """66896648950445244523161731856403098711121722383113"""
    """62229893423380308135336276614282806444486645238749"""
    """30358907296290491560440772390713810515859307960866"""
    """70172427121883998797908792274921901699720888093776"""
    """65727333001053367881220235421809751254540594752243"""
    """52584907711670556013604839586446706324415722155397"""
    """53697817977846174064955149290862569321978468622482"""
    """83972241375657056057490261407972968652414535100474"""
    """82166370484403199890008895243450658541227588666881"""
    """16427171479924442928230863465674813919123162824586"""
    """17866458359124566529476545682848912883142607690042"""
    """24219022671055626321111109370544217506941658960408"""
    """07198403850962455444362981230987879927244284909188"""
    """84580156166097919133875499200524063689912560717606"""
    """05886116467109405077541002256983155200055935729725"""
    """71636269561882670428252483600823257530420752963450"""
)



def  __UpperCAmelCase						(					SCREAMING_SNAKE_CASE__:						str = N     )	->      int:

   """simple docstring"""
   __a					  =     -sys.maxsize - 1
   for i in range(len(SCREAMING_SNAKE_CASE__     ) - 12     ):
      __a					  =     1
      for j in range(13     ):
         product *= int(n[i + j]     )
      if product > largest_product:
         __a					  =     product
   return largest_product


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