def main():
    """
    This file require the input file is in json format and has `pred` field to annotate the corresponding program solution.
    :return:
    """
    parser = ArgumentParser()
    parser.add_argument("--completion_file", type=str)
    parser.add_argument("--output_file", type=str)
    parser.add_argument("--num_workers", type=int, default=4)
    parser.add_argument("--pseudo_test_cases", type=str)
    args = parser.parse_args()

    print("CPU Cores:", os.cpu_count())

    if os.path.exists(args.completion_file):
        if args.completion_file.endswith(".json"):
            data = json.load(open(args.completion_file))
        else:
            data = [json.loads(line) for line in open(args.completion_file).readlines()]
    else:
        data = []
        for file in glob(args.completion_file):
            print(file)
            if file.endswith(".json"):
                data += json.load(open(file))
            else:
                data += [json.loads(line) for line in open(file).readlines()]

    print(len(data))
    pseudo_test_cases = json.load(open(args.pseudo_test_cases))
    pseudo_test_cases = {item["id"]: item for item in pseudo_test_cases}

    new_data = []
    for item in data:
        problem_id, resp_id, prefix_id = item["prefix_id"].split("_")
        problem_id = int(problem_id)
        item["problem_id"] = problem_id
        if problem_id in pseudo_test_cases:
            item["pseudo_input_output"] = pseudo_test_cases[problem_id]["pseudo_test_cases"]
            new_data.append(item)
    data = new_data

    print(f"Total number of items: {len(data)}")

    missing = 0
    corr = 0
    corr_at_k = 0
    pbar = tqdm(data)
    cnt = Counter()

    outputs = []
    with ThreadPoolExecutor(max_workers=args.num_workers) as executor:
        futures = []
        for _input in pbar:
            future = executor.submit(_worker, _input)
            futures.append(future)
            pbar.update()

        for future in tqdm(as_completed(futures), total=len(futures), desc="Collecting results"):
            outputs.append(future.result())

    for item in outputs:
        if "res" in item:
            if item["res"][0] is True:
                corr += 1
            if any(item["res"]):
                corr_at_k += 1
            cnt.update(item["res"])
        else:
            missing += 1

    print(f"Missing: {missing / len(outputs)}")
    print(f"Correct: {corr / len(outputs)}")
    print(f"Correct at k: {corr_at_k / len(outputs)}")
    print(cnt)
    json.dump(outputs, open(args.output_file, "w"), ensure_ascii=False, indent=2)

    This file require the input file is in json format and has `pred` field to annotate the corresponding program solution.
    :return:
    
PFPO/scripts/apps/pseudo_test_cases/oss_combine_run_extract_pseudo_label.py