"""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_image_inputs


if is_torch_available():
						import torch

if is_vision_available():
						from PIL import Image

						from transformers import ConvNextImageProcessor


class       _lowercase		( unittest.TestCase	):

				def __init__(  self							:     Optional[Any]							,     _lowercase							:     int							,     _lowercase							:     str=7							,     _lowercase							:     Optional[Any]=3							,     _lowercase							:     Tuple=1_8							,     _lowercase							:     int=3_0							,     _lowercase							:     List[Any]=4_0_0							,     _lowercase							:     Dict=True							,     _lowercase							:     Any=None							,     _lowercase							:     Optional[Any]=0.875							,     _lowercase							:     str=True							,     _lowercase							:     Any=[0.5, 0.5, 0.5]							,     _lowercase							:     Dict=[0.5, 0.5, 0.5]							,     ):


										'''simple docstring'''
										UpperCAmelCase__       						=		size if size is not None else {'shortest_edge': 2_0}
										UpperCAmelCase__       						=		parent
										UpperCAmelCase__       						=		batch_size
										UpperCAmelCase__       						=		num_channels
										UpperCAmelCase__       						=		image_size
										UpperCAmelCase__       						=		min_resolution
										UpperCAmelCase__       						=		max_resolution
										UpperCAmelCase__       						=		do_resize
										UpperCAmelCase__       						=		size
										UpperCAmelCase__       						=		crop_pct
										UpperCAmelCase__       						=		do_normalize
										UpperCAmelCase__       						=		image_mean
										UpperCAmelCase__       						=		image_std

				def 							A			(  self							:     Dict  ):


										'''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       _lowercase		( lowerCamelCase_   ,   unittest.TestCase	):
				lowerCamelCase__							=							ConvNextImageProcessor if is_vision_available() else None

				def 							A			(  self							:     int  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		ConvNextImageProcessingTester(self  )

				@property
				def 							A			(  self							:     Any  ):


										'''simple docstring'''
										return self.image_processor_tester.prepare_image_processor_dict()

				def 							A			(  self							:     Union[str, Any]  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		self.image_processing_class(**self.image_processor_dict  )
										self.assertTrue(hasattr(snake_case_							,     """do_resize"""  )  )
										self.assertTrue(hasattr(snake_case_							,     """size"""  )  )
										self.assertTrue(hasattr(snake_case_							,     """crop_pct"""  )  )
										self.assertTrue(hasattr(snake_case_							,     """do_normalize"""  )  )
										self.assertTrue(hasattr(snake_case_							,     """image_mean"""  )  )
										self.assertTrue(hasattr(snake_case_							,     """image_std"""  )  )

				def 							A			(  self							:     List[Any]  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		self.image_processing_class.from_dict(self.image_processor_dict  )
										self.assertEqual(image_processor.size							,     {"""shortest_edge""": 2_0}  )

										UpperCAmelCase__       						=		self.image_processing_class.from_dict(self.image_processor_dict							,     size=4_2  )
										self.assertEqual(image_processor.size							,     {"""shortest_edge""": 4_2}  )

				def 							A			(  self							:     List[Any]  ):


										'''simple docstring'''
										pass

				def 							A			(  self							:     int  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		self.image_processing_class(**self.image_processor_dict  )
										# create random PIL images
										UpperCAmelCase__       						=		prepare_image_inputs(self.image_processor_tester							,     equal_resolution=snake_case_  )
										for image in image_inputs:
																self.assertIsInstance(snake_case_							,     Image.Image  )

										# Test not batched input
										UpperCAmelCase__       						=		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
										UpperCAmelCase__       						=		image_processing(snake_case_							,     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 							A			(  self							:     Any  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		self.image_processing_class(**self.image_processor_dict  )
										# create random numpy tensors
										UpperCAmelCase__       						=		prepare_image_inputs(self.image_processor_tester							,     equal_resolution=snake_case_							,     numpify=snake_case_  )
										for image in image_inputs:
																self.assertIsInstance(snake_case_							,     np.ndarray  )

										# Test not batched input
										UpperCAmelCase__       						=		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
										UpperCAmelCase__       						=		image_processing(snake_case_							,     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 							A			(  self							:     Optional[Any]  ):


										'''simple docstring'''
										UpperCAmelCase__       						=		self.image_processing_class(**self.image_processor_dict  )
										# create random PyTorch tensors
										UpperCAmelCase__       						=		prepare_image_inputs(self.image_processor_tester							,     equal_resolution=snake_case_							,     torchify=snake_case_  )
										for image in image_inputs:
																self.assertIsInstance(snake_case_							,     torch.Tensor  )

										# Test not batched input
										UpperCAmelCase__       						=		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
										UpperCAmelCase__       						=		image_processing(snake_case_							,     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"""],
										    )							,     )


'''simple docstring'''


from itertools import combinations, product


def    _lowerCamelCase       ( lowerCamelCase_   :				int      ,	lowerCamelCase_   :				int      ,	lowerCamelCase_   :				int      ,	lowerCamelCase_   :				int  ):



     """simple docstring"""





     if xa == ya == 0 or xa == ya == 0:
          return False
     UpperCAmelCase_				:  Union[str, Any]  = xa * xa + ya * ya
     UpperCAmelCase_				:  str  = xa * xa + ya * ya
     UpperCAmelCase_				:  str  = (xa - xa) * (xa - xa) + (ya - ya) * (ya - ya)
     return (
         a_square + b_square == c_square
         or a_square + c_square == b_square
         or b_square + c_square == a_square
     )


def    _lowerCamelCase       ( lowerCamelCase_   :				int = 50  ):



     """simple docstring"""





     return sum(
         1
         for pta, pta in combinations(product(range(limit + 1  )      ,	repeat=2  )      ,	2  )
         if is_right(*lowerCamelCase_      ,	*lowerCamelCase_  )  )


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






