SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Please feed the example inputs to the function solution as an entire string. As I said before, please make sure you use the most straightforward and brute-force algorithm to solve the algorithm. Do not consider any efficiency issue, make the solution as brute-force. The answer will depend on the number of variables that may affect the answer and how do you think they can be enumerated?
Reference Oracle Generated by LLM
from functools import cmp_to_key
defasc desc ending_comparator(a,b):
for i in range(len(a)):
17（1+1）=2！
17.  $a[1] <   b$  return -1
return-1 elif a[j]>b[j]:
elif a[i] >
elif a[i] < b[i]:
def solution(stdin: str) -> str:
lines  $\equiv$  stain.strip().split("\n").
```python
n, m) = map(int, lines[i].split())
books = [(title, idx) for (idx, title) in
books  $=$  [(title, idx) for (idx, title) in numeterminate[lines[1]: start=1]]
books-sort(key=cmp to key( lambda
```python
import os import (NC) -cmp_(nc)(cambridge x),  
asc desc ending comparator(x[0], y[0]))
output  $=$  [str(book[1]) for book in books]
return '.join(output)
Figure 15: The prompt we used for oracle generation and one oracle generated with it. The instructions are in blue. The language model is instructed to generate the most straightforward solution by enumerating over a very large search space of all combinations of relevant variables.
A.3 The List of Problems from LeetCode
We list the problems we collected from LeetCode as benchmarks to test ALGO in Table 5, among them are 10 easy problems, 18 medium problems, and 7 hard problems.
You are given this problem.
Andi and Budi were given an assignment to tidy up their bookshelf of n books. Each book is represented by the book title - a string si numbered from 1 to n, each with length m. Andi really wants to sort the book lexicographically. Ascending, while Budi wants to sort it lexicographically descending. (https://codeforces.com/problems/problem/1575/A, remaining part omitted)
You should first create an input generator function 'gen_input', 'gen_input' should take a list of arguments to control the upper limit of the input and return a single string that represents the input. 'gen_input' should only generate test inputs that follow the problem constraints, 'gen_input' should only generate test inputs and not test outputs.
You should then create an extra function 'batch_gen_input' that takes one argument - 'batch_size'. 'batch_gen_input' should run 'gen_input' for 'batch_size' times with a small upper limit to make sure that it works. 'batch_gen_input' should return a list of strings that represent the inputs.
def gen_input(n_max: int, m_max: int) -> str:
n = random.randint(1, n_max)
m = random.randint(1, min(m_max, 10 ** 6 // n))
bookTitles  $\equiv$  set()
while len(bookTitles) < n:
book_title =
```python
>>> join(random.choice(stringascii_uppercase) for in
range(m)))
book titles.add(book title)
input string  $=$  f{n} {m}n' + '\n'.join(book titles)
return input_string
$\therefore m - 1 \neq  0$  ;
def batch_gen_entries(batch_size,) -> list:
inputs  $=$  []
for_in range(batch_size):
inputs.append(gen input(5, 10))
return inputs
Figure 16: The prompt is used to first generate a function gen_input and then generate a batch generator that employs the already generated gen_input to generate several input cases by calling it multiple times.
Table 5: The Leetcode problems we use. We only pick problems that were released concurrently or after GPT-4 to avoid contamination.
Problem ID	Problem Name	Level
2582	pass-the-pillow	easy
2583	kth-largest-sum-in-a-binary-tree	medium
2584	split-the-array-to-make-coprime-products	hard
2585	number-of-ways-to-earn-points	hard
2586	count-the-number-of-vowel-strings-in-range	easy
2587	rearrange-array-to-maximize-prefix-score	medium
2588	count-the-number-of-beautiful-subarrays	medium
2589	minimum-time-to-complete-all-tasks	hard
2591	distribute-money-to-maximum-children	easy
2592	maximize-greatness-of-an-array	medium
2593	find-score-of-an-array-after-marking-all-elements	medium
2594	minimum-time-to-repair-cars	medium
2595	number-of-even-and-odd-bits	easy
2596	check-knight-tour-configuration	medium
2597	the-number-of-beautiful-subsets	medium
2598	smallest-missing-non-negative-integer-after-operations	medium
2600	k-items-with-the-maximum-sum	easy
2601	prime-subtraction-operation	medium
2602	minimum-operations-to make-all-array-elements-equal	medium
2603	collect-coins-in-a-tree	hard
2609	find-the-longest-balanced-substring-of-a-binary-string	easy
2610	convert-an-array-into-a-2d-array-with-conditions	medium
2611	mice-and-cheese	medium
2612	minimum-reverse-operations	hard
2614	prime-in-diagonal	easy
2615	sum-of-distances	medium
2616	minimize-the-maximum-difference-of-pairs	medium
2617	minimum-number-of-visited-cells-in-a-grid	hard
2639	find-the-width-of-columns-of-a-grid	easy
2640	find-the-score-of-all-prefixes-of-an-array	medium
2641	cousins-in-binary-tree-II	medium
2643	row-with-maximum-ones	easy
2644	find-the-maximum-divisibility-score	easy
2645	minimum-additions-to-make-valid-string	medium
2646	minimize-the-total-price-of-the-trips	hard