bilingual-math-code-verification-v1 / code /math_code_007_verify.py
efe-T's picture
Upload folder using huggingface_hub
93237a0 verified
Raw History Blame Contribute Delete
555 Bytes
from itertools import combinations
blocked = {(1, 1), (2, 3)}
count = 0
for right_positions in combinations(range(8), 4):
right_positions = set(right_positions)
x = y = 0
valid = True
for step in range(8):
if step in right_positions:
x += 1
else:
y += 1
if (x, y) in blocked:
valid = False
break
if valid:
assert (x, y) == (4, 4)
count += 1
result = {"valid_paths": count}
import json
print(json.dumps(result, ensure_ascii=False, sort_keys=True))