

'''simple docstring'''

from __future__ import annotations

from math import ceil, floor, sqrt




def 				UpperCamelCase(					UpperCAmelCase_ = 2_00_00_00     ):
 UpperCAmelCase	:     list[int]						 =			[0]
 UpperCAmelCase	:     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
 UpperCAmelCase	:     int						 =			0
 # the area corresponding to the grid that gives the product closest to target
 UpperCAmelCase	:     int						 =			0
 # an estimate of b, using the quadratic formula
 UpperCAmelCase	:     float
 # the largest integer less than b_estimate
 UpperCAmelCase	:     int
 # the largest integer less than b_estimate
 UpperCAmelCase	:     int
 # the triangle number corresponding to b_floor
 UpperCAmelCase	:     int
 # the triangle number corresponding to b_ceil
 UpperCAmelCase	:     int

 for idx_a, triangle_a in enumerate(triangle_numbers[1:]  ,	1     ):
  UpperCAmelCase	:     Optional[int]						 =			(-1 + sqrt(1 + 8 * target / triangle_a     )) / 2
  UpperCAmelCase	:     Optional[int]						 =			floor(UpperCAmelCase_     )
  UpperCAmelCase	:     int						 =			ceil(UpperCAmelCase_     )
  UpperCAmelCase	:     Dict						 =			triangle_numbers[b_floor]
  UpperCAmelCase	:     Tuple						 =			triangle_numbers[b_ceil]

  if abs(target - triangle_b_first_guess * triangle_a     ) < abs(
      target - best_product     ):
   UpperCAmelCase	:     Dict						 =			triangle_b_first_guess * triangle_a
   UpperCAmelCase	:     List[Any]						 =			idx_a * b_floor

  if abs(target - triangle_b_second_guess * triangle_a     ) < abs(
      target - best_product     ):
   UpperCAmelCase	:     int						 =			triangle_b_second_guess * triangle_a
   UpperCAmelCase	:     List[str]						 =			idx_a * b_ceil

 return area


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







'''simple docstring'''

import argparse
import json

from tqdm import tqdm




def 				UpperCamelCase(					):
 UpperCAmelCase	:     List[Any]						 =			argparse.ArgumentParser()

 # Required parameters
 parser.add_argument(
     '--src_path'  ,	type=UpperCAmelCase_  ,	default='biencoder-nq-dev.json'  ,	help='Path to raw DPR training data'  ,	)
 parser.add_argument(
     '--evaluation_set'  ,	type=UpperCAmelCase_  ,	help='where to store parsed evaluation_set file'  ,	)
 parser.add_argument(
     '--gold_data_path'  ,	type=UpperCAmelCase_  ,	help='where to store parsed gold_data_path file'  ,	)
 UpperCAmelCase	:     int						 =			parser.parse_args()

 with open(args.src_path  ,	'r'     ) as src_file, open(args.evaluation_set  ,	'w'     ) as eval_file, open(
     args.gold_data_path  ,	'w'     ) as gold_file:
  UpperCAmelCase	:     int						 =			json.load(UpperCAmelCase_     )
  for dpr_record in tqdm(UpperCAmelCase_     ):
   UpperCAmelCase	:     Any						 =			dpr_record['question']
   UpperCAmelCase	:     List[str]						 =			[context['title'] for context in dpr_record['positive_ctxs']]
   eval_file.write(question + '\n'     )
   gold_file.write('\t'.join(UpperCAmelCase_     ) + '\n'     )


if __name__ == "__main__":
 main()




