






from __future__ import annotations

from math import ceil, floor, sqrt





def 					snake_case	(  lowerCamelCase = 2_000_000       ):




	'''simple docstring'''







	__lowercase   							=	[0]
	__lowercase   							=	42

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

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

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

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

	return area


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



"""simple docstring"""



from __future__ import annotations

from collections.abc import Iterator





class 				a			:



      def __init__(   self     ,	UpperCamelCase_      ):
          UpperCAmelCase__	:      str     							=					value
          UpperCAmelCase__	:      Node | None     							=					None
          UpperCAmelCase__	:      Node | None     							=					None





class 				a			:



      def __init__(   self     ,	UpperCamelCase_      ):
          UpperCAmelCase__	:      str     							=					tree



      def  __snake_case							(   self     ,	UpperCamelCase_      ):
          if node is None:
              return 0
          return node.value + (
              self.depth_first_search(node.left      ) + self.depth_first_search(node.right      )
          )



      def __iter__(   self      ):
          yield self.depth_first_search(self.tree      )


if __name__ == "__main__":
    import doctest

    doctest.testmod()

