



import colorsys

from PIL import Image  # type: ignore




def 	UpperCAmelCase   (						_lowerCamelCase ,    _lowerCamelCase ,    _lowerCamelCase    ):
			A							:					Tuple              =						x
			A							:					List[str]              =						y
			for step in range(_lowerCamelCase    ):  # noqa: B007
						A							:					Union[str, Any]              =						a * a - b * b + x
						A							:					Tuple              =						2 * a * b + y
						A							:					Union[str, Any]              =						a_new

						# divergence happens for all complex number with an absolute value
						# greater than 4
						if a * a + b * b > 4:
									break
			return step / (max_step - 1)




def 	UpperCAmelCase   (						_lowerCamelCase    ):
			if distance == 1:
						return (0, 0, 0)
			else:
						return (255, 255, 255)




def 	UpperCAmelCase   (						_lowerCamelCase    ):
			if distance == 1:
						return (0, 0, 0)
			else:
						return tuple(round(i * 255    ) for i in colorsys.hsv_to_rgb(_lowerCamelCase ,    1 ,    1    )    )




def 	UpperCAmelCase   (						_lowerCamelCase = 800 ,    _lowerCamelCase = 600 ,    _lowerCamelCase = -0.6 ,    _lowerCamelCase = 0 ,    _lowerCamelCase = 3.2 ,    _lowerCamelCase = 50 ,    _lowerCamelCase = True ,    ):
			A							:					Union[str, Any]              =						Image.new("RGB" ,    (image_width, image_height)    )
			A							:					int              =						img.load()

			# loop through the image-coordinates
			for image_x in range(_lowerCamelCase    ):
						for image_y in range(_lowerCamelCase    ):
									# determine the figure-coordinates based on the image-coordinates
									A							:					str              =						figure_width / image_width * image_height
									A							:					str              =						figure_center_x + (image_x / image_width - 0.5) * figure_width
									A							:					str              =						figure_center_y + (image_y / image_height - 0.5) * figure_height

									A							:					Union[str, Any]              =						get_distance(_lowerCamelCase ,    _lowerCamelCase ,    _lowerCamelCase    )

									# color the corresponding pixel based on the selected coloring-function
									if use_distance_color_coding:
												A							:					str              =						get_color_coded_rgb(_lowerCamelCase    )
									else:
												A							:					Dict              =						get_black_and_white_rgb(_lowerCamelCase    )

			return img


if __name__ == "__main__":
							import doctest

							doctest.testmod()

							# colored version, full figure
							__SCREAMING_SNAKE_CASE           =  get_image()

							# uncomment for colored version, different section, zoomed in
							# img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
							# figure_width = 0.8)

							# uncomment for black and white version, full figure
							# img = get_image(use_distance_color_coding = False)

							# uncomment to save the image
							# img.save("mandelbrot.png")

							img.show()




from math import sqrt




def 	UpperCAmelCase   (						_lowerCamelCase = 100_0000    ):
			A							:					int              =						0
			A							:					int              =						0
			A							:					int

			while num_cuboids <= limit:
						max_cuboid_size += 1
						for sum_shortest_sides in range(2 ,    2 * max_cuboid_size + 1    ):
									if sqrt(sum_shortest_sides**2 + max_cuboid_size**2    ).is_integer():
												num_cuboids += (
												    min(_lowerCamelCase ,    sum_shortest_sides // 2    )
												    - max(1 ,    sum_shortest_sides - max_cuboid_size    )
												    + 1
												)

			return max_cuboid_size


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