

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


if is_torch_available():
 import torch

if is_vision_available():
 from PIL import Image

 from transformers import TvltImageProcessor







def      snake_case__							(  lowerCAmelCase_,       lowerCAmelCase_=10,       lowerCAmelCase_=10,       lowerCAmelCase_=False,       lowerCAmelCase_=False     ):





     """simple docstring"""







     SCREAMING_SNAKE_CASE 		=[]
     for i in range(image_processor_tester.num_frames     ):
          video.append(np.random.randint(255,       size=(image_processor_tester.num_channels, width, height),       dtype=np.uinta     )     )

     if not numpify and not torchify:
          # PIL expects the channel dimension as last dimension
          SCREAMING_SNAKE_CASE 		=[Image.fromarray(np.moveaxis(lowerCAmelCase_,       0,       -1     )     ) for frame in video]

     if torchify:
          SCREAMING_SNAKE_CASE 		=[torch.from_numpy(lowerCAmelCase_     ) for frame in video]

     return video







def      snake_case__							(  lowerCAmelCase_,       lowerCAmelCase_=False,       lowerCAmelCase_=False,       lowerCAmelCase_=False     ):





     """simple docstring"""







     assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"

     SCREAMING_SNAKE_CASE 		=[]
     for i in range(image_processor_tester.batch_size     ):
          if equal_resolution:
               SCREAMING_SNAKE_CASE 		=SCREAMING_SNAKE_CASE 		=image_processor_tester.max_resolution
          else:
               SCREAMING_SNAKE_CASE		,    SCREAMING_SNAKE_CASE 		=np.random.choice(
                   np.arange(image_processor_tester.min_resolution,       image_processor_tester.max_resolution     ),       2     )
               SCREAMING_SNAKE_CASE 		=prepare_video(
                   image_processor_tester=lowerCAmelCase_,       width=lowerCAmelCase_,       height=lowerCAmelCase_,       numpify=lowerCAmelCase_,       torchify=lowerCAmelCase_,       )
          video_inputs.append(lowerCAmelCase_     )

     return video_inputs



class 						a_			(				unittest.TestCase	):



      """simple docstring"""







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

           SCREAMING_SNAKE_CASE 		=parent
           SCREAMING_SNAKE_CASE 		=batch_size
           SCREAMING_SNAKE_CASE 		=num_channels
           SCREAMING_SNAKE_CASE 		=num_frames
           SCREAMING_SNAKE_CASE 		=image_size
           SCREAMING_SNAKE_CASE 		=min_resolution
           SCREAMING_SNAKE_CASE 		=max_resolution
           SCREAMING_SNAKE_CASE 		=do_resize
           SCREAMING_SNAKE_CASE 		=size
           SCREAMING_SNAKE_CASE 		=do_normalize
           SCREAMING_SNAKE_CASE 		=image_mean
           SCREAMING_SNAKE_CASE 		=image_std
           SCREAMING_SNAKE_CASE 		=do_center_crop
           SCREAMING_SNAKE_CASE 		=crop_size


      def 			_lowerCAmelCase	( self	:				str							):
           return {
               "image_mean": self.image_mean,
               "image_std": self.image_std,
               "do_normalize": self.do_normalize,
               "do_resize": self.do_resize,
               "size": self.size,
               "do_center_crop": self.do_center_crop,
               "crop_size": self.crop_size,
           }







@require_torch
@require_vision
class 						a_			(				lowerCamelCase_					,     unittest.TestCase	):



      """simple docstring"""







      __UpperCAmelCase     						= TvltImageProcessor if is_vision_available() else None
      def 			_lowerCAmelCase	( self	:				List[Any]							):
           SCREAMING_SNAKE_CASE 		=TvltImageProcessorTester(self							)
      @property
      def 			_lowerCAmelCase	( self	:				Union[str, Any]							):
           return self.image_processor_tester.prepare_image_processor_dict()
      def 			_lowerCAmelCase	( self	:				List[Any]							):
           SCREAMING_SNAKE_CASE 		=self.image_processing_class(**self.image_processor_dict							)
           self.assertTrue(hasattr(snake_case     ,'image_mean'							)							)
           self.assertTrue(hasattr(snake_case     ,'image_std'							)							)
           self.assertTrue(hasattr(snake_case     ,'do_normalize'							)							)
           self.assertTrue(hasattr(snake_case     ,'do_resize'							)							)
           self.assertTrue(hasattr(snake_case     ,'do_center_crop'							)							)
           self.assertTrue(hasattr(snake_case     ,'size'							)							)
      def 			_lowerCAmelCase	( self	:				Dict							):
           # Initialize image_processor
           SCREAMING_SNAKE_CASE 		=self.image_processing_class(**self.image_processor_dict							)
           # create random PIL videos
           SCREAMING_SNAKE_CASE 		=prepare_video_inputs(self.image_processor_tester     ,equal_resolution=snake_case							)
           for video in video_inputs:
                self.assertIsInstance(snake_case     ,snake_case							)
                self.assertIsInstance(video[0]     ,Image.Image							)

           # Test not batched input
           SCREAMING_SNAKE_CASE 		=image_processor(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
           SCREAMING_SNAKE_CASE 		=image_processor(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 			_lowerCAmelCase	( self	:				Optional[int]							):
           # Initialize image_processor
           SCREAMING_SNAKE_CASE 		=self.image_processing_class(**self.image_processor_dict							)
           # create random numpy tensors
           SCREAMING_SNAKE_CASE 		=prepare_video_inputs(self.image_processor_tester     ,equal_resolution=snake_case     ,numpify=snake_case							)
           for video in video_inputs:
                self.assertIsInstance(snake_case     ,snake_case							)
                self.assertIsInstance(video[0]     ,np.ndarray							)

           # Test not batched input
           SCREAMING_SNAKE_CASE 		=image_processor(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
           SCREAMING_SNAKE_CASE 		=image_processor(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 			_lowerCAmelCase	( self	:				Any							):
           # Initialize image_processor
           SCREAMING_SNAKE_CASE 		=self.image_processing_class(**self.image_processor_dict							)
           # create random PyTorch tensors
           SCREAMING_SNAKE_CASE 		=prepare_video_inputs(self.image_processor_tester     ,equal_resolution=snake_case     ,torchify=snake_case							)
           for video in video_inputs:
                self.assertIsInstance(snake_case     ,snake_case							)
                self.assertIsInstance(video[0]     ,torch.Tensor							)

           # Test not batched input
           SCREAMING_SNAKE_CASE 		=image_processor(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
           SCREAMING_SNAKE_CASE 		=image_processor(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      snake_case__							(  lowerCAmelCase_ = 100     ):





     """simple docstring"""







     SCREAMING_SNAKE_CASE 		=[[0 for _ in range(lowerCAmelCase_     )] for _ in range(m + 1     )]
     for i in range(m + 1     ):
          SCREAMING_SNAKE_CASE 		=1

     for n in range(m + 1     ):
          for k in range(1,       lowerCAmelCase_     ):
               memo[n][k] += memo[n][k - 1]
               if n > k:
                    memo[n][k] += memo[n - k - 1][k]

     return memo[m][m - 1] - 1


if __name__ == "__main__":
 print(solution(int(input("Enter a number: ").strip())))

