Xnhyacinth's picture
Upload HarnessMix codegen train and held-out eval data
01a492e verified
Raw
History Blame Contribute Delete
2.62 kB
import subprocess
import sys
from pathlib import Path
cases = [{'input': '6\n0 1 7 1 7 10\n', 'output': '2\n'}, {'input': '3\n1 1 1\n', 'output': '-1\n'}, {'input': '1\n0\n', 'output': '0\n'}, {'input': '5\n2 2 1 1 3\n', 'output': '2\n'}, {'input': '1\n1\n', 'output': '0\n'}, {'input': '10\n4 21 3 21 21 1 1 2 2 3\n', 'output': '-1\n'}, {'input': '2\n1 2\n', 'output': '0\n'}, {'input': '5\n0 0 0 0 0\n', 'output': '0\n'}, {'input': '6\n6 6 0 8 0 0\n', 'output': '1\n'}, {'input': '10\n0 0 0 0 0 1 0 1 0 1\n', 'output': '-1\n'}, {'input': '100\n0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 0 3 0 0 3 0 0 0 0 0 0 3 0 0 3 0 0 0 0 0 0 0 3 0 0 0 0 0\n', 'output': '-1\n'}, {'input': '1\n1000000000\n', 'output': '0\n'}, {'input': '2\n1 0\n', 'output': '0\n'}, {'input': '2\n1000000000 1000000000\n', 'output': '1\n'}, {'input': '5\n1 0 0 0 1\n', 'output': '1\n'}, {'input': '15\n380515742 842209759 945171461 664384656 945171461 474872104 0 0 131648973 131648973 474872104 842209759 664384656 0 380515742\n', 'output': '6\n'}, {'input': '123\n0 6361 8903 10428 0 258 0 10422 0 0 2642 1958 0 0 0 0 0 8249 1958 0 0 2642 0 0 0 11566 4709 1847 3998 0 1331 0 0 10289 2739 6135 3450 0 0 10994 6069 4337 5854 1331 5854 0 630 630 11244 5928 2706 0 683 214 0 9080 0 0 0 10422 683 11566 10994 0 0 3450 11244 11542 3998 1847 2708 9871 2739 2001 0 12216 6069 0 5928 0 10289 1307 0 1307 8903 0 6361 6135 6632 10428 0 0 632 258 9080 12216 4709 4967 2706 0 11542 2001 6632 0 8249 214 0 10301 4967 10301 7296 7296 10914 2708 4337 0 0 632 0 10914 0 9871 0\n', 'output': '40\n'}, {'input': '10\n0 3 2 3 2 0 1 3 3 0\n', 'output': '-1\n'}, {'input': '20\n0 1 2 0 0 0 0 5 3 4 0 0 1 1 3 0 4 0 1 0\n', 'output': '-1\n'}, {'input': '47\n1 6 0 6 1 1 6 4 3 6 5 3 6 3 2 2 5 1 4 7 3 5 6 1 6 7 4 5 6 3 3 3 7 4 1 6 1 1 7 1 3 1 5 5 1 3 6\n', 'output': '-1\n'}]
solution = Path(__file__).with_name("solution.py")
for index, case in enumerate(cases):
proc = subprocess.run(
[sys.executable, str(solution)],
input=case["input"],
text=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=10,
)
if proc.returncode != 0:
raise AssertionError(f"case {index} exited {proc.returncode}: {proc.stderr}")
got = proc.stdout.strip()
expected = case["output"].strip()
if got.split() != expected.split():
raise AssertionError(
f"case {index} output mismatch\nexpected={expected!r}\ngot={got!r}\nstderr={proc.stderr}"
)
print('deepcoder_primeintellect_io')