Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- tasks/construct-ae-p38-factorial-factors-l2-s3/environment/Dockerfile +7 -0
- tasks/construct-ae-p38-factorial-factors-l2-s3/environment/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l2-s3/solution/solve.sh +5 -0
- tasks/construct-ae-p38-factorial-factors-l2-s3/tests/check.py +12 -0
- tasks/construct-ae-p38-factorial-factors-l2-s3/tests/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l2-s3/tests/run.py +127 -0
- tasks/construct-ae-p38-factorial-factors-l2-s3/tests/test.sh +9 -0
- tasks/construct-ae-p38-factorial-factors-l2-s4/environment/Dockerfile +7 -0
- tasks/construct-ae-p38-factorial-factors-l2-s4/environment/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l2-s4/solution/solve.sh +5 -0
- tasks/construct-ae-p38-factorial-factors-l2-s4/tests/check.py +12 -0
- tasks/construct-ae-p38-factorial-factors-l2-s4/tests/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l2-s4/tests/run.py +127 -0
- tasks/construct-ae-p38-factorial-factors-l2-s4/tests/test.sh +9 -0
- tasks/construct-ae-p38-factorial-factors-l5-s7/environment/Dockerfile +7 -0
- tasks/construct-ae-p38-factorial-factors-l5-s7/environment/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l5-s7/solution/solve.sh +5 -0
- tasks/construct-ae-p38-factorial-factors-l5-s7/tests/check.py +12 -0
- tasks/construct-ae-p38-factorial-factors-l5-s7/tests/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l5-s7/tests/run.py +127 -0
- tasks/construct-ae-p38-factorial-factors-l5-s7/tests/test.sh +9 -0
- tasks/construct-ae-p38-factorial-factors-l6-s2/environment/Dockerfile +7 -0
- tasks/construct-ae-p38-factorial-factors-l6-s2/environment/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l6-s2/solution/solve.sh +5 -0
- tasks/construct-ae-p38-factorial-factors-l6-s2/tests/check.py +12 -0
- tasks/construct-ae-p38-factorial-factors-l6-s2/tests/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l6-s2/tests/run.py +127 -0
- tasks/construct-ae-p38-factorial-factors-l6-s2/tests/test.sh +9 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s4/environment/Dockerfile +7 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s4/environment/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s4/solution/solve.sh +5 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/check.py +38 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/run.py +127 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/test.sh +9 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s1/environment/Dockerfile +7 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s1/environment/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s1/solution/solve.sh +5 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/check.py +38 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/run.py +127 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/test.sh +9 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s8/environment/Dockerfile +7 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s8/environment/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s8/solution/solve.sh +5 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/check.py +38 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/run.py +127 -0
- tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/test.sh +9 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l1-s0/environment/Dockerfile +7 -0
tasks/construct-ae-p38-factorial-factors-l2-s3/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|
tasks/construct-ae-p38-factorial-factors-l2-s3/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 106, "t": 30, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l2-s3/solution/solve.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# oracle: a known valid construction (planted witness or published solution)
|
| 3 |
+
cat > /workdir/answer.json <<'RLMATH_EOF'
|
| 4 |
+
{"factors": [360, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 36, 36, 36, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 41, 41, 42, 43, 43, 46, 46, 46, 46, 47, 47, 49, 49, 49, 49, 49, 49, 49, 49, 53, 53, 58, 58, 58, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p38-factorial-factors-l2-s3/tests/check.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
|
| 2 |
+
import math
|
| 3 |
+
|
| 4 |
+
from run import Invalid, int_list
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def check(inst, ans):
|
| 8 |
+
n, t = inst["N"], inst["t"]
|
| 9 |
+
f = int_list(ans.get("factors"), n, t, None, "factors")
|
| 10 |
+
if math.prod(f) != math.factorial(n):
|
| 11 |
+
raise Invalid(f"the product of the factors is not {n}!")
|
| 12 |
+
return None, {"min_factor": min(f)}
|
tasks/construct-ae-p38-factorial-factors-l2-s3/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 106, "t": 30, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l2-s3/tests/run.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
|
| 2 |
+
|
| 3 |
+
Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
|
| 4 |
+
|
| 5 |
+
python3 /tests/run.py /tests/instance.json /workdir/answer.json
|
| 6 |
+
|
| 7 |
+
Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
|
| 8 |
+
|
| 9 |
+
check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
|
| 10 |
+
construct : value is ignored; a returned check means the witness is valid -> reward 1.0
|
| 11 |
+
optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
|
| 12 |
+
progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
|
| 13 |
+
clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
|
| 14 |
+
inst must carry "direction", "baseline", "best_known".
|
| 15 |
+
"""
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
VALID_FLOOR = 0.1
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Invalid(Exception):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ------------------------------------------------------------ input helpers
|
| 29 |
+
|
| 30 |
+
def int_list(v, n=None, lo=None, hi=None, name="list"):
|
| 31 |
+
if not isinstance(v, list):
|
| 32 |
+
raise Invalid(f"{name} must be a list")
|
| 33 |
+
if n is not None and len(v) != n:
|
| 34 |
+
raise Invalid(f"{name} must have length {n}, got {len(v)}")
|
| 35 |
+
for x in v:
|
| 36 |
+
if isinstance(x, bool) or not isinstance(x, int):
|
| 37 |
+
raise Invalid(f"{name} must contain integers only")
|
| 38 |
+
if (lo is not None and x < lo) or (hi is not None and x > hi):
|
| 39 |
+
raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
|
| 40 |
+
return v
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def as_int(x, name="value", lo=None, hi=None):
|
| 44 |
+
return int_list([x], 1, lo, hi, name)[0]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def num(x, name="value"):
|
| 48 |
+
if isinstance(x, bool) or not isinstance(x, (int, float)):
|
| 49 |
+
raise Invalid(f"{name} must be a number")
|
| 50 |
+
if not math.isfinite(x):
|
| 51 |
+
raise Invalid(f"{name} is not finite")
|
| 52 |
+
return float(x)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def float_matrix(v, rows=None, cols=None, name="matrix"):
|
| 56 |
+
if not isinstance(v, list) or (rows is not None and len(v) != rows):
|
| 57 |
+
raise Invalid(f"{name} must be a list of {rows} rows")
|
| 58 |
+
out = []
|
| 59 |
+
for r in v:
|
| 60 |
+
if not isinstance(r, list) or (cols is not None and len(r) != cols):
|
| 61 |
+
raise Invalid(f"each row of {name} must have {cols} numbers")
|
| 62 |
+
out.append([num(x, name) for x in r])
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def float_list(v, n=None, name="list"):
|
| 67 |
+
if not isinstance(v, list) or (n is not None and len(v) != n):
|
| 68 |
+
raise Invalid(f"{name} must be a list of length {n}")
|
| 69 |
+
return [num(x, name) for x in v]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------------------ reward
|
| 73 |
+
|
| 74 |
+
def optimize_reward(inst, s):
|
| 75 |
+
b, best = inst["baseline"], inst["best_known"]
|
| 76 |
+
if inst.get("progress_scale") == "log":
|
| 77 |
+
# for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
|
| 78 |
+
# progress is measured in log10(value + floor)
|
| 79 |
+
f = inst.get("log_floor", 1e-3)
|
| 80 |
+
b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
|
| 81 |
+
if inst["direction"] == "maximize":
|
| 82 |
+
p = (s - b) / (best - b)
|
| 83 |
+
else:
|
| 84 |
+
p = (b - s) / (b - best)
|
| 85 |
+
return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def grade(inst, ans, check):
|
| 89 |
+
try:
|
| 90 |
+
if not isinstance(ans, dict):
|
| 91 |
+
raise Invalid("answer must be a JSON object")
|
| 92 |
+
value, extra = check(inst, ans)
|
| 93 |
+
if inst.get("subset") == "optimize":
|
| 94 |
+
s = float(value)
|
| 95 |
+
if not math.isfinite(s):
|
| 96 |
+
raise Invalid("non-finite score")
|
| 97 |
+
return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
|
| 98 |
+
return 1.0, {"valid": True, **(extra or {})}
|
| 99 |
+
except Invalid as e:
|
| 100 |
+
return 0.0, {"valid": False, "error": str(e)}
|
| 101 |
+
except Exception as e: # any malformed answer
|
| 102 |
+
return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def main():
|
| 106 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 107 |
+
sys.path.insert(0, here)
|
| 108 |
+
# import ourselves as `run` so check.py's `from run import Invalid` is the same class
|
| 109 |
+
import run as R # noqa: E402
|
| 110 |
+
import check as family # noqa: E402
|
| 111 |
+
|
| 112 |
+
inst = json.load(open(sys.argv[1]))
|
| 113 |
+
try:
|
| 114 |
+
ans = json.load(open(sys.argv[2]))
|
| 115 |
+
except Exception as e:
|
| 116 |
+
reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
|
| 117 |
+
else:
|
| 118 |
+
reward, det = R.grade(inst, ans, family.check)
|
| 119 |
+
det["reward"] = reward
|
| 120 |
+
if os.path.isdir("/logs/verifier"):
|
| 121 |
+
with open("/logs/verifier/details.json", "w") as f:
|
| 122 |
+
json.dump(det, f)
|
| 123 |
+
print(reward)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
tasks/construct-ae-p38-factorial-factors-l2-s3/tests/test.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
if [ ! -s /workdir/answer.json ]; then
|
| 4 |
+
echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
|
| 5 |
+
echo 0 > /logs/verifier/reward.txt
|
| 6 |
+
exit 0
|
| 7 |
+
fi
|
| 8 |
+
timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
|
| 9 |
+
> /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
|
tasks/construct-ae-p38-factorial-factors-l2-s4/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|
tasks/construct-ae-p38-factorial-factors-l2-s4/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 110, "t": 31, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l2-s4/solution/solve.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# oracle: a known valid construction (planted witness or published solution)
|
| 3 |
+
cat > /workdir/answer.json <<'RLMATH_EOF'
|
| 4 |
+
{"factors": [186, 31, 31, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 43, 43, 46, 46, 46, 46, 47, 47, 53, 53, 58, 58, 58, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p38-factorial-factors-l2-s4/tests/check.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
|
| 2 |
+
import math
|
| 3 |
+
|
| 4 |
+
from run import Invalid, int_list
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def check(inst, ans):
|
| 8 |
+
n, t = inst["N"], inst["t"]
|
| 9 |
+
f = int_list(ans.get("factors"), n, t, None, "factors")
|
| 10 |
+
if math.prod(f) != math.factorial(n):
|
| 11 |
+
raise Invalid(f"the product of the factors is not {n}!")
|
| 12 |
+
return None, {"min_factor": min(f)}
|
tasks/construct-ae-p38-factorial-factors-l2-s4/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 110, "t": 31, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l2-s4/tests/run.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
|
| 2 |
+
|
| 3 |
+
Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
|
| 4 |
+
|
| 5 |
+
python3 /tests/run.py /tests/instance.json /workdir/answer.json
|
| 6 |
+
|
| 7 |
+
Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
|
| 8 |
+
|
| 9 |
+
check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
|
| 10 |
+
construct : value is ignored; a returned check means the witness is valid -> reward 1.0
|
| 11 |
+
optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
|
| 12 |
+
progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
|
| 13 |
+
clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
|
| 14 |
+
inst must carry "direction", "baseline", "best_known".
|
| 15 |
+
"""
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
VALID_FLOOR = 0.1
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Invalid(Exception):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ------------------------------------------------------------ input helpers
|
| 29 |
+
|
| 30 |
+
def int_list(v, n=None, lo=None, hi=None, name="list"):
|
| 31 |
+
if not isinstance(v, list):
|
| 32 |
+
raise Invalid(f"{name} must be a list")
|
| 33 |
+
if n is not None and len(v) != n:
|
| 34 |
+
raise Invalid(f"{name} must have length {n}, got {len(v)}")
|
| 35 |
+
for x in v:
|
| 36 |
+
if isinstance(x, bool) or not isinstance(x, int):
|
| 37 |
+
raise Invalid(f"{name} must contain integers only")
|
| 38 |
+
if (lo is not None and x < lo) or (hi is not None and x > hi):
|
| 39 |
+
raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
|
| 40 |
+
return v
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def as_int(x, name="value", lo=None, hi=None):
|
| 44 |
+
return int_list([x], 1, lo, hi, name)[0]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def num(x, name="value"):
|
| 48 |
+
if isinstance(x, bool) or not isinstance(x, (int, float)):
|
| 49 |
+
raise Invalid(f"{name} must be a number")
|
| 50 |
+
if not math.isfinite(x):
|
| 51 |
+
raise Invalid(f"{name} is not finite")
|
| 52 |
+
return float(x)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def float_matrix(v, rows=None, cols=None, name="matrix"):
|
| 56 |
+
if not isinstance(v, list) or (rows is not None and len(v) != rows):
|
| 57 |
+
raise Invalid(f"{name} must be a list of {rows} rows")
|
| 58 |
+
out = []
|
| 59 |
+
for r in v:
|
| 60 |
+
if not isinstance(r, list) or (cols is not None and len(r) != cols):
|
| 61 |
+
raise Invalid(f"each row of {name} must have {cols} numbers")
|
| 62 |
+
out.append([num(x, name) for x in r])
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def float_list(v, n=None, name="list"):
|
| 67 |
+
if not isinstance(v, list) or (n is not None and len(v) != n):
|
| 68 |
+
raise Invalid(f"{name} must be a list of length {n}")
|
| 69 |
+
return [num(x, name) for x in v]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------------------ reward
|
| 73 |
+
|
| 74 |
+
def optimize_reward(inst, s):
|
| 75 |
+
b, best = inst["baseline"], inst["best_known"]
|
| 76 |
+
if inst.get("progress_scale") == "log":
|
| 77 |
+
# for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
|
| 78 |
+
# progress is measured in log10(value + floor)
|
| 79 |
+
f = inst.get("log_floor", 1e-3)
|
| 80 |
+
b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
|
| 81 |
+
if inst["direction"] == "maximize":
|
| 82 |
+
p = (s - b) / (best - b)
|
| 83 |
+
else:
|
| 84 |
+
p = (b - s) / (b - best)
|
| 85 |
+
return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def grade(inst, ans, check):
|
| 89 |
+
try:
|
| 90 |
+
if not isinstance(ans, dict):
|
| 91 |
+
raise Invalid("answer must be a JSON object")
|
| 92 |
+
value, extra = check(inst, ans)
|
| 93 |
+
if inst.get("subset") == "optimize":
|
| 94 |
+
s = float(value)
|
| 95 |
+
if not math.isfinite(s):
|
| 96 |
+
raise Invalid("non-finite score")
|
| 97 |
+
return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
|
| 98 |
+
return 1.0, {"valid": True, **(extra or {})}
|
| 99 |
+
except Invalid as e:
|
| 100 |
+
return 0.0, {"valid": False, "error": str(e)}
|
| 101 |
+
except Exception as e: # any malformed answer
|
| 102 |
+
return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def main():
|
| 106 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 107 |
+
sys.path.insert(0, here)
|
| 108 |
+
# import ourselves as `run` so check.py's `from run import Invalid` is the same class
|
| 109 |
+
import run as R # noqa: E402
|
| 110 |
+
import check as family # noqa: E402
|
| 111 |
+
|
| 112 |
+
inst = json.load(open(sys.argv[1]))
|
| 113 |
+
try:
|
| 114 |
+
ans = json.load(open(sys.argv[2]))
|
| 115 |
+
except Exception as e:
|
| 116 |
+
reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
|
| 117 |
+
else:
|
| 118 |
+
reward, det = R.grade(inst, ans, family.check)
|
| 119 |
+
det["reward"] = reward
|
| 120 |
+
if os.path.isdir("/logs/verifier"):
|
| 121 |
+
with open("/logs/verifier/details.json", "w") as f:
|
| 122 |
+
json.dump(det, f)
|
| 123 |
+
print(reward)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
tasks/construct-ae-p38-factorial-factors-l2-s4/tests/test.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
if [ ! -s /workdir/answer.json ]; then
|
| 4 |
+
echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
|
| 5 |
+
echo 0 > /logs/verifier/reward.txt
|
| 6 |
+
exit 0
|
| 7 |
+
fi
|
| 8 |
+
timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
|
| 9 |
+
> /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
|
tasks/construct-ae-p38-factorial-factors-l5-s7/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|
tasks/construct-ae-p38-factorial-factors-l5-s7/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 3059, "t": 980, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l5-s7/solution/solve.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# oracle: a known valid construction (planted witness or published solution)
|
| 3 |
+
cat > /workdir/answer.json <<'RLMATH_EOF'
|
| 4 |
+
{"factors": [9800, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 980, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 981, 982, 982, 982, 982, 982, 982, 983, 983, 983, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 984, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 985, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 986, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 987, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 988, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 989, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 990, 991, 991, 991, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 992, 993, 993, 993, 993, 993, 993, 993, 993, 993, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 994, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 995, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 996, 997, 997, 997, 998, 998, 998, 998, 998, 998, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 999, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1002, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1003, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1004, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1005, 1006, 1006, 1006, 1006, 1006, 1006, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1007, 1009, 1009, 1009, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1014, 1015, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1017, 1018, 1018, 1018, 1018, 1018, 1018, 1019, 1019, 1019, 1021, 1021, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1028, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1030, 1031, 1031, 1033, 1033, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1037, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1038, 1039, 1039, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1042, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1043, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1044, 1046, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1049, 1049, 1051, 1051, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1052, 1053, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1055, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1057, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1059, 1061, 1061, 1063, 1063, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1067, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1068, 1069, 1069, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1070, 1073, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1074, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1076, 1077, 1077, 1077, 1077, 1077, 1077, 1077, 1077, 1082, 1082, 1082, 1082, 1082, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1084, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1086, 1087, 1087, 1091, 1091, 1093, 1093, 1094, 1094, 1094, 1094, 1094, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1096, 1097, 1097, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1099, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1101, 1103, 1103, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1108, 1109, 1109, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1112, 1114, 1114, 1114, 1114, 1114, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115, 1117, 1117, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119, 1123, 1123, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1124, 1126, 1126, 1126, 1126, 1126, 1129, 1129, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1132, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1135, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1137, 1138, 1138, 1138, 1138, 1138, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1141, 1142, 1142, 1142, 1142, 1142, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1145, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1146, 1149, 1149, 1149, 1149, 1149, 1149, 1149, 1151, 1151, 1153, 1153, 1154, 1154, 1154, 1154, 1154, 1157, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1163, 1163, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1165, 1167, 1167, 1167, 1167, 1167, 1167, 1167, 1171, 1171, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1172, 1174, 1174, 1174, 1174, 1174, 1181, 1181, 1185, 1186, 1186, 1186, 1186, 1186, 1187, 1187, 1191, 1191, 1191, 1191, 1191, 1191, 1191, 1193, 1193, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1198, 1198, 1198, 1198, 1198, 1201, 1201, 1202, 1202, 1202, 1202, 1202, 1203, 1203, 1203, 1203, 1203, 1203, 1203, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1205, 1213, 1213, 1214, 1214, 1214, 1214, 1214, 1217, 1217, 1223, 1223, 1226, 1226, 1226, 1226, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1228, 1229, 1229, 1231, 1231, 1234, 1234, 1234, 1234, 1237, 1237, 1238, 1238, 1238, 1238, 1244, 1244, 1244, 1244, 1244, 1244, 1244, 1244, 1244, 1249, 1249, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1252, 1257, 1257, 1257, 1257, 1257, 1257, 1257, 1259, 1259, 1262, 1262, 1262, 1262, 1263, 1263, 1263, 1263, 1263, 1263, 1263, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1268, 1277, 1277, 1279, 1279, 1282, 1282, 1282, 1282, 1283, 1283, 1286, 1286, 1286, 1286, 1289, 1289, 1291, 1291, 1293, 1293, 1293, 1293, 1293, 1293, 1293, 1294, 1294, 1294, 1294, 1297, 1297, 1299, 1299, 1299, 1299, 1299, 1299, 1299, 1301, 1301, 1303, 1303, 1306, 1306, 1306, 1306, 1307, 1307, 1317, 1317, 1317, 1317, 1317, 1317, 1318, 1318, 1318, 1318, 1319, 1319, 1321, 1321, 1322, 1322, 1322, 1322, 1327, 1327, 1329, 1329, 1329, 1329, 1329, 1329, 1346, 1346, 1346, 1346, 1347, 1347, 1347, 1347, 1347, 1347, 1354, 1354, 1354, 1354, 1361, 1361, 1366, 1366, 1366, 1366, 1367, 1367, 1371, 1371, 1371, 1371, 1371, 1371, 1373, 1373, 1381, 1381, 1382, 1382, 1382, 1382, 1383, 1383, 1383, 1383, 1383, 1383, 1389, 1389, 1389, 1389, 1389, 1389, 1399, 1399, 1401, 1401, 1401, 1401, 1401, 1401, 1402, 1402, 1402, 1402, 1409, 1409, 1418, 1418, 1418, 1418, 1423, 1423, 1427, 1427, 1429, 1429, 1433, 1433, 1437, 1437, 1437, 1437, 1437, 1437, 1438, 1438, 1438, 1438, 1439, 1439, 1447, 1447, 1451, 1451, 1453, 1453, 1454, 1454, 1454, 1454, 1459, 1459, 1461, 1461, 1461, 1461, 1461, 1461, 1466, 1466, 1466, 1466, 1471, 1471, 1478, 1478, 1478, 1478, 1481, 1481, 1483, 1483, 1486, 1486, 1486, 1486, 1487, 1487, 1489, 1489, 1493, 1493, 1499, 1499, 1502, 1502, 1502, 1502, 1511, 1511, 1514, 1514, 1514, 1514, 1522, 1522, 1522, 1522, 1523, 1523, 1531, 1538, 1538, 1538, 1543, 1546, 1546, 1546, 1549, 1553, 1559, 1567, 1571, 1574, 1574, 1574, 1579, 1583, 1594, 1594, 1594, 1597, 1601, 1607, 1609, 1613, 1618, 1618, 1618, 1619, 1621, 1622, 1622, 1622, 1627, 1637, 1642, 1642, 1642, 1646, 1646, 1646, 1654, 1654, 1654, 1657, 1658, 1658, 1658, 1663, 1667, 1669, 1678, 1678, 1678, 1693, 1697, 1699, 1706, 1706, 1706, 1709, 1714, 1714, 1714, 1718, 1718, 1718, 1721, 1723, 1726, 1726, 1726, 1733, 1741, 1747, 1753, 1754, 1754, 1754, 1759, 1762, 1762, 1762, 1766, 1766, 1766, 1774, 1774, 1774, 1777, 1783, 1787, 1789, 1801, 1811, 1814, 1814, 1814, 1822, 1822, 1822, 1823, 1831, 1838, 1838, 1838, 1847, 1858, 1858, 1858, 1861, 1867, 1871, 1873, 1874, 1874, 1874, 1877, 1879, 1882, 1882, 1882, 1889, 1894, 1894, 1894, 1901, 1906, 1906, 1906, 1907, 1913, 1931, 1933, 1934, 1934, 1934, 1942, 1942, 1942, 1949, 1951, 1954, 1954, 1954, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p38-factorial-factors-l5-s7/tests/check.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
|
| 2 |
+
import math
|
| 3 |
+
|
| 4 |
+
from run import Invalid, int_list
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def check(inst, ans):
|
| 8 |
+
n, t = inst["N"], inst["t"]
|
| 9 |
+
f = int_list(ans.get("factors"), n, t, None, "factors")
|
| 10 |
+
if math.prod(f) != math.factorial(n):
|
| 11 |
+
raise Invalid(f"the product of the factors is not {n}!")
|
| 12 |
+
return None, {"min_factor": min(f)}
|
tasks/construct-ae-p38-factorial-factors-l5-s7/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 3059, "t": 980, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l5-s7/tests/run.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
|
| 2 |
+
|
| 3 |
+
Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
|
| 4 |
+
|
| 5 |
+
python3 /tests/run.py /tests/instance.json /workdir/answer.json
|
| 6 |
+
|
| 7 |
+
Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
|
| 8 |
+
|
| 9 |
+
check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
|
| 10 |
+
construct : value is ignored; a returned check means the witness is valid -> reward 1.0
|
| 11 |
+
optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
|
| 12 |
+
progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
|
| 13 |
+
clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
|
| 14 |
+
inst must carry "direction", "baseline", "best_known".
|
| 15 |
+
"""
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
VALID_FLOOR = 0.1
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Invalid(Exception):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ------------------------------------------------------------ input helpers
|
| 29 |
+
|
| 30 |
+
def int_list(v, n=None, lo=None, hi=None, name="list"):
|
| 31 |
+
if not isinstance(v, list):
|
| 32 |
+
raise Invalid(f"{name} must be a list")
|
| 33 |
+
if n is not None and len(v) != n:
|
| 34 |
+
raise Invalid(f"{name} must have length {n}, got {len(v)}")
|
| 35 |
+
for x in v:
|
| 36 |
+
if isinstance(x, bool) or not isinstance(x, int):
|
| 37 |
+
raise Invalid(f"{name} must contain integers only")
|
| 38 |
+
if (lo is not None and x < lo) or (hi is not None and x > hi):
|
| 39 |
+
raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
|
| 40 |
+
return v
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def as_int(x, name="value", lo=None, hi=None):
|
| 44 |
+
return int_list([x], 1, lo, hi, name)[0]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def num(x, name="value"):
|
| 48 |
+
if isinstance(x, bool) or not isinstance(x, (int, float)):
|
| 49 |
+
raise Invalid(f"{name} must be a number")
|
| 50 |
+
if not math.isfinite(x):
|
| 51 |
+
raise Invalid(f"{name} is not finite")
|
| 52 |
+
return float(x)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def float_matrix(v, rows=None, cols=None, name="matrix"):
|
| 56 |
+
if not isinstance(v, list) or (rows is not None and len(v) != rows):
|
| 57 |
+
raise Invalid(f"{name} must be a list of {rows} rows")
|
| 58 |
+
out = []
|
| 59 |
+
for r in v:
|
| 60 |
+
if not isinstance(r, list) or (cols is not None and len(r) != cols):
|
| 61 |
+
raise Invalid(f"each row of {name} must have {cols} numbers")
|
| 62 |
+
out.append([num(x, name) for x in r])
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def float_list(v, n=None, name="list"):
|
| 67 |
+
if not isinstance(v, list) or (n is not None and len(v) != n):
|
| 68 |
+
raise Invalid(f"{name} must be a list of length {n}")
|
| 69 |
+
return [num(x, name) for x in v]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------------------ reward
|
| 73 |
+
|
| 74 |
+
def optimize_reward(inst, s):
|
| 75 |
+
b, best = inst["baseline"], inst["best_known"]
|
| 76 |
+
if inst.get("progress_scale") == "log":
|
| 77 |
+
# for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
|
| 78 |
+
# progress is measured in log10(value + floor)
|
| 79 |
+
f = inst.get("log_floor", 1e-3)
|
| 80 |
+
b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
|
| 81 |
+
if inst["direction"] == "maximize":
|
| 82 |
+
p = (s - b) / (best - b)
|
| 83 |
+
else:
|
| 84 |
+
p = (b - s) / (b - best)
|
| 85 |
+
return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def grade(inst, ans, check):
|
| 89 |
+
try:
|
| 90 |
+
if not isinstance(ans, dict):
|
| 91 |
+
raise Invalid("answer must be a JSON object")
|
| 92 |
+
value, extra = check(inst, ans)
|
| 93 |
+
if inst.get("subset") == "optimize":
|
| 94 |
+
s = float(value)
|
| 95 |
+
if not math.isfinite(s):
|
| 96 |
+
raise Invalid("non-finite score")
|
| 97 |
+
return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
|
| 98 |
+
return 1.0, {"valid": True, **(extra or {})}
|
| 99 |
+
except Invalid as e:
|
| 100 |
+
return 0.0, {"valid": False, "error": str(e)}
|
| 101 |
+
except Exception as e: # any malformed answer
|
| 102 |
+
return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def main():
|
| 106 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 107 |
+
sys.path.insert(0, here)
|
| 108 |
+
# import ourselves as `run` so check.py's `from run import Invalid` is the same class
|
| 109 |
+
import run as R # noqa: E402
|
| 110 |
+
import check as family # noqa: E402
|
| 111 |
+
|
| 112 |
+
inst = json.load(open(sys.argv[1]))
|
| 113 |
+
try:
|
| 114 |
+
ans = json.load(open(sys.argv[2]))
|
| 115 |
+
except Exception as e:
|
| 116 |
+
reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
|
| 117 |
+
else:
|
| 118 |
+
reward, det = R.grade(inst, ans, family.check)
|
| 119 |
+
det["reward"] = reward
|
| 120 |
+
if os.path.isdir("/logs/verifier"):
|
| 121 |
+
with open("/logs/verifier/details.json", "w") as f:
|
| 122 |
+
json.dump(det, f)
|
| 123 |
+
print(reward)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
tasks/construct-ae-p38-factorial-factors-l5-s7/tests/test.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
if [ ! -s /workdir/answer.json ]; then
|
| 4 |
+
echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
|
| 5 |
+
echo 0 > /logs/verifier/reward.txt
|
| 6 |
+
exit 0
|
| 7 |
+
fi
|
| 8 |
+
timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
|
| 9 |
+
> /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
|
tasks/construct-ae-p38-factorial-factors-l6-s2/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|
tasks/construct-ae-p38-factorial-factors-l6-s2/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 6230, "t": 2021, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l6-s2/solution/solve.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# oracle: a known valid construction (planted witness or published solution)
|
| 3 |
+
cat > /workdir/answer.json <<'RLMATH_EOF'
|
| 4 |
+
{"factors": [94987, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2024, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2026, 2026, 2026, 2026, 2026, 2026, 2027, 2027, 2027, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2028, 2029, 2029, 2029, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2030, 2031, 2031, 2031, 2031, 2031, 2031, 2031, 2031, 2031, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2032, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2033, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2034, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2035, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2036, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2038, 2038, 2038, 2038, 2038, 2038, 2039, 2039, 2039, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2041, 2042, 2042, 2042, 2042, 2042, 2042, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2043, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2044, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2045, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2046, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2048, 2049, 2049, 2049, 2049, 2049, 2049, 2049, 2049, 2049, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2050, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2051, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2052, 2053, 2053, 2053, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2054, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2055, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2056, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2058, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2059, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2061, 2062, 2062, 2062, 2062, 2062, 2062, 2063, 2063, 2063, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2064, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2065, 2066, 2066, 2066, 2066, 2066, 2066, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2067, 2069, 2069, 2069, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2072, 2073, 2073, 2073, 2073, 2073, 2073, 2073, 2073, 2073, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2075, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2076, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2077, 2078, 2078, 2078, 2078, 2078, 2079, 2081, 2081, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2082, 2083, 2083, 2084, 2084, 2084, 2084, 2084, 2084, 2084, 2084, 2084, 2084, 2084, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2085, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2087, 2087, 2088, 2089, 2089, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2091, 2092, 2092, 2092, 2092, 2092, 2092, 2092, 2092, 2092, 2092, 2092, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2094, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2095, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2097, 2098, 2098, 2098, 2098, 2098, 2099, 2099, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2101, 2102, 2102, 2102, 2102, 2102, 2103, 2103, 2103, 2103, 2103, 2103, 2103, 2103, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2104, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2105, 2107, 2108, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2110, 2111, 2111, 2113, 2113, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2115, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2118, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2119, 2120, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2121, 2122, 2122, 2122, 2122, 2122, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2123, 2126, 2126, 2126, 2126, 2126, 2127, 2127, 2127, 2127, 2127, 2127, 2127, 2127, 2129, 2129, 2131, 2131, 2137, 2137, 2138, 2138, 2138, 2138, 2138, 2141, 2141, 2143, 2143, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2148, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2149, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2151, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2152, 2153, 2153, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2154, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2155, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2157, 2161, 2161, 2163, 2163, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2164, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2165, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2167, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2168, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2169, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2171, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2172, 2174, 2174, 2174, 2174, 2174, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2177, 2179, 2179, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2181, 2182, 2182, 2182, 2182, 2182, 2186, 2186, 2186, 2186, 2186, 2188, 2188, 2188, 2188, 2188, 2188, 2188, 2188, 2188, 2188, 2188, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2189, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2191, 2194, 2194, 2194, 2194, 2194, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2195, 2197, 2199, 2199, 2199, 2199, 2199, 2199, 2199, 2199, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2202, 2203, 2203, 2206, 2206, 2206, 2206, 2206, 2207, 2207, 2213, 2213, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2215, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2216, 2217, 2217, 2217, 2217, 2217, 2217, 2217, 2217, 2218, 2218, 2218, 2218, 2218, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2219, 2221, 2221, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 2228, 2229, 2229, 2229, 2229, 2229, 2229, 2229, 2229, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2230, 2234, 2234, 2234, 2234, 2234, 2237, 2237, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2238, 2239, 2239, 2243, 2243, 2245, 2245, 2245, 2245, 2245, 2245, 2245, 2245, 2245, 2245, 2245, 2245, 2245, 2246, 2246, 2246, 2246, 2246, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2248, 2251, 2251, 2252, 2252, 2252, 2252, 2252, 2252, 2252, 2252, 2252, 2252, 2252, 2253, 2253, 2253, 2253, 2253, 2253, 2253, 2253, 2258, 2258, 2258, 2258, 2258, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2259, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2264, 2267, 2267, 2269, 2269, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2271, 2273, 2273, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2274, 2276, 2276, 2276, 2276, 2276, 2276, 2276, 2276, 2276, 2276, 2281, 2281, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2283, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2284, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2285, 2287, 2287, 2293, 2293, 2297, 2297, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2298, 2302, 2302, 2302, 2302, 2302, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2305, 2306, 2306, 2306, 2306, 2306, 2307, 2307, 2307, 2307, 2307, 2307, 2307, 2307, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2308, 2309, 2309, 2311, 2311, 2315, 2315, 2315, 2315, 2315, 2315, 2315, 2315, 2315, 2315, 2315, 2315, 2315, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2317, 2319, 2319, 2319, 2319, 2319, 2319, 2319, 2319, 2326, 2326, 2326, 2326, 2326, 2333, 2333, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2334, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2335, 2339, 2339, 2341, 2341, 2342, 2342, 2342, 2342, 2342, 2347, 2347, 2348, 2348, 2348, 2348, 2348, 2348, 2348, 2348, 2348, 2348, 2351, 2351, 2357, 2357, 2361, 2361, 2361, 2361, 2361, 2361, 2361, 2362, 2362, 2362, 2362, 2362, 2371, 2371, 2372, 2372, 2372, 2372, 2372, 2372, 2372, 2372, 2372, 2372, 2374, 2374, 2374, 2374, 2374, 2377, 2377, 2381, 2381, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2382, 2383, 2383, 2386, 2386, 2386, 2386, 2386, 2389, 2389, 2391, 2391, 2391, 2391, 2391, 2391, 2391, 2393, 2393, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2395, 2396, 2396, 2396, 2396, 2396, 2396, 2396, 2396, 2396, 2396, 2399, 2399, 2402, 2402, 2402, 2402, 2402, 2404, 2404, 2404, 2404, 2404, 2404, 2404, 2404, 2404, 2404, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2406, 2411, 2411, 2417, 2417, 2423, 2423, 2426, 2426, 2426, 2426, 2426, 2427, 2427, 2427, 2427, 2427, 2427, 2427, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2428, 2433, 2433, 2433, 2433, 2433, 2433, 2433, 2434, 2434, 2434, 2434, 2434, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2435, 2437, 2437, 2441, 2441, 2446, 2446, 2446, 2446, 2446, 2447, 2447, 2452, 2452, 2452, 2452, 2452, 2452, 2452, 2452, 2452, 2452, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2455, 2458, 2458, 2458, 2458, 2458, 2459, 2459, 2462, 2462, 2462, 2462, 2462, 2463, 2463, 2463, 2463, 2463, 2463, 2463, 2467, 2467, 2468, 2468, 2468, 2468, 2468, 2468, 2468, 2468, 2468, 2468, 2469, 2469, 2469, 2469, 2469, 2469, 2469, 2473, 2473, 2474, 2474, 2474, 2474, 2474, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2476, 2477, 2477, 2481, 2481, 2481, 2481, 2481, 2481, 2481, 2487, 2487, 2487, 2487, 2487, 2487, 2487, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2495, 2498, 2498, 2498, 2498, 2503, 2503, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2515, 2517, 2517, 2517, 2517, 2517, 2517, 2517, 2518, 2518, 2518, 2518, 2521, 2521, 2524, 2524, 2524, 2524, 2524, 2524, 2524, 2524, 2524, 2531, 2531, 2537, 2539, 2539, 2543, 2543, 2549, 2549, 2551, 2551, 2554, 2554, 2554, 2554, 2557, 2557, 2558, 2558, 2558, 2558, 2559, 2559, 2559, 2559, 2559, 2559, 2559, 2564, 2564, 2564, 2564, 2564, 2564, 2564, 2564, 2564, 2566, 2566, 2566, 2566, 2571, 2571, 2571, 2571, 2571, 2571, 2571, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2572, 2577, 2577, 2577, 2577, 2577, 2577, 2577, 2578, 2578, 2578, 2578, 2579, 2579, 2582, 2582, 2582, 2582, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2588, 2589, 2589, 2589, 2589, 2589, 2589, 2589, 2591, 2591, 2593, 2593, 2594, 2594, 2594, 2594, 2602, 2602, 2602, 2602, 2606, 2606, 2606, 2606, 2609, 2609, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2612, 2614, 2614, 2614, 2614, 2617, 2617, 2621, 2621, 2631, 2631, 2631, 2631, 2631, 2631, 2631, 2633, 2633, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2636, 2638, 2638, 2638, 2638, 2642, 2642, 2642, 2642, 2643, 2643, 2643, 2643, 2643, 2643, 2643, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2644, 2647, 2647, 2649, 2649, 2649, 2649, 2649, 2649, 2649, 2654, 2654, 2654, 2654, 2657, 2657, 2659, 2659, 2661, 2661, 2661, 2661, 2661, 2661, 2661, 2663, 2663, 2671, 2671, 2677, 2677, 2681, 2683, 2683, 2687, 2687, 2689, 2689, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2692, 2693, 2693, 2699, 2699, 2707, 2707, 2711, 2711, 2713, 2713, 2719, 2719, 2721, 2721, 2721, 2721, 2721, 2721, 2722, 2722, 2722, 2722, 2729, 2729, 2731, 2731, 2733, 2733, 2733, 2733, 2733, 2733, 2734, 2734, 2734, 2734, 2741, 2741, 2746, 2746, 2746, 2746, 2749, 2749, 2753, 2753, 2757, 2757, 2757, 2757, 2757, 2757, 2762, 2762, 2762, 2762, 2767, 2767, 2777, 2777, 2787, 2787, 2787, 2787, 2787, 2787, 2789, 2789, 2791, 2791, 2797, 2797, 2798, 2798, 2798, 2798, 2801, 2801, 2803, 2803, 2811, 2811, 2811, 2811, 2811, 2811, 2818, 2818, 2818, 2818, 2819, 2819, 2823, 2823, 2823, 2823, 2823, 2823, 2833, 2833, 2837, 2837, 2841, 2841, 2841, 2841, 2841, 2841, 2843, 2843, 2846, 2846, 2846, 2846, 2851, 2851, 2854, 2854, 2854, 2854, 2857, 2857, 2858, 2858, 2858, 2858, 2859, 2859, 2859, 2859, 2859, 2859, 2861, 2861, 2866, 2866, 2866, 2866, 2878, 2878, 2878, 2878, 2879, 2879, 2887, 2887, 2894, 2894, 2894, 2894, 2897, 2897, 2901, 2901, 2901, 2901, 2901, 2901, 2902, 2902, 2902, 2902, 2903, 2903, 2906, 2906, 2906, 2906, 2909, 2909, 2913, 2913, 2913, 2913, 2913, 2913, 2917, 2917, 2918, 2918, 2918, 2918, 2927, 2927, 2931, 2931, 2931, 2931, 2931, 2931, 2939, 2939, 2942, 2942, 2942, 2942, 2949, 2949, 2949, 2949, 2949, 2949, 2953, 2953, 2957, 2957, 2962, 2962, 2962, 2962, 2963, 2963, 2966, 2966, 2966, 2966, 2969, 2969, 2971, 2971, 2973, 2973, 2973, 2973, 2973, 2973, 2974, 2974, 2974, 2974, 2978, 2978, 2978, 2978, 2986, 2986, 2986, 2986, 2991, 2991, 2991, 2991, 2991, 2991, 2998, 2998, 2998, 2998, 2999, 2999, 3001, 3001, 3011, 3011, 3019, 3019, 3022, 3022, 3022, 3022, 3023, 3023, 3027, 3027, 3027, 3027, 3027, 3027, 3037, 3037, 3041, 3041, 3046, 3046, 3046, 3046, 3049, 3049, 3061, 3061, 3062, 3062, 3062, 3062, 3067, 3067, 3079, 3079, 3083, 3083, 3086, 3086, 3086, 3086, 3089, 3089, 3098, 3098, 3098, 3098, 3106, 3106, 3106, 3106, 3109, 3109, 3118, 3118, 3118, 3119, 3121, 3134, 3134, 3134, 3137, 3142, 3142, 3142, 3158, 3158, 3158, 3163, 3166, 3166, 3166, 3167, 3169, 3181, 3187, 3191, 3194, 3194, 3194, 3202, 3202, 3202, 3203, 3209, 3214, 3214, 3214, 3217, 3218, 3218, 3218, 3221, 3226, 3226, 3226, 3229, 3238, 3238, 3238, 3242, 3242, 3242, 3251, 3253, 3254, 3254, 3254, 3257, 3259, 3271, 3274, 3274, 3274, 3299, 3301, 3307, 3313, 3314, 3314, 3314, 3319, 3323, 3326, 3326, 3326, 3329, 3331, 3334, 3334, 3334, 3338, 3338, 3338, 3343, 3347, 3359, 3361, 3371, 3373, 3386, 3386, 3386, 3389, 3391, 3394, 3394, 3394, 3398, 3398, 3398, 3407, 3413, 3418, 3418, 3418, 3433, 3442, 3442, 3442, 3446, 3446, 3446, 3449, 3457, 3461, 3463, 3466, 3466, 3466, 3467, 3469, 3482, 3482, 3482, 3491, 3494, 3494, 3494, 3499, 3506, 3506, 3506, 3511, 3517, 3518, 3518, 3518, 3527, 3529, 3533, 3539, 3541, 3547, 3554, 3554, 3554, 3557, 3559, 3566, 3566, 3566, 3571, 3574, 3574, 3574, 3578, 3578, 3578, 3581, 3583, 3593, 3602, 3602, 3602, 3607, 3613, 3617, 3622, 3622, 3622, 3623, 3631, 3637, 3643, 3646, 3646, 3646, 3659, 3662, 3662, 3662, 3671, 3673, 3677, 3691, 3694, 3694, 3694, 3697, 3701, 3709, 3719, 3722, 3722, 3722, 3727, 3733, 3734, 3734, 3734, 3739, 3742, 3742, 3742, 3746, 3746, 3746, 3754, 3754, 3754, 3758, 3758, 3758, 3761, 3767, 3769, 3778, 3778, 3778, 3779, 3793, 3797, 3802, 3802, 3802, 3803, 3814, 3814, 3814, 3821, 3823, 3826, 3826, 3826, 3833, 3847, 3851, 3853, 3862, 3862, 3862, 3863, 3866, 3866, 3866, 3877, 3881, 3889, 3898, 3898, 3898, 3902, 3902, 3902, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3946, 3946, 3946, 3947, 3958, 3958, 3958, 3967, 3974, 3974, 3974, 3986, 3986, 3986, 3989, 3994, 3994, 3994, 3998, 3998, 3998, 4001, 4003, 4006, 4006, 4006, 4007, 4013, 4019, 4021, 4022, 4022, 4022, 4027, 4034, 4034, 4034, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p38-factorial-factors-l6-s2/tests/check.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Factor N! into N factors, each >= t (AlphaEvolve problem 38 / OEIS A034258). Exact big-integer check."""
|
| 2 |
+
import math
|
| 3 |
+
|
| 4 |
+
from run import Invalid, int_list
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def check(inst, ans):
|
| 8 |
+
n, t = inst["N"], inst["t"]
|
| 9 |
+
f = int_list(ans.get("factors"), n, t, None, "factors")
|
| 10 |
+
if math.prod(f) != math.factorial(n):
|
| 11 |
+
raise Invalid(f"the product of the factors is not {n}!")
|
| 12 |
+
return None, {"min_factor": min(f)}
|
tasks/construct-ae-p38-factorial-factors-l6-s2/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 6230, "t": 2021, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l6-s2/tests/run.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
|
| 2 |
+
|
| 3 |
+
Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
|
| 4 |
+
|
| 5 |
+
python3 /tests/run.py /tests/instance.json /workdir/answer.json
|
| 6 |
+
|
| 7 |
+
Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
|
| 8 |
+
|
| 9 |
+
check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
|
| 10 |
+
construct : value is ignored; a returned check means the witness is valid -> reward 1.0
|
| 11 |
+
optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
|
| 12 |
+
progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
|
| 13 |
+
clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
|
| 14 |
+
inst must carry "direction", "baseline", "best_known".
|
| 15 |
+
"""
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
VALID_FLOOR = 0.1
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Invalid(Exception):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ------------------------------------------------------------ input helpers
|
| 29 |
+
|
| 30 |
+
def int_list(v, n=None, lo=None, hi=None, name="list"):
|
| 31 |
+
if not isinstance(v, list):
|
| 32 |
+
raise Invalid(f"{name} must be a list")
|
| 33 |
+
if n is not None and len(v) != n:
|
| 34 |
+
raise Invalid(f"{name} must have length {n}, got {len(v)}")
|
| 35 |
+
for x in v:
|
| 36 |
+
if isinstance(x, bool) or not isinstance(x, int):
|
| 37 |
+
raise Invalid(f"{name} must contain integers only")
|
| 38 |
+
if (lo is not None and x < lo) or (hi is not None and x > hi):
|
| 39 |
+
raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
|
| 40 |
+
return v
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def as_int(x, name="value", lo=None, hi=None):
|
| 44 |
+
return int_list([x], 1, lo, hi, name)[0]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def num(x, name="value"):
|
| 48 |
+
if isinstance(x, bool) or not isinstance(x, (int, float)):
|
| 49 |
+
raise Invalid(f"{name} must be a number")
|
| 50 |
+
if not math.isfinite(x):
|
| 51 |
+
raise Invalid(f"{name} is not finite")
|
| 52 |
+
return float(x)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def float_matrix(v, rows=None, cols=None, name="matrix"):
|
| 56 |
+
if not isinstance(v, list) or (rows is not None and len(v) != rows):
|
| 57 |
+
raise Invalid(f"{name} must be a list of {rows} rows")
|
| 58 |
+
out = []
|
| 59 |
+
for r in v:
|
| 60 |
+
if not isinstance(r, list) or (cols is not None and len(r) != cols):
|
| 61 |
+
raise Invalid(f"each row of {name} must have {cols} numbers")
|
| 62 |
+
out.append([num(x, name) for x in r])
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def float_list(v, n=None, name="list"):
|
| 67 |
+
if not isinstance(v, list) or (n is not None and len(v) != n):
|
| 68 |
+
raise Invalid(f"{name} must be a list of length {n}")
|
| 69 |
+
return [num(x, name) for x in v]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------------------ reward
|
| 73 |
+
|
| 74 |
+
def optimize_reward(inst, s):
|
| 75 |
+
b, best = inst["baseline"], inst["best_known"]
|
| 76 |
+
if inst.get("progress_scale") == "log":
|
| 77 |
+
# for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
|
| 78 |
+
# progress is measured in log10(value + floor)
|
| 79 |
+
f = inst.get("log_floor", 1e-3)
|
| 80 |
+
b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
|
| 81 |
+
if inst["direction"] == "maximize":
|
| 82 |
+
p = (s - b) / (best - b)
|
| 83 |
+
else:
|
| 84 |
+
p = (b - s) / (b - best)
|
| 85 |
+
return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def grade(inst, ans, check):
|
| 89 |
+
try:
|
| 90 |
+
if not isinstance(ans, dict):
|
| 91 |
+
raise Invalid("answer must be a JSON object")
|
| 92 |
+
value, extra = check(inst, ans)
|
| 93 |
+
if inst.get("subset") == "optimize":
|
| 94 |
+
s = float(value)
|
| 95 |
+
if not math.isfinite(s):
|
| 96 |
+
raise Invalid("non-finite score")
|
| 97 |
+
return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
|
| 98 |
+
return 1.0, {"valid": True, **(extra or {})}
|
| 99 |
+
except Invalid as e:
|
| 100 |
+
return 0.0, {"valid": False, "error": str(e)}
|
| 101 |
+
except Exception as e: # any malformed answer
|
| 102 |
+
return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def main():
|
| 106 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 107 |
+
sys.path.insert(0, here)
|
| 108 |
+
# import ourselves as `run` so check.py's `from run import Invalid` is the same class
|
| 109 |
+
import run as R # noqa: E402
|
| 110 |
+
import check as family # noqa: E402
|
| 111 |
+
|
| 112 |
+
inst = json.load(open(sys.argv[1]))
|
| 113 |
+
try:
|
| 114 |
+
ans = json.load(open(sys.argv[2]))
|
| 115 |
+
except Exception as e:
|
| 116 |
+
reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
|
| 117 |
+
else:
|
| 118 |
+
reward, det = R.grade(inst, ans, family.check)
|
| 119 |
+
det["reward"] = reward
|
| 120 |
+
if os.path.isdir("/logs/verifier"):
|
| 121 |
+
with open("/logs/verifier/details.json", "w") as f:
|
| 122 |
+
json.dump(det, f)
|
| 123 |
+
print(reward)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
tasks/construct-ae-p38-factorial-factors-l6-s2/tests/test.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
if [ ! -s /workdir/answer.json ]; then
|
| 4 |
+
echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
|
| 5 |
+
echo 0 > /logs/verifier/reward.txt
|
| 6 |
+
exit 0
|
| 7 |
+
fi
|
| 8 |
+
timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
|
| 9 |
+
> /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
|
tasks/construct-ae-p52-erdos-squarefree-l1-s4/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|
tasks/construct-ae-p52-erdos-squarefree-l1-s4/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 54, "t": 2, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l1-s4/solution/solve.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# oracle: a known valid construction (planted witness or published solution)
|
| 3 |
+
cat > /workdir/answer.json <<'RLMATH_EOF'
|
| 4 |
+
{"A": [7, 32]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/check.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Erdos squarefree problem (AlphaEvolve problem 52): A in [1, N], |A| >= t, ab+1 NOT squarefree for all a, b in A
|
| 2 |
+
(a = b included). The repo's problem page says "square-free"; the notebook and the Erdos problem ask for
|
| 3 |
+
"never squarefree", which is what we check. Exact: for every pair we find a prime p with p^2 | ab+1."""
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
from run import Invalid, int_list
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def _primes(n):
|
| 10 |
+
s = np.ones(n + 1, dtype=bool)
|
| 11 |
+
s[:2] = False
|
| 12 |
+
for i in range(2, int(n ** .5) + 1):
|
| 13 |
+
if s[i]:
|
| 14 |
+
s[i * i::i] = False
|
| 15 |
+
return np.nonzero(s)[0]
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def check(inst, ans):
|
| 19 |
+
n, t = inst["N"], inst["t"]
|
| 20 |
+
a = ans.get("A")
|
| 21 |
+
if not isinstance(a, list) or not (t <= len(a) <= 2 * t + 20):
|
| 22 |
+
raise Invalid(f"A must be a list of {t}..{2 * t + 20} integers")
|
| 23 |
+
int_list(a, None, 1, n, "A")
|
| 24 |
+
if len(set(a)) != len(a):
|
| 25 |
+
raise Invalid("A must consist of distinct integers")
|
| 26 |
+
x = np.array(sorted(a), dtype=np.int64)
|
| 27 |
+
iu, ju = np.triu_indices(len(x))
|
| 28 |
+
va, vb = x[iu], x[ju]
|
| 29 |
+
left = np.ones(len(iu), dtype=bool) # pairs without a square divisor found yet
|
| 30 |
+
for p in _primes(int((n * n + 1) ** .5) + 1):
|
| 31 |
+
q = int(p) * int(p)
|
| 32 |
+
idx = np.nonzero(left)[0]
|
| 33 |
+
hit = ((va[idx] % q) * (vb[idx] % q) + 1) % q == 0
|
| 34 |
+
left[idx[hit]] = False
|
| 35 |
+
if not left.any():
|
| 36 |
+
return None, {"size": len(a)}
|
| 37 |
+
k = int(np.nonzero(left)[0][0])
|
| 38 |
+
raise Invalid(f"{int(va[k])}*{int(vb[k])}+1 = {int(va[k]) * int(vb[k]) + 1} is squarefree")
|
tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 54, "t": 2, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/run.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
|
| 2 |
+
|
| 3 |
+
Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
|
| 4 |
+
|
| 5 |
+
python3 /tests/run.py /tests/instance.json /workdir/answer.json
|
| 6 |
+
|
| 7 |
+
Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
|
| 8 |
+
|
| 9 |
+
check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
|
| 10 |
+
construct : value is ignored; a returned check means the witness is valid -> reward 1.0
|
| 11 |
+
optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
|
| 12 |
+
progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
|
| 13 |
+
clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
|
| 14 |
+
inst must carry "direction", "baseline", "best_known".
|
| 15 |
+
"""
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
VALID_FLOOR = 0.1
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Invalid(Exception):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ------------------------------------------------------------ input helpers
|
| 29 |
+
|
| 30 |
+
def int_list(v, n=None, lo=None, hi=None, name="list"):
|
| 31 |
+
if not isinstance(v, list):
|
| 32 |
+
raise Invalid(f"{name} must be a list")
|
| 33 |
+
if n is not None and len(v) != n:
|
| 34 |
+
raise Invalid(f"{name} must have length {n}, got {len(v)}")
|
| 35 |
+
for x in v:
|
| 36 |
+
if isinstance(x, bool) or not isinstance(x, int):
|
| 37 |
+
raise Invalid(f"{name} must contain integers only")
|
| 38 |
+
if (lo is not None and x < lo) or (hi is not None and x > hi):
|
| 39 |
+
raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
|
| 40 |
+
return v
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def as_int(x, name="value", lo=None, hi=None):
|
| 44 |
+
return int_list([x], 1, lo, hi, name)[0]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def num(x, name="value"):
|
| 48 |
+
if isinstance(x, bool) or not isinstance(x, (int, float)):
|
| 49 |
+
raise Invalid(f"{name} must be a number")
|
| 50 |
+
if not math.isfinite(x):
|
| 51 |
+
raise Invalid(f"{name} is not finite")
|
| 52 |
+
return float(x)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def float_matrix(v, rows=None, cols=None, name="matrix"):
|
| 56 |
+
if not isinstance(v, list) or (rows is not None and len(v) != rows):
|
| 57 |
+
raise Invalid(f"{name} must be a list of {rows} rows")
|
| 58 |
+
out = []
|
| 59 |
+
for r in v:
|
| 60 |
+
if not isinstance(r, list) or (cols is not None and len(r) != cols):
|
| 61 |
+
raise Invalid(f"each row of {name} must have {cols} numbers")
|
| 62 |
+
out.append([num(x, name) for x in r])
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def float_list(v, n=None, name="list"):
|
| 67 |
+
if not isinstance(v, list) or (n is not None and len(v) != n):
|
| 68 |
+
raise Invalid(f"{name} must be a list of length {n}")
|
| 69 |
+
return [num(x, name) for x in v]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------------------ reward
|
| 73 |
+
|
| 74 |
+
def optimize_reward(inst, s):
|
| 75 |
+
b, best = inst["baseline"], inst["best_known"]
|
| 76 |
+
if inst.get("progress_scale") == "log":
|
| 77 |
+
# for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
|
| 78 |
+
# progress is measured in log10(value + floor)
|
| 79 |
+
f = inst.get("log_floor", 1e-3)
|
| 80 |
+
b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
|
| 81 |
+
if inst["direction"] == "maximize":
|
| 82 |
+
p = (s - b) / (best - b)
|
| 83 |
+
else:
|
| 84 |
+
p = (b - s) / (b - best)
|
| 85 |
+
return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def grade(inst, ans, check):
|
| 89 |
+
try:
|
| 90 |
+
if not isinstance(ans, dict):
|
| 91 |
+
raise Invalid("answer must be a JSON object")
|
| 92 |
+
value, extra = check(inst, ans)
|
| 93 |
+
if inst.get("subset") == "optimize":
|
| 94 |
+
s = float(value)
|
| 95 |
+
if not math.isfinite(s):
|
| 96 |
+
raise Invalid("non-finite score")
|
| 97 |
+
return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
|
| 98 |
+
return 1.0, {"valid": True, **(extra or {})}
|
| 99 |
+
except Invalid as e:
|
| 100 |
+
return 0.0, {"valid": False, "error": str(e)}
|
| 101 |
+
except Exception as e: # any malformed answer
|
| 102 |
+
return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def main():
|
| 106 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 107 |
+
sys.path.insert(0, here)
|
| 108 |
+
# import ourselves as `run` so check.py's `from run import Invalid` is the same class
|
| 109 |
+
import run as R # noqa: E402
|
| 110 |
+
import check as family # noqa: E402
|
| 111 |
+
|
| 112 |
+
inst = json.load(open(sys.argv[1]))
|
| 113 |
+
try:
|
| 114 |
+
ans = json.load(open(sys.argv[2]))
|
| 115 |
+
except Exception as e:
|
| 116 |
+
reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
|
| 117 |
+
else:
|
| 118 |
+
reward, det = R.grade(inst, ans, family.check)
|
| 119 |
+
det["reward"] = reward
|
| 120 |
+
if os.path.isdir("/logs/verifier"):
|
| 121 |
+
with open("/logs/verifier/details.json", "w") as f:
|
| 122 |
+
json.dump(det, f)
|
| 123 |
+
print(reward)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
tasks/construct-ae-p52-erdos-squarefree-l1-s4/tests/test.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
if [ ! -s /workdir/answer.json ]; then
|
| 4 |
+
echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
|
| 5 |
+
echo 0 > /logs/verifier/reward.txt
|
| 6 |
+
exit 0
|
| 7 |
+
fi
|
| 8 |
+
timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
|
| 9 |
+
> /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
|
tasks/construct-ae-p52-erdos-squarefree-l2-s1/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|
tasks/construct-ae-p52-erdos-squarefree-l2-s1/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 124, "t": 5, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l2-s1/solution/solve.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# oracle: a known valid construction (planted witness or published solution)
|
| 3 |
+
cat > /workdir/answer.json <<'RLMATH_EOF'
|
| 4 |
+
{"A": [7, 32, 57, 82, 107]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/check.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Erdos squarefree problem (AlphaEvolve problem 52): A in [1, N], |A| >= t, ab+1 NOT squarefree for all a, b in A
|
| 2 |
+
(a = b included). The repo's problem page says "square-free"; the notebook and the Erdos problem ask for
|
| 3 |
+
"never squarefree", which is what we check. Exact: for every pair we find a prime p with p^2 | ab+1."""
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
from run import Invalid, int_list
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def _primes(n):
|
| 10 |
+
s = np.ones(n + 1, dtype=bool)
|
| 11 |
+
s[:2] = False
|
| 12 |
+
for i in range(2, int(n ** .5) + 1):
|
| 13 |
+
if s[i]:
|
| 14 |
+
s[i * i::i] = False
|
| 15 |
+
return np.nonzero(s)[0]
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def check(inst, ans):
|
| 19 |
+
n, t = inst["N"], inst["t"]
|
| 20 |
+
a = ans.get("A")
|
| 21 |
+
if not isinstance(a, list) or not (t <= len(a) <= 2 * t + 20):
|
| 22 |
+
raise Invalid(f"A must be a list of {t}..{2 * t + 20} integers")
|
| 23 |
+
int_list(a, None, 1, n, "A")
|
| 24 |
+
if len(set(a)) != len(a):
|
| 25 |
+
raise Invalid("A must consist of distinct integers")
|
| 26 |
+
x = np.array(sorted(a), dtype=np.int64)
|
| 27 |
+
iu, ju = np.triu_indices(len(x))
|
| 28 |
+
va, vb = x[iu], x[ju]
|
| 29 |
+
left = np.ones(len(iu), dtype=bool) # pairs without a square divisor found yet
|
| 30 |
+
for p in _primes(int((n * n + 1) ** .5) + 1):
|
| 31 |
+
q = int(p) * int(p)
|
| 32 |
+
idx = np.nonzero(left)[0]
|
| 33 |
+
hit = ((va[idx] % q) * (vb[idx] % q) + 1) % q == 0
|
| 34 |
+
left[idx[hit]] = False
|
| 35 |
+
if not left.any():
|
| 36 |
+
return None, {"size": len(a)}
|
| 37 |
+
k = int(np.nonzero(left)[0][0])
|
| 38 |
+
raise Invalid(f"{int(va[k])}*{int(vb[k])}+1 = {int(va[k]) * int(vb[k]) + 1} is squarefree")
|
tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 124, "t": 5, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/run.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
|
| 2 |
+
|
| 3 |
+
Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
|
| 4 |
+
|
| 5 |
+
python3 /tests/run.py /tests/instance.json /workdir/answer.json
|
| 6 |
+
|
| 7 |
+
Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
|
| 8 |
+
|
| 9 |
+
check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
|
| 10 |
+
construct : value is ignored; a returned check means the witness is valid -> reward 1.0
|
| 11 |
+
optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
|
| 12 |
+
progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
|
| 13 |
+
clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
|
| 14 |
+
inst must carry "direction", "baseline", "best_known".
|
| 15 |
+
"""
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
VALID_FLOOR = 0.1
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Invalid(Exception):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ------------------------------------------------------------ input helpers
|
| 29 |
+
|
| 30 |
+
def int_list(v, n=None, lo=None, hi=None, name="list"):
|
| 31 |
+
if not isinstance(v, list):
|
| 32 |
+
raise Invalid(f"{name} must be a list")
|
| 33 |
+
if n is not None and len(v) != n:
|
| 34 |
+
raise Invalid(f"{name} must have length {n}, got {len(v)}")
|
| 35 |
+
for x in v:
|
| 36 |
+
if isinstance(x, bool) or not isinstance(x, int):
|
| 37 |
+
raise Invalid(f"{name} must contain integers only")
|
| 38 |
+
if (lo is not None and x < lo) or (hi is not None and x > hi):
|
| 39 |
+
raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
|
| 40 |
+
return v
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def as_int(x, name="value", lo=None, hi=None):
|
| 44 |
+
return int_list([x], 1, lo, hi, name)[0]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def num(x, name="value"):
|
| 48 |
+
if isinstance(x, bool) or not isinstance(x, (int, float)):
|
| 49 |
+
raise Invalid(f"{name} must be a number")
|
| 50 |
+
if not math.isfinite(x):
|
| 51 |
+
raise Invalid(f"{name} is not finite")
|
| 52 |
+
return float(x)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def float_matrix(v, rows=None, cols=None, name="matrix"):
|
| 56 |
+
if not isinstance(v, list) or (rows is not None and len(v) != rows):
|
| 57 |
+
raise Invalid(f"{name} must be a list of {rows} rows")
|
| 58 |
+
out = []
|
| 59 |
+
for r in v:
|
| 60 |
+
if not isinstance(r, list) or (cols is not None and len(r) != cols):
|
| 61 |
+
raise Invalid(f"each row of {name} must have {cols} numbers")
|
| 62 |
+
out.append([num(x, name) for x in r])
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def float_list(v, n=None, name="list"):
|
| 67 |
+
if not isinstance(v, list) or (n is not None and len(v) != n):
|
| 68 |
+
raise Invalid(f"{name} must be a list of length {n}")
|
| 69 |
+
return [num(x, name) for x in v]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------------------ reward
|
| 73 |
+
|
| 74 |
+
def optimize_reward(inst, s):
|
| 75 |
+
b, best = inst["baseline"], inst["best_known"]
|
| 76 |
+
if inst.get("progress_scale") == "log":
|
| 77 |
+
# for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
|
| 78 |
+
# progress is measured in log10(value + floor)
|
| 79 |
+
f = inst.get("log_floor", 1e-3)
|
| 80 |
+
b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
|
| 81 |
+
if inst["direction"] == "maximize":
|
| 82 |
+
p = (s - b) / (best - b)
|
| 83 |
+
else:
|
| 84 |
+
p = (b - s) / (b - best)
|
| 85 |
+
return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def grade(inst, ans, check):
|
| 89 |
+
try:
|
| 90 |
+
if not isinstance(ans, dict):
|
| 91 |
+
raise Invalid("answer must be a JSON object")
|
| 92 |
+
value, extra = check(inst, ans)
|
| 93 |
+
if inst.get("subset") == "optimize":
|
| 94 |
+
s = float(value)
|
| 95 |
+
if not math.isfinite(s):
|
| 96 |
+
raise Invalid("non-finite score")
|
| 97 |
+
return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
|
| 98 |
+
return 1.0, {"valid": True, **(extra or {})}
|
| 99 |
+
except Invalid as e:
|
| 100 |
+
return 0.0, {"valid": False, "error": str(e)}
|
| 101 |
+
except Exception as e: # any malformed answer
|
| 102 |
+
return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def main():
|
| 106 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 107 |
+
sys.path.insert(0, here)
|
| 108 |
+
# import ourselves as `run` so check.py's `from run import Invalid` is the same class
|
| 109 |
+
import run as R # noqa: E402
|
| 110 |
+
import check as family # noqa: E402
|
| 111 |
+
|
| 112 |
+
inst = json.load(open(sys.argv[1]))
|
| 113 |
+
try:
|
| 114 |
+
ans = json.load(open(sys.argv[2]))
|
| 115 |
+
except Exception as e:
|
| 116 |
+
reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
|
| 117 |
+
else:
|
| 118 |
+
reward, det = R.grade(inst, ans, family.check)
|
| 119 |
+
det["reward"] = reward
|
| 120 |
+
if os.path.isdir("/logs/verifier"):
|
| 121 |
+
with open("/logs/verifier/details.json", "w") as f:
|
| 122 |
+
json.dump(det, f)
|
| 123 |
+
print(reward)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
tasks/construct-ae-p52-erdos-squarefree-l2-s1/tests/test.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
if [ ! -s /workdir/answer.json ]; then
|
| 4 |
+
echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
|
| 5 |
+
echo 0 > /logs/verifier/reward.txt
|
| 6 |
+
exit 0
|
| 7 |
+
fi
|
| 8 |
+
timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
|
| 9 |
+
> /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
|
tasks/construct-ae-p52-erdos-squarefree-l2-s8/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|
tasks/construct-ae-p52-erdos-squarefree-l2-s8/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 207, "t": 9, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l2-s8/solution/solve.sh
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# oracle: a known valid construction (planted witness or published solution)
|
| 3 |
+
cat > /workdir/answer.json <<'RLMATH_EOF'
|
| 4 |
+
{"A": [7, 32, 57, 82, 107, 132, 157, 182, 207]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/check.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Erdos squarefree problem (AlphaEvolve problem 52): A in [1, N], |A| >= t, ab+1 NOT squarefree for all a, b in A
|
| 2 |
+
(a = b included). The repo's problem page says "square-free"; the notebook and the Erdos problem ask for
|
| 3 |
+
"never squarefree", which is what we check. Exact: for every pair we find a prime p with p^2 | ab+1."""
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
from run import Invalid, int_list
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def _primes(n):
|
| 10 |
+
s = np.ones(n + 1, dtype=bool)
|
| 11 |
+
s[:2] = False
|
| 12 |
+
for i in range(2, int(n ** .5) + 1):
|
| 13 |
+
if s[i]:
|
| 14 |
+
s[i * i::i] = False
|
| 15 |
+
return np.nonzero(s)[0]
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def check(inst, ans):
|
| 19 |
+
n, t = inst["N"], inst["t"]
|
| 20 |
+
a = ans.get("A")
|
| 21 |
+
if not isinstance(a, list) or not (t <= len(a) <= 2 * t + 20):
|
| 22 |
+
raise Invalid(f"A must be a list of {t}..{2 * t + 20} integers")
|
| 23 |
+
int_list(a, None, 1, n, "A")
|
| 24 |
+
if len(set(a)) != len(a):
|
| 25 |
+
raise Invalid("A must consist of distinct integers")
|
| 26 |
+
x = np.array(sorted(a), dtype=np.int64)
|
| 27 |
+
iu, ju = np.triu_indices(len(x))
|
| 28 |
+
va, vb = x[iu], x[ju]
|
| 29 |
+
left = np.ones(len(iu), dtype=bool) # pairs without a square divisor found yet
|
| 30 |
+
for p in _primes(int((n * n + 1) ** .5) + 1):
|
| 31 |
+
q = int(p) * int(p)
|
| 32 |
+
idx = np.nonzero(left)[0]
|
| 33 |
+
hit = ((va[idx] % q) * (vb[idx] % q) + 1) % q == 0
|
| 34 |
+
left[idx[hit]] = False
|
| 35 |
+
if not left.any():
|
| 36 |
+
return None, {"size": len(a)}
|
| 37 |
+
k = int(np.nonzero(left)[0][0])
|
| 38 |
+
raise Invalid(f"{int(va[k])}*{int(vb[k])}+1 = {int(va[k]) * int(vb[k]) + 1} is squarefree")
|
tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 207, "t": 9, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/run.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""rlmath runtime grader. Copied into every task as /tests/run.py next to /tests/check.py.
|
| 2 |
+
|
| 3 |
+
Deterministic; no LLM in the reward path. Runs with python3 + numpy/scipy/sympy/networkx only.
|
| 4 |
+
|
| 5 |
+
python3 /tests/run.py /tests/instance.json /workdir/answer.json
|
| 6 |
+
|
| 7 |
+
Prints the reward in [0, 1] and writes /logs/verifier/details.json when that directory exists.
|
| 8 |
+
|
| 9 |
+
check.py must define check(inst, ans) -> (value, extra_dict) and raise Invalid for a bad answer.
|
| 10 |
+
construct : value is ignored; a returned check means the witness is valid -> reward 1.0
|
| 11 |
+
optimize : value is the raw objective; reward = 0.1 + 0.9 * progress, where
|
| 12 |
+
progress = clip((s - baseline) / (best_known - baseline), 0, 1) (maximize)
|
| 13 |
+
clip((baseline - s) / (baseline - best_known), 0, 1) (minimize)
|
| 14 |
+
inst must carry "direction", "baseline", "best_known".
|
| 15 |
+
"""
|
| 16 |
+
import json
|
| 17 |
+
import math
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
VALID_FLOOR = 0.1
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Invalid(Exception):
|
| 25 |
+
pass
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
# ------------------------------------------------------------ input helpers
|
| 29 |
+
|
| 30 |
+
def int_list(v, n=None, lo=None, hi=None, name="list"):
|
| 31 |
+
if not isinstance(v, list):
|
| 32 |
+
raise Invalid(f"{name} must be a list")
|
| 33 |
+
if n is not None and len(v) != n:
|
| 34 |
+
raise Invalid(f"{name} must have length {n}, got {len(v)}")
|
| 35 |
+
for x in v:
|
| 36 |
+
if isinstance(x, bool) or not isinstance(x, int):
|
| 37 |
+
raise Invalid(f"{name} must contain integers only")
|
| 38 |
+
if (lo is not None and x < lo) or (hi is not None and x > hi):
|
| 39 |
+
raise Invalid(f"{name} entry {x} out of range [{lo}, {hi}]")
|
| 40 |
+
return v
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def as_int(x, name="value", lo=None, hi=None):
|
| 44 |
+
return int_list([x], 1, lo, hi, name)[0]
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def num(x, name="value"):
|
| 48 |
+
if isinstance(x, bool) or not isinstance(x, (int, float)):
|
| 49 |
+
raise Invalid(f"{name} must be a number")
|
| 50 |
+
if not math.isfinite(x):
|
| 51 |
+
raise Invalid(f"{name} is not finite")
|
| 52 |
+
return float(x)
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def float_matrix(v, rows=None, cols=None, name="matrix"):
|
| 56 |
+
if not isinstance(v, list) or (rows is not None and len(v) != rows):
|
| 57 |
+
raise Invalid(f"{name} must be a list of {rows} rows")
|
| 58 |
+
out = []
|
| 59 |
+
for r in v:
|
| 60 |
+
if not isinstance(r, list) or (cols is not None and len(r) != cols):
|
| 61 |
+
raise Invalid(f"each row of {name} must have {cols} numbers")
|
| 62 |
+
out.append([num(x, name) for x in r])
|
| 63 |
+
return out
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def float_list(v, n=None, name="list"):
|
| 67 |
+
if not isinstance(v, list) or (n is not None and len(v) != n):
|
| 68 |
+
raise Invalid(f"{name} must be a list of length {n}")
|
| 69 |
+
return [num(x, name) for x in v]
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# ------------------------------------------------------------------ reward
|
| 73 |
+
|
| 74 |
+
def optimize_reward(inst, s):
|
| 75 |
+
b, best = inst["baseline"], inst["best_known"]
|
| 76 |
+
if inst.get("progress_scale") == "log":
|
| 77 |
+
# for non-negative losses spanning orders of magnitude (e.g. overlap loss -> 0);
|
| 78 |
+
# progress is measured in log10(value + floor)
|
| 79 |
+
f = inst.get("log_floor", 1e-3)
|
| 80 |
+
b, best, s = (math.log10(max(x, 0.0) + f) for x in (b, best, s))
|
| 81 |
+
if inst["direction"] == "maximize":
|
| 82 |
+
p = (s - b) / (best - b)
|
| 83 |
+
else:
|
| 84 |
+
p = (b - s) / (b - best)
|
| 85 |
+
return VALID_FLOOR + (1 - VALID_FLOOR) * max(0.0, min(1.0, p))
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def grade(inst, ans, check):
|
| 89 |
+
try:
|
| 90 |
+
if not isinstance(ans, dict):
|
| 91 |
+
raise Invalid("answer must be a JSON object")
|
| 92 |
+
value, extra = check(inst, ans)
|
| 93 |
+
if inst.get("subset") == "optimize":
|
| 94 |
+
s = float(value)
|
| 95 |
+
if not math.isfinite(s):
|
| 96 |
+
raise Invalid("non-finite score")
|
| 97 |
+
return optimize_reward(inst, s), {"valid": True, "raw_score": s, **(extra or {})}
|
| 98 |
+
return 1.0, {"valid": True, **(extra or {})}
|
| 99 |
+
except Invalid as e:
|
| 100 |
+
return 0.0, {"valid": False, "error": str(e)}
|
| 101 |
+
except Exception as e: # any malformed answer
|
| 102 |
+
return 0.0, {"valid": False, "error": f"{type(e).__name__}: {e}"}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def main():
|
| 106 |
+
here = os.path.dirname(os.path.abspath(__file__))
|
| 107 |
+
sys.path.insert(0, here)
|
| 108 |
+
# import ourselves as `run` so check.py's `from run import Invalid` is the same class
|
| 109 |
+
import run as R # noqa: E402
|
| 110 |
+
import check as family # noqa: E402
|
| 111 |
+
|
| 112 |
+
inst = json.load(open(sys.argv[1]))
|
| 113 |
+
try:
|
| 114 |
+
ans = json.load(open(sys.argv[2]))
|
| 115 |
+
except Exception as e:
|
| 116 |
+
reward, det = 0.0, {"valid": False, "error": f"unreadable answer: {e}"}
|
| 117 |
+
else:
|
| 118 |
+
reward, det = R.grade(inst, ans, family.check)
|
| 119 |
+
det["reward"] = reward
|
| 120 |
+
if os.path.isdir("/logs/verifier"):
|
| 121 |
+
with open("/logs/verifier/details.json", "w") as f:
|
| 122 |
+
json.dump(det, f)
|
| 123 |
+
print(reward)
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
if __name__ == "__main__":
|
| 127 |
+
main()
|
tasks/construct-ae-p52-erdos-squarefree-l2-s8/tests/test.sh
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
mkdir -p /logs/verifier
|
| 3 |
+
if [ ! -s /workdir/answer.json ]; then
|
| 4 |
+
echo '{"valid": false, "error": "no /workdir/answer.json"}' > /logs/verifier/details.json
|
| 5 |
+
echo 0 > /logs/verifier/reward.txt
|
| 6 |
+
exit 0
|
| 7 |
+
fi
|
| 8 |
+
timeout 290 python3 /tests/run.py /tests/instance.json /workdir/answer.json \
|
| 9 |
+
> /logs/verifier/reward.txt 2> /logs/verifier/grader.log || echo 0 > /logs/verifier/reward.txt
|
tasks/construct-ae-p65-imo2025-p6-tiling-l1-s0/environment/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.16-slim
|
| 2 |
+
RUN apt-get update && apt-get install -y --no-install-recommends tmux curl git procps build-essential \
|
| 3 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 4 |
+
RUN pip install --no-cache-dir numpy==2.4.6 scipy==1.17.1 sympy==1.14.0 networkx==3.6.1 \
|
| 5 |
+
python-sat==1.9.dev15 z3-solver==5.1.0.0 PuLP==3.3.2 ortools==9.15.6755
|
| 6 |
+
WORKDIR /workdir
|
| 7 |
+
COPY instance.json /workdir/instance.json
|