import subprocess import sys from pathlib import Path cases = [{'input': '10 2 1\n1 1 1\n1 1 1\n1 1 1\n2 2 2\n2 2 2\n2 2 2\n', 'output': '1 9\n'}, {'input': '8 1 1\n2 2 1\n3 3 1\n3 1 3\n1 1 1\n2 1 1\n1 2 3\n', 'output': '5 2\n'}, {'input': '5 1 1\n1 2 2\n2 2 2\n2 2 2\n1 2 2\n2 2 2\n2 2 2\n', 'output': '0 0\n'}, {'input': '1 1 1\n3 3 1\n1 1 1\n3 2 2\n2 2 2\n1 3 1\n3 3 2\n', 'output': '0 0\n'}, {'input': '1 3 1\n1 3 3\n2 3 2\n2 1 3\n1 3 2\n3 3 2\n3 1 1\n', 'output': '0 1\n'}, {'input': '10 2 1\n2 2 1\n3 2 2\n3 1 3\n3 1 3\n1 2 2\n3 3 2\n', 'output': '8 1\n'}, {'input': '10 1 2\n1 1 2\n2 1 2\n1 3 1\n2 3 3\n3 2 2\n3 2 1\n', 'output': '3 5\n'}, {'input': '1000000 2 3\n3 1 1\n3 1 1\n1 2 2\n3 1 1\n3 1 1\n1 1 3\n', 'output': '0 333334\n'}, {'input': '1000000 1 3\n1 2 3\n2 1 2\n2 1 2\n1 2 3\n1 1 1\n2 3 3\n', 'output': '999998 1\n'}, {'input': '1000000000000 1 3\n3 1 1\n3 2 1\n2 2 2\n2 2 1\n1 2 2\n1 1 3\n', 'output': '500000000001 499999999998\n'}, {'input': '1000000000000 3 2\n2 3 3\n2 1 2\n1 1 1\n2 3 1\n1 3 3\n3 3 3\n', 'output': '500000000001 499999999999\n'}, {'input': '1000000000000000000 2 3\n1 3 1\n2 3 3\n2 2 2\n1 2 3\n3 1 2\n2 2 2\n', 'output': '1 500000000000000000\n'}, {'input': '999999999999999999 2 2\n2 3 2\n2 1 2\n1 3 3\n2 2 2\n1 3 2\n1 2 1\n', 'output': '499999999999999999 0\n'}, {'input': '1000000000000000000 2 1\n3 1 2\n2 3 3\n1 2 3\n2 2 3\n1 1 3\n2 3 2\n', 'output': '1000000000000000000 0\n'}, {'input': '1000000000000000000 3 3\n2 1 3\n1 2 3\n1 3 2\n3 2 2\n3 1 3\n3 3 1\n', 'output': '750000000000000000 0\n'}, {'input': '1000000000000000000 3 1\n2 3 2\n2 2 1\n2 3 3\n3 3 3\n2 1 1\n1 2 1\n', 'output': '500000000000000000 1\n'}, {'input': '478359268475263455 1 1\n3 2 3\n2 3 3\n2 1 1\n3 3 3\n2 3 3\n1 3 1\n', 'output': '0 0\n'}, {'input': '837264528963824683 3 3\n3 1 1\n1 3 1\n1 3 1\n3 2 1\n2 3 3\n2 2 2\n', 'output': '0 837264528963824682\n'}, {'input': '129341234876124184 1 2\n1 3 3\n1 1 2\n1 2 3\n3 1 1\n3 1 3\n3 2 3\n', 'output': '64670617438062091 64670617438062093\n'}, {'input': '981267318925341267 3 2\n1 2 1\n3 2 2\n3 3 3\n3 2 2\n2 2 3\n2 2 1\n', 'output': '981267318925341267 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')