
from __future__ import annotations

from math import ceil, floor, sqrt






def 		_UpperCAmelCase   (	UpperCamelCase:     int = 2_0_0_0_0_0_0  ):






	"""simple docstring"""


	__lowerCAmelCase         =							[0]
	__lowerCAmelCase         =							4_2

	for idx in range(1			,							ceil(sqrt(target * 2  ) * 1.1  )  ):
		triangle_numbers.append(triangle_numbers[-1] + idx  )

	# we want this to be as close as possible to target
	__lowerCAmelCase         =							0
	# the area corresponding to the grid that gives the product closest to target
	__lowerCAmelCase         =							0
	# an estimate of b, using the quadratic formula
	__lowerCAmelCase         =							4_2
	# the largest integer less than b_estimate
	__lowerCAmelCase         =							4_2
	# the largest integer less than b_estimate
	__lowerCAmelCase         =							4_2
	# the triangle number corresponding to b_floor
	__lowerCAmelCase         =							4_2
	# the triangle number corresponding to b_ceil
	__lowerCAmelCase         =							4_2

	for idx_a, triangle_a in enumerate(triangle_numbers[1:]			,							1  ):
		__lowerCAmelCase         =							(-1 + sqrt(1 + 8 * target / triangle_a  )) / 2
		__lowerCAmelCase         =							floor(UpperCamelCase  )
		__lowerCAmelCase         =							ceil(UpperCamelCase  )
		__lowerCAmelCase         =							triangle_numbers[b_floor]
		__lowerCAmelCase         =							triangle_numbers[b_ceil]

		if abs(target - triangle_b_first_guess * triangle_a  ) < abs(
		    target - best_product  ):
			__lowerCAmelCase         =							triangle_b_first_guess * triangle_a
			__lowerCAmelCase         =							idx_a * b_floor

		if abs(target - triangle_b_second_guess * triangle_a  ) < abs(
		    target - best_product  ):
			__lowerCAmelCase         =							triangle_b_second_guess * triangle_a
			__lowerCAmelCase         =							idx_a * b_ceil

	return area


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








import unittest

import numpy as np
import torch

from diffusers import VersatileDiffusionImageVariationPipeline
from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device


UpperCamelCase_   	=	False

class       a		(   unittest.TestCase					):
							pass

@slow
@require_torch_gpu
class       a		(   unittest.TestCase					):







							def       UpperCAmelCase__					(						self  :  Dict ):
								"""simple docstring"""







								__lowerCAmelCase         =							VersatileDiffusionImageVariationPipeline.from_pretrained("shi-labs/versatile-diffusion" )
								pipe.to(snake_case__ )
								pipe.set_progress_bar_config(disable=snake_case__ )

								__lowerCAmelCase         =							load_image(
								    "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/versatile_diffusion/benz.jpg" )
								__lowerCAmelCase         =							torch.manual_seed(0 )
								__lowerCAmelCase         =							pipe(
								    image=snake_case__      ,				generator=snake_case__      ,				guidance_scale=7.5      ,				num_inference_steps=50      ,				output_type="numpy"      ,				).images

								__lowerCAmelCase         =							image[0, 253:256, 253:256, -1]

								assert image.shape == (1, 512, 512, 3)
								__lowerCAmelCase         =							np.array([0.0_4_4_1, 0.0_4_6_9, 0.0_5_0_7, 0.0_5_7_5, 0.0_6_3_2, 0.0_6_5_0, 0.0_8_6_5, 0.0_9_0_9, 0.0_9_4_5] )

								assert np.abs(image_slice.flatten() - expected_slice ).max() < 1E-2






