


'''simple docstring'''







import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs


if is_torch_available():
   import torch

if is_vision_available():
   from PIL import Image

   from transformers import VideoMAEImageProcessor


class  __lowerCamelCase (       unittest.TestCase       ):
    """simple docstring"""


    def __init__(  self			:							str      ,							SCREAMING_SNAKE_CASE			:							Dict      ,							SCREAMING_SNAKE_CASE			:							List[Any]=7      ,							SCREAMING_SNAKE_CASE			:							str=3      ,							SCREAMING_SNAKE_CASE			:							List[str]=10      ,							SCREAMING_SNAKE_CASE			:							int=18      ,							SCREAMING_SNAKE_CASE			:							str=30      ,							SCREAMING_SNAKE_CASE			:							Any=400      ,							SCREAMING_SNAKE_CASE			:							Tuple=True      ,							SCREAMING_SNAKE_CASE			:							str=None      ,							SCREAMING_SNAKE_CASE			:							Tuple=True      ,							SCREAMING_SNAKE_CASE			:							Optional[int]=[0.5, 0.5, 0.5]      ,							SCREAMING_SNAKE_CASE			:							Optional[Any]=[0.5, 0.5, 0.5]      ,							SCREAMING_SNAKE_CASE			:							Optional[Any]=None      ,							):
           _A     :	str      =					size if size is not None else {'shortest_edge': 18}
           _A     :	Any      =					crop_size if crop_size is not None else {'height': 18, 'width': 18}

           _A     :	Tuple      =					parent
           _A     :	Dict      =					batch_size
           _A     :	List[str]      =					num_channels
           _A     :	List[Any]      =					num_frames
           _A     :	Optional[int]      =					image_size
           _A     :	Dict      =					min_resolution
           _A     :	List[str]      =					max_resolution
           _A     :	Any      =					do_resize
           _A     :	Optional[int]      =					size
           _A     :	str      =					do_normalize
           _A     :	Dict      =					image_mean
           _A     :	Dict      =					image_std
           _A     :	Optional[Any]      =					crop_size


    def    A    (  self			:							Union[str, Any]):
           return {
               "image_mean": self.image_mean,
               "image_std": self.image_std,
               "do_normalize": self.do_normalize,
               "do_resize": self.do_resize,
               "size": self.size,
               "crop_size": self.crop_size,
           }




@require_torch
@require_vision
class  __lowerCamelCase (       a_				,					unittest.TestCase       ):
    """simple docstring"""
    a													=    VideoMAEImageProcessor if is_vision_available() else None


    def    A    (  self			:							Optional[Any]):
           _A     :	List[str]      =					VideoMAEImageProcessingTester(self)


    @property
    def    A    (  self			:							Optional[int]):
           return self.image_processor_tester.prepare_image_processor_dict()


    def    A    (  self			:							List[Any]):
           _A     :	List[Any]      =					self.image_processing_class(**self.image_processor_dict)
           self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,							'image_mean'))
           self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,							'image_std'))
           self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,							'do_normalize'))
           self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,							'do_resize'))
           self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,							'do_center_crop'))
           self.assertTrue(hasattr(SCREAMING_SNAKE_CASE      ,							'size'))


    def    A    (  self			:							Union[str, Any]):
           _A     :	Union[str, Any]      =					self.image_processing_class.from_dict(self.image_processor_dict)
           self.assertEqual(image_processor.size      ,							{'shortest_edge': 18})
           self.assertEqual(image_processor.crop_size      ,							{'height': 18, 'width': 18})

           _A     :	Dict      =					self.image_processing_class.from_dict(self.image_processor_dict      ,							size=42      ,							crop_size=84)
           self.assertEqual(image_processor.size      ,							{'shortest_edge': 42})
           self.assertEqual(image_processor.crop_size      ,							{'height': 84, 'width': 84})


    def    A    (  self			:							int):
           pass


    def    A    (  self			:							Union[str, Any]):
           # Initialize image_processing
           _A     :	List[str]      =					self.image_processing_class(**self.image_processor_dict)
           # create random PIL videos
           _A     :	List[Any]      =					prepare_video_inputs(self.image_processor_tester      ,							equal_resolution=SCREAMING_SNAKE_CASE)
           for video in video_inputs:
                  self.assertIsInstance(SCREAMING_SNAKE_CASE      ,							SCREAMING_SNAKE_CASE)
                  self.assertIsInstance(video[0]      ,							Image.Image)

           # Test not batched input
           _A     :	Dict      =					image_processing(video_inputs[0]      ,							return_tensors='pt').pixel_values
           self.assertEqual(
               encoded_videos.shape      ,							(
                   1,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               )      ,							)

           # Test batched
           _A     :	int      =					image_processing(SCREAMING_SNAKE_CASE      ,							return_tensors='pt').pixel_values
           self.assertEqual(
               encoded_videos.shape      ,							(
                   self.image_processor_tester.batch_size,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               )      ,							)


    def    A    (  self			:							str):
           # Initialize image_processing
           _A     :	Optional[Any]      =					self.image_processing_class(**self.image_processor_dict)
           # create random numpy tensors
           _A     :	Optional[int]      =					prepare_video_inputs(self.image_processor_tester      ,							equal_resolution=SCREAMING_SNAKE_CASE      ,							numpify=SCREAMING_SNAKE_CASE)
           for video in video_inputs:
                  self.assertIsInstance(SCREAMING_SNAKE_CASE      ,							SCREAMING_SNAKE_CASE)
                  self.assertIsInstance(video[0]      ,							np.ndarray)

           # Test not batched input
           _A     :	Optional[int]      =					image_processing(video_inputs[0]      ,							return_tensors='pt').pixel_values
           self.assertEqual(
               encoded_videos.shape      ,							(
                   1,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               )      ,							)

           # Test batched
           _A     :	Any      =					image_processing(SCREAMING_SNAKE_CASE      ,							return_tensors='pt').pixel_values
           self.assertEqual(
               encoded_videos.shape      ,							(
                   self.image_processor_tester.batch_size,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               )      ,							)


    def    A    (  self			:							str):
           # Initialize image_processing
           _A     :	Union[str, Any]      =					self.image_processing_class(**self.image_processor_dict)
           # create random PyTorch tensors
           _A     :	str      =					prepare_video_inputs(self.image_processor_tester      ,							equal_resolution=SCREAMING_SNAKE_CASE      ,							torchify=SCREAMING_SNAKE_CASE)
           for video in video_inputs:
                  self.assertIsInstance(SCREAMING_SNAKE_CASE      ,							SCREAMING_SNAKE_CASE)
                  self.assertIsInstance(video[0]      ,							torch.Tensor)

           # Test not batched input
           _A     :	Tuple      =					image_processing(video_inputs[0]      ,							return_tensors='pt').pixel_values
           self.assertEqual(
               encoded_videos.shape      ,							(
                   1,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               )      ,							)

           # Test batched
           _A     :	Dict      =					image_processing(SCREAMING_SNAKE_CASE      ,							return_tensors='pt').pixel_values
           self.assertEqual(
               encoded_videos.shape      ,							(
                   self.image_processor_tester.batch_size,
                   self.image_processor_tester.num_frames,
                   self.image_processor_tester.num_channels,
                   self.image_processor_tester.crop_size['height'],
                   self.image_processor_tester.crop_size['width'],
               )      ,							)










