





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 (
    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, logging


lowercase_					     =	logging.get_logger(__name__)
class        SCREAMING_SNAKE_CASE     (_A   ):
   _UpperCamelCase					:	Union[str, Any]				      = ['pixel_values']


   def __init__(					self    :       str    ,  a    :       bool = True    ,  a    :       Optional[Dict[str, int]] = None    ,  a    :       PILImageResampling = PILImageResampling.BILINEAR    ,  a    :       bool = True    ,  a    :       Dict[str, int] = None    ,  a    :       bool = True    ,  a    :       Union[int, float] = 1 / 255    ,  a    :       bool = True    ,  a    :       Optional[Union[float, List[float]]] = None    ,  a    :       Optional[Union[float, List[float]]] = None    ,  **a    :       List[Any]    ,  )->     None:





     """simple docstring"""







     super().__init__(**UpperCamelCase__ )
     lowercase__			    =						size if size is not None else {'shortest_edge': 256}
     lowercase__			    =						get_size_dict(UpperCamelCase__    ,  default_to_square=UpperCamelCase__ )
     lowercase__			    =						crop_size if crop_size is not None else {'height': 224, 'width': 224}
     lowercase__			    =						get_size_dict(UpperCamelCase__ )
     lowercase__			    =						do_resize
     lowercase__			    =						size
     lowercase__			    =						resample
     lowercase__			    =						do_center_crop
     lowercase__			    =						crop_size
     lowercase__			    =						do_rescale
     lowercase__			    =						rescale_factor
     lowercase__			    =						do_normalize
     lowercase__			    =						image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
     lowercase__			    =						image_std if image_std is not None else IMAGENET_STANDARD_STD


   def  SCREAMING_SNAKE_CASE_							(					self    :       Any    ,  a    :       np.ndarray    ,  a    :       Dict[str, int]    ,  a    :       PILImageResampling = PILImageResampling.BICUBIC    ,  a    :       Optional[Union[str, ChannelDimension]] = None    ,  **a    :       Tuple    ,  )->     np.ndarray:





     """simple docstring"""







     lowercase__			    =						get_size_dict(UpperCamelCase__    ,  default_to_square=UpperCamelCase__ )
     if "shortest_edge" not in size:
       raise ValueError(f"""The `size` parameter must contain the key `shortest_edge`. Got {size.keys()}""" )
     lowercase__			    =						get_resize_output_image_size(UpperCamelCase__    ,  size=size['shortest_edge']    ,  default_to_square=UpperCamelCase__ )
     return resize(UpperCamelCase__    ,  size=UpperCamelCase__    ,  resample=UpperCamelCase__    ,  data_format=UpperCamelCase__    ,  **UpperCamelCase__ )


   def  SCREAMING_SNAKE_CASE_							(					self    :       str    ,  a    :       np.ndarray    ,  a    :       Dict[str, int]    ,  a    :       Optional[Union[str, ChannelDimension]] = None    ,  **a    :       str    ,  )->     np.ndarray:





     """simple docstring"""







     lowercase__			    =						get_size_dict(UpperCamelCase__ )
     return center_crop(UpperCamelCase__    ,  size=(size['height'], size['width'])    ,  data_format=UpperCamelCase__    ,  **UpperCamelCase__ )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Tuple    ,  a    :       np.ndarray    ,  a    :       float    ,  a    :       Optional[Union[str, ChannelDimension]] = None    ,  **a    :       Any )->     np.ndarray:





     """simple docstring"""







     return rescale(UpperCamelCase__    ,  scale=UpperCamelCase__    ,  data_format=UpperCamelCase__    ,  **UpperCamelCase__ )


   def  SCREAMING_SNAKE_CASE_							(					self    :       List[str]    ,  a    :       np.ndarray    ,  a    :       Union[float, List[float]]    ,  a    :       Union[float, List[float]]    ,  a    :       Optional[Union[str, ChannelDimension]] = None    ,  **a    :       str    ,  )->     np.ndarray:





     """simple docstring"""







     return normalize(UpperCamelCase__    ,  mean=UpperCamelCase__    ,  std=UpperCamelCase__    ,  data_format=UpperCamelCase__    ,  **UpperCamelCase__ )


   def  SCREAMING_SNAKE_CASE_							(					self    :       Optional[Any]    ,  a    :       ImageInput    ,  a    :       Optional[bool] = None    ,  a    :       Dict[str, int] = None    ,  a    :       PILImageResampling = None    ,  a    :       bool = None    ,  a    :       Dict[str, int] = None    ,  a    :       Optional[bool] = None    ,  a    :       Optional[float] = None    ,  a    :       Optional[bool] = None    ,  a    :       Optional[Union[float, List[float]]] = None    ,  a    :       Optional[Union[float, List[float]]] = None    ,  a    :       Optional[Union[str, TensorType]] = None    ,  a    :       Union[str, ChannelDimension] = ChannelDimension.FIRST    ,  **a    :       int    ,  )->     Dict:





     """simple docstring"""







     lowercase__			    =						do_resize if do_resize is not None else self.do_resize
     lowercase__			    =						size if size is not None else self.size
     lowercase__			    =						get_size_dict(UpperCamelCase__    ,  default_to_square=UpperCamelCase__ )
     lowercase__			    =						resample if resample is not None else self.resample
     lowercase__			    =						do_center_crop if do_center_crop is not None else self.do_center_crop
     lowercase__			    =						crop_size if crop_size is not None else self.crop_size
     lowercase__			    =						get_size_dict(UpperCamelCase__ )
     lowercase__			    =						do_rescale if do_rescale is not None else self.do_rescale
     lowercase__			    =						rescale_factor if rescale_factor is not None else self.rescale_factor
     lowercase__			    =						do_normalize if do_normalize is not None else self.do_normalize
     lowercase__			    =						image_mean if image_mean is not None else self.image_mean
     lowercase__			    =						image_std if image_std is not None else self.image_std

     lowercase__			    =						make_list_of_images(UpperCamelCase__ )

     if not valid_images(UpperCamelCase__ ):
       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.
     lowercase__			    =						[to_numpy_array(UpperCamelCase__ ) for image in images]

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

     if do_center_crop:
       lowercase__			    =						[self.center_crop(image=UpperCamelCase__    ,  size=UpperCamelCase__ ) for image in images]

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

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

     lowercase__			    =						[to_channel_dimension_format(UpperCamelCase__    ,  UpperCamelCase__ ) for image in images]

     lowercase__			    =						{'pixel_values': images}
     return BatchFeature(data=UpperCamelCase__    ,  tensor_type=UpperCamelCase__ )









def     __UpperCamelCase						(_SCREAMING_SNAKE_CASE = 50	)       ->     int:
  lowercase__			    =						[[0] * 3 for _ in range(length + 1	)]

  for row_length in range(length + 1	):
    for tile_length in range(2	,		5	):
      for tile_start in range(row_length - tile_length + 1	):
        different_colour_ways_number[row_length][tile_length - 2] += (
            different_colour_ways_number[row_length - tile_start - tile_length][
                tile_length - 2
            ]
            + 1
        )

  return sum(different_colour_ways_number[length]	)


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


