Datasets:
Download code/math_code_009_solution.py from efe-T/bilingual-math-code-verification-v1: direct link, hf CLI and curl.
- Browser
- Download file 413 Bytes
-
https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_009_solution.py
- Command line
-
hf download hf://datasets/efe-T/bilingual-math-code-verification-v1/code/math_code_009_solution.py
-
curl -L -o math_code_009_solution.py https://huggingface.co/datasets/efe-T/bilingual-math-code-verification-v1/resolve/main/code/math_code_009_solution.py
413 Bytes
| from fractions import Fraction | |
| candidates = [] | |
| for y in range(7): | |
| x = min((14 - y) // 2, 18 - 3 * y) | |
| if x >= 0: | |
| assert 2 * x + y <= 14 and x + 3 * y <= 18 | |
| candidates.append((5 * x + 7 * y, x, y)) | |
| profit, x, y = max(candidates) | |
| assert Fraction(profit) <= Fraction(274, 5) | |
| result = {"x": x, "y": y, "profit": profit} | |
| import json | |
| print(json.dumps(result, ensure_ascii=False, sort_keys=True)) | |