Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- 100/instruction.md +3 -0
- 100/solution/__init__.py +1 -0
- 100/solution/_reference.py +7 -0
- 100/solution/solution.py +22 -0
- 100/solution/solve.sh +12 -0
- 100/task.toml +19 -0
- 100/tests/__init__.py +0 -0
- 100/tests/conftest.py +3 -0
- 100/tests/test_mbpp_0.py +6 -0
- 100/tests/test_mbpp_1.py +6 -0
- 100/tests/test_mbpp_2.py +6 -0
- 108/instruction.md +3 -0
- 108/solution/__init__.py +1 -0
- 108/solution/_reference.py +8 -0
- 108/solution/solution.py +22 -0
- 108/solution/solve.sh +12 -0
- 108/task.toml +19 -0
- 108/tests/__init__.py +0 -0
- 108/tests/conftest.py +3 -0
- 108/tests/test_mbpp_0.py +6 -0
- 108/tests/test_mbpp_1.py +6 -0
- 108/tests/test_mbpp_2.py +6 -0
- 113/instruction.md +3 -0
- 113/solution/__init__.py +1 -0
- 113/solution/_reference.py +13 -0
- 113/solution/solution.py +22 -0
- 113/solution/solve.sh +12 -0
- 113/task.toml +19 -0
- 113/tests/__init__.py +0 -0
- 113/tests/conftest.py +3 -0
- 113/tests/test_mbpp_0.py +6 -0
- 113/tests/test_mbpp_1.py +6 -0
- 113/tests/test_mbpp_2.py +6 -0
- 116/instruction.md +3 -0
- 120/instruction.md +3 -0
- 120/solution/__init__.py +1 -0
- 120/solution/_reference.py +4 -0
- 120/solution/solution.py +22 -0
- 120/solution/solve.sh +12 -0
- 120/task.toml +19 -0
- 120/tests/__init__.py +0 -0
- 120/tests/conftest.py +3 -0
- 120/tests/test_mbpp_0.py +6 -0
- 120/tests/test_mbpp_1.py +6 -0
- 120/tests/test_mbpp_2.py +6 -0
- 127/instruction.md +3 -0
- 127/task.toml +19 -0
- 130/instruction.md +3 -0
- 130/solution/__init__.py +1 -0
- 130/solution/_reference.py +8 -0
100/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 100
|
| 2 |
+
|
| 3 |
+
Write a function to find the next smallest palindrome of a specified integer, returned as an integer.
|
100/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
100/solution/_reference.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import sys
|
| 3 |
+
def next_smallest_palindrome(num):
|
| 4 |
+
numstr = str(num)
|
| 5 |
+
for i in range(num+1,sys.maxsize):
|
| 6 |
+
if str(i) == str(i)[::-1]:
|
| 7 |
+
return i
|
100/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
100/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
100/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/100"
|
| 5 |
+
name = "MBPP — 100"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
100/tests/__init__.py
ADDED
|
File without changes
|
100/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
100/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert next_smallest_palindrome(99)==101
|
100/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert next_smallest_palindrome(1221)==1331
|
100/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert next_smallest_palindrome(120)==121
|
108/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 108
|
| 2 |
+
|
| 3 |
+
Write a function to merge three lists into a single sorted list.
|
108/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
108/solution/_reference.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import heapq
|
| 3 |
+
def merge_sorted_list(num1,num2,num3):
|
| 4 |
+
num1=sorted(num1)
|
| 5 |
+
num2=sorted(num2)
|
| 6 |
+
num3=sorted(num3)
|
| 7 |
+
result = heapq.merge(num1,num2,num3)
|
| 8 |
+
return list(result)
|
108/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
108/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
108/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/108"
|
| 5 |
+
name = "MBPP — 108"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
108/tests/__init__.py
ADDED
|
File without changes
|
108/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
108/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert merge_sorted_list([25, 24, 15, 4, 5, 29, 110],[19, 20, 11, 56, 25, 233, 154],[24, 26, 54, 48])==[4, 5, 11, 15, 19, 20, 24, 24, 25, 25, 26, 29, 48, 54, 56, 110, 154, 233]
|
108/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert merge_sorted_list([1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12])==[1, 1, 2, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 11, 12]
|
108/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert merge_sorted_list([18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1],[25, 35, 22, 85, 14, 65, 75, 25, 58],[12, 74, 9, 50, 61, 41])==[1, 2, 3, 4, 7, 8, 9, 9, 9, 10, 12, 14, 14, 18, 22, 25, 25, 35, 41, 50, 58, 61, 65, 74, 75, 85]
|
113/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 113
|
| 2 |
+
|
| 3 |
+
Write a function to check if a string represents an integer or not.
|
113/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
113/solution/_reference.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def check_integer(text):
|
| 3 |
+
text = text.strip()
|
| 4 |
+
if len(text) < 1:
|
| 5 |
+
return None
|
| 6 |
+
else:
|
| 7 |
+
if all(text[i] in "0123456789" for i in range(len(text))):
|
| 8 |
+
return True
|
| 9 |
+
elif (text[0] in "+-") and \
|
| 10 |
+
all(text[i] in "0123456789" for i in range(1,len(text))):
|
| 11 |
+
return True
|
| 12 |
+
else:
|
| 13 |
+
return False
|
113/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
113/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
113/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/113"
|
| 5 |
+
name = "MBPP — 113"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
113/tests/__init__.py
ADDED
|
File without changes
|
113/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
113/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert check_integer("python")==False
|
113/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert check_integer("1")==True
|
113/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert check_integer("12345")==True
|
116/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 116
|
| 2 |
+
|
| 3 |
+
Write a function to convert a given tuple of positive integers into a single integer.
|
120/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 120
|
| 2 |
+
|
| 3 |
+
Write a function to find the maximum absolute product between numbers in pairs of tuples within a given list.
|
120/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
120/solution/_reference.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
def max_product_tuple(list1):
|
| 3 |
+
result_max = max([abs(x * y) for x, y in list1] )
|
| 4 |
+
return result_max
|
120/solution/solution.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Stub solution module — agents must overwrite this file.
|
| 2 |
+
|
| 3 |
+
Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
|
| 4 |
+
canonical upstream solution at `solution/_reference.py` and this
|
| 5 |
+
stub at `solution/solution.py`. The pytest verifier imports from
|
| 6 |
+
`solution.solution`, so any attempt to run the tests against this
|
| 7 |
+
stub fails loudly with NotImplementedError instead of silently
|
| 8 |
+
passing on a pre-shipped answer.
|
| 9 |
+
|
| 10 |
+
- Non-oracle agents: must overwrite `solution.py` with their own
|
| 11 |
+
attempt (the file the pytest tests import from).
|
| 12 |
+
- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
|
| 13 |
+
copies `_reference.py` over `solution.py` before the verifier runs,
|
| 14 |
+
so oracle smoke trials still pass.
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __getattr__(name: str):
|
| 18 |
+
raise NotImplementedError(
|
| 19 |
+
f"solution.solution.{name!r} not implemented — the agent must "
|
| 20 |
+
f"replace this file with a real solution. Oracle agents do "
|
| 21 |
+
f"this via solve.sh, which copies _reference.py."
|
| 22 |
+
)
|
120/solution/solve.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
set -eu
|
| 3 |
+
HERE="$(dirname "$0")"
|
| 4 |
+
if [ -f "$HERE/_reference.py" ]; then
|
| 5 |
+
cd "$HERE"
|
| 6 |
+
elif [ -f "$HERE/solution/_reference.py" ]; then
|
| 7 |
+
cd "$HERE/solution"
|
| 8 |
+
else
|
| 9 |
+
echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
|
| 10 |
+
exit 1
|
| 11 |
+
fi
|
| 12 |
+
cp -f _reference.py solution.py
|
120/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/120"
|
| 5 |
+
name = "MBPP — 120"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
120/tests/__init__.py
ADDED
|
File without changes
|
120/tests/conftest.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
120/tests/test_mbpp_0.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_0() -> None:
|
| 6 |
+
assert max_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36
|
120/tests/test_mbpp_1.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_1() -> None:
|
| 6 |
+
assert max_product_tuple([(10,20), (15,2), (5,10)] )==200
|
120/tests/test_mbpp_2.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
|
| 2 |
+
from solution import * # noqa: F401,F403
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def test_mbpp_2() -> None:
|
| 6 |
+
assert max_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==484
|
127/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 127
|
| 2 |
+
|
| 3 |
+
Write a function to multiply two integers.
|
127/task.toml
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
schema_version = "1"
|
| 2 |
+
|
| 3 |
+
[task]
|
| 4 |
+
id = "mbpp/127"
|
| 5 |
+
name = "MBPP — 127"
|
| 6 |
+
|
| 7 |
+
[environment]
|
| 8 |
+
os = "linux"
|
| 9 |
+
docker_image = "python:3.11-slim"
|
| 10 |
+
|
| 11 |
+
[agent]
|
| 12 |
+
name = "oracle"
|
| 13 |
+
|
| 14 |
+
[verifier]
|
| 15 |
+
name = "pytest"
|
| 16 |
+
|
| 17 |
+
[[steps]]
|
| 18 |
+
name = "main"
|
| 19 |
+
artifacts = ["solution/solution.py"]
|
130/instruction.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MBPP 130
|
| 2 |
+
|
| 3 |
+
Write a function to find the item with maximum frequency in a given list.
|
130/solution/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from solution.solution import * # noqa: F401,F403
|
130/solution/_reference.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
from collections import defaultdict
|
| 3 |
+
def max_occurrences(nums):
|
| 4 |
+
dict = defaultdict(int)
|
| 5 |
+
for i in nums:
|
| 6 |
+
dict[i] += 1
|
| 7 |
+
result = max(dict.items(), key=lambda x: x[1])
|
| 8 |
+
return result[0]
|