
_A						      =				{}



def 		lowercase_    (     A__				,	A__				,	A__	)							->							int:
    """simple docstring"""

    if late == 3 or absent == 2:
        return 0

    # if we have no days left, and have not failed any other rules,
    # we have a prize string
    if days == 0:
        return 1

    # No easy solution, so now we need to do the recursive calculation

    # First, check if the combination is already in the cache, and
    # if yes, return the stored value from there since we already
    # know the number of possible prize strings from this point on
    snake_case				  =      (days, absent, late)
    if key in cache:
        return cache[key]

    # now we calculate the three possible ways that can unfold from
    # this point on, depending on our attendance today

    # 1) if we are late (but not absent), the "absent" counter stays as
    # it is, but the "late" counter increases by one
    snake_case				  =      _calculate(days - 1				,	A__				,	late + 1	)

    # 2) if we are absent, the "absent" counter increases by 1, and the
    # "late" counter resets to 0
    snake_case				  =      _calculate(days - 1				,	absent + 1				,	0	)

    # 3) if we are on time, this resets the "late" counter and keeps the
    # absent counter
    snake_case				  =      _calculate(days - 1				,	A__				,	0	)

    snake_case				  =      state_late + state_absent + state_ontime

    snake_case				  =      prizestrings
    return prizestrings



def 		lowercase_    (     A__ = 30	)							->							int:
    """simple docstring"""

    return _calculate(A__				,	absent=0				,	late=0	)


if __name__ == "__main__":
   print(solution())



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_image_inputs


if is_torch_available():
   import torch

if is_vision_available():
   from PIL import Image

   from transformers import MobileNetVaImageProcessor







