import subprocess import sys from pathlib import Path cases = [{'input': '3 4 2\n2 2\n2 3\n', 'output': '2\n'}, {'input': '100 100 3\n15 16\n16 15\n99 88\n', 'output': '545732279\n'}, {'input': '1000 1000 4\n50 50\n51 50\n50 51\n51 51\n', 'output': '899660737\n'}, {'input': '100000 100000 4\n50001 50001\n50000 50000\n50000 50001\n50001 50000\n', 'output': '999612315\n'}, {'input': '2 2 2\n2 1\n1 2\n', 'output': '0\n'}, {'input': '100 10 30\n40 4\n15 3\n75 3\n88 10\n32 1\n16 5\n81 8\n45 2\n72 8\n11 6\n86 4\n50 2\n9 4\n11 1\n20 3\n47 3\n2 4\n68 3\n90 5\n85 2\n88 1\n88 5\n86 3\n70 9\n49 3\n34 4\n5 7\n77 5\n50 1\n87 5\n', 'output': '402737011\n'}, {'input': '100000 100000 2\n1 2\n2 1\n', 'output': '0\n'}, {'input': '100000 100000 2\n99999 100000\n100000 99999\n', 'output': '0\n'}, {'input': '100000 100000 3\n99998 100000\n99999 99999\n100000 99998\n', 'output': '0\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')