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-l5-s3/environment/Dockerfile +7 -0
- tasks/construct-ae-p38-factorial-factors-l5-s3/environment/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l5-s3/solution/solve.sh +5 -0
- tasks/construct-ae-p38-factorial-factors-l5-s3/tests/check.py +12 -0
- tasks/construct-ae-p38-factorial-factors-l5-s3/tests/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l5-s3/tests/run.py +127 -0
- tasks/construct-ae-p38-factorial-factors-l5-s3/tests/test.sh +9 -0
- tasks/construct-ae-p38-factorial-factors-l5-s4/environment/Dockerfile +7 -0
- tasks/construct-ae-p38-factorial-factors-l5-s4/environment/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l5-s4/solution/solve.sh +5 -0
- tasks/construct-ae-p38-factorial-factors-l5-s4/tests/check.py +12 -0
- tasks/construct-ae-p38-factorial-factors-l5-s4/tests/instance.json +1 -0
- tasks/construct-ae-p38-factorial-factors-l5-s4/tests/run.py +127 -0
- tasks/construct-ae-p38-factorial-factors-l5-s4/tests/test.sh +9 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s0/environment/Dockerfile +7 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s0/environment/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s0/solution/solve.sh +5 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s0/tests/check.py +38 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s0/tests/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s0/tests/run.py +127 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s0/tests/test.sh +9 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s7/environment/Dockerfile +7 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s7/environment/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s7/solution/solve.sh +5 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s7/tests/check.py +38 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s7/tests/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s7/tests/run.py +127 -0
- tasks/construct-ae-p52-erdos-squarefree-l1-s7/tests/test.sh +9 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s6/environment/Dockerfile +7 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s6/environment/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s6/solution/solve.sh +5 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s6/tests/check.py +38 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s6/tests/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s6/tests/run.py +127 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s6/tests/test.sh +9 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s8/environment/Dockerfile +7 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s8/environment/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s8/solution/solve.sh +5 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s8/tests/check.py +38 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s8/tests/instance.json +1 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s8/tests/run.py +127 -0
- tasks/construct-ae-p52-erdos-squarefree-l5-s8/tests/test.sh +9 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/environment/Dockerfile +7 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/environment/instance.json +1 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/solution/solve.sh +5 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/tests/check.py +24 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/tests/instance.json +1 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/tests/run.py +127 -0
- tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/tests/test.sh +9 -0
- tasks/construct-mc-all-interval-l1-s2/environment/Dockerfile +7 -0
tasks/construct-ae-p38-factorial-factors-l5-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-l5-s3/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 1893, "t": 599, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l5-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": [1797, 599, 599, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 601, 601, 601, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 603, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 604, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 606, 607, 607, 607, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 610, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 611, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 612, 613, 613, 613, 614, 614, 614, 614, 614, 614, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 615, 617, 617, 617, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 618, 619, 619, 619, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 620, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 621, 622, 622, 622, 622, 622, 622, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 625, 626, 626, 626, 626, 626, 626, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 628, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, 631, 631, 631, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 633, 633, 633, 633, 633, 633, 633, 633, 634, 634, 634, 634, 634, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 635, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 637, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, 641, 641, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, 643, 643, 644, 644, 644, 644, 644, 644, 644, 644, 644, 644, 644, 644, 647, 647, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 649, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 652, 653, 653, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 654, 655, 655, 655, 655, 655, 655, 655, 655, 655, 655, 655, 655, 655, 655, 656, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 659, 659, 661, 661, 662, 662, 662, 662, 662, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 664, 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, 668, 669, 669, 669, 669, 669, 669, 669, 669, 673, 673, 674, 674, 674, 674, 674, 677, 677, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 681, 681, 681, 681, 681, 681, 681, 681, 683, 683, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 685, 687, 687, 687, 687, 687, 687, 687, 687, 691, 691, 692, 692, 692, 692, 692, 692, 692, 692, 692, 692, 694, 694, 694, 694, 694, 695, 695, 695, 695, 695, 695, 695, 695, 695, 695, 695, 695, 695, 698, 698, 698, 698, 698, 699, 699, 699, 699, 699, 699, 699, 699, 701, 701, 706, 706, 706, 706, 706, 709, 709, 716, 716, 716, 716, 716, 716, 716, 716, 716, 716, 717, 717, 717, 717, 717, 717, 717, 718, 718, 718, 718, 718, 719, 719, 723, 723, 723, 723, 723, 723, 723, 724, 724, 724, 724, 724, 724, 724, 724, 724, 724, 727, 727, 733, 733, 734, 734, 734, 734, 734, 739, 739, 743, 743, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 746, 746, 746, 746, 746, 749, 751, 751, 753, 753, 753, 753, 753, 753, 753, 757, 757, 758, 758, 758, 758, 761, 761, 764, 764, 764, 764, 764, 764, 764, 764, 764, 766, 766, 766, 766, 769, 769, 771, 771, 771, 771, 771, 771, 771, 772, 772, 772, 772, 772, 772, 772, 772, 772, 773, 773, 778, 778, 778, 778, 787, 787, 788, 788, 788, 788, 788, 788, 788, 788, 788, 789, 789, 789, 789, 789, 789, 789, 794, 794, 794, 794, 796, 796, 796, 796, 796, 796, 796, 796, 796, 797, 797, 802, 802, 802, 802, 807, 807, 807, 807, 807, 807, 807, 809, 809, 811, 811, 813, 813, 813, 813, 813, 813, 818, 818, 818, 818, 821, 821, 823, 823, 827, 827, 829, 829, 831, 831, 831, 831, 831, 831, 838, 838, 838, 838, 839, 839, 842, 842, 842, 842, 843, 843, 843, 843, 843, 843, 849, 849, 849, 849, 849, 849, 853, 853, 857, 857, 859, 859, 862, 862, 862, 862, 863, 863, 866, 866, 866, 866, 877, 877, 878, 878, 878, 878, 879, 879, 879, 879, 879, 879, 881, 881, 883, 883, 886, 886, 886, 886, 887, 887, 898, 898, 898, 898, 907, 907, 911, 911, 914, 914, 914, 914, 919, 919, 922, 922, 922, 922, 926, 926, 926, 926, 929, 929, 934, 934, 934, 934, 937, 937, 941, 941, 947, 953, 958, 958, 958, 967, 971, 974, 974, 974, 977, 982, 982, 982, 983, 991, 997, 998, 998, 998, 1006, 1006, 1006, 1009, 1013, 1018, 1018, 1018, 1019, 1021, 1031, 1033, 1039, 1042, 1042, 1042, 1046, 1046, 1046, 1049, 1051, 1061, 1063, 1069, 1082, 1082, 1082, 1087, 1091, 1093, 1094, 1094, 1094, 1097, 1103, 1109, 1114, 1114, 1114, 1117, 1123, 1126, 1126, 1126, 1129, 1138, 1138, 1138, 1142, 1142, 1142, 1151, 1153, 1154, 1154, 1154, 1163, 1171, 1174, 1174, 1174, 1181, 1186, 1186, 1186, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p38-factorial-factors-l5-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-l5-s3/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 1893, "t": 599, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l5-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-l5-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-l5-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-l5-s4/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 2295, "t": 732, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l5-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": [1464, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 732, 733, 733, 733, 734, 734, 734, 734, 734, 734, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 735, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 736, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 737, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, 739, 739, 739, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 741, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, 743, 743, 743, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 745, 746, 746, 746, 746, 746, 746, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 747, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 749, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 751, 751, 751, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 752, 753, 753, 753, 753, 753, 753, 753, 753, 753, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, 757, 757, 757, 758, 758, 758, 758, 758, 758, 759, 759, 759, 759, 759, 759, 761, 761, 761, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 762, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 763, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 764, 766, 766, 766, 766, 766, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 767, 769, 769, 771, 771, 771, 771, 771, 771, 771, 771, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 773, 773, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 776, 778, 778, 778, 778, 778, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 781, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 783, 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 785, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 786, 787, 787, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 788, 789, 789, 789, 789, 789, 789, 789, 789, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 790, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 791, 794, 794, 794, 794, 794, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 796, 797, 797, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 799, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 801, 802, 802, 802, 802, 802, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 803, 807, 807, 807, 807, 807, 807, 807, 807, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, 809, 809, 811, 811, 813, 813, 813, 813, 813, 813, 813, 813, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 818, 818, 818, 818, 818, 821, 821, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 823, 823, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 824, 827, 827, 829, 829, 831, 831, 831, 831, 831, 831, 831, 831, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 834, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 838, 838, 838, 838, 838, 839, 839, 841, 842, 842, 842, 842, 842, 843, 843, 843, 843, 843, 843, 843, 843, 844, 844, 844, 844, 844, 844, 844, 844, 844, 844, 849, 849, 849, 849, 849, 849, 849, 849, 853, 853, 857, 857, 859, 859, 862, 862, 862, 862, 862, 863, 863, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 865, 866, 866, 866, 866, 866, 877, 877, 878, 878, 878, 878, 878, 879, 879, 879, 879, 879, 879, 879, 881, 881, 883, 883, 886, 886, 886, 886, 886, 887, 887, 892, 892, 892, 892, 892, 892, 892, 892, 892, 892, 895, 895, 895, 895, 895, 895, 895, 895, 895, 895, 895, 895, 898, 898, 898, 898, 898, 905, 905, 905, 905, 905, 905, 905, 905, 905, 905, 905, 905, 907, 907, 908, 908, 908, 908, 908, 908, 908, 908, 908, 908, 911, 911, 914, 914, 914, 914, 914, 916, 916, 916, 916, 916, 916, 916, 916, 916, 916, 919, 919, 921, 921, 921, 921, 921, 921, 921, 922, 922, 922, 922, 926, 926, 926, 926, 929, 929, 932, 932, 932, 932, 932, 932, 932, 932, 932, 933, 933, 933, 933, 933, 933, 933, 934, 934, 934, 934, 937, 937, 939, 939, 939, 939, 939, 939, 939, 941, 941, 947, 947, 951, 951, 951, 951, 951, 951, 951, 953, 953, 956, 956, 956, 956, 956, 956, 956, 956, 956, 958, 958, 958, 958, 964, 964, 964, 964, 964, 964, 964, 964, 964, 967, 967, 971, 971, 974, 974, 974, 974, 977, 977, 982, 982, 982, 982, 983, 983, 991, 991, 993, 993, 993, 993, 993, 993, 997, 997, 998, 998, 998, 998, 1006, 1006, 1006, 1006, 1009, 1009, 1011, 1011, 1011, 1011, 1011, 1011, 1013, 1013, 1018, 1018, 1018, 1018, 1019, 1019, 1021, 1021, 1031, 1031, 1033, 1033, 1039, 1039, 1041, 1041, 1041, 1041, 1041, 1041, 1042, 1042, 1042, 1042, 1046, 1046, 1046, 1046, 1047, 1047, 1047, 1047, 1047, 1047, 1049, 1049, 1051, 1051, 1059, 1059, 1059, 1059, 1059, 1059, 1061, 1061, 1063, 1063, 1069, 1069, 1077, 1077, 1077, 1077, 1077, 1077, 1082, 1082, 1082, 1082, 1087, 1087, 1091, 1091, 1093, 1093, 1094, 1094, 1094, 1094, 1097, 1097, 1103, 1103, 1109, 1109, 1114, 1114, 1114, 1114, 1117, 1117, 1123, 1123, 1126, 1126, 1126, 1126, 1129, 1129, 1138, 1138, 1138, 1138, 1142, 1142, 1142, 1142, 1151, 1153, 1154, 1154, 1154, 1163, 1171, 1174, 1174, 1174, 1181, 1186, 1186, 1186, 1187, 1193, 1198, 1198, 1198, 1201, 1202, 1202, 1202, 1213, 1214, 1214, 1214, 1217, 1223, 1226, 1226, 1226, 1229, 1231, 1234, 1234, 1234, 1237, 1238, 1238, 1238, 1249, 1259, 1262, 1262, 1262, 1277, 1279, 1282, 1282, 1282, 1283, 1286, 1286, 1286, 1289, 1291, 1294, 1294, 1294, 1297, 1301, 1303, 1306, 1306, 1306, 1307, 1318, 1318, 1318, 1319, 1321, 1322, 1322, 1322, 1327, 1346, 1346, 1346, 1354, 1354, 1354, 1361, 1366, 1366, 1366, 1367, 1373, 1381, 1382, 1382, 1382, 1399, 1402, 1402, 1402, 1409, 1418, 1418, 1418, 1423, 1427, 1429, 1433, 1438, 1438, 1438, 1439, 1447, 1451, 1453, 1454, 1454, 1454, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 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]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p38-factorial-factors-l5-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-l5-s4/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 2295, "t": 732, "family": "ae_p38_factorial_factors", "subset": "construct"}
|
tasks/construct-ae-p38-factorial-factors-l5-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-l5-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-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
|
tasks/construct-ae-p52-erdos-squarefree-l1-s0/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 71, "t": 3, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l1-s0/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]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p52-erdos-squarefree-l1-s0/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-s0/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 71, "t": 3, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l1-s0/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-s0/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-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-p52-erdos-squarefree-l1-s7/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 40, "t": 2, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l1-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 |
+
{"A": [7, 32]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p52-erdos-squarefree-l1-s7/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-s7/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 40, "t": 2, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l1-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-p52-erdos-squarefree-l1-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-p52-erdos-squarefree-l5-s6/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-l5-s6/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 4172, "t": 167, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l5-s6/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, 232, 257, 282, 307, 332, 357, 382, 407, 432, 457, 482, 507, 532, 557, 582, 607, 632, 657, 682, 707, 732, 757, 782, 807, 832, 857, 882, 907, 932, 957, 982, 1007, 1032, 1057, 1082, 1107, 1132, 1157, 1182, 1207, 1232, 1257, 1282, 1307, 1332, 1357, 1382, 1407, 1432, 1457, 1482, 1507, 1532, 1557, 1582, 1607, 1632, 1657, 1682, 1707, 1732, 1757, 1782, 1807, 1832, 1857, 1882, 1907, 1932, 1957, 1982, 2007, 2032, 2057, 2082, 2107, 2132, 2157, 2182, 2207, 2232, 2257, 2282, 2307, 2332, 2357, 2382, 2407, 2432, 2457, 2482, 2507, 2532, 2557, 2582, 2607, 2632, 2657, 2682, 2707, 2732, 2757, 2782, 2807, 2832, 2857, 2882, 2907, 2932, 2957, 2982, 3007, 3032, 3057, 3082, 3107, 3132, 3157, 3182, 3207, 3232, 3257, 3282, 3307, 3332, 3357, 3382, 3407, 3432, 3457, 3482, 3507, 3532, 3557, 3582, 3607, 3632, 3657, 3682, 3707, 3732, 3757, 3782, 3807, 3832, 3857, 3882, 3907, 3932, 3957, 3982, 4007, 4032, 4057, 4082, 4107, 4132, 4157]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p52-erdos-squarefree-l5-s6/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-l5-s6/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 4172, "t": 167, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l5-s6/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-l5-s6/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-l5-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-l5-s8/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 5020, "t": 201, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l5-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, 232, 257, 282, 307, 332, 357, 382, 407, 432, 457, 482, 507, 532, 557, 582, 607, 632, 657, 682, 707, 732, 757, 782, 807, 832, 857, 882, 907, 932, 957, 982, 1007, 1032, 1057, 1082, 1107, 1132, 1157, 1182, 1207, 1232, 1257, 1282, 1307, 1332, 1357, 1382, 1407, 1432, 1457, 1482, 1507, 1532, 1557, 1582, 1607, 1632, 1657, 1682, 1707, 1732, 1757, 1782, 1807, 1832, 1857, 1882, 1907, 1932, 1957, 1982, 2007, 2032, 2057, 2082, 2107, 2132, 2157, 2182, 2207, 2232, 2257, 2282, 2307, 2332, 2357, 2382, 2407, 2432, 2457, 2482, 2507, 2532, 2557, 2582, 2607, 2632, 2657, 2682, 2707, 2732, 2757, 2782, 2807, 2832, 2857, 2882, 2907, 2932, 2957, 2982, 3007, 3032, 3057, 3082, 3107, 3132, 3157, 3182, 3207, 3232, 3257, 3282, 3307, 3332, 3357, 3382, 3407, 3432, 3457, 3482, 3507, 3532, 3557, 3582, 3607, 3632, 3657, 3682, 3707, 3732, 3757, 3782, 3807, 3832, 3857, 3882, 3907, 3932, 3957, 3982, 4007, 4032, 4057, 4082, 4107, 4132, 4157, 4182, 4207, 4232, 4257, 4282, 4307, 4332, 4357, 4382, 4407, 4432, 4457, 4482, 4507, 4532, 4557, 4582, 4607, 4632, 4657, 4682, 4707, 4732, 4757, 4782, 4807, 4832, 4857, 4882, 4907, 4932, 4957, 4982, 5007]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p52-erdos-squarefree-l5-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-l5-s8/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"N": 5020, "t": 201, "family": "ae_p52_erdos_squarefree", "subset": "construct"}
|
tasks/construct-ae-p52-erdos-squarefree-l5-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-l5-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-l6-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
|
tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/environment/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"n": 2025, "max_tiles": 2112, "family": "ae_p65_imo2025_p6_tiling", "subset": "construct"}
|
tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/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 |
+
{"tiles": [[0, 0, 45, 44], [0, 45, 1, 1980], [1, 44, 45, 45], [1, 90, 1, 1935], [2, 89, 45, 45], [2, 135, 1, 1890], [3, 134, 45, 45], [3, 180, 1, 1845], [4, 179, 45, 45], [4, 225, 1, 1800], [5, 224, 45, 45], [5, 270, 1, 1755], [6, 269, 45, 45], [6, 315, 1, 1710], [7, 314, 45, 45], [7, 360, 1, 1665], [8, 359, 45, 45], [8, 405, 1, 1620], [9, 404, 45, 45], [9, 450, 1, 1575], [10, 449, 45, 45], [10, 495, 1, 1530], [11, 494, 45, 45], [11, 540, 1, 1485], [12, 539, 45, 45], [12, 585, 1, 1440], [13, 584, 45, 45], [13, 630, 1, 1395], [14, 629, 45, 45], [14, 675, 1, 1350], [15, 674, 45, 45], [15, 720, 1, 1305], [16, 719, 45, 45], [16, 765, 1, 1260], [17, 764, 45, 45], [17, 810, 1, 1215], [18, 809, 45, 45], [18, 855, 1, 1170], [19, 854, 45, 45], [19, 900, 1, 1125], [20, 899, 45, 45], [20, 945, 1, 1080], [21, 944, 45, 45], [21, 990, 1, 1035], [22, 989, 45, 45], [22, 1035, 1, 990], [23, 1034, 45, 45], [23, 1080, 1, 945], [24, 1079, 45, 45], [24, 1125, 1, 900], [25, 1124, 45, 45], [25, 1170, 1, 855], [26, 1169, 45, 45], [26, 1215, 1, 810], [27, 1214, 45, 45], [27, 1260, 1, 765], [28, 1259, 45, 45], [28, 1305, 1, 720], [29, 1304, 45, 45], [29, 1350, 1, 675], [30, 1349, 45, 45], [30, 1395, 1, 630], [31, 1394, 45, 45], [31, 1440, 1, 585], [32, 1439, 45, 45], [32, 1485, 1, 540], [33, 1484, 45, 45], [33, 1530, 1, 495], [34, 1529, 45, 45], [34, 1575, 1, 450], [35, 1574, 45, 45], [35, 1620, 1, 405], [36, 1619, 45, 45], [36, 1665, 1, 360], [37, 1664, 45, 45], [37, 1710, 1, 315], [38, 1709, 45, 45], [38, 1755, 1, 270], [39, 1754, 45, 45], [39, 1800, 1, 225], [40, 1799, 45, 45], [40, 1845, 1, 180], [41, 1844, 45, 45], [41, 1890, 1, 135], [42, 1889, 45, 45], [42, 1935, 1, 90], [43, 1934, 45, 45], [43, 1980, 1, 45], [44, 1979, 45, 45], [45, 0, 45, 43], [45, 2024, 1980, 1], [46, 43, 45, 45], [47, 88, 45, 45], [48, 133, 45, 45], [49, 178, 45, 45], [50, 223, 45, 45], [51, 268, 45, 45], [52, 313, 45, 45], [53, 358, 45, 45], [54, 403, 45, 45], [55, 448, 45, 45], [56, 493, 45, 45], [57, 538, 45, 45], [58, 583, 45, 45], [59, 628, 45, 45], [60, 673, 45, 45], [61, 718, 45, 45], [62, 763, 45, 45], [63, 808, 45, 45], [64, 853, 45, 45], [65, 898, 45, 45], [66, 943, 45, 45], [67, 988, 45, 45], [68, 1033, 45, 45], [69, 1078, 45, 45], [70, 1123, 45, 45], [71, 1168, 45, 45], [72, 1213, 45, 45], [73, 1258, 45, 45], [74, 1303, 45, 45], [75, 1348, 45, 45], [76, 1393, 45, 45], [77, 1438, 45, 45], [78, 1483, 45, 45], [79, 1528, 45, 45], [80, 1573, 45, 45], [81, 1618, 45, 45], [82, 1663, 45, 45], [83, 1708, 45, 45], [84, 1753, 45, 45], [85, 1798, 45, 45], [86, 1843, 45, 45], [87, 1888, 45, 45], [88, 1933, 45, 45], [89, 1978, 45, 45], [90, 0, 45, 42], [90, 2023, 1935, 1], [91, 42, 45, 45], [92, 87, 45, 45], [93, 132, 45, 45], [94, 177, 45, 45], [95, 222, 45, 45], [96, 267, 45, 45], [97, 312, 45, 45], [98, 357, 45, 45], [99, 402, 45, 45], [100, 447, 45, 45], [101, 492, 45, 45], [102, 537, 45, 45], [103, 582, 45, 45], [104, 627, 45, 45], [105, 672, 45, 45], [106, 717, 45, 45], [107, 762, 45, 45], [108, 807, 45, 45], [109, 852, 45, 45], [110, 897, 45, 45], [111, 942, 45, 45], [112, 987, 45, 45], [113, 1032, 45, 45], [114, 1077, 45, 45], [115, 1122, 45, 45], [116, 1167, 45, 45], [117, 1212, 45, 45], [118, 1257, 45, 45], [119, 1302, 45, 45], [120, 1347, 45, 45], [121, 1392, 45, 45], [122, 1437, 45, 45], [123, 1482, 45, 45], [124, 1527, 45, 45], [125, 1572, 45, 45], [126, 1617, 45, 45], [127, 1662, 45, 45], [128, 1707, 45, 45], [129, 1752, 45, 45], [130, 1797, 45, 45], [131, 1842, 45, 45], [132, 1887, 45, 45], [133, 1932, 45, 45], [134, 1977, 45, 45], [135, 0, 45, 41], [135, 2022, 1890, 1], [136, 41, 45, 45], [137, 86, 45, 45], [138, 131, 45, 45], [139, 176, 45, 45], [140, 221, 45, 45], [141, 266, 45, 45], [142, 311, 45, 45], [143, 356, 45, 45], [144, 401, 45, 45], [145, 446, 45, 45], [146, 491, 45, 45], [147, 536, 45, 45], [148, 581, 45, 45], [149, 626, 45, 45], [150, 671, 45, 45], [151, 716, 45, 45], [152, 761, 45, 45], [153, 806, 45, 45], [154, 851, 45, 45], [155, 896, 45, 45], [156, 941, 45, 45], [157, 986, 45, 45], [158, 1031, 45, 45], [159, 1076, 45, 45], [160, 1121, 45, 45], [161, 1166, 45, 45], [162, 1211, 45, 45], [163, 1256, 45, 45], [164, 1301, 45, 45], [165, 1346, 45, 45], [166, 1391, 45, 45], [167, 1436, 45, 45], [168, 1481, 45, 45], [169, 1526, 45, 45], [170, 1571, 45, 45], [171, 1616, 45, 45], [172, 1661, 45, 45], [173, 1706, 45, 45], [174, 1751, 45, 45], [175, 1796, 45, 45], [176, 1841, 45, 45], [177, 1886, 45, 45], [178, 1931, 45, 45], [179, 1976, 45, 45], [180, 0, 45, 40], [180, 2021, 1845, 1], [181, 40, 45, 45], [182, 85, 45, 45], [183, 130, 45, 45], [184, 175, 45, 45], [185, 220, 45, 45], [186, 265, 45, 45], [187, 310, 45, 45], [188, 355, 45, 45], [189, 400, 45, 45], [190, 445, 45, 45], [191, 490, 45, 45], [192, 535, 45, 45], [193, 580, 45, 45], [194, 625, 45, 45], [195, 670, 45, 45], [196, 715, 45, 45], [197, 760, 45, 45], [198, 805, 45, 45], [199, 850, 45, 45], [200, 895, 45, 45], [201, 940, 45, 45], [202, 985, 45, 45], [203, 1030, 45, 45], [204, 1075, 45, 45], [205, 1120, 45, 45], [206, 1165, 45, 45], [207, 1210, 45, 45], [208, 1255, 45, 45], [209, 1300, 45, 45], [210, 1345, 45, 45], [211, 1390, 45, 45], [212, 1435, 45, 45], [213, 1480, 45, 45], [214, 1525, 45, 45], [215, 1570, 45, 45], [216, 1615, 45, 45], [217, 1660, 45, 45], [218, 1705, 45, 45], [219, 1750, 45, 45], [220, 1795, 45, 45], [221, 1840, 45, 45], [222, 1885, 45, 45], [223, 1930, 45, 45], [224, 1975, 45, 45], [225, 0, 45, 39], [225, 2020, 1800, 1], [226, 39, 45, 45], [227, 84, 45, 45], [228, 129, 45, 45], [229, 174, 45, 45], [230, 219, 45, 45], [231, 264, 45, 45], [232, 309, 45, 45], [233, 354, 45, 45], [234, 399, 45, 45], [235, 444, 45, 45], [236, 489, 45, 45], [237, 534, 45, 45], [238, 579, 45, 45], [239, 624, 45, 45], [240, 669, 45, 45], [241, 714, 45, 45], [242, 759, 45, 45], [243, 804, 45, 45], [244, 849, 45, 45], [245, 894, 45, 45], [246, 939, 45, 45], [247, 984, 45, 45], [248, 1029, 45, 45], [249, 1074, 45, 45], [250, 1119, 45, 45], [251, 1164, 45, 45], [252, 1209, 45, 45], [253, 1254, 45, 45], [254, 1299, 45, 45], [255, 1344, 45, 45], [256, 1389, 45, 45], [257, 1434, 45, 45], [258, 1479, 45, 45], [259, 1524, 45, 45], [260, 1569, 45, 45], [261, 1614, 45, 45], [262, 1659, 45, 45], [263, 1704, 45, 45], [264, 1749, 45, 45], [265, 1794, 45, 45], [266, 1839, 45, 45], [267, 1884, 45, 45], [268, 1929, 45, 45], [269, 1974, 45, 45], [270, 0, 45, 38], [270, 2019, 1755, 1], [271, 38, 45, 45], [272, 83, 45, 45], [273, 128, 45, 45], [274, 173, 45, 45], [275, 218, 45, 45], [276, 263, 45, 45], [277, 308, 45, 45], [278, 353, 45, 45], [279, 398, 45, 45], [280, 443, 45, 45], [281, 488, 45, 45], [282, 533, 45, 45], [283, 578, 45, 45], [284, 623, 45, 45], [285, 668, 45, 45], [286, 713, 45, 45], [287, 758, 45, 45], [288, 803, 45, 45], [289, 848, 45, 45], [290, 893, 45, 45], [291, 938, 45, 45], [292, 983, 45, 45], [293, 1028, 45, 45], [294, 1073, 45, 45], [295, 1118, 45, 45], [296, 1163, 45, 45], [297, 1208, 45, 45], [298, 1253, 45, 45], [299, 1298, 45, 45], [300, 1343, 45, 45], [301, 1388, 45, 45], [302, 1433, 45, 45], [303, 1478, 45, 45], [304, 1523, 45, 45], [305, 1568, 45, 45], [306, 1613, 45, 45], [307, 1658, 45, 45], [308, 1703, 45, 45], [309, 1748, 45, 45], [310, 1793, 45, 45], [311, 1838, 45, 45], [312, 1883, 45, 45], [313, 1928, 45, 45], [314, 1973, 45, 45], [315, 0, 45, 37], [315, 2018, 1710, 1], [316, 37, 45, 45], [317, 82, 45, 45], [318, 127, 45, 45], [319, 172, 45, 45], [320, 217, 45, 45], [321, 262, 45, 45], [322, 307, 45, 45], [323, 352, 45, 45], [324, 397, 45, 45], [325, 442, 45, 45], [326, 487, 45, 45], [327, 532, 45, 45], [328, 577, 45, 45], [329, 622, 45, 45], [330, 667, 45, 45], [331, 712, 45, 45], [332, 757, 45, 45], [333, 802, 45, 45], [334, 847, 45, 45], [335, 892, 45, 45], [336, 937, 45, 45], [337, 982, 45, 45], [338, 1027, 45, 45], [339, 1072, 45, 45], [340, 1117, 45, 45], [341, 1162, 45, 45], [342, 1207, 45, 45], [343, 1252, 45, 45], [344, 1297, 45, 45], [345, 1342, 45, 45], [346, 1387, 45, 45], [347, 1432, 45, 45], [348, 1477, 45, 45], [349, 1522, 45, 45], [350, 1567, 45, 45], [351, 1612, 45, 45], [352, 1657, 45, 45], [353, 1702, 45, 45], [354, 1747, 45, 45], [355, 1792, 45, 45], [356, 1837, 45, 45], [357, 1882, 45, 45], [358, 1927, 45, 45], [359, 1972, 45, 45], [360, 0, 45, 36], [360, 2017, 1665, 1], [361, 36, 45, 45], [362, 81, 45, 45], [363, 126, 45, 45], [364, 171, 45, 45], [365, 216, 45, 45], [366, 261, 45, 45], [367, 306, 45, 45], [368, 351, 45, 45], [369, 396, 45, 45], [370, 441, 45, 45], [371, 486, 45, 45], [372, 531, 45, 45], [373, 576, 45, 45], [374, 621, 45, 45], [375, 666, 45, 45], [376, 711, 45, 45], [377, 756, 45, 45], [378, 801, 45, 45], [379, 846, 45, 45], [380, 891, 45, 45], [381, 936, 45, 45], [382, 981, 45, 45], [383, 1026, 45, 45], [384, 1071, 45, 45], [385, 1116, 45, 45], [386, 1161, 45, 45], [387, 1206, 45, 45], [388, 1251, 45, 45], [389, 1296, 45, 45], [390, 1341, 45, 45], [391, 1386, 45, 45], [392, 1431, 45, 45], [393, 1476, 45, 45], [394, 1521, 45, 45], [395, 1566, 45, 45], [396, 1611, 45, 45], [397, 1656, 45, 45], [398, 1701, 45, 45], [399, 1746, 45, 45], [400, 1791, 45, 45], [401, 1836, 45, 45], [402, 1881, 45, 45], [403, 1926, 45, 45], [404, 1971, 45, 45], [405, 0, 45, 35], [405, 2016, 1620, 1], [406, 35, 45, 45], [407, 80, 45, 45], [408, 125, 45, 45], [409, 170, 45, 45], [410, 215, 45, 45], [411, 260, 45, 45], [412, 305, 45, 45], [413, 350, 45, 45], [414, 395, 45, 45], [415, 440, 45, 45], [416, 485, 45, 45], [417, 530, 45, 45], [418, 575, 45, 45], [419, 620, 45, 45], [420, 665, 45, 45], [421, 710, 45, 45], [422, 755, 45, 45], [423, 800, 45, 45], [424, 845, 45, 45], [425, 890, 45, 45], [426, 935, 45, 45], [427, 980, 45, 45], [428, 1025, 45, 45], [429, 1070, 45, 45], [430, 1115, 45, 45], [431, 1160, 45, 45], [432, 1205, 45, 45], [433, 1250, 45, 45], [434, 1295, 45, 45], [435, 1340, 45, 45], [436, 1385, 45, 45], [437, 1430, 45, 45], [438, 1475, 45, 45], [439, 1520, 45, 45], [440, 1565, 45, 45], [441, 1610, 45, 45], [442, 1655, 45, 45], [443, 1700, 45, 45], [444, 1745, 45, 45], [445, 1790, 45, 45], [446, 1835, 45, 45], [447, 1880, 45, 45], [448, 1925, 45, 45], [449, 1970, 45, 45], [450, 0, 45, 34], [450, 2015, 1575, 1], [451, 34, 45, 45], [452, 79, 45, 45], [453, 124, 45, 45], [454, 169, 45, 45], [455, 214, 45, 45], [456, 259, 45, 45], [457, 304, 45, 45], [458, 349, 45, 45], [459, 394, 45, 45], [460, 439, 45, 45], [461, 484, 45, 45], [462, 529, 45, 45], [463, 574, 45, 45], [464, 619, 45, 45], [465, 664, 45, 45], [466, 709, 45, 45], [467, 754, 45, 45], [468, 799, 45, 45], [469, 844, 45, 45], [470, 889, 45, 45], [471, 934, 45, 45], [472, 979, 45, 45], [473, 1024, 45, 45], [474, 1069, 45, 45], [475, 1114, 45, 45], [476, 1159, 45, 45], [477, 1204, 45, 45], [478, 1249, 45, 45], [479, 1294, 45, 45], [480, 1339, 45, 45], [481, 1384, 45, 45], [482, 1429, 45, 45], [483, 1474, 45, 45], [484, 1519, 45, 45], [485, 1564, 45, 45], [486, 1609, 45, 45], [487, 1654, 45, 45], [488, 1699, 45, 45], [489, 1744, 45, 45], [490, 1789, 45, 45], [491, 1834, 45, 45], [492, 1879, 45, 45], [493, 1924, 45, 45], [494, 1969, 45, 45], [495, 0, 45, 33], [495, 2014, 1530, 1], [496, 33, 45, 45], [497, 78, 45, 45], [498, 123, 45, 45], [499, 168, 45, 45], [500, 213, 45, 45], [501, 258, 45, 45], [502, 303, 45, 45], [503, 348, 45, 45], [504, 393, 45, 45], [505, 438, 45, 45], [506, 483, 45, 45], [507, 528, 45, 45], [508, 573, 45, 45], [509, 618, 45, 45], [510, 663, 45, 45], [511, 708, 45, 45], [512, 753, 45, 45], [513, 798, 45, 45], [514, 843, 45, 45], [515, 888, 45, 45], [516, 933, 45, 45], [517, 978, 45, 45], [518, 1023, 45, 45], [519, 1068, 45, 45], [520, 1113, 45, 45], [521, 1158, 45, 45], [522, 1203, 45, 45], [523, 1248, 45, 45], [524, 1293, 45, 45], [525, 1338, 45, 45], [526, 1383, 45, 45], [527, 1428, 45, 45], [528, 1473, 45, 45], [529, 1518, 45, 45], [530, 1563, 45, 45], [531, 1608, 45, 45], [532, 1653, 45, 45], [533, 1698, 45, 45], [534, 1743, 45, 45], [535, 1788, 45, 45], [536, 1833, 45, 45], [537, 1878, 45, 45], [538, 1923, 45, 45], [539, 1968, 45, 45], [540, 0, 45, 32], [540, 2013, 1485, 1], [541, 32, 45, 45], [542, 77, 45, 45], [543, 122, 45, 45], [544, 167, 45, 45], [545, 212, 45, 45], [546, 257, 45, 45], [547, 302, 45, 45], [548, 347, 45, 45], [549, 392, 45, 45], [550, 437, 45, 45], [551, 482, 45, 45], [552, 527, 45, 45], [553, 572, 45, 45], [554, 617, 45, 45], [555, 662, 45, 45], [556, 707, 45, 45], [557, 752, 45, 45], [558, 797, 45, 45], [559, 842, 45, 45], [560, 887, 45, 45], [561, 932, 45, 45], [562, 977, 45, 45], [563, 1022, 45, 45], [564, 1067, 45, 45], [565, 1112, 45, 45], [566, 1157, 45, 45], [567, 1202, 45, 45], [568, 1247, 45, 45], [569, 1292, 45, 45], [570, 1337, 45, 45], [571, 1382, 45, 45], [572, 1427, 45, 45], [573, 1472, 45, 45], [574, 1517, 45, 45], [575, 1562, 45, 45], [576, 1607, 45, 45], [577, 1652, 45, 45], [578, 1697, 45, 45], [579, 1742, 45, 45], [580, 1787, 45, 45], [581, 1832, 45, 45], [582, 1877, 45, 45], [583, 1922, 45, 45], [584, 1967, 45, 45], [585, 0, 45, 31], [585, 2012, 1440, 1], [586, 31, 45, 45], [587, 76, 45, 45], [588, 121, 45, 45], [589, 166, 45, 45], [590, 211, 45, 45], [591, 256, 45, 45], [592, 301, 45, 45], [593, 346, 45, 45], [594, 391, 45, 45], [595, 436, 45, 45], [596, 481, 45, 45], [597, 526, 45, 45], [598, 571, 45, 45], [599, 616, 45, 45], [600, 661, 45, 45], [601, 706, 45, 45], [602, 751, 45, 45], [603, 796, 45, 45], [604, 841, 45, 45], [605, 886, 45, 45], [606, 931, 45, 45], [607, 976, 45, 45], [608, 1021, 45, 45], [609, 1066, 45, 45], [610, 1111, 45, 45], [611, 1156, 45, 45], [612, 1201, 45, 45], [613, 1246, 45, 45], [614, 1291, 45, 45], [615, 1336, 45, 45], [616, 1381, 45, 45], [617, 1426, 45, 45], [618, 1471, 45, 45], [619, 1516, 45, 45], [620, 1561, 45, 45], [621, 1606, 45, 45], [622, 1651, 45, 45], [623, 1696, 45, 45], [624, 1741, 45, 45], [625, 1786, 45, 45], [626, 1831, 45, 45], [627, 1876, 45, 45], [628, 1921, 45, 45], [629, 1966, 45, 45], [630, 0, 45, 30], [630, 2011, 1395, 1], [631, 30, 45, 45], [632, 75, 45, 45], [633, 120, 45, 45], [634, 165, 45, 45], [635, 210, 45, 45], [636, 255, 45, 45], [637, 300, 45, 45], [638, 345, 45, 45], [639, 390, 45, 45], [640, 435, 45, 45], [641, 480, 45, 45], [642, 525, 45, 45], [643, 570, 45, 45], [644, 615, 45, 45], [645, 660, 45, 45], [646, 705, 45, 45], [647, 750, 45, 45], [648, 795, 45, 45], [649, 840, 45, 45], [650, 885, 45, 45], [651, 930, 45, 45], [652, 975, 45, 45], [653, 1020, 45, 45], [654, 1065, 45, 45], [655, 1110, 45, 45], [656, 1155, 45, 45], [657, 1200, 45, 45], [658, 1245, 45, 45], [659, 1290, 45, 45], [660, 1335, 45, 45], [661, 1380, 45, 45], [662, 1425, 45, 45], [663, 1470, 45, 45], [664, 1515, 45, 45], [665, 1560, 45, 45], [666, 1605, 45, 45], [667, 1650, 45, 45], [668, 1695, 45, 45], [669, 1740, 45, 45], [670, 1785, 45, 45], [671, 1830, 45, 45], [672, 1875, 45, 45], [673, 1920, 45, 45], [674, 1965, 45, 45], [675, 0, 45, 29], [675, 2010, 1350, 1], [676, 29, 45, 45], [677, 74, 45, 45], [678, 119, 45, 45], [679, 164, 45, 45], [680, 209, 45, 45], [681, 254, 45, 45], [682, 299, 45, 45], [683, 344, 45, 45], [684, 389, 45, 45], [685, 434, 45, 45], [686, 479, 45, 45], [687, 524, 45, 45], [688, 569, 45, 45], [689, 614, 45, 45], [690, 659, 45, 45], [691, 704, 45, 45], [692, 749, 45, 45], [693, 794, 45, 45], [694, 839, 45, 45], [695, 884, 45, 45], [696, 929, 45, 45], [697, 974, 45, 45], [698, 1019, 45, 45], [699, 1064, 45, 45], [700, 1109, 45, 45], [701, 1154, 45, 45], [702, 1199, 45, 45], [703, 1244, 45, 45], [704, 1289, 45, 45], [705, 1334, 45, 45], [706, 1379, 45, 45], [707, 1424, 45, 45], [708, 1469, 45, 45], [709, 1514, 45, 45], [710, 1559, 45, 45], [711, 1604, 45, 45], [712, 1649, 45, 45], [713, 1694, 45, 45], [714, 1739, 45, 45], [715, 1784, 45, 45], [716, 1829, 45, 45], [717, 1874, 45, 45], [718, 1919, 45, 45], [719, 1964, 45, 45], [720, 0, 45, 28], [720, 2009, 1305, 1], [721, 28, 45, 45], [722, 73, 45, 45], [723, 118, 45, 45], [724, 163, 45, 45], [725, 208, 45, 45], [726, 253, 45, 45], [727, 298, 45, 45], [728, 343, 45, 45], [729, 388, 45, 45], [730, 433, 45, 45], [731, 478, 45, 45], [732, 523, 45, 45], [733, 568, 45, 45], [734, 613, 45, 45], [735, 658, 45, 45], [736, 703, 45, 45], [737, 748, 45, 45], [738, 793, 45, 45], [739, 838, 45, 45], [740, 883, 45, 45], [741, 928, 45, 45], [742, 973, 45, 45], [743, 1018, 45, 45], [744, 1063, 45, 45], [745, 1108, 45, 45], [746, 1153, 45, 45], [747, 1198, 45, 45], [748, 1243, 45, 45], [749, 1288, 45, 45], [750, 1333, 45, 45], [751, 1378, 45, 45], [752, 1423, 45, 45], [753, 1468, 45, 45], [754, 1513, 45, 45], [755, 1558, 45, 45], [756, 1603, 45, 45], [757, 1648, 45, 45], [758, 1693, 45, 45], [759, 1738, 45, 45], [760, 1783, 45, 45], [761, 1828, 45, 45], [762, 1873, 45, 45], [763, 1918, 45, 45], [764, 1963, 45, 45], [765, 0, 45, 27], [765, 2008, 1260, 1], [766, 27, 45, 45], [767, 72, 45, 45], [768, 117, 45, 45], [769, 162, 45, 45], [770, 207, 45, 45], [771, 252, 45, 45], [772, 297, 45, 45], [773, 342, 45, 45], [774, 387, 45, 45], [775, 432, 45, 45], [776, 477, 45, 45], [777, 522, 45, 45], [778, 567, 45, 45], [779, 612, 45, 45], [780, 657, 45, 45], [781, 702, 45, 45], [782, 747, 45, 45], [783, 792, 45, 45], [784, 837, 45, 45], [785, 882, 45, 45], [786, 927, 45, 45], [787, 972, 45, 45], [788, 1017, 45, 45], [789, 1062, 45, 45], [790, 1107, 45, 45], [791, 1152, 45, 45], [792, 1197, 45, 45], [793, 1242, 45, 45], [794, 1287, 45, 45], [795, 1332, 45, 45], [796, 1377, 45, 45], [797, 1422, 45, 45], [798, 1467, 45, 45], [799, 1512, 45, 45], [800, 1557, 45, 45], [801, 1602, 45, 45], [802, 1647, 45, 45], [803, 1692, 45, 45], [804, 1737, 45, 45], [805, 1782, 45, 45], [806, 1827, 45, 45], [807, 1872, 45, 45], [808, 1917, 45, 45], [809, 1962, 45, 45], [810, 0, 45, 26], [810, 2007, 1215, 1], [811, 26, 45, 45], [812, 71, 45, 45], [813, 116, 45, 45], [814, 161, 45, 45], [815, 206, 45, 45], [816, 251, 45, 45], [817, 296, 45, 45], [818, 341, 45, 45], [819, 386, 45, 45], [820, 431, 45, 45], [821, 476, 45, 45], [822, 521, 45, 45], [823, 566, 45, 45], [824, 611, 45, 45], [825, 656, 45, 45], [826, 701, 45, 45], [827, 746, 45, 45], [828, 791, 45, 45], [829, 836, 45, 45], [830, 881, 45, 45], [831, 926, 45, 45], [832, 971, 45, 45], [833, 1016, 45, 45], [834, 1061, 45, 45], [835, 1106, 45, 45], [836, 1151, 45, 45], [837, 1196, 45, 45], [838, 1241, 45, 45], [839, 1286, 45, 45], [840, 1331, 45, 45], [841, 1376, 45, 45], [842, 1421, 45, 45], [843, 1466, 45, 45], [844, 1511, 45, 45], [845, 1556, 45, 45], [846, 1601, 45, 45], [847, 1646, 45, 45], [848, 1691, 45, 45], [849, 1736, 45, 45], [850, 1781, 45, 45], [851, 1826, 45, 45], [852, 1871, 45, 45], [853, 1916, 45, 45], [854, 1961, 45, 45], [855, 0, 45, 25], [855, 2006, 1170, 1], [856, 25, 45, 45], [857, 70, 45, 45], [858, 115, 45, 45], [859, 160, 45, 45], [860, 205, 45, 45], [861, 250, 45, 45], [862, 295, 45, 45], [863, 340, 45, 45], [864, 385, 45, 45], [865, 430, 45, 45], [866, 475, 45, 45], [867, 520, 45, 45], [868, 565, 45, 45], [869, 610, 45, 45], [870, 655, 45, 45], [871, 700, 45, 45], [872, 745, 45, 45], [873, 790, 45, 45], [874, 835, 45, 45], [875, 880, 45, 45], [876, 925, 45, 45], [877, 970, 45, 45], [878, 1015, 45, 45], [879, 1060, 45, 45], [880, 1105, 45, 45], [881, 1150, 45, 45], [882, 1195, 45, 45], [883, 1240, 45, 45], [884, 1285, 45, 45], [885, 1330, 45, 45], [886, 1375, 45, 45], [887, 1420, 45, 45], [888, 1465, 45, 45], [889, 1510, 45, 45], [890, 1555, 45, 45], [891, 1600, 45, 45], [892, 1645, 45, 45], [893, 1690, 45, 45], [894, 1735, 45, 45], [895, 1780, 45, 45], [896, 1825, 45, 45], [897, 1870, 45, 45], [898, 1915, 45, 45], [899, 1960, 45, 45], [900, 0, 45, 24], [900, 2005, 1125, 1], [901, 24, 45, 45], [902, 69, 45, 45], [903, 114, 45, 45], [904, 159, 45, 45], [905, 204, 45, 45], [906, 249, 45, 45], [907, 294, 45, 45], [908, 339, 45, 45], [909, 384, 45, 45], [910, 429, 45, 45], [911, 474, 45, 45], [912, 519, 45, 45], [913, 564, 45, 45], [914, 609, 45, 45], [915, 654, 45, 45], [916, 699, 45, 45], [917, 744, 45, 45], [918, 789, 45, 45], [919, 834, 45, 45], [920, 879, 45, 45], [921, 924, 45, 45], [922, 969, 45, 45], [923, 1014, 45, 45], [924, 1059, 45, 45], [925, 1104, 45, 45], [926, 1149, 45, 45], [927, 1194, 45, 45], [928, 1239, 45, 45], [929, 1284, 45, 45], [930, 1329, 45, 45], [931, 1374, 45, 45], [932, 1419, 45, 45], [933, 1464, 45, 45], [934, 1509, 45, 45], [935, 1554, 45, 45], [936, 1599, 45, 45], [937, 1644, 45, 45], [938, 1689, 45, 45], [939, 1734, 45, 45], [940, 1779, 45, 45], [941, 1824, 45, 45], [942, 1869, 45, 45], [943, 1914, 45, 45], [944, 1959, 45, 45], [945, 0, 45, 23], [945, 2004, 1080, 1], [946, 23, 45, 45], [947, 68, 45, 45], [948, 113, 45, 45], [949, 158, 45, 45], [950, 203, 45, 45], [951, 248, 45, 45], [952, 293, 45, 45], [953, 338, 45, 45], [954, 383, 45, 45], [955, 428, 45, 45], [956, 473, 45, 45], [957, 518, 45, 45], [958, 563, 45, 45], [959, 608, 45, 45], [960, 653, 45, 45], [961, 698, 45, 45], [962, 743, 45, 45], [963, 788, 45, 45], [964, 833, 45, 45], [965, 878, 45, 45], [966, 923, 45, 45], [967, 968, 45, 45], [968, 1013, 45, 45], [969, 1058, 45, 45], [970, 1103, 45, 45], [971, 1148, 45, 45], [972, 1193, 45, 45], [973, 1238, 45, 45], [974, 1283, 45, 45], [975, 1328, 45, 45], [976, 1373, 45, 45], [977, 1418, 45, 45], [978, 1463, 45, 45], [979, 1508, 45, 45], [980, 1553, 45, 45], [981, 1598, 45, 45], [982, 1643, 45, 45], [983, 1688, 45, 45], [984, 1733, 45, 45], [985, 1778, 45, 45], [986, 1823, 45, 45], [987, 1868, 45, 45], [988, 1913, 45, 45], [989, 1958, 45, 45], [990, 0, 45, 22], [990, 2003, 1035, 1], [991, 22, 45, 45], [992, 67, 45, 45], [993, 112, 45, 45], [994, 157, 45, 45], [995, 202, 45, 45], [996, 247, 45, 45], [997, 292, 45, 45], [998, 337, 45, 45], [999, 382, 45, 45], [1000, 427, 45, 45], [1001, 472, 45, 45], [1002, 517, 45, 45], [1003, 562, 45, 45], [1004, 607, 45, 45], [1005, 652, 45, 45], [1006, 697, 45, 45], [1007, 742, 45, 45], [1008, 787, 45, 45], [1009, 832, 45, 45], [1010, 877, 45, 45], [1011, 922, 45, 45], [1012, 967, 45, 45], [1013, 1012, 45, 45], [1014, 1057, 45, 45], [1015, 1102, 45, 45], [1016, 1147, 45, 45], [1017, 1192, 45, 45], [1018, 1237, 45, 45], [1019, 1282, 45, 45], [1020, 1327, 45, 45], [1021, 1372, 45, 45], [1022, 1417, 45, 45], [1023, 1462, 45, 45], [1024, 1507, 45, 45], [1025, 1552, 45, 45], [1026, 1597, 45, 45], [1027, 1642, 45, 45], [1028, 1687, 45, 45], [1029, 1732, 45, 45], [1030, 1777, 45, 45], [1031, 1822, 45, 45], [1032, 1867, 45, 45], [1033, 1912, 45, 45], [1034, 1957, 45, 45], [1035, 0, 45, 21], [1035, 2002, 990, 1], [1036, 21, 45, 45], [1037, 66, 45, 45], [1038, 111, 45, 45], [1039, 156, 45, 45], [1040, 201, 45, 45], [1041, 246, 45, 45], [1042, 291, 45, 45], [1043, 336, 45, 45], [1044, 381, 45, 45], [1045, 426, 45, 45], [1046, 471, 45, 45], [1047, 516, 45, 45], [1048, 561, 45, 45], [1049, 606, 45, 45], [1050, 651, 45, 45], [1051, 696, 45, 45], [1052, 741, 45, 45], [1053, 786, 45, 45], [1054, 831, 45, 45], [1055, 876, 45, 45], [1056, 921, 45, 45], [1057, 966, 45, 45], [1058, 1011, 45, 45], [1059, 1056, 45, 45], [1060, 1101, 45, 45], [1061, 1146, 45, 45], [1062, 1191, 45, 45], [1063, 1236, 45, 45], [1064, 1281, 45, 45], [1065, 1326, 45, 45], [1066, 1371, 45, 45], [1067, 1416, 45, 45], [1068, 1461, 45, 45], [1069, 1506, 45, 45], [1070, 1551, 45, 45], [1071, 1596, 45, 45], [1072, 1641, 45, 45], [1073, 1686, 45, 45], [1074, 1731, 45, 45], [1075, 1776, 45, 45], [1076, 1821, 45, 45], [1077, 1866, 45, 45], [1078, 1911, 45, 45], [1079, 1956, 45, 45], [1080, 0, 45, 20], [1080, 2001, 945, 1], [1081, 20, 45, 45], [1082, 65, 45, 45], [1083, 110, 45, 45], [1084, 155, 45, 45], [1085, 200, 45, 45], [1086, 245, 45, 45], [1087, 290, 45, 45], [1088, 335, 45, 45], [1089, 380, 45, 45], [1090, 425, 45, 45], [1091, 470, 45, 45], [1092, 515, 45, 45], [1093, 560, 45, 45], [1094, 605, 45, 45], [1095, 650, 45, 45], [1096, 695, 45, 45], [1097, 740, 45, 45], [1098, 785, 45, 45], [1099, 830, 45, 45], [1100, 875, 45, 45], [1101, 920, 45, 45], [1102, 965, 45, 45], [1103, 1010, 45, 45], [1104, 1055, 45, 45], [1105, 1100, 45, 45], [1106, 1145, 45, 45], [1107, 1190, 45, 45], [1108, 1235, 45, 45], [1109, 1280, 45, 45], [1110, 1325, 45, 45], [1111, 1370, 45, 45], [1112, 1415, 45, 45], [1113, 1460, 45, 45], [1114, 1505, 45, 45], [1115, 1550, 45, 45], [1116, 1595, 45, 45], [1117, 1640, 45, 45], [1118, 1685, 45, 45], [1119, 1730, 45, 45], [1120, 1775, 45, 45], [1121, 1820, 45, 45], [1122, 1865, 45, 45], [1123, 1910, 45, 45], [1124, 1955, 45, 45], [1125, 0, 45, 19], [1125, 2000, 900, 1], [1126, 19, 45, 45], [1127, 64, 45, 45], [1128, 109, 45, 45], [1129, 154, 45, 45], [1130, 199, 45, 45], [1131, 244, 45, 45], [1132, 289, 45, 45], [1133, 334, 45, 45], [1134, 379, 45, 45], [1135, 424, 45, 45], [1136, 469, 45, 45], [1137, 514, 45, 45], [1138, 559, 45, 45], [1139, 604, 45, 45], [1140, 649, 45, 45], [1141, 694, 45, 45], [1142, 739, 45, 45], [1143, 784, 45, 45], [1144, 829, 45, 45], [1145, 874, 45, 45], [1146, 919, 45, 45], [1147, 964, 45, 45], [1148, 1009, 45, 45], [1149, 1054, 45, 45], [1150, 1099, 45, 45], [1151, 1144, 45, 45], [1152, 1189, 45, 45], [1153, 1234, 45, 45], [1154, 1279, 45, 45], [1155, 1324, 45, 45], [1156, 1369, 45, 45], [1157, 1414, 45, 45], [1158, 1459, 45, 45], [1159, 1504, 45, 45], [1160, 1549, 45, 45], [1161, 1594, 45, 45], [1162, 1639, 45, 45], [1163, 1684, 45, 45], [1164, 1729, 45, 45], [1165, 1774, 45, 45], [1166, 1819, 45, 45], [1167, 1864, 45, 45], [1168, 1909, 45, 45], [1169, 1954, 45, 45], [1170, 0, 45, 18], [1170, 1999, 855, 1], [1171, 18, 45, 45], [1172, 63, 45, 45], [1173, 108, 45, 45], [1174, 153, 45, 45], [1175, 198, 45, 45], [1176, 243, 45, 45], [1177, 288, 45, 45], [1178, 333, 45, 45], [1179, 378, 45, 45], [1180, 423, 45, 45], [1181, 468, 45, 45], [1182, 513, 45, 45], [1183, 558, 45, 45], [1184, 603, 45, 45], [1185, 648, 45, 45], [1186, 693, 45, 45], [1187, 738, 45, 45], [1188, 783, 45, 45], [1189, 828, 45, 45], [1190, 873, 45, 45], [1191, 918, 45, 45], [1192, 963, 45, 45], [1193, 1008, 45, 45], [1194, 1053, 45, 45], [1195, 1098, 45, 45], [1196, 1143, 45, 45], [1197, 1188, 45, 45], [1198, 1233, 45, 45], [1199, 1278, 45, 45], [1200, 1323, 45, 45], [1201, 1368, 45, 45], [1202, 1413, 45, 45], [1203, 1458, 45, 45], [1204, 1503, 45, 45], [1205, 1548, 45, 45], [1206, 1593, 45, 45], [1207, 1638, 45, 45], [1208, 1683, 45, 45], [1209, 1728, 45, 45], [1210, 1773, 45, 45], [1211, 1818, 45, 45], [1212, 1863, 45, 45], [1213, 1908, 45, 45], [1214, 1953, 45, 45], [1215, 0, 45, 17], [1215, 1998, 810, 1], [1216, 17, 45, 45], [1217, 62, 45, 45], [1218, 107, 45, 45], [1219, 152, 45, 45], [1220, 197, 45, 45], [1221, 242, 45, 45], [1222, 287, 45, 45], [1223, 332, 45, 45], [1224, 377, 45, 45], [1225, 422, 45, 45], [1226, 467, 45, 45], [1227, 512, 45, 45], [1228, 557, 45, 45], [1229, 602, 45, 45], [1230, 647, 45, 45], [1231, 692, 45, 45], [1232, 737, 45, 45], [1233, 782, 45, 45], [1234, 827, 45, 45], [1235, 872, 45, 45], [1236, 917, 45, 45], [1237, 962, 45, 45], [1238, 1007, 45, 45], [1239, 1052, 45, 45], [1240, 1097, 45, 45], [1241, 1142, 45, 45], [1242, 1187, 45, 45], [1243, 1232, 45, 45], [1244, 1277, 45, 45], [1245, 1322, 45, 45], [1246, 1367, 45, 45], [1247, 1412, 45, 45], [1248, 1457, 45, 45], [1249, 1502, 45, 45], [1250, 1547, 45, 45], [1251, 1592, 45, 45], [1252, 1637, 45, 45], [1253, 1682, 45, 45], [1254, 1727, 45, 45], [1255, 1772, 45, 45], [1256, 1817, 45, 45], [1257, 1862, 45, 45], [1258, 1907, 45, 45], [1259, 1952, 45, 45], [1260, 0, 45, 16], [1260, 1997, 765, 1], [1261, 16, 45, 45], [1262, 61, 45, 45], [1263, 106, 45, 45], [1264, 151, 45, 45], [1265, 196, 45, 45], [1266, 241, 45, 45], [1267, 286, 45, 45], [1268, 331, 45, 45], [1269, 376, 45, 45], [1270, 421, 45, 45], [1271, 466, 45, 45], [1272, 511, 45, 45], [1273, 556, 45, 45], [1274, 601, 45, 45], [1275, 646, 45, 45], [1276, 691, 45, 45], [1277, 736, 45, 45], [1278, 781, 45, 45], [1279, 826, 45, 45], [1280, 871, 45, 45], [1281, 916, 45, 45], [1282, 961, 45, 45], [1283, 1006, 45, 45], [1284, 1051, 45, 45], [1285, 1096, 45, 45], [1286, 1141, 45, 45], [1287, 1186, 45, 45], [1288, 1231, 45, 45], [1289, 1276, 45, 45], [1290, 1321, 45, 45], [1291, 1366, 45, 45], [1292, 1411, 45, 45], [1293, 1456, 45, 45], [1294, 1501, 45, 45], [1295, 1546, 45, 45], [1296, 1591, 45, 45], [1297, 1636, 45, 45], [1298, 1681, 45, 45], [1299, 1726, 45, 45], [1300, 1771, 45, 45], [1301, 1816, 45, 45], [1302, 1861, 45, 45], [1303, 1906, 45, 45], [1304, 1951, 45, 45], [1305, 0, 45, 15], [1305, 1996, 720, 1], [1306, 15, 45, 45], [1307, 60, 45, 45], [1308, 105, 45, 45], [1309, 150, 45, 45], [1310, 195, 45, 45], [1311, 240, 45, 45], [1312, 285, 45, 45], [1313, 330, 45, 45], [1314, 375, 45, 45], [1315, 420, 45, 45], [1316, 465, 45, 45], [1317, 510, 45, 45], [1318, 555, 45, 45], [1319, 600, 45, 45], [1320, 645, 45, 45], [1321, 690, 45, 45], [1322, 735, 45, 45], [1323, 780, 45, 45], [1324, 825, 45, 45], [1325, 870, 45, 45], [1326, 915, 45, 45], [1327, 960, 45, 45], [1328, 1005, 45, 45], [1329, 1050, 45, 45], [1330, 1095, 45, 45], [1331, 1140, 45, 45], [1332, 1185, 45, 45], [1333, 1230, 45, 45], [1334, 1275, 45, 45], [1335, 1320, 45, 45], [1336, 1365, 45, 45], [1337, 1410, 45, 45], [1338, 1455, 45, 45], [1339, 1500, 45, 45], [1340, 1545, 45, 45], [1341, 1590, 45, 45], [1342, 1635, 45, 45], [1343, 1680, 45, 45], [1344, 1725, 45, 45], [1345, 1770, 45, 45], [1346, 1815, 45, 45], [1347, 1860, 45, 45], [1348, 1905, 45, 45], [1349, 1950, 45, 45], [1350, 0, 45, 14], [1350, 1995, 675, 1], [1351, 14, 45, 45], [1352, 59, 45, 45], [1353, 104, 45, 45], [1354, 149, 45, 45], [1355, 194, 45, 45], [1356, 239, 45, 45], [1357, 284, 45, 45], [1358, 329, 45, 45], [1359, 374, 45, 45], [1360, 419, 45, 45], [1361, 464, 45, 45], [1362, 509, 45, 45], [1363, 554, 45, 45], [1364, 599, 45, 45], [1365, 644, 45, 45], [1366, 689, 45, 45], [1367, 734, 45, 45], [1368, 779, 45, 45], [1369, 824, 45, 45], [1370, 869, 45, 45], [1371, 914, 45, 45], [1372, 959, 45, 45], [1373, 1004, 45, 45], [1374, 1049, 45, 45], [1375, 1094, 45, 45], [1376, 1139, 45, 45], [1377, 1184, 45, 45], [1378, 1229, 45, 45], [1379, 1274, 45, 45], [1380, 1319, 45, 45], [1381, 1364, 45, 45], [1382, 1409, 45, 45], [1383, 1454, 45, 45], [1384, 1499, 45, 45], [1385, 1544, 45, 45], [1386, 1589, 45, 45], [1387, 1634, 45, 45], [1388, 1679, 45, 45], [1389, 1724, 45, 45], [1390, 1769, 45, 45], [1391, 1814, 45, 45], [1392, 1859, 45, 45], [1393, 1904, 45, 45], [1394, 1949, 45, 45], [1395, 0, 45, 13], [1395, 1994, 630, 1], [1396, 13, 45, 45], [1397, 58, 45, 45], [1398, 103, 45, 45], [1399, 148, 45, 45], [1400, 193, 45, 45], [1401, 238, 45, 45], [1402, 283, 45, 45], [1403, 328, 45, 45], [1404, 373, 45, 45], [1405, 418, 45, 45], [1406, 463, 45, 45], [1407, 508, 45, 45], [1408, 553, 45, 45], [1409, 598, 45, 45], [1410, 643, 45, 45], [1411, 688, 45, 45], [1412, 733, 45, 45], [1413, 778, 45, 45], [1414, 823, 45, 45], [1415, 868, 45, 45], [1416, 913, 45, 45], [1417, 958, 45, 45], [1418, 1003, 45, 45], [1419, 1048, 45, 45], [1420, 1093, 45, 45], [1421, 1138, 45, 45], [1422, 1183, 45, 45], [1423, 1228, 45, 45], [1424, 1273, 45, 45], [1425, 1318, 45, 45], [1426, 1363, 45, 45], [1427, 1408, 45, 45], [1428, 1453, 45, 45], [1429, 1498, 45, 45], [1430, 1543, 45, 45], [1431, 1588, 45, 45], [1432, 1633, 45, 45], [1433, 1678, 45, 45], [1434, 1723, 45, 45], [1435, 1768, 45, 45], [1436, 1813, 45, 45], [1437, 1858, 45, 45], [1438, 1903, 45, 45], [1439, 1948, 45, 45], [1440, 0, 45, 12], [1440, 1993, 585, 1], [1441, 12, 45, 45], [1442, 57, 45, 45], [1443, 102, 45, 45], [1444, 147, 45, 45], [1445, 192, 45, 45], [1446, 237, 45, 45], [1447, 282, 45, 45], [1448, 327, 45, 45], [1449, 372, 45, 45], [1450, 417, 45, 45], [1451, 462, 45, 45], [1452, 507, 45, 45], [1453, 552, 45, 45], [1454, 597, 45, 45], [1455, 642, 45, 45], [1456, 687, 45, 45], [1457, 732, 45, 45], [1458, 777, 45, 45], [1459, 822, 45, 45], [1460, 867, 45, 45], [1461, 912, 45, 45], [1462, 957, 45, 45], [1463, 1002, 45, 45], [1464, 1047, 45, 45], [1465, 1092, 45, 45], [1466, 1137, 45, 45], [1467, 1182, 45, 45], [1468, 1227, 45, 45], [1469, 1272, 45, 45], [1470, 1317, 45, 45], [1471, 1362, 45, 45], [1472, 1407, 45, 45], [1473, 1452, 45, 45], [1474, 1497, 45, 45], [1475, 1542, 45, 45], [1476, 1587, 45, 45], [1477, 1632, 45, 45], [1478, 1677, 45, 45], [1479, 1722, 45, 45], [1480, 1767, 45, 45], [1481, 1812, 45, 45], [1482, 1857, 45, 45], [1483, 1902, 45, 45], [1484, 1947, 45, 45], [1485, 0, 45, 11], [1485, 1992, 540, 1], [1486, 11, 45, 45], [1487, 56, 45, 45], [1488, 101, 45, 45], [1489, 146, 45, 45], [1490, 191, 45, 45], [1491, 236, 45, 45], [1492, 281, 45, 45], [1493, 326, 45, 45], [1494, 371, 45, 45], [1495, 416, 45, 45], [1496, 461, 45, 45], [1497, 506, 45, 45], [1498, 551, 45, 45], [1499, 596, 45, 45], [1500, 641, 45, 45], [1501, 686, 45, 45], [1502, 731, 45, 45], [1503, 776, 45, 45], [1504, 821, 45, 45], [1505, 866, 45, 45], [1506, 911, 45, 45], [1507, 956, 45, 45], [1508, 1001, 45, 45], [1509, 1046, 45, 45], [1510, 1091, 45, 45], [1511, 1136, 45, 45], [1512, 1181, 45, 45], [1513, 1226, 45, 45], [1514, 1271, 45, 45], [1515, 1316, 45, 45], [1516, 1361, 45, 45], [1517, 1406, 45, 45], [1518, 1451, 45, 45], [1519, 1496, 45, 45], [1520, 1541, 45, 45], [1521, 1586, 45, 45], [1522, 1631, 45, 45], [1523, 1676, 45, 45], [1524, 1721, 45, 45], [1525, 1766, 45, 45], [1526, 1811, 45, 45], [1527, 1856, 45, 45], [1528, 1901, 45, 45], [1529, 1946, 45, 45], [1530, 0, 45, 10], [1530, 1991, 495, 1], [1531, 10, 45, 45], [1532, 55, 45, 45], [1533, 100, 45, 45], [1534, 145, 45, 45], [1535, 190, 45, 45], [1536, 235, 45, 45], [1537, 280, 45, 45], [1538, 325, 45, 45], [1539, 370, 45, 45], [1540, 415, 45, 45], [1541, 460, 45, 45], [1542, 505, 45, 45], [1543, 550, 45, 45], [1544, 595, 45, 45], [1545, 640, 45, 45], [1546, 685, 45, 45], [1547, 730, 45, 45], [1548, 775, 45, 45], [1549, 820, 45, 45], [1550, 865, 45, 45], [1551, 910, 45, 45], [1552, 955, 45, 45], [1553, 1000, 45, 45], [1554, 1045, 45, 45], [1555, 1090, 45, 45], [1556, 1135, 45, 45], [1557, 1180, 45, 45], [1558, 1225, 45, 45], [1559, 1270, 45, 45], [1560, 1315, 45, 45], [1561, 1360, 45, 45], [1562, 1405, 45, 45], [1563, 1450, 45, 45], [1564, 1495, 45, 45], [1565, 1540, 45, 45], [1566, 1585, 45, 45], [1567, 1630, 45, 45], [1568, 1675, 45, 45], [1569, 1720, 45, 45], [1570, 1765, 45, 45], [1571, 1810, 45, 45], [1572, 1855, 45, 45], [1573, 1900, 45, 45], [1574, 1945, 45, 45], [1575, 0, 45, 9], [1575, 1990, 450, 1], [1576, 9, 45, 45], [1577, 54, 45, 45], [1578, 99, 45, 45], [1579, 144, 45, 45], [1580, 189, 45, 45], [1581, 234, 45, 45], [1582, 279, 45, 45], [1583, 324, 45, 45], [1584, 369, 45, 45], [1585, 414, 45, 45], [1586, 459, 45, 45], [1587, 504, 45, 45], [1588, 549, 45, 45], [1589, 594, 45, 45], [1590, 639, 45, 45], [1591, 684, 45, 45], [1592, 729, 45, 45], [1593, 774, 45, 45], [1594, 819, 45, 45], [1595, 864, 45, 45], [1596, 909, 45, 45], [1597, 954, 45, 45], [1598, 999, 45, 45], [1599, 1044, 45, 45], [1600, 1089, 45, 45], [1601, 1134, 45, 45], [1602, 1179, 45, 45], [1603, 1224, 45, 45], [1604, 1269, 45, 45], [1605, 1314, 45, 45], [1606, 1359, 45, 45], [1607, 1404, 45, 45], [1608, 1449, 45, 45], [1609, 1494, 45, 45], [1610, 1539, 45, 45], [1611, 1584, 45, 45], [1612, 1629, 45, 45], [1613, 1674, 45, 45], [1614, 1719, 45, 45], [1615, 1764, 45, 45], [1616, 1809, 45, 45], [1617, 1854, 45, 45], [1618, 1899, 45, 45], [1619, 1944, 45, 45], [1620, 0, 45, 8], [1620, 1989, 405, 1], [1621, 8, 45, 45], [1622, 53, 45, 45], [1623, 98, 45, 45], [1624, 143, 45, 45], [1625, 188, 45, 45], [1626, 233, 45, 45], [1627, 278, 45, 45], [1628, 323, 45, 45], [1629, 368, 45, 45], [1630, 413, 45, 45], [1631, 458, 45, 45], [1632, 503, 45, 45], [1633, 548, 45, 45], [1634, 593, 45, 45], [1635, 638, 45, 45], [1636, 683, 45, 45], [1637, 728, 45, 45], [1638, 773, 45, 45], [1639, 818, 45, 45], [1640, 863, 45, 45], [1641, 908, 45, 45], [1642, 953, 45, 45], [1643, 998, 45, 45], [1644, 1043, 45, 45], [1645, 1088, 45, 45], [1646, 1133, 45, 45], [1647, 1178, 45, 45], [1648, 1223, 45, 45], [1649, 1268, 45, 45], [1650, 1313, 45, 45], [1651, 1358, 45, 45], [1652, 1403, 45, 45], [1653, 1448, 45, 45], [1654, 1493, 45, 45], [1655, 1538, 45, 45], [1656, 1583, 45, 45], [1657, 1628, 45, 45], [1658, 1673, 45, 45], [1659, 1718, 45, 45], [1660, 1763, 45, 45], [1661, 1808, 45, 45], [1662, 1853, 45, 45], [1663, 1898, 45, 45], [1664, 1943, 45, 45], [1665, 0, 45, 7], [1665, 1988, 360, 1], [1666, 7, 45, 45], [1667, 52, 45, 45], [1668, 97, 45, 45], [1669, 142, 45, 45], [1670, 187, 45, 45], [1671, 232, 45, 45], [1672, 277, 45, 45], [1673, 322, 45, 45], [1674, 367, 45, 45], [1675, 412, 45, 45], [1676, 457, 45, 45], [1677, 502, 45, 45], [1678, 547, 45, 45], [1679, 592, 45, 45], [1680, 637, 45, 45], [1681, 682, 45, 45], [1682, 727, 45, 45], [1683, 772, 45, 45], [1684, 817, 45, 45], [1685, 862, 45, 45], [1686, 907, 45, 45], [1687, 952, 45, 45], [1688, 997, 45, 45], [1689, 1042, 45, 45], [1690, 1087, 45, 45], [1691, 1132, 45, 45], [1692, 1177, 45, 45], [1693, 1222, 45, 45], [1694, 1267, 45, 45], [1695, 1312, 45, 45], [1696, 1357, 45, 45], [1697, 1402, 45, 45], [1698, 1447, 45, 45], [1699, 1492, 45, 45], [1700, 1537, 45, 45], [1701, 1582, 45, 45], [1702, 1627, 45, 45], [1703, 1672, 45, 45], [1704, 1717, 45, 45], [1705, 1762, 45, 45], [1706, 1807, 45, 45], [1707, 1852, 45, 45], [1708, 1897, 45, 45], [1709, 1942, 45, 45], [1710, 0, 45, 6], [1710, 1987, 315, 1], [1711, 6, 45, 45], [1712, 51, 45, 45], [1713, 96, 45, 45], [1714, 141, 45, 45], [1715, 186, 45, 45], [1716, 231, 45, 45], [1717, 276, 45, 45], [1718, 321, 45, 45], [1719, 366, 45, 45], [1720, 411, 45, 45], [1721, 456, 45, 45], [1722, 501, 45, 45], [1723, 546, 45, 45], [1724, 591, 45, 45], [1725, 636, 45, 45], [1726, 681, 45, 45], [1727, 726, 45, 45], [1728, 771, 45, 45], [1729, 816, 45, 45], [1730, 861, 45, 45], [1731, 906, 45, 45], [1732, 951, 45, 45], [1733, 996, 45, 45], [1734, 1041, 45, 45], [1735, 1086, 45, 45], [1736, 1131, 45, 45], [1737, 1176, 45, 45], [1738, 1221, 45, 45], [1739, 1266, 45, 45], [1740, 1311, 45, 45], [1741, 1356, 45, 45], [1742, 1401, 45, 45], [1743, 1446, 45, 45], [1744, 1491, 45, 45], [1745, 1536, 45, 45], [1746, 1581, 45, 45], [1747, 1626, 45, 45], [1748, 1671, 45, 45], [1749, 1716, 45, 45], [1750, 1761, 45, 45], [1751, 1806, 45, 45], [1752, 1851, 45, 45], [1753, 1896, 45, 45], [1754, 1941, 45, 45], [1755, 0, 45, 5], [1755, 1986, 270, 1], [1756, 5, 45, 45], [1757, 50, 45, 45], [1758, 95, 45, 45], [1759, 140, 45, 45], [1760, 185, 45, 45], [1761, 230, 45, 45], [1762, 275, 45, 45], [1763, 320, 45, 45], [1764, 365, 45, 45], [1765, 410, 45, 45], [1766, 455, 45, 45], [1767, 500, 45, 45], [1768, 545, 45, 45], [1769, 590, 45, 45], [1770, 635, 45, 45], [1771, 680, 45, 45], [1772, 725, 45, 45], [1773, 770, 45, 45], [1774, 815, 45, 45], [1775, 860, 45, 45], [1776, 905, 45, 45], [1777, 950, 45, 45], [1778, 995, 45, 45], [1779, 1040, 45, 45], [1780, 1085, 45, 45], [1781, 1130, 45, 45], [1782, 1175, 45, 45], [1783, 1220, 45, 45], [1784, 1265, 45, 45], [1785, 1310, 45, 45], [1786, 1355, 45, 45], [1787, 1400, 45, 45], [1788, 1445, 45, 45], [1789, 1490, 45, 45], [1790, 1535, 45, 45], [1791, 1580, 45, 45], [1792, 1625, 45, 45], [1793, 1670, 45, 45], [1794, 1715, 45, 45], [1795, 1760, 45, 45], [1796, 1805, 45, 45], [1797, 1850, 45, 45], [1798, 1895, 45, 45], [1799, 1940, 45, 45], [1800, 0, 45, 4], [1800, 1985, 225, 1], [1801, 4, 45, 45], [1802, 49, 45, 45], [1803, 94, 45, 45], [1804, 139, 45, 45], [1805, 184, 45, 45], [1806, 229, 45, 45], [1807, 274, 45, 45], [1808, 319, 45, 45], [1809, 364, 45, 45], [1810, 409, 45, 45], [1811, 454, 45, 45], [1812, 499, 45, 45], [1813, 544, 45, 45], [1814, 589, 45, 45], [1815, 634, 45, 45], [1816, 679, 45, 45], [1817, 724, 45, 45], [1818, 769, 45, 45], [1819, 814, 45, 45], [1820, 859, 45, 45], [1821, 904, 45, 45], [1822, 949, 45, 45], [1823, 994, 45, 45], [1824, 1039, 45, 45], [1825, 1084, 45, 45], [1826, 1129, 45, 45], [1827, 1174, 45, 45], [1828, 1219, 45, 45], [1829, 1264, 45, 45], [1830, 1309, 45, 45], [1831, 1354, 45, 45], [1832, 1399, 45, 45], [1833, 1444, 45, 45], [1834, 1489, 45, 45], [1835, 1534, 45, 45], [1836, 1579, 45, 45], [1837, 1624, 45, 45], [1838, 1669, 45, 45], [1839, 1714, 45, 45], [1840, 1759, 45, 45], [1841, 1804, 45, 45], [1842, 1849, 45, 45], [1843, 1894, 45, 45], [1844, 1939, 45, 45], [1845, 0, 45, 3], [1845, 1984, 180, 1], [1846, 3, 45, 45], [1847, 48, 45, 45], [1848, 93, 45, 45], [1849, 138, 45, 45], [1850, 183, 45, 45], [1851, 228, 45, 45], [1852, 273, 45, 45], [1853, 318, 45, 45], [1854, 363, 45, 45], [1855, 408, 45, 45], [1856, 453, 45, 45], [1857, 498, 45, 45], [1858, 543, 45, 45], [1859, 588, 45, 45], [1860, 633, 45, 45], [1861, 678, 45, 45], [1862, 723, 45, 45], [1863, 768, 45, 45], [1864, 813, 45, 45], [1865, 858, 45, 45], [1866, 903, 45, 45], [1867, 948, 45, 45], [1868, 993, 45, 45], [1869, 1038, 45, 45], [1870, 1083, 45, 45], [1871, 1128, 45, 45], [1872, 1173, 45, 45], [1873, 1218, 45, 45], [1874, 1263, 45, 45], [1875, 1308, 45, 45], [1876, 1353, 45, 45], [1877, 1398, 45, 45], [1878, 1443, 45, 45], [1879, 1488, 45, 45], [1880, 1533, 45, 45], [1881, 1578, 45, 45], [1882, 1623, 45, 45], [1883, 1668, 45, 45], [1884, 1713, 45, 45], [1885, 1758, 45, 45], [1886, 1803, 45, 45], [1887, 1848, 45, 45], [1888, 1893, 45, 45], [1889, 1938, 45, 45], [1890, 0, 45, 2], [1890, 1983, 135, 1], [1891, 2, 45, 45], [1892, 47, 45, 45], [1893, 92, 45, 45], [1894, 137, 45, 45], [1895, 182, 45, 45], [1896, 227, 45, 45], [1897, 272, 45, 45], [1898, 317, 45, 45], [1899, 362, 45, 45], [1900, 407, 45, 45], [1901, 452, 45, 45], [1902, 497, 45, 45], [1903, 542, 45, 45], [1904, 587, 45, 45], [1905, 632, 45, 45], [1906, 677, 45, 45], [1907, 722, 45, 45], [1908, 767, 45, 45], [1909, 812, 45, 45], [1910, 857, 45, 45], [1911, 902, 45, 45], [1912, 947, 45, 45], [1913, 992, 45, 45], [1914, 1037, 45, 45], [1915, 1082, 45, 45], [1916, 1127, 45, 45], [1917, 1172, 45, 45], [1918, 1217, 45, 45], [1919, 1262, 45, 45], [1920, 1307, 45, 45], [1921, 1352, 45, 45], [1922, 1397, 45, 45], [1923, 1442, 45, 45], [1924, 1487, 45, 45], [1925, 1532, 45, 45], [1926, 1577, 45, 45], [1927, 1622, 45, 45], [1928, 1667, 45, 45], [1929, 1712, 45, 45], [1930, 1757, 45, 45], [1931, 1802, 45, 45], [1932, 1847, 45, 45], [1933, 1892, 45, 45], [1934, 1937, 45, 45], [1935, 0, 45, 1], [1935, 1982, 90, 1], [1936, 1, 45, 45], [1937, 46, 45, 45], [1938, 91, 45, 45], [1939, 136, 45, 45], [1940, 181, 45, 45], [1941, 226, 45, 45], [1942, 271, 45, 45], [1943, 316, 45, 45], [1944, 361, 45, 45], [1945, 406, 45, 45], [1946, 451, 45, 45], [1947, 496, 45, 45], [1948, 541, 45, 45], [1949, 586, 45, 45], [1950, 631, 45, 45], [1951, 676, 45, 45], [1952, 721, 45, 45], [1953, 766, 45, 45], [1954, 811, 45, 45], [1955, 856, 45, 45], [1956, 901, 45, 45], [1957, 946, 45, 45], [1958, 991, 45, 45], [1959, 1036, 45, 45], [1960, 1081, 45, 45], [1961, 1126, 45, 45], [1962, 1171, 45, 45], [1963, 1216, 45, 45], [1964, 1261, 45, 45], [1965, 1306, 45, 45], [1966, 1351, 45, 45], [1967, 1396, 45, 45], [1968, 1441, 45, 45], [1969, 1486, 45, 45], [1970, 1531, 45, 45], [1971, 1576, 45, 45], [1972, 1621, 45, 45], [1973, 1666, 45, 45], [1974, 1711, 45, 45], [1975, 1756, 45, 45], [1976, 1801, 45, 45], [1977, 1846, 45, 45], [1978, 1891, 45, 45], [1979, 1936, 45, 45], [1980, 1981, 45, 1], [1981, 0, 44, 45], [1982, 45, 43, 45], [1983, 90, 42, 45], [1984, 135, 41, 45], [1985, 180, 40, 45], [1986, 225, 39, 45], [1987, 270, 38, 45], [1988, 315, 37, 45], [1989, 360, 36, 45], [1990, 405, 35, 45], [1991, 450, 34, 45], [1992, 495, 33, 45], [1993, 540, 32, 45], [1994, 585, 31, 45], [1995, 630, 30, 45], [1996, 675, 29, 45], [1997, 720, 28, 45], [1998, 765, 27, 45], [1999, 810, 26, 45], [2000, 855, 25, 45], [2001, 900, 24, 45], [2002, 945, 23, 45], [2003, 990, 22, 45], [2004, 1035, 21, 45], [2005, 1080, 20, 45], [2006, 1125, 19, 45], [2007, 1170, 18, 45], [2008, 1215, 17, 45], [2009, 1260, 16, 45], [2010, 1305, 15, 45], [2011, 1350, 14, 45], [2012, 1395, 13, 45], [2013, 1440, 12, 45], [2014, 1485, 11, 45], [2015, 1530, 10, 45], [2016, 1575, 9, 45], [2017, 1620, 8, 45], [2018, 1665, 7, 45], [2019, 1710, 6, 45], [2020, 1755, 5, 45], [2021, 1800, 4, 45], [2022, 1845, 3, 45], [2023, 1890, 2, 45], [2024, 1935, 1, 45]]}
|
| 5 |
+
RLMATH_EOF
|
tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/tests/check.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""IMO 2025 Problem 6 variant (AlphaEvolve problem 65): at most T rectangular tiles on an n x n grid, no overlaps,
|
| 2 |
+
every row and every column has exactly one uncovered unit square."""
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
from run import Invalid, int_list
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def check(inst, ans):
|
| 9 |
+
n, cap = inst["n"], inst["max_tiles"]
|
| 10 |
+
tiles = ans.get("tiles")
|
| 11 |
+
if not isinstance(tiles, list) or not (1 <= len(tiles) <= cap):
|
| 12 |
+
raise Invalid(f"tiles must be a list of 1..{cap} [row, col, height, width] entries")
|
| 13 |
+
cover = np.zeros((n, n), dtype=np.int32)
|
| 14 |
+
for t in tiles:
|
| 15 |
+
r, c, h, w = int_list(t, 4, 0, n, "tile")
|
| 16 |
+
if h < 1 or w < 1 or r + h > n or c + w > n:
|
| 17 |
+
raise Invalid(f"tile {t} is empty or leaves the grid")
|
| 18 |
+
cover[r:r + h, c:c + w] += 1
|
| 19 |
+
if cover.max() > 1:
|
| 20 |
+
raise Invalid("tiles overlap")
|
| 21 |
+
free = cover == 0
|
| 22 |
+
if not (free.sum(axis=1) == 1).all() or not (free.sum(axis=0) == 1).all():
|
| 23 |
+
raise Invalid("some row or column does not have exactly one uncovered square")
|
| 24 |
+
return None, {"tiles": len(tiles)}
|
tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/tests/instance.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"n": 2025, "max_tiles": 2112, "family": "ae_p65_imo2025_p6_tiling", "subset": "construct"}
|
tasks/construct-ae-p65-imo2025-p6-tiling-l6-s0/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-p65-imo2025-p6-tiling-l6-s0/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-mc-all-interval-l1-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
|