Datasets:
Download code/math_code_004_solution.py from efe-T/bilingual-math-code-verification-v1: direct link, hf CLI and curl.
- Browser
- Download file 512 Bytes
-
https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_004_solution.py
- Command line
-
hf download hf://datasets/efe-T/bilingual-math-code-verification-v1/code/math_code_004_solution.py
-
curl -L -o math_code_004_solution.py https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_004_solution.py
512 Bytes
| mods = [(5, 2), (7, 3), (9, 4)] | |
| n, step = 0, 1 | |
| for modulus, remainder in mods: | |
| while n % modulus != remainder: | |
| n += step | |
| step *= modulus # Bu örnekte modüller aralarında asal. | |
| first = n | |
| q = max(0, (1000 - first + step - 1) // step) | |
| above = first + q * step | |
| assert all(above % m == r for m, r in mods) | |
| assert above >= 1000 and above - step < 1000 | |
| result = {"first": first, "period": step, "first_at_least_1000": above} | |
| import json | |
| print(json.dumps(result, ensure_ascii=False, sort_keys=True)) | |