



'''simple docstring'''

from __future__ import annotations

from math import ceil, floor, sqrt






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						int = 2_000_000							)      ->						int:







	"""simple docstring"""
	lowerCAmelCase   =     [0]
	lowerCAmelCase   =     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
	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   =     42
	# the largest integer less than b_estimate
	lowerCAmelCase   =     42
	# the largest integer less than b_estimate
	lowerCAmelCase   =     42
	# the triangle number corresponding to b_floor
	lowerCAmelCase   =     42
	# the triangle number corresponding to b_ceil
	lowerCAmelCase   =     42

	for idx_a, triangle_a in enumerate(triangle_numbers[1:]							,		1							):
		lowerCAmelCase   =     (-1 + sqrt(1 + 8 * target / triangle_a							)) / 2
		lowerCAmelCase   =     floor(_SCREAMING_SNAKE_CASE							)
		lowerCAmelCase   =     ceil(_SCREAMING_SNAKE_CASE							)
		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() = }''')




'''simple docstring'''

from __future__ import annotations

UpperCAmelCase     		=   []






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							,		_SCREAMING_SNAKE_CASE					:						int							,		_SCREAMING_SNAKE_CASE					:						int							)      ->						bool:







	"""simple docstring"""
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		if board[row][i] == 1:
			return False
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		if board[i][column] == 1:
			return False
	for i, j in zip(range(_SCREAMING_SNAKE_CASE							,		-1							,		-1							)							,		range(_SCREAMING_SNAKE_CASE							,		-1							,		-1							)							):
		if board[i][j] == 1:
			return False
	for i, j in zip(range(_SCREAMING_SNAKE_CASE							,		-1							,		-1							)							,		range(_SCREAMING_SNAKE_CASE							,		len(_SCREAMING_SNAKE_CASE							)							)							):
		if board[i][j] == 1:
			return False
	return True






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							,		_SCREAMING_SNAKE_CASE					:						int							)      ->						bool:







	"""simple docstring"""
	if row >= len(_SCREAMING_SNAKE_CASE							):
		solution.append(_SCREAMING_SNAKE_CASE							)
		printboard(_SCREAMING_SNAKE_CASE							)
		print()
		return True
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		if is_safe(_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							,		_SCREAMING_SNAKE_CASE							):
			lowerCAmelCase   =     1
			solve(_SCREAMING_SNAKE_CASE							,		row + 1							)
			lowerCAmelCase   =     0
	return False






def 		_snake_case		( _SCREAMING_SNAKE_CASE					:						list[list[int]]							)      ->						None:







	"""simple docstring"""
	for i in range(len(_SCREAMING_SNAKE_CASE							)							):
		for j in range(len(_SCREAMING_SNAKE_CASE							)							):
			if board[i][j] == 1:
				print("""Q"""							,		end=""" """							)
			else:
				print("""."""							,		end=""" """							)
		print()


# n=int(input("The no. of queens"))
UpperCAmelCase     		=   8
UpperCAmelCase     		=   [[0 for i in range(n)] for j in range(n)]
solve(board, 0)





print('The total no. of solutions are :', len(solution))