from __future__ import annotations
def       __magic_name__(  __UpperCAmelCase ,						__UpperCAmelCase ,						__UpperCAmelCase ,						__UpperCAmelCase		)						->    Optional[Any]:  # noqa: E741



      '''simple docstring'''

      while r - l > 1:
            _lowerCamelCase			    =				(l + r) // 2
            if v[m] >= key:
                  _lowerCamelCase			    =				m
            else:
                  _lowerCamelCase			    =				m  # noqa: E741
      return r
def       __magic_name__(  __UpperCAmelCase		)						->    int:



      '''simple docstring'''

      if len(__UpperCAmelCase		) == 0:
            return 0

      _lowerCamelCase			    =				[0] * len(__UpperCAmelCase		)
      _lowerCamelCase			    =				1

      _lowerCamelCase			    =				v[0]

      for i in range(1 ,						len(__UpperCAmelCase		)		):
            if v[i] < tail[0]:
                  _lowerCamelCase			    =				v[i]
            elif v[i] > tail[length - 1]:
                  _lowerCamelCase			    =				v[i]
                  length += 1
            else:
                  _lowerCamelCase			    =				v[i]

      return length


if __name__ == "__main__":
     import doctest

     doctest.testmod()
import argparse
import json

from tqdm import tqdm
def       __magic_name__(  )						->    List[str]:



      '''simple docstring'''

      _lowerCamelCase			    =				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''' ,						)
      _lowerCamelCase			    =				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:
            _lowerCamelCase			    =				json.load(__UpperCAmelCase		)
            for dpr_record in tqdm(__UpperCAmelCase		):
                  _lowerCamelCase			    =				dpr_record['''question''']
                  _lowerCamelCase			    =				[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()