






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'''
def      UpperCamelCase_				(      A__  ,      A__  ,      A__						):

	def count_of_possible_combinations(A__						) -> int:
		if target < 0:
			return 0
		if target == 0:
			return 1
		return sum(count_of_possible_combinations(target - item						) for item in array						)

	return count_of_possible_combinations(A__						)






def      UpperCamelCase_				(      A__  ,      A__  ,      A__						):

	def count_of_possible_combinations_with_dp_array(
	    A__  ,      A__						) -> int:
		if target < 0:
			return 0
		if target == 0:
			return 1
		if dp_array[target] != -1:
			return dp_array[target]
		a_      				=						sum(
		    count_of_possible_combinations_with_dp_array(target - item  ,      A__						)
		    for item in array						)
		a_      				=						answer
		return answer

	a_      				=						[-1] * (target + 1)
	return count_of_possible_combinations_with_dp_array(A__  ,      A__						)






def      UpperCamelCase_				(      A__  ,      A__  ,      A__						):
	a_      				=						[0] * (target + 1)
	a_      				=						1

	for i in range(1  ,      target + 1						):
		for j in range(A__						):
			if i - array[j] >= 0:
				dp_array[i] += dp_array[i - array[j]]

	return dp_array[target]


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		lowercase__											=3
		lowercase__											=5
		lowercase__											=[1, 2, 5]
		print(combination_sum_iv(n, array, target))