class   lowerCamelCase	(						unittest.TestCase						):





     def __init__(self   :					Optional[int]       ,					_A   :					Dict       ,					_A   :					Optional[int]=7       ,					_A   :					Union[str, Any]=3       ,					_A   :					Tuple=1_8       ,					_A   :					str=3_0       ,					_A   :					Union[str, Any]=4_0_0       ,					_A   :					Optional[Any]=True       ,					_A   :					Union[str, Any]=None       ,					_A   :					str=True       ,					_A   :					Optional[int]=None       ,					)		->		int:
         snake_case				  =      size if size is not None else {"shortest_edge": 2_0}
         snake_case				  =      crop_size if crop_size is not None else {"height": 1_8, "width": 1_8}
         snake_case				  =      parent
         snake_case				  =      batch_size
         snake_case				  =      num_channels
         snake_case				  =      image_size
         snake_case				  =      min_resolution
         snake_case				  =      max_resolution
         snake_case				  =      do_resize
         snake_case				  =      size
         snake_case				  =      do_center_crop
         snake_case				  =      crop_size





     def 	UpperCAmelCase(self   :					str     )		->		int:
         return {
             "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   lowerCamelCase	(						A_							,				unittest.TestCase						):
     UpperCAmelCase__       :							Optional[int]     =	MobileNetVaImageProcessor if is_vision_available() else None





     def 	UpperCAmelCase(self   :					Dict     )		->		List[Any]:
         snake_case				  =      MobileNetVaImageProcessingTester(self     )





     @property
     def 	UpperCAmelCase(self   :					Union[str, Any]     )		->		Tuple:
         return self.image_processor_tester.prepare_image_processor_dict()





     def 	UpperCAmelCase(self   :					Tuple     )		->		Tuple:
         snake_case				  =      self.image_processing_class(**self.image_processor_dict     )
         self.assertTrue(hasattr(_A       ,					"do_resize"     )     )
         self.assertTrue(hasattr(_A       ,					"size"     )     )
         self.assertTrue(hasattr(_A       ,					"do_center_crop"     )     )
         self.assertTrue(hasattr(_A       ,					"crop_size"     )     )





     def 	UpperCAmelCase(self   :					int     )		->		List[Any]:
         snake_case				  =      self.image_processing_class.from_dict(self.image_processor_dict     )
         self.assertEqual(image_processor.size       ,					{"shortest_edge": 2_0}     )
         self.assertEqual(image_processor.crop_size       ,					{"height": 1_8, "width": 1_8}     )

         snake_case				  =      self.image_processing_class.from_dict(self.image_processor_dict       ,					size=4_2       ,					crop_size=8_4     )
         self.assertEqual(image_processor.size       ,					{"shortest_edge": 4_2}     )
         self.assertEqual(image_processor.crop_size       ,					{"height": 8_4, "width": 8_4}     )





     def 	UpperCAmelCase(self   :					Any     )		->		Tuple:
         pass





     def 	UpperCAmelCase(self   :					Tuple     )		->		Tuple:
         # Initialize image_processing
         snake_case				  =      self.image_processing_class(**self.image_processor_dict     )
         # create random PIL images
         snake_case				  =      prepare_image_inputs(self.image_processor_tester       ,					equal_resolution=_A     )
         for image in image_inputs:
             self.assertIsInstance(_A       ,					Image.Image     )

         # Test not batched input
         snake_case				  =      image_processing(image_inputs[0]       ,					return_tensors="pt"     ).pixel_values
         self.assertEqual(
             encoded_images.shape       ,					(
                 1,
                 self.image_processor_tester.num_channels,
                 self.image_processor_tester.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )       ,					)

         # Test batched
         snake_case				  =      image_processing(_A       ,					return_tensors="pt"     ).pixel_values
         self.assertEqual(
             encoded_images.shape       ,					(
                 self.image_processor_tester.batch_size,
                 self.image_processor_tester.num_channels,
                 self.image_processor_tester.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )       ,					)





     def 	UpperCAmelCase(self   :					Tuple     )		->		List[Any]:
         # Initialize image_processing
         snake_case				  =      self.image_processing_class(**self.image_processor_dict     )
         # create random numpy tensors
         snake_case				  =      prepare_image_inputs(self.image_processor_tester       ,					equal_resolution=_A       ,					numpify=_A     )
         for image in image_inputs:
             self.assertIsInstance(_A       ,					np.ndarray     )

         # Test not batched input
         snake_case				  =      image_processing(image_inputs[0]       ,					return_tensors="pt"     ).pixel_values
         self.assertEqual(
             encoded_images.shape       ,					(
                 1,
                 self.image_processor_tester.num_channels,
                 self.image_processor_tester.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )       ,					)

         # Test batched
         snake_case				  =      image_processing(_A       ,					return_tensors="pt"     ).pixel_values
         self.assertEqual(
             encoded_images.shape       ,					(
                 self.image_processor_tester.batch_size,
                 self.image_processor_tester.num_channels,
                 self.image_processor_tester.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )       ,					)





     def 	UpperCAmelCase(self   :					List[str]     )		->		List[str]:
         # Initialize image_processing
         snake_case				  =      self.image_processing_class(**self.image_processor_dict     )
         # create random PyTorch tensors
         snake_case				  =      prepare_image_inputs(self.image_processor_tester       ,					equal_resolution=_A       ,					torchify=_A     )
         for image in image_inputs:
             self.assertIsInstance(_A       ,					torch.Tensor     )

         # Test not batched input
         snake_case				  =      image_processing(image_inputs[0]       ,					return_tensors="pt"     ).pixel_values
         self.assertEqual(
             encoded_images.shape       ,					(
                 1,
                 self.image_processor_tester.num_channels,
                 self.image_processor_tester.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )       ,					)

         # Test batched
         snake_case				  =      image_processing(_A       ,					return_tensors="pt"     ).pixel_values
         self.assertEqual(
             encoded_images.shape       ,					(
                 self.image_processor_tester.batch_size,
                 self.image_processor_tester.num_channels,
                 self.image_processor_tester.crop_size["height"],
                 self.image_processor_tester.crop_size["width"],
             )       ,					)

