import subprocess import sys from pathlib import Path cases = [{'input': '5 3 2\n', 'output': '1 2\n2 3\n1 4\n5 1\n'}, {'input': '8 5 2\n', 'output': '-1\n'}, {'input': '8 4 2\n', 'output': '4 8\n5 7\n2 3\n8 1\n2 1\n5 6\n1 5\n'}, {'input': '2 1 1\n', 'output': '1 2\n'}, {'input': '10 3 3\n', 'output': '1 2\n2 3\n3 4\n5 2\n6 2\n7 2\n8 2\n9 2\n10 2\n'}, {'input': '15 6 4\n', 'output': '1 2\n2 3\n3 4\n4 5\n1 6\n6 7\n8 1\n9 1\n10 1\n11 1\n12 1\n13 1\n14 1\n15 1\n'}, {'input': '16 15 14\n', 'output': '1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n10 11\n11 12\n12 13\n13 14\n14 15\n1 16\n'}, {'input': '1000 51 25\n', 'output': '-1\n'}, {'input': '3 1 1\n', 'output': '-1\n'}, {'input': '3 2 1\n', 'output': '1 2\n1 3\n'}, {'input': '3 2 2\n', 'output': '1 2\n2 3\n'}, {'input': '4 1 1\n', 'output': '-1\n'}, {'input': '4 2 1\n', 'output': '1 2\n1 3\n4 1\n'}, {'input': '4 2 2\n', 'output': '1 2\n2 3\n4 2\n'}, {'input': '4 3 1\n', 'output': '-1\n'}, {'input': '4 3 2\n', 'output': '1 2\n2 3\n1 4\n'}, {'input': '4 3 3\n', 'output': '1 2\n2 3\n3 4\n'}, {'input': '8 5 3\n', 'output': '1 2\n2 3\n3 4\n1 5\n5 6\n7 1\n8 1\n'}, {'input': '20 19 19\n', 'output': '1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n10 11\n11 12\n12 13\n13 14\n14 15\n15 16\n16 17\n17 18\n18 19\n19 20\n'}, {'input': '30 14 14\n', 'output': '1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n10 11\n11 12\n12 13\n13 14\n14 15\n16 2\n17 2\n18 2\n19 2\n20 2\n21 2\n22 2\n23 2\n24 2\n25 2\n26 2\n27 2\n28 2\n29 2\n30 2\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')