codegen / assets /train /deepcoder_primeintellect /deepcoder_primeintellect_0985cdedcc76e693 /test_solution.py
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| cases = [{'input': '7 6\n2 5 3 1 11 4 4\n7 8 2 4 1 8\n', 'output': '3\n'}, {'input': '3 3\n1 10 100\n1 100 10\n', 'output': '2\n'}, {'input': '1 4\n4\n1 1 1 1\n', 'output': '1\n'}, {'input': '1 1\n1000000\n1000000\n', 'output': '1\n'}, {'input': '3 5\n2 2 9\n2 1 4 2 4\n', 'output': '2\n'}, {'input': '5 3\n1 1 4 1 2\n1 4 4\n', 'output': '2\n'}, {'input': '30 50\n3 3 1 3 1 2 4 3 4 1 3 2 3 3 2 3 2 1 3 4 2 1 1 3 2 2 1 3 1 60\n4 4 1 2 2 2 3 1 3 2 1 2 4 4 2 1 2 3 1 3 4 4 3 3 4 4 4 1 2 1 3 3 1 1 3 3 4 3 2 3 2 4 1 4 2 3 2 2 3 1\n', 'output': '12\n'}, {'input': '50 50\n5733 740 547 3647 5382 5109 6842 7102 5879 1502 3574 1628 7905 4357 8569 9564 8268 3542 2487 8532 425 7713 2585 925 6458 2697 2844 69 324 9030 495 4428 6724 3524 3304 4874 1303 2098 1136 1048 2464 7316 274 9586 534 2450 2368 8060 7795 70692\n1918 4122 6806 4914 6517 6278 9842 9480 6609 4221 9373 1728 9508 9778 8578 5589 2673 6618 6031 9016 4017 6671 6008 2268 5154 9614 6834 9512 9618 6424 1736 1464 6520 9812 1722 9197 2412 2699 73 968 2906 2715 6573 8675 548 7061 5455 88 5565 2544\n', 'output': '1\n'}, {'input': '1 2\n2\n1 1\n', 'output': '1\n'}, {'input': '1 2\n1000000\n999999 1\n', 'output': '1\n'}, {'input': '2 2\n1 1\n1 1\n', 'output': '2\n'}, {'input': '2 2\n500000 500000\n1 999999\n', 'output': '1\n'}, {'input': '2 2\n2 3\n4 1\n', 'output': '1\n'}, {'input': '2 2\n2 3\n3 2\n', 'output': '1\n'}, {'input': '2 2\n2 3\n2 3\n', 'output': '2\n'}, {'input': '2 3\n2 2\n1 1 2\n', 'output': '2\n'}, {'input': '1 1\n1\n1\n', 'output': '1\n'}, {'input': '2 3\n3 2\n2 1 2\n', 'output': '2\n'}, {'input': '2 3\n2 3\n2 1 2\n', 'output': '2\n'}, {'input': '50 30\n2 3 1 2 2 4 3 4 3 2 1 4 2 3 1 3 1 2 2 3 1 1 1 2 3 1 4 3 1 2 1 2 2 1 2 4 4 3 3 2 2 1 1 1 2 2 2 4 3 3\n3 3 3 4 1 4 1 4 4 1 3 4 3 1 2 4 2 1 4 2 3 1 1 2 2 1 2 4 1 41\n', 'output': '12\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') | |