'''simple docstring'''







import sys

sys.set_int_max_str_digits(0)  # type: ignore






def       lowerCAmelCase__       (				lowerCamelCase     :			int   ):
       _A     :	Optional[Any]      =					[0] * 11
       _A     :	str      =					[0] * 11

       # mark last 9 numbers
       for _ in range(9   ):
              _A     :	int      =					1
              _A     :	Optional[int]      =					number // 10
       # flag
       _A     :	List[Any]      =					True

       # check last 9 numbers for pandigitality

       for x in range(9   ):
              if not check_last[x + 1]:
                     _A     :	Optional[int]      =					False
       if not f:
              return f

       # mark first 9 numbers
       _A     :	Optional[int]      =					int(str(lowerCamelCase   )[:9]   )

       for _ in range(9   ):
              _A     :	Optional[Any]      =					1
              _A     :	str      =					number // 10

       # check first 9 numbers for pandigitality

       for x in range(9   ):
              if not check_front[x + 1]:
                     _A     :	Optional[Any]      =					False
       return f






def       lowerCAmelCase__       (				lowerCamelCase     :			int   ):
       _A     :	Dict      =					[0] * 11

       # mark last 9 numbers
       for _ in range(9   ):
              _A     :	List[str]      =					1
              _A     :	Dict      =					number // 10
       # flag
       _A     :	Optional[int]      =					True

       # check last 9 numbers for pandigitality

       for x in range(9   ):
              if not check_last[x + 1]:
                     _A     :	List[str]      =					False
       return f






def       lowerCAmelCase__       (				):
       _A     :	List[Any]      =					1
       _A     :	Dict      =					1
       _A     :	Dict      =					2
       # temporary Fibonacci numbers

       _A     :	List[Any]      =					1
       _A     :	Union[str, Any]      =					1
       _A     :	List[Any]      =					2
       # temporary Fibonacci numbers mod 1e9

       # mod m=1e9, done for fast optimisation
       _A     :	Tuple      =					[0] * 1000000
       _A     :	Any      =					1000000000

       for x in range(1000000   ):
              _A     :	Tuple      =					(aa + ba) % m
              _A     :	Optional[Any]      =					ba % m
              _A     :	str      =					ca % m
              if checka(lowerCamelCase   ):
                     _A     :	Dict      =					1

       for x in range(1000000   ):
              _A     :	List[str]      =					a + b
              _A     :	Optional[int]      =					b
              _A     :	str      =					c
              # perform check only if in tocheck
              if tocheck[x + 3] and check(lowerCamelCase   ):
                     return x + 3  # first 2 already done
       return -1


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






