


def 			a_   (					SCREAMING_SNAKE_CASE__      :   int = 4_000_000  ):
       '''simple docstring'''





       if n <= 1:
              return 0
       _lowerCamelCase :	Dict						=0
       _lowerCamelCase :	Any						=2
       _lowerCamelCase :	List[Any]						=0
       while 4 * b + a <= n:
              _lowerCamelCase :	List[str]						=b, 4 * b + a
              count += a
       return count + b


if __name__ == "__main__":
 print(F"""{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 ConvNextImageProcessor




class A						(     unittest.TestCase  ):






      def __init__(      self		:  Optional[Any]    ,     lowercase_		:  str    ,     lowercase_		:  Tuple=7    ,     lowercase_		:  int=3    ,     lowercase_		:  Union[str, Any]=18    ,     lowercase_		:  Optional[int]=30    ,     lowercase_		:  Tuple=400    ,     lowercase_		:  str=True    ,     lowercase_		:  Dict=None    ,     lowercase_		:  Tuple=0.875    ,     lowercase_		:  List[Any]=True    ,     lowercase_		:  Union[str, Any]=[0.5, 0.5, 0.5]    ,     lowercase_		:  List[str]=[0.5, 0.5, 0.5]    ,     )      ->		Any:
             """simple docstring"""




             _lowerCamelCase :	Optional[Any]						=size if size is not None else {'shortest_edge': 20}
             _lowerCamelCase :	Optional[Any]						=parent
             _lowerCamelCase :	Union[str, Any]						=batch_size
             _lowerCamelCase :	Dict						=num_channels
             _lowerCamelCase :	Union[str, Any]						=image_size
             _lowerCamelCase :	Optional[int]						=min_resolution
             _lowerCamelCase :	Tuple						=max_resolution
             _lowerCamelCase :	Any						=do_resize
             _lowerCamelCase :	Dict						=size
             _lowerCamelCase :	int						=crop_pct
             _lowerCamelCase :	Dict						=do_normalize
             _lowerCamelCase :	int						=image_mean
             _lowerCamelCase :	Union[str, Any]						=image_std






      def  lowerCamelCase (      self		:  List[str]				)      ->		int:
             """simple docstring"""




             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_pct": self.crop_pct,
             }




@require_torch
@require_vision
class A						(     UpperCamelCase_					,							unittest.TestCase  ):
      UpperCamelCase__							:						List[Any]   =ConvNextImageProcessor if is_vision_available() else None






      def  lowerCamelCase (      self		:  List[str]				)      ->		Tuple:
             """simple docstring"""




             _lowerCamelCase :	Optional[Any]						=ConvNextImageProcessingTester(self				)






      @property
      def  lowerCamelCase (      self		:  List[str]				)      ->		int:
             """simple docstring"""




             return self.image_processor_tester.prepare_image_processor_dict()






      def  lowerCamelCase (      self		:  Optional[int]				)      ->		str:
             """simple docstring"""




             _lowerCamelCase :	Dict						=self.image_processing_class(**self.image_processor_dict				)
             self.assertTrue(hasattr(lowercase_    ,     'do_resize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'size'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'crop_pct'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'do_normalize'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'image_mean'				)				)
             self.assertTrue(hasattr(lowercase_    ,     'image_std'				)				)






      def  lowerCamelCase (      self		:  Union[str, Any]				)      ->		List[Any]:
             """simple docstring"""




             _lowerCamelCase :	Tuple						=self.image_processing_class.from_dict(self.image_processor_dict				)
             self.assertEqual(image_processor.size    ,     {'shortest_edge': 20}				)

             _lowerCamelCase :	Tuple						=self.image_processing_class.from_dict(self.image_processor_dict    ,     size=42				)
             self.assertEqual(image_processor.size    ,     {'shortest_edge': 42}				)






      def  lowerCamelCase (      self		:  Optional[Any]				)      ->		int:
             """simple docstring"""




             pass






      def  lowerCamelCase (      self		:  Dict				)      ->		Optional[Any]:
             """simple docstring"""




             _lowerCamelCase :	Optional[Any]						=self.image_processing_class(**self.image_processor_dict				)
             # create random PIL images
             _lowerCamelCase :	Any						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     Image.Image				)

             # Test not batched input
             _lowerCamelCase :	Tuple						=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.size['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )

             # Test batched
             _lowerCamelCase :	List[str]						=image_processing(lowercase_    ,     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.size['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )






      def  lowerCamelCase (      self		:  int				)      ->		Union[str, Any]:
             """simple docstring"""




             _lowerCamelCase :	Optional[int]						=self.image_processing_class(**self.image_processor_dict				)
             # create random numpy tensors
             _lowerCamelCase :	List[Any]						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_    ,     numpify=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     np.ndarray				)

             # Test not batched input
             _lowerCamelCase :	Optional[Any]						=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.size['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )

             # Test batched
             _lowerCamelCase :	Any						=image_processing(lowercase_    ,     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.size['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )






      def  lowerCamelCase (      self		:  str				)      ->		Optional[int]:
             """simple docstring"""




             _lowerCamelCase :	List[Any]						=self.image_processing_class(**self.image_processor_dict				)
             # create random PyTorch tensors
             _lowerCamelCase :	Any						=prepare_image_inputs(self.image_processor_tester    ,     equal_resolution=lowercase_    ,     torchify=lowercase_				)
             for image in image_inputs:
                    self.assertIsInstance(lowercase_    ,     torch.Tensor				)

             # Test not batched input
             _lowerCamelCase :	Optional[Any]						=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.size['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )

             # Test batched
             _lowerCamelCase :	Union[str, Any]						=image_processing(lowercase_    ,     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.size['shortest_edge'],
                     self.image_processor_tester.size['shortest_edge'],
                 )    ,     )


