




"""simple docstring"""






from __future__ import annotations

from math import ceil, floor, sqrt





def 							UpperCAmelCase		(		snake_case			:					int = 2000000    ):
					_lowerCAmelCase:list[int]									=  [0]
					_lowerCAmelCase:int

					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:int									=  0
					# the area corresponding to the grid that gives the product closest to target
					_lowerCAmelCase:int									=  0
					# an estimate of b, using the quadratic formula
					_lowerCAmelCase:float
					# the largest integer less than b_estimate
					_lowerCAmelCase:int
					# the largest integer less than b_estimate
					_lowerCAmelCase:int
					# the triangle number corresponding to b_floor
					_lowerCAmelCase:int
					# the triangle number corresponding to b_ceil
					_lowerCAmelCase:int

					for idx_a, triangle_a in enumerate(triangle_numbers[1:]      ,       1    ):
										_lowerCAmelCase:str									=  (-1 + sqrt(1 + 8 * target / triangle_a    )) / 2
										_lowerCAmelCase:Any									=  floor(snake_case    )
										_lowerCAmelCase:List[Any]									=  ceil(snake_case    )
										_lowerCAmelCase:int									=  triangle_numbers[b_floor]
										_lowerCAmelCase:str									=  triangle_numbers[b_ceil]

										if abs(target - triangle_b_first_guess * triangle_a    ) < abs(
										    target - best_product    ):
															_lowerCAmelCase:Dict									=  triangle_b_first_guess * triangle_a
															_lowerCAmelCase:Tuple									=  idx_a * b_floor

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

					return area


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












"""simple docstring"""






def 							UpperCAmelCase		(		snake_case			:					int      ,       snake_case			:					int    ):
					return x if y == 0 else greatest_common_divisor(snake_case      ,       x % y    )





def 							UpperCAmelCase		(		snake_case			:					int      ,       snake_case			:					int    ):
					return (x * y) // greatest_common_divisor(snake_case      ,       snake_case    )





def 							UpperCAmelCase		(		snake_case			:					int = 20    ):
					_lowerCAmelCase:List[Any]									=  1
					for i in range(1      ,       n + 1    ):
										_lowerCAmelCase:List[str]									=  lcm(snake_case      ,       snake_case    )
					return g


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






