import subprocess import sys from pathlib import Path cases = [{'input': '2 3 1 10\n', 'output': '1\n'}, {'input': '3 5 10 22\n', 'output': '8\n'}, {'input': '2 3 3 5\n', 'output': '0\n'}, {'input': '2 2 1 10\n', 'output': '1\n'}, {'input': '2 2 1 1000000\n', 'output': '213568\n'}, {'input': '2 2 1 1000000000000000000\n', 'output': '144115188075855871\n'}, {'input': '2 3 1 1000000\n', 'output': '206415\n'}, {'input': '2 3 1 1000000000000000000\n', 'output': '261485717957290893\n'}, {'input': '12345 54321 1 1000000\n', 'output': '933334\n'}, {'input': '54321 12345 1 1000000000000000000\n', 'output': '976614248345331214\n'}, {'input': '2 3 100000000 1000000000000\n', 'output': '188286357653\n'}, {'input': '2 14 732028847861235712 732028847861235712\n', 'output': '0\n'}, {'input': '14 2 732028847861235713 732028847861235713\n', 'output': '1\n'}, {'input': '3 2 6 7\n', 'output': '1\n'}, {'input': '16 5 821690667 821691481\n', 'output': '815\n'}, {'input': '1000000000000000000 2 1 1000000000000000000\n', 'output': '423539247696576511\n'}, {'input': '2 1000000000000000000 1000000000000000 1000000000000000000\n', 'output': '423539247696576511\n'}, {'input': '2 2 1000000000000000000 1000000000000000000\n', 'output': '1\n'}, {'input': '3 3 1 1\n', 'output': '1\n'}, {'input': '2 3 626492297402423196 726555387600422608\n', 'output': '100063090197999413\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')