diff --git a/129/instruction.md b/129/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..09d86b73aec2ec5d8dd20e26d886bbeb1d705f88 --- /dev/null +++ b/129/instruction.md @@ -0,0 +1,3 @@ +# MBPP 129 + +Write a function to calculate whether the matrix is a magic square. diff --git a/129/solution/__init__.py b/129/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/129/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/129/solution/_reference.py b/129/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..e53916d813f64695d8c842ebaf0d8dfa1f826a53 --- /dev/null +++ b/129/solution/_reference.py @@ -0,0 +1,18 @@ + +def magic_square_test(my_matrix): + iSize = len(my_matrix[0]) + sum_list = [] + sum_list.extend([sum (lines) for lines in my_matrix]) + for col in range(iSize): + sum_list.append(sum(row[col] for row in my_matrix)) + result1 = 0 + for i in range(0,iSize): + result1 +=my_matrix[i][i] + sum_list.append(result1) + result2 = 0 + for i in range(iSize-1,-1,-1): + result2 +=my_matrix[i][i] + sum_list.append(result2) + if len(set(sum_list))>1: + return False + return True \ No newline at end of file diff --git a/129/solution/solution.py b/129/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/129/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/129/solution/solve.sh b/129/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/129/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/129/task.toml b/129/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..755978789bc8687c878059be9085643042f09718 --- /dev/null +++ b/129/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/129" +name = "MBPP — 129" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/129/tests/__init__.py b/129/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/129/tests/conftest.py b/129/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/129/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/129/tests/test_mbpp_1.py b/129/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..8c66af240fbc9bddc931c6ea0a6a4ab54ec4e242 --- /dev/null +++ b/129/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 8]])==True diff --git a/129/tests/test_mbpp_2.py b/129/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..ede3464494f90e3501070aeb7123326d5db8ccde --- /dev/null +++ b/129/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 7]])==False diff --git a/160/instruction.md b/160/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b581958683ac1b5db68f616024ec0dd28eed42a --- /dev/null +++ b/160/instruction.md @@ -0,0 +1,3 @@ +# MBPP 160 + +Write a function that returns integers x and y that satisfy ax + by = n as a tuple, or return None if no solution exists. diff --git a/160/solution/__init__.py b/160/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/160/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/160/solution/_reference.py b/160/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..903c59f5510eb069525c2f5990d1534fc63c8f04 --- /dev/null +++ b/160/solution/_reference.py @@ -0,0 +1,8 @@ + +def find_solution(a, b, n): + i = 0 + while i * a <= n: + if (n - (i * a)) % b == 0: + return (i, (n - (i * a)) // b) + i = i + 1 + return None \ No newline at end of file diff --git a/160/solution/solution.py b/160/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/160/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/160/solution/solve.sh b/160/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/160/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/160/task.toml b/160/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..03fc69fed8bff0a416edfae3e66642010b391684 --- /dev/null +++ b/160/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/160" +name = "MBPP — 160" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/160/tests/__init__.py b/160/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/160/tests/conftest.py b/160/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/160/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/160/tests/test_mbpp_1.py b/160/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..a894ddc4003e080792106a311d5b0039c99eb667 --- /dev/null +++ b/160/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert find_solution(4, 2, 7) == None diff --git a/160/tests/test_mbpp_2.py b/160/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..983273120f9c4e1067726a55ef43883276db792e --- /dev/null +++ b/160/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert find_solution(1, 13, 17) == (4, 1) diff --git a/171/instruction.md b/171/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9988126a73ab0e7dcd4238bccc3f30ee3f502aa4 --- /dev/null +++ b/171/instruction.md @@ -0,0 +1,3 @@ +# MBPP 171 + +Write a function to find the perimeter of a regular pentagon from the length of its sides. diff --git a/171/solution/__init__.py b/171/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/171/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/171/solution/_reference.py b/171/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..8017671de03801bd9a6704892f2ee814bf2e1bd7 --- /dev/null +++ b/171/solution/_reference.py @@ -0,0 +1,5 @@ + +import math +def perimeter_pentagon(a): + perimeter=(5*a) + return perimeter \ No newline at end of file diff --git a/171/solution/solution.py b/171/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/171/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/171/solution/solve.sh b/171/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/171/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/171/task.toml b/171/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3fcb46c4f391ddb70c24b15f03c505de5a1b74db --- /dev/null +++ b/171/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/171" +name = "MBPP — 171" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/171/tests/__init__.py b/171/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/171/tests/conftest.py b/171/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/171/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/171/tests/test_mbpp_0.py b/171/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..36a112a1d298192c5fe00793683f89e939f9b1e5 --- /dev/null +++ b/171/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert perimeter_pentagon(5) == 25 diff --git a/171/tests/test_mbpp_1.py b/171/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..bdf59d965ad2e5cc30e892584f5b4fac69a7473a --- /dev/null +++ b/171/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert perimeter_pentagon(10) == 50 diff --git a/171/tests/test_mbpp_2.py b/171/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..1e0f12d4b03b2572e0494a3daedf350032962de2 --- /dev/null +++ b/171/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert perimeter_pentagon(15) == 75 diff --git a/223/task.toml b/223/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f15ae5ceac0e4f5ed1a53da4acb05d5623b1a23c --- /dev/null +++ b/223/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/223" +name = "MBPP — 223" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/240/instruction.md b/240/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2ff8c0a0b4da8bbe835ac2b858bd1158f94541b2 --- /dev/null +++ b/240/instruction.md @@ -0,0 +1,3 @@ +# MBPP 240 + +Write a function that takes in two lists and replaces the last element of the first list with the elements of the second list. diff --git a/240/solution/__init__.py b/240/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/240/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/240/solution/_reference.py b/240/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..c42875bca8f8ff14d4c881af06329283d7990d96 --- /dev/null +++ b/240/solution/_reference.py @@ -0,0 +1,5 @@ + +def replace_list(list1,list2): + list1[-1:] = list2 + replace_list=list1 + return replace_list diff --git a/240/solution/solution.py b/240/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/240/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/240/solution/solve.sh b/240/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/240/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/240/task.toml b/240/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f07ee0d29c52cdddfa617159f521c1658f3b1576 --- /dev/null +++ b/240/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/240" +name = "MBPP — 240" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/240/tests/__init__.py b/240/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/240/tests/conftest.py b/240/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/240/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/240/tests/test_mbpp_0.py b/240/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..f97d8ccb25cfe890c41299c407788ee2a013c20a --- /dev/null +++ b/240/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert replace_list([1, 3, 5, 7, 9, 10],[2, 4, 6, 8])==[1, 3, 5, 7, 9, 2, 4, 6, 8] diff --git a/240/tests/test_mbpp_1.py b/240/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..6ee070ab2180bf33a9438cf6213712c24b2128c2 --- /dev/null +++ b/240/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert replace_list([1,2,3,4,5],[5,6,7,8])==[1,2,3,4,5,6,7,8] diff --git a/240/tests/test_mbpp_2.py b/240/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..29135b3efcda52d78e0ff17cb56eca418926a6f2 --- /dev/null +++ b/240/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert replace_list(["red","blue","green"],["yellow"])==["red","blue","yellow"] diff --git a/246/instruction.md b/246/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..513e788765022f5e7951989fa7112361dbd01325 --- /dev/null +++ b/246/instruction.md @@ -0,0 +1,3 @@ +# MBPP 246 + +Write a function for computing square roots using the babylonian method. diff --git a/246/solution/__init__.py b/246/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/246/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/246/solution/_reference.py b/246/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..0b5bf86b3cc68a2db31fde4cc07239122e559f09 --- /dev/null +++ b/246/solution/_reference.py @@ -0,0 +1,11 @@ +import math +def babylonian_squareroot(number): + if(number == 0): + return 0; + g = number/2.0; + g2 = g + 1; + while(g != g2): + n = number/ g; + g2 = g; + g = (g + n)/2; + return g; \ No newline at end of file diff --git a/246/solution/solution.py b/246/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/246/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/246/solution/solve.sh b/246/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/246/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/246/task.toml b/246/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..49be796968af6313d6f4bb334d38e8a256a3df6d --- /dev/null +++ b/246/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/246" +name = "MBPP — 246" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/246/tests/__init__.py b/246/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/246/tests/conftest.py b/246/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/246/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/246/tests/test_mbpp_0.py b/246/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..9b62f2d446b6929982be0abbef6d0117cd585b51 --- /dev/null +++ b/246/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert math.isclose(babylonian_squareroot(10), 3.162277660168379, rel_tol=0.001) diff --git a/246/tests/test_mbpp_1.py b/246/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..443bb72a139cfc83d6c805fabaa83850e0de7cae --- /dev/null +++ b/246/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert math.isclose(babylonian_squareroot(2), 1.414213562373095, rel_tol=0.001) diff --git a/246/tests/test_mbpp_2.py b/246/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..308e1529640d98d77b9b068018ddb81f49b0f2a8 --- /dev/null +++ b/246/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert math.isclose(babylonian_squareroot(9), 3.0, rel_tol=0.001) diff --git a/257/instruction.md b/257/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0bb25bcea7dd306d52b8681d3d20795d78e939ad --- /dev/null +++ b/257/instruction.md @@ -0,0 +1,3 @@ +# MBPP 257 + +Write a function that takes in two numbers and returns a tuple with the second number and then the first number. diff --git a/257/solution/__init__.py b/257/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/257/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/257/solution/_reference.py b/257/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..22cc26a8e29dab39243bebdd65acc8086b7c3a89 --- /dev/null +++ b/257/solution/_reference.py @@ -0,0 +1,6 @@ + +def swap_numbers(a,b): + temp = a + a = b + b = temp + return (a,b) \ No newline at end of file diff --git a/257/solution/solution.py b/257/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/257/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/257/solution/solve.sh b/257/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/257/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/257/task.toml b/257/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ec711986ad285a4cb0e4f0ee9b210f92341e1981 --- /dev/null +++ b/257/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/257" +name = "MBPP — 257" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/257/tests/__init__.py b/257/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/257/tests/test_mbpp_0.py b/257/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..7d4d629a35df531246828d9737df02fef76b56c6 --- /dev/null +++ b/257/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert swap_numbers(10,20)==(20,10) diff --git a/257/tests/test_mbpp_1.py b/257/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..dac7e3d9c7b6c936ca585b752bea4a09a77fb4ce --- /dev/null +++ b/257/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert swap_numbers(15,17)==(17,15) diff --git a/257/tests/test_mbpp_2.py b/257/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..95d2faf4d499b6d3867462765b8f3765f0236a94 --- /dev/null +++ b/257/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert swap_numbers(100,200)==(200,100) diff --git a/266/instruction.md b/266/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5bce0a4c956f0e5e90fbcc485548ffd59947a2a6 --- /dev/null +++ b/266/instruction.md @@ -0,0 +1,3 @@ +# MBPP 266 + +Write a function to find the lateral surface area of a cube given its side length. diff --git a/266/solution/__init__.py b/266/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/266/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/266/solution/_reference.py b/266/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..467223154473d1400f64e2fee195d884bab13219 --- /dev/null +++ b/266/solution/_reference.py @@ -0,0 +1,4 @@ + +def lateralsurface_cube(l): + LSA = 4 * (l * l) + return LSA \ No newline at end of file diff --git a/266/solution/solution.py b/266/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/266/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/266/solution/solve.sh b/266/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/266/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/266/task.toml b/266/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ff878e0e0714b129d2e5271d19e235b2727a4a7b --- /dev/null +++ b/266/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/266" +name = "MBPP — 266" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/266/tests/__init__.py b/266/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/266/tests/conftest.py b/266/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/266/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/266/tests/test_mbpp_0.py b/266/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c7bb4e373825e233c9cc9acfaf26e0c0513248b3 --- /dev/null +++ b/266/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert lateralsurface_cube(5)==100 diff --git a/266/tests/test_mbpp_1.py b/266/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..506610291f6f9ac5b1383ef6d8e7a24bf6274ddc --- /dev/null +++ b/266/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert lateralsurface_cube(9)==324 diff --git a/266/tests/test_mbpp_2.py b/266/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..1998b1f98d661e7a6cf66cdd82bda631fd86074f --- /dev/null +++ b/266/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert lateralsurface_cube(10)==400 diff --git a/305/instruction.md b/305/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..222421f47435a365f95236e7fa31e32fc102e202 --- /dev/null +++ b/305/instruction.md @@ -0,0 +1,3 @@ +# MBPP 305 + +Write a function to return two words from a list of words starting with letter 'p'. diff --git a/305/solution/__init__.py b/305/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/305/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/305/solution/_reference.py b/305/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..c3bc9f079b96236dcf6405ca136f1598a896e364 --- /dev/null +++ b/305/solution/_reference.py @@ -0,0 +1,7 @@ + +import re +def start_withp(words): + for w in words: + m = re.match("(P\w+)\W(P\w+)", w) + if m: + return m.groups() \ No newline at end of file diff --git a/305/solution/solution.py b/305/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/305/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/305/solution/solve.sh b/305/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/305/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/305/task.toml b/305/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2d3a2dd198ae2e44ffa206e5ffc8033be9a12c44 --- /dev/null +++ b/305/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/305" +name = "MBPP — 305" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/312/instruction.md b/312/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c41bc0a119b267ce0cfc25c215d779705e039ddb --- /dev/null +++ b/312/instruction.md @@ -0,0 +1,3 @@ +# MBPP 312 + +Write a function to find the volume of a cone. diff --git a/312/solution/__init__.py b/312/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/312/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/312/solution/_reference.py b/312/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..f3c797e768d2c96555e59bf60f0289ddee1566c3 --- /dev/null +++ b/312/solution/_reference.py @@ -0,0 +1,5 @@ +import math +import math +def volume_cone(r,h): + volume = (1.0/3) * math.pi * r * r * h + return volume \ No newline at end of file diff --git a/312/solution/solution.py b/312/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/312/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/312/solution/solve.sh b/312/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/312/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/312/task.toml b/312/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4778a6b8189e46dad4122e7861d80a2ec2be03b8 --- /dev/null +++ b/312/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/312" +name = "MBPP — 312" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/312/tests/__init__.py b/312/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/312/tests/conftest.py b/312/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/312/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/312/tests/test_mbpp_0.py b/312/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..518619e8a23304ecfd93eddb20ba61412fce9a71 --- /dev/null +++ b/312/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert math.isclose(volume_cone(5,12), 314.15926535897927, rel_tol=0.001) diff --git a/312/tests/test_mbpp_1.py b/312/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..cf17d2bc73616cdda785d3a85914bfcc4e3b87d3 --- /dev/null +++ b/312/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert math.isclose(volume_cone(10,15), 1570.7963267948965, rel_tol=0.001) diff --git a/312/tests/test_mbpp_2.py b/312/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..d9b5dab53e6a0e98931810f76cc97d90bfacb1d7 --- /dev/null +++ b/312/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert math.isclose(volume_cone(19,17), 6426.651371693521, rel_tol=0.001) diff --git a/408/tests/__init__.py b/408/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/424/instruction.md b/424/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fb04aa74dbb9f3a3434b3afe01915cff95b128d7 --- /dev/null +++ b/424/instruction.md @@ -0,0 +1,3 @@ +# MBPP 424 + +Write a function to extract only the rear index element of each string in the given tuple. diff --git a/424/solution/__init__.py b/424/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/424/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/424/solution/_reference.py b/424/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..202c27f87501cba100ae40d95793b7d2941ef3ec --- /dev/null +++ b/424/solution/_reference.py @@ -0,0 +1,4 @@ + +def extract_rear(test_tuple): + res = list(sub[len(sub) - 1] for sub in test_tuple) + return (res) \ No newline at end of file diff --git a/424/solution/solution.py b/424/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/424/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/424/solution/solve.sh b/424/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/424/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/424/task.toml b/424/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a5e2a69ea2638c54f1eda37d0dcd9392b5d56e2b --- /dev/null +++ b/424/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/424" +name = "MBPP — 424" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/424/tests/__init__.py b/424/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/424/tests/conftest.py b/424/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/424/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/424/tests/test_mbpp_0.py b/424/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..40207b1140942cd86374fda23b118f6d67dd95e3 --- /dev/null +++ b/424/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert extract_rear(('Mers', 'for', 'Vers') ) == ['s', 'r', 's'] diff --git a/424/tests/test_mbpp_1.py b/424/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..06ee408f0e689d201cbaa4ab49ae44fdf6bb3b74 --- /dev/null +++ b/424/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert extract_rear(('Avenge', 'for', 'People') ) == ['e', 'r', 'e'] diff --git a/424/tests/test_mbpp_2.py b/424/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..30855b2c2a18d4bdae9b78b3e4cc4278e882e8c1 --- /dev/null +++ b/424/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert extract_rear(('Gotta', 'get', 'go') ) == ['a', 't', 'o'] diff --git a/438/instruction.md b/438/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..46fae34e44c84efc8bd929503dc61273c7c7b55d --- /dev/null +++ b/438/instruction.md @@ -0,0 +1,3 @@ +# MBPP 438 + +Write a function to count bidirectional tuple pairs. diff --git a/438/solution/__init__.py b/438/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/438/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/438/solution/_reference.py b/438/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..c46b9f51c87ae8838a0209a5037f529ab2a6cf3a --- /dev/null +++ b/438/solution/_reference.py @@ -0,0 +1,8 @@ + +def count_bidirectional(test_list): + res = 0 + for idx in range(0, len(test_list)): + for iidx in range(idx + 1, len(test_list)): + if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]: + res += 1 + return res \ No newline at end of file diff --git a/438/solution/solution.py b/438/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/438/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/438/solution/solve.sh b/438/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/438/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/438/task.toml b/438/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d2a5c32eccedcbe50fe3e3ca7749b24d18a16671 --- /dev/null +++ b/438/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/438" +name = "MBPP — 438" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/438/tests/__init__.py b/438/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/438/tests/conftest.py b/438/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/438/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/438/tests/test_mbpp_1.py b/438/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..8b6ba114cb092ed4567278d4855bf04887ffcbd3 --- /dev/null +++ b/438/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert count_bidirectional([(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ) == 2 diff --git a/445/instruction.md b/445/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fdf69931309352c356f531fad5cff8ac98fa831f --- /dev/null +++ b/445/instruction.md @@ -0,0 +1,3 @@ +# MBPP 445 + +Write a function to perform index wise multiplication of tuple elements in the given two tuples. diff --git a/445/solution/__init__.py b/445/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/445/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/445/solution/_reference.py b/445/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4ff818acb04943750fb208c07dcb6bc7475da534 --- /dev/null +++ b/445/solution/_reference.py @@ -0,0 +1,5 @@ + +def index_multiplication(test_tup1, test_tup2): + res = tuple(tuple(a * b for a, b in zip(tup1, tup2)) + for tup1, tup2 in zip(test_tup1, test_tup2)) + return (res) \ No newline at end of file diff --git a/445/solution/solution.py b/445/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/445/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/445/solution/solve.sh b/445/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/445/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/445/task.toml b/445/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6b0fd492c2f90d3bafedba8e3a4a470ae5fb8e0a --- /dev/null +++ b/445/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/445" +name = "MBPP — 445" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/445/tests/__init__.py b/445/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/445/tests/conftest.py b/445/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/445/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/445/tests/test_mbpp_0.py b/445/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..ef5548a96477909315e3dbf46f99b6a85e916a07 --- /dev/null +++ b/445/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert index_multiplication(((1, 3), (4, 5), (2, 9), (1, 10)),((6, 7), (3, 9), (1, 1), (7, 3)) ) == ((6, 21), (12, 45), (2, 9), (7, 30)) diff --git a/445/tests/test_mbpp_1.py b/445/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..a9ae549c0c96b99a73a91e8da9dc22515ca5ff47 --- /dev/null +++ b/445/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert index_multiplication(((2, 4), (5, 6), (3, 10), (2, 11)),((7, 8), (4, 10), (2, 2), (8, 4)) ) == ((14, 32), (20, 60), (6, 20), (16, 44)) diff --git a/445/tests/test_mbpp_2.py b/445/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..3173accf266053fb3ef31ede5c316231d0d93617 --- /dev/null +++ b/445/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert index_multiplication(((3, 5), (6, 7), (4, 11), (3, 12)),((8, 9), (5, 11), (3, 3), (9, 5)) ) == ((24, 45), (30, 77), (12, 33), (27, 60)) diff --git a/450/instruction.md b/450/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0baf87e2683a48d10a94c01c2ec4e21ed3760fde --- /dev/null +++ b/450/instruction.md @@ -0,0 +1,3 @@ +# MBPP 450 + +Write a function to extract specified size of strings from a given list of string values. diff --git a/450/solution/__init__.py b/450/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/450/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/450/solution/_reference.py b/450/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..7d2e1b3b3809f8be6fce9da710b32364bc7641ca --- /dev/null +++ b/450/solution/_reference.py @@ -0,0 +1,4 @@ + +def extract_string(str, l): + result = [e for e in str if len(e) == l] + return result \ No newline at end of file diff --git a/450/solution/solution.py b/450/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/450/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/450/solution/solve.sh b/450/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/450/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/450/task.toml b/450/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8e0eff7bd05e93db4b587ceb53d64df12cc1645a --- /dev/null +++ b/450/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/450" +name = "MBPP — 450" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/450/tests/__init__.py b/450/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/450/tests/conftest.py b/450/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/450/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/450/tests/test_mbpp_0.py b/450/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..bcc6f9c4ff1ab005cb88bdba70f9a3d3bec2321d --- /dev/null +++ b/450/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,8)==['practice', 'solution'] diff --git a/450/tests/test_mbpp_1.py b/450/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..80410820c1e4e1a70a583346a30238ef32895cd6 --- /dev/null +++ b/450/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,6)==['Python'] diff --git a/450/tests/test_mbpp_2.py b/450/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..ef612153bd55bca9a66f55c82cbae374969f3fe1 --- /dev/null +++ b/450/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert extract_string(['Python', 'list', 'exercises', 'practice', 'solution'] ,9)==['exercises'] diff --git a/474/instruction.md b/474/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1eb903f3d43dc1ac38fdc1821fcd74be21a8ad8b --- /dev/null +++ b/474/instruction.md @@ -0,0 +1,3 @@ +# MBPP 474 + +Write a function to replace characters in a string. diff --git a/474/solution/__init__.py b/474/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/474/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/474/solution/_reference.py b/474/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..23052eb64f42d1dc4db9b607a1beadf5e8c84f42 --- /dev/null +++ b/474/solution/_reference.py @@ -0,0 +1,4 @@ + +def replace_char(str1,ch,newch): + str2 = str1.replace(ch, newch) + return str2 \ No newline at end of file diff --git a/474/solution/solution.py b/474/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/474/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/474/solution/solve.sh b/474/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/474/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/474/task.toml b/474/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..24a10ab29d6e8c83a082ad8f2d7080e98f6ec19e --- /dev/null +++ b/474/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/474" +name = "MBPP — 474" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/474/tests/__init__.py b/474/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/474/tests/conftest.py b/474/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/474/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/474/tests/test_mbpp_0.py b/474/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..47b033f5c85a3506a3bc7999be4e6693ee33052a --- /dev/null +++ b/474/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert replace_char("polygon",'y','l')==("pollgon") diff --git a/474/tests/test_mbpp_1.py b/474/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..90879be6350b40902c948f9c70d83c4e8974a3cb --- /dev/null +++ b/474/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert replace_char("character",'c','a')==("aharaater") diff --git a/474/tests/test_mbpp_2.py b/474/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..52d080706d35a6144f719490644ed72e1f92aedd --- /dev/null +++ b/474/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert replace_char("python",'l','a')==("python") diff --git a/63/instruction.md b/63/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..57640dd54cac8168a845316df641183c65a458b8 --- /dev/null +++ b/63/instruction.md @@ -0,0 +1,3 @@ +# MBPP 63 + +Write a function to find the maximum difference between available pairs in the given tuple list. diff --git a/63/solution/__init__.py b/63/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/63/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/63/solution/_reference.py b/63/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..6676705f658c51386ad5d92c2ed5f5085e3ba2c6 --- /dev/null +++ b/63/solution/_reference.py @@ -0,0 +1,5 @@ + +def max_difference(test_list): + temp = [abs(b - a) for a, b in test_list] + res = max(temp) + return (res) \ No newline at end of file diff --git a/63/solution/solution.py b/63/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/63/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/63/solution/solve.sh b/63/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/63/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/63/task.toml b/63/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f361280aa4676d03458e9b9a13b075b426bc4798 --- /dev/null +++ b/63/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/63" +name = "MBPP — 63" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/63/tests/__init__.py b/63/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/63/tests/conftest.py b/63/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/63/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/63/tests/test_mbpp_0.py b/63/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..e60a2272d3fc60c0c9efd03573089386d319a542 --- /dev/null +++ b/63/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert max_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7 diff --git a/63/tests/test_mbpp_1.py b/63/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..50034ea4a5fa6f918794aa96be0b17303b31ac54 --- /dev/null +++ b/63/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert max_difference([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15 diff --git a/63/tests/test_mbpp_2.py b/63/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..efa8a2ef74a58e4d32dbf8ba3d9187f909d13705 --- /dev/null +++ b/63/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert max_difference([(12, 35), (21, 27), (13, 23), (41, 22)]) == 23 diff --git a/71/solution/__init__.py b/71/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/71/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/71/solution/_reference.py b/71/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..c03ae151e0160da4c3eae68206f79405fc82906c --- /dev/null +++ b/71/solution/_reference.py @@ -0,0 +1,16 @@ + +def comb_sort(nums): + shrink_fact = 1.3 + gaps = len(nums) + swapped = True + i = 0 + while gaps > 1 or swapped: + gaps = int(float(gaps) / shrink_fact) + swapped = False + i = 0 + while gaps + i < len(nums): + if nums[i] > nums[i+gaps]: + nums[i], nums[i+gaps] = nums[i+gaps], nums[i] + swapped = True + i += 1 + return nums \ No newline at end of file diff --git a/71/solution/solve.sh b/71/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/71/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/71/tests/__init__.py b/71/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/71/tests/test_mbpp_0.py b/71/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..5aed69305dbc8a391d2cdf2fbf11bbd5ec20f88c --- /dev/null +++ b/71/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert comb_sort([5, 15, 37, 25, 79]) == [5, 15, 25, 37, 79] diff --git a/71/tests/test_mbpp_1.py b/71/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..02e02e8a2823e85e416e844d33257876da280f06 --- /dev/null +++ b/71/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert comb_sort([41, 32, 15, 19, 22]) == [15, 19, 22, 32, 41] diff --git a/71/tests/test_mbpp_2.py b/71/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..8042af0e734c705ed5b4c391bf5c384a6e130003 --- /dev/null +++ b/71/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert comb_sort([99, 15, 13, 47]) == [13, 15, 47, 99] diff --git a/79/solution/_reference.py b/79/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..902ea1c32c31d82700d28aa286ecdd310b4387be --- /dev/null +++ b/79/solution/_reference.py @@ -0,0 +1,8 @@ + +def word_len(s): + s = s.split(' ') + for word in s: + if len(word)%2!=0: + return True + else: + return False \ No newline at end of file diff --git a/79/tests/conftest.py b/79/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/79/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/79/tests/test_mbpp_2.py b/79/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..0bee7554de9385a8ebe8e631dd5c6f414b43e56d --- /dev/null +++ b/79/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert word_len("structure") == True diff --git a/90/instruction.md b/90/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..306edbca9603105a6d41735b235ba228e968bcbf --- /dev/null +++ b/90/instruction.md @@ -0,0 +1,3 @@ +# MBPP 90 + +Write a python function to find the length of the longest word. diff --git a/90/solution/__init__.py b/90/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/90/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/90/solution/_reference.py b/90/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..6bd7c704c3f9bd801c5db08bdf7c04639e067d29 --- /dev/null +++ b/90/solution/_reference.py @@ -0,0 +1,7 @@ + +def len_log(list1): + max=len(list1[0]) + for i in list1: + if len(i)>max: + max=len(i) + return max \ No newline at end of file diff --git a/90/solution/solution.py b/90/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/90/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/90/solution/solve.sh b/90/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/90/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/90/task.toml b/90/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a326eb915b0fb11b0c96ced55a9fa7ef75e821ce --- /dev/null +++ b/90/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/90" +name = "MBPP — 90" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/90/tests/__init__.py b/90/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/90/tests/conftest.py b/90/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/90/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/90/tests/test_mbpp_0.py b/90/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..a0da9c8bceafbcfe865e7ac2413357849e1794c6 --- /dev/null +++ b/90/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert len_log(["python","PHP","bigdata"]) == 7 diff --git a/90/tests/test_mbpp_1.py b/90/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..36a0bf2606408bdc781f8994521f86d03d698c0f --- /dev/null +++ b/90/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert len_log(["a","ab","abc"]) == 3 diff --git a/90/tests/test_mbpp_2.py b/90/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..3918e64e109733b18bf64b3369a9fec486aff791 --- /dev/null +++ b/90/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert len_log(["small","big","tall"]) == 5 diff --git a/96/instruction.md b/96/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..11c482269b6d11c901c961110cf354d389b5e8bc --- /dev/null +++ b/96/instruction.md @@ -0,0 +1,3 @@ +# MBPP 96 + +Write a python function to find the number of divisors of a given integer. diff --git a/96/solution/__init__.py b/96/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/96/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/96/solution/_reference.py b/96/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..f92d5d0b91e3853393073d75d5286ba5db03dffe --- /dev/null +++ b/96/solution/_reference.py @@ -0,0 +1,5 @@ + +def divisor(n): + for i in range(n): + x = len([i for i in range(1,n+1) if not n % i]) + return x \ No newline at end of file diff --git a/96/solution/solution.py b/96/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/96/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/96/solution/solve.sh b/96/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/96/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/96/task.toml b/96/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fa8f1e99106c6e054e210f73e2471dba0173d7c5 --- /dev/null +++ b/96/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/96" +name = "MBPP — 96" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/96/tests/__init__.py b/96/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/96/tests/conftest.py b/96/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/96/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/96/tests/test_mbpp_0.py b/96/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..0c719ee5e41c05a18e23b3fe3a242b3ba6de2795 --- /dev/null +++ b/96/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert divisor(15) == 4 diff --git a/96/tests/test_mbpp_1.py b/96/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..325ccf30dfd19f3f005fa62d5ce12f50adb1459c --- /dev/null +++ b/96/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert divisor(12) == 6 diff --git a/96/tests/test_mbpp_2.py b/96/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..c993404a45b4fe5678176312ec408d578254f505 --- /dev/null +++ b/96/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert divisor(9) == 3 diff --git a/98/instruction.md b/98/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4da34ea274cba39020c9b9319d86804656732486 --- /dev/null +++ b/98/instruction.md @@ -0,0 +1,3 @@ +# MBPP 98 + +Write a function to multiply all the numbers in a list and divide with the length of the list. diff --git a/98/solution/__init__.py b/98/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/98/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/98/solution/_reference.py b/98/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4cc25b545960d271d664c7dba40c89cd98251529 --- /dev/null +++ b/98/solution/_reference.py @@ -0,0 +1,6 @@ +import math +def multiply_num(numbers): + total = 1 + for x in numbers: + total *= x + return total/len(numbers) \ No newline at end of file diff --git a/98/solution/solution.py b/98/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/98/solution/solution.py @@ -0,0 +1,22 @@ +"""Stub solution module — agents must overwrite this file. + +Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the +canonical upstream solution at `solution/_reference.py` and this +stub at `solution/solution.py`. The pytest verifier imports from +`solution.solution`, so any attempt to run the tests against this +stub fails loudly with NotImplementedError instead of silently +passing on a pre-shipped answer. + +- Non-oracle agents: must overwrite `solution.py` with their own + attempt (the file the pytest tests import from). +- OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`) + copies `_reference.py` over `solution.py` before the verifier runs, + so oracle smoke trials still pass. +""" + +def __getattr__(name: str): + raise NotImplementedError( + f"solution.solution.{name!r} not implemented — the agent must " + f"replace this file with a real solution. Oracle agents do " + f"this via solve.sh, which copies _reference.py." + ) diff --git a/98/solution/solve.sh b/98/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/98/solution/solve.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +HERE="$(dirname "$0")" +if [ -f "$HERE/_reference.py" ]; then + cd "$HERE" +elif [ -f "$HERE/solution/_reference.py" ]; then + cd "$HERE/solution" +else + echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2 + exit 1 +fi +cp -f _reference.py solution.py diff --git a/98/task.toml b/98/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..39bd1126605166e4bd1bf085ac8617dba0400f3f --- /dev/null +++ b/98/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/98" +name = "MBPP — 98" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/98/tests/__init__.py b/98/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/98/tests/conftest.py b/98/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/98/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/98/tests/test_mbpp_0.py b/98/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..0869c61b92f7d4faf5cb6ae4cf8129822cb37ba2 --- /dev/null +++ b/98/tests/test_mbpp_0.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_0() -> None: + assert math.isclose(multiply_num((8, 2, 3, -1, 7)), -67.2, rel_tol=0.001) diff --git a/98/tests/test_mbpp_1.py b/98/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..2b4288fca01cec4d5438d6b9a56024dfc76c0313 --- /dev/null +++ b/98/tests/test_mbpp_1.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_1() -> None: + assert math.isclose(multiply_num((-10,-20,-30)), -2000.0, rel_tol=0.001) diff --git a/98/tests/test_mbpp_2.py b/98/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..677e80b3b17aecd294b432f8c1f2100bc16a9e01 --- /dev/null +++ b/98/tests/test_mbpp_2.py @@ -0,0 +1,6 @@ +# Auto-generated by loom_benchmarks.util.pytest_from_test_strings. +from solution import * # noqa: F401,F403 + + +def test_mbpp_2() -> None: + assert math.isclose(multiply_num((19,15,18)), 1710.0, rel_tol=0.001)