diff --git a/100/instruction.md b/100/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9d2463596a0b03108c1628e2de214399f3351dfc --- /dev/null +++ b/100/instruction.md @@ -0,0 +1,3 @@ +# MBPP 100 + +Write a function to find the next smallest palindrome of a specified integer, returned as an integer. diff --git a/100/solution/__init__.py b/100/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/100/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/100/solution/_reference.py b/100/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..fa240288ac49d34a56a08713575ab076729e4849 --- /dev/null +++ b/100/solution/_reference.py @@ -0,0 +1,7 @@ + +import sys +def next_smallest_palindrome(num): + numstr = str(num) + for i in range(num+1,sys.maxsize): + if str(i) == str(i)[::-1]: + return i \ No newline at end of file diff --git a/100/solution/solution.py b/100/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/100/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/100/solution/solve.sh b/100/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/100/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/100/task.toml b/100/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..303b296f8b353fa78249e203ad1057fb957b06aa --- /dev/null +++ b/100/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/100" +name = "MBPP — 100" + +[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/100/tests/__init__.py b/100/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/100/tests/conftest.py b/100/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/100/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/100/tests/test_mbpp_0.py b/100/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..d6161919a3542dc011d8b6e29fbd8f666260a32b --- /dev/null +++ b/100/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 next_smallest_palindrome(99)==101 diff --git a/100/tests/test_mbpp_1.py b/100/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c35dae66ba0d929d178405056c0715aa5c1b0bf3 --- /dev/null +++ b/100/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 next_smallest_palindrome(1221)==1331 diff --git a/100/tests/test_mbpp_2.py b/100/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..86b7af11f6ce864828b16cf3b37ae0061f25c90f --- /dev/null +++ b/100/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 next_smallest_palindrome(120)==121 diff --git a/108/instruction.md b/108/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..68103e940c86e03e75d62867eebe743adbc7065e --- /dev/null +++ b/108/instruction.md @@ -0,0 +1,3 @@ +# MBPP 108 + +Write a function to merge three lists into a single sorted list. diff --git a/108/solution/__init__.py b/108/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/108/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/108/solution/_reference.py b/108/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4338fa662ac50cb3057641b8d30090ac3c39965e --- /dev/null +++ b/108/solution/_reference.py @@ -0,0 +1,8 @@ + +import heapq +def merge_sorted_list(num1,num2,num3): + num1=sorted(num1) + num2=sorted(num2) + num3=sorted(num3) + result = heapq.merge(num1,num2,num3) + return list(result) \ No newline at end of file diff --git a/108/solution/solution.py b/108/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/108/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/108/solution/solve.sh b/108/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/108/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/108/task.toml b/108/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7f83f8f87fdef0bf66c01dad70ff81ac09cb843a --- /dev/null +++ b/108/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/108" +name = "MBPP — 108" + +[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/108/tests/__init__.py b/108/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/108/tests/conftest.py b/108/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/108/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/108/tests/test_mbpp_0.py b/108/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..912b70babbff0b65709bd4dd6f1476ce2e7b623d --- /dev/null +++ b/108/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 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] diff --git a/108/tests/test_mbpp_1.py b/108/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..d9cdc3b0bbd2283a5db5b6df8f87f37e72f07d73 --- /dev/null +++ b/108/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 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] diff --git a/108/tests/test_mbpp_2.py b/108/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..2af7eb24865405620ffe5553892705b41869b1f9 --- /dev/null +++ b/108/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 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] diff --git a/113/instruction.md b/113/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cf032bc831247e624754793e1c18d322868694cd --- /dev/null +++ b/113/instruction.md @@ -0,0 +1,3 @@ +# MBPP 113 + +Write a function to check if a string represents an integer or not. diff --git a/113/solution/__init__.py b/113/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/113/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/113/solution/_reference.py b/113/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..d8e9b4167ec421ec0e52dcdabc759c2ef1a05e9c --- /dev/null +++ b/113/solution/_reference.py @@ -0,0 +1,13 @@ + +def check_integer(text): + text = text.strip() + if len(text) < 1: + return None + else: + if all(text[i] in "0123456789" for i in range(len(text))): + return True + elif (text[0] in "+-") and \ + all(text[i] in "0123456789" for i in range(1,len(text))): + return True + else: + return False \ No newline at end of file diff --git a/113/solution/solution.py b/113/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/113/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/113/solution/solve.sh b/113/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/113/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/113/task.toml b/113/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f5be0d8b11edc5a41e1ef164ab2446a02ec5bc15 --- /dev/null +++ b/113/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/113" +name = "MBPP — 113" + +[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/113/tests/__init__.py b/113/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/113/tests/conftest.py b/113/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/113/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/113/tests/test_mbpp_0.py b/113/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..afd1de15b6809684f584a4899904b311e3d6a79a --- /dev/null +++ b/113/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 check_integer("python")==False diff --git a/113/tests/test_mbpp_1.py b/113/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..1f718a6e850b01e3ed5d3fb5186b8ebd1da6d76d --- /dev/null +++ b/113/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 check_integer("1")==True diff --git a/113/tests/test_mbpp_2.py b/113/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..8321e6b8ace11b96a7afc278c70c86bbbcc0c6e1 --- /dev/null +++ b/113/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 check_integer("12345")==True diff --git a/116/instruction.md b/116/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b2502724280270d1bdbc8ecf114cedecde97740 --- /dev/null +++ b/116/instruction.md @@ -0,0 +1,3 @@ +# MBPP 116 + +Write a function to convert a given tuple of positive integers into a single integer. diff --git a/120/instruction.md b/120/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8738d0d19ca2805f5e2ec71c82d69e0d2a0dbf74 --- /dev/null +++ b/120/instruction.md @@ -0,0 +1,3 @@ +# MBPP 120 + +Write a function to find the maximum absolute product between numbers in pairs of tuples within a given list. diff --git a/120/solution/__init__.py b/120/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/120/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/120/solution/_reference.py b/120/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..1dc54a674e8a566045aec1b5f28db55b1585e8a3 --- /dev/null +++ b/120/solution/_reference.py @@ -0,0 +1,4 @@ + +def max_product_tuple(list1): + result_max = max([abs(x * y) for x, y in list1] ) + return result_max \ No newline at end of file diff --git a/120/solution/solution.py b/120/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/120/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/120/solution/solve.sh b/120/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/120/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/120/task.toml b/120/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b8f022f533e175bafac45122f97a27733b9695fe --- /dev/null +++ b/120/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/120" +name = "MBPP — 120" + +[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/120/tests/__init__.py b/120/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/120/tests/conftest.py b/120/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/120/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/120/tests/test_mbpp_0.py b/120/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..73cfcaf2ee0c43c1d8f869412fb5d179757d637e --- /dev/null +++ b/120/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_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36 diff --git a/120/tests/test_mbpp_1.py b/120/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..346a93725e82c8f3b2d5b79d0e7515dba96cbce4 --- /dev/null +++ b/120/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_product_tuple([(10,20), (15,2), (5,10)] )==200 diff --git a/120/tests/test_mbpp_2.py b/120/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..d40202efd250a888c494f21f907d0ad73eb599ec --- /dev/null +++ b/120/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_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==484 diff --git a/127/instruction.md b/127/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6dfa66404a71528a7ef28ac52d9acdd131367dbc --- /dev/null +++ b/127/instruction.md @@ -0,0 +1,3 @@ +# MBPP 127 + +Write a function to multiply two integers. diff --git a/127/task.toml b/127/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..946aa049506781213e95a1c79381957292b5a96a --- /dev/null +++ b/127/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/127" +name = "MBPP — 127" + +[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/130/instruction.md b/130/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6f2551abfe5b75601993106a394b3ceaf5ca383e --- /dev/null +++ b/130/instruction.md @@ -0,0 +1,3 @@ +# MBPP 130 + +Write a function to find the item with maximum frequency in a given list. diff --git a/130/solution/__init__.py b/130/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/130/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/130/solution/_reference.py b/130/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..7e380918a00a9d1a5fad26e1fcd177e9d60325d6 --- /dev/null +++ b/130/solution/_reference.py @@ -0,0 +1,8 @@ + +from collections import defaultdict +def max_occurrences(nums): + dict = defaultdict(int) + for i in nums: + dict[i] += 1 + result = max(dict.items(), key=lambda x: x[1]) + return result[0] \ No newline at end of file diff --git a/130/solution/solution.py b/130/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/130/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/130/solution/solve.sh b/130/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/130/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/130/task.toml b/130/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..eb34ba5f0b9a20790b5504bd2ca4e8673c96e0c8 --- /dev/null +++ b/130/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/130" +name = "MBPP — 130" + +[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/130/tests/__init__.py b/130/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/130/tests/conftest.py b/130/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/130/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/130/tests/test_mbpp_0.py b/130/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..f412b51847e92d25428077e1972d8978ffa31697 --- /dev/null +++ b/130/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_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,2,4,6,9,1,2])==2 diff --git a/130/tests/test_mbpp_1.py b/130/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..ea7e1c960fa0734ef25494234f1b14dc1348a65a --- /dev/null +++ b/130/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_occurrences([2,3,8,4,7,9,8,7,9,15,14,10,12,13,16,18])==8 diff --git a/130/tests/test_mbpp_2.py b/130/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..c780adcec7dc58f856e49cf17dd0b2065fa489e2 --- /dev/null +++ b/130/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_occurrences([10,20,20,30,40,90,80,50,30,20,50,10])==20 diff --git a/131/instruction.md b/131/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..67eef3aca8bf6cc402e22d3300a2ba63cc0cfeb2 --- /dev/null +++ b/131/instruction.md @@ -0,0 +1,3 @@ +# MBPP 131 + +Write a python function to reverse only the vowels of a given string (where y is not a vowel). diff --git a/131/solution/__init__.py b/131/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/131/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/131/solution/_reference.py b/131/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..26f73058809967efaa36b86c0739f86d4cb833fe --- /dev/null +++ b/131/solution/_reference.py @@ -0,0 +1,14 @@ + +def reverse_vowels(str1): + vowels = "" + for char in str1: + if char in "aeiouAEIOU": + vowels += char + result_string = "" + for char in str1: + if char in "aeiouAEIOU": + result_string += vowels[-1] + vowels = vowels[:-1] + else: + result_string += char + return result_string \ No newline at end of file diff --git a/131/solution/solution.py b/131/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/131/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/131/solution/solve.sh b/131/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/131/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/131/task.toml b/131/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1028e79f7ad3ad8466d79577de5801a63b71850e --- /dev/null +++ b/131/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/131" +name = "MBPP — 131" + +[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/131/tests/__init__.py b/131/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/131/tests/conftest.py b/131/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/131/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/131/tests/test_mbpp_0.py b/131/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..a3c695abe2e2f63b40b96a5b9896ddbb3c785598 --- /dev/null +++ b/131/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 reverse_vowels("Python") == "Python" diff --git a/131/tests/test_mbpp_1.py b/131/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..4b2a8ef21a95fff585a7bfcdc07697cabb6349ac --- /dev/null +++ b/131/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 reverse_vowels("USA") == "ASU" diff --git a/131/tests/test_mbpp_2.py b/131/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..56165b0477008938f379a50b05f7eda2c3db0a56 --- /dev/null +++ b/131/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 reverse_vowels("ab") == "ab" diff --git a/132/solution/solution.py b/132/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/132/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/132/tests/__init__.py b/132/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/140/instruction.md b/140/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..01934398bf8bd463fa10b25b81ace774efc34aa9 --- /dev/null +++ b/140/instruction.md @@ -0,0 +1,3 @@ +# MBPP 140 + +Write a function to flatten the list of lists into a single set of numbers. diff --git a/140/solution/__init__.py b/140/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/140/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/140/solution/_reference.py b/140/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..e15a93d8335a78c8843ca1bd51b4b89f88a853cf --- /dev/null +++ b/140/solution/_reference.py @@ -0,0 +1,10 @@ + +def extract_singly(test_list): + res = [] + temp = set() + for inner in test_list: + for ele in inner: + if not ele in temp: + temp.add(ele) + res.append(ele) + return (res) \ No newline at end of file diff --git a/140/solution/solution.py b/140/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/140/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/140/solution/solve.sh b/140/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/140/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/140/task.toml b/140/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5c2618ca8a49f31ea9aa25a7177da690f4bb337f --- /dev/null +++ b/140/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/140" +name = "MBPP — 140" + +[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/140/tests/__init__.py b/140/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/140/tests/conftest.py b/140/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/140/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/140/tests/test_mbpp_0.py b/140/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..2b5dd8b2584e346b7ad2df6ef0254395285b1e94 --- /dev/null +++ b/140/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 set(extract_singly([(3, 4, 5), (4, 5, 7), (1, 4)])) == set([3, 4, 5, 7, 1]) diff --git a/140/tests/test_mbpp_1.py b/140/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..ff3ba379094d6e2b76d0945788e7e8b877aafe83 --- /dev/null +++ b/140/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 set(extract_singly([(1, 2, 3), (4, 2, 3), (7, 8)])) == set([1, 2, 3, 4, 7, 8]) diff --git a/140/tests/test_mbpp_2.py b/140/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..4b0dc3af7c52be84f3a81c0fe1fdb37f40fa8ccb --- /dev/null +++ b/140/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 set(extract_singly([(7, 8, 9), (10, 11, 12), (10, 11)])) == set([7, 8, 9, 10, 11, 12]) diff --git a/167/instruction.md b/167/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0d14e06b77c74d33614bb653171635b68cd8e23c --- /dev/null +++ b/167/instruction.md @@ -0,0 +1,3 @@ +# MBPP 167 + +Write a python function to find the smallest power of 2 greater than or equal to n. diff --git a/167/solution/__init__.py b/167/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/167/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/167/solution/_reference.py b/167/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..21fb0ad146c38ae7a3e6eac46d47413afe3a3f52 --- /dev/null +++ b/167/solution/_reference.py @@ -0,0 +1,11 @@ + +def next_power_of_2(n): + if n and not n & (n - 1): + return n + + count = 0 + while n != 0: + n >>= 1 + count += 1 + + return 1 << count; \ No newline at end of file diff --git a/167/solution/solution.py b/167/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/167/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/167/solution/solve.sh b/167/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/167/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/167/task.toml b/167/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..799a66ef60813b77e49837267deef921bcd121b7 --- /dev/null +++ b/167/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/167" +name = "MBPP — 167" + +[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/167/tests/__init__.py b/167/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/167/tests/conftest.py b/167/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/167/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/167/tests/test_mbpp_0.py b/167/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..63b869aafce81761374b30fabb64e7bd0e999edb --- /dev/null +++ b/167/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 next_power_of_2(0) == 1 diff --git a/167/tests/test_mbpp_1.py b/167/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..dcdb4fc5c340c502f46808e14ff80ee98b8c46de --- /dev/null +++ b/167/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 next_power_of_2(5) == 8 diff --git a/167/tests/test_mbpp_2.py b/167/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..4f6b8ab051cfd45ba6fd201be846cc1e26461f47 --- /dev/null +++ b/167/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 next_power_of_2(17) == 32 diff --git a/168/instruction.md b/168/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6bd597d0c5d8d1bc87990c79d36b2fbda93043bb --- /dev/null +++ b/168/instruction.md @@ -0,0 +1,3 @@ +# MBPP 168 + +Write a function to count the number of occurrences of a number in a given list. diff --git a/168/solution/__init__.py b/168/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/168/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/168/solution/_reference.py b/168/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..bf8abc294d8d0c826b14380478ab84aeacf7369b --- /dev/null +++ b/168/solution/_reference.py @@ -0,0 +1,8 @@ + +def frequency(a,x): + count = 0 + for i in a: + if i == x: + count += 1 + + return count \ No newline at end of file diff --git a/168/solution/solution.py b/168/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/168/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/168/solution/solve.sh b/168/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/168/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/168/task.toml b/168/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee094c10beb54d5c8eb4d6080b274313377cb3c3 --- /dev/null +++ b/168/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/168" +name = "MBPP — 168" + +[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/168/tests/conftest.py b/168/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/168/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/168/tests/test_mbpp_0.py b/168/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..f1d8532668b3de9a76b03f178908354914e17d8a --- /dev/null +++ b/168/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 frequency([1,2,3], 4) == 0 diff --git a/168/tests/test_mbpp_1.py b/168/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..0d0640fc735df3bb5ea5ee237f7bba567ef70f21 --- /dev/null +++ b/168/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 frequency([1,2,2,3,3,3,4], 3) == 3 diff --git a/168/tests/test_mbpp_2.py b/168/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..4bb476d0850c0b66dab468006a5c004f865879c2 --- /dev/null +++ b/168/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 frequency([0,1,2,3,1,2], 1) == 2 diff --git a/20/instruction.md b/20/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..22fd894176a9529bc4317b8b8732e46dd2d69032 --- /dev/null +++ b/20/instruction.md @@ -0,0 +1,3 @@ +# MBPP 20 + +Write a function to check if the given number is woodball or not. diff --git a/20/solution/__init__.py b/20/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/20/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/20/solution/_reference.py b/20/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..24a44a33b2b47fef961bd8529ce4d52cca5aef0d --- /dev/null +++ b/20/solution/_reference.py @@ -0,0 +1,14 @@ + +def is_woodall(x): + if (x % 2 == 0): + return False + if (x == 1): + return True + x = x + 1 + p = 0 + while (x % 2 == 0): + x = x/2 + p = p + 1 + if (p == x): + return True + return False \ No newline at end of file diff --git a/20/solution/solution.py b/20/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/20/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/20/solution/solve.sh b/20/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/20/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/20/task.toml b/20/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2fcecb286363e81e16ef971d8df2450c43ed356a --- /dev/null +++ b/20/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/20" +name = "MBPP — 20" + +[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/20/tests/__init__.py b/20/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/20/tests/conftest.py b/20/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/20/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/20/tests/test_mbpp_0.py b/20/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c2e91b0cb926fc76753bd2239a56625e3f86cc81 --- /dev/null +++ b/20/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 is_woodall(383) == True diff --git a/20/tests/test_mbpp_1.py b/20/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..777f5393ff3aff5df4c25e70f4625a0d251bbfab --- /dev/null +++ b/20/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 is_woodall(254) == False diff --git a/20/tests/test_mbpp_2.py b/20/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..66082ad15c14bb030d8876b8d55d572af0b8619d --- /dev/null +++ b/20/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 is_woodall(200) == False diff --git a/228/solution/solution.py b/228/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/228/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/228/tests/__init__.py b/228/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/228/tests/conftest.py b/228/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/228/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/228/tests/test_mbpp_0.py b/228/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..95ac85a3f69c4c24e9bd4bb80bd5a025e6aa66c7 --- /dev/null +++ b/228/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 all_Bits_Set_In_The_Given_Range(4,1,2) == True diff --git a/229/instruction.md b/229/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1d3e7aaea6a506a663cf6b0413e17d902157c5d2 --- /dev/null +++ b/229/instruction.md @@ -0,0 +1,3 @@ +# MBPP 229 + +Write a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved. diff --git a/229/solution/__init__.py b/229/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/229/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/229/solution/_reference.py b/229/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..716745c2f1ef61b9eaf1a4a2ed33ca618568934e --- /dev/null +++ b/229/solution/_reference.py @@ -0,0 +1,10 @@ + +def re_arrange_array(arr, n): + j=0 + for i in range(0, n): + if (arr[i] < 0): + temp = arr[i] + arr[i] = arr[j] + arr[j] = temp + j = j + 1 + return arr \ No newline at end of file diff --git a/229/solution/solution.py b/229/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/229/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/229/solution/solve.sh b/229/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/229/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/229/task.toml b/229/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..98ed565d27cbe3b5bfb8b38f2773521797f1aa42 --- /dev/null +++ b/229/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/229" +name = "MBPP — 229" + +[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/229/tests/__init__.py b/229/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/229/tests/conftest.py b/229/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/229/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/229/tests/test_mbpp_0.py b/229/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c804cbfb3cfc5ef4610c0be6768d45bf56047933 --- /dev/null +++ b/229/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 re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9] diff --git a/229/tests/test_mbpp_1.py b/229/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..f4347b9ad8d04b820acd2ffab49760a11c2261b3 --- /dev/null +++ b/229/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 re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15] diff --git a/229/tests/test_mbpp_2.py b/229/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..968bab7cbd89f0a95976b4a6ad0a319bd15ee3a4 --- /dev/null +++ b/229/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 re_arrange_array([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85] diff --git a/232/instruction.md b/232/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..31be76f3f2c07f4873633365795dc117a2b53a29 --- /dev/null +++ b/232/instruction.md @@ -0,0 +1,3 @@ +# MBPP 232 + +Write a function that takes in a list and an integer n and returns a list containing the n largest items from the list. diff --git a/232/solution/__init__.py b/232/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/232/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/232/solution/_reference.py b/232/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..639b80e8bdff931576c4ca3feb4ef139e48d23f1 --- /dev/null +++ b/232/solution/_reference.py @@ -0,0 +1,5 @@ + +import heapq +def larg_nnum(list1,n): + largest=heapq.nlargest(n,list1) + return largest \ No newline at end of file diff --git a/232/solution/solution.py b/232/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/232/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/232/solution/solve.sh b/232/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/232/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/232/task.toml b/232/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6bfb3729e68ce5888328d3499d6804183c6fae77 --- /dev/null +++ b/232/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/232" +name = "MBPP — 232" + +[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/232/tests/__init__.py b/232/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/232/tests/conftest.py b/232/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/232/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/232/tests/test_mbpp_0.py b/232/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..4f09f004add48193e3d5907c6ea8e954b8b663fa --- /dev/null +++ b/232/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 set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],2))==set([100,90]) diff --git a/232/tests/test_mbpp_1.py b/232/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..9a82f04b0deeafe35347c77aba2b989d1fff432f --- /dev/null +++ b/232/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 set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],5))==set([100,90,80,70,60]) diff --git a/232/tests/test_mbpp_2.py b/232/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..8419a77830335c0d88d1fac5bca45f648ffece5c --- /dev/null +++ b/232/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 set(larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],3))==set([100,90,80]) diff --git a/244/tests/conftest.py b/244/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/244/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/245/instruction.md b/245/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..062a4ef21cb112895541ad6cb95efe3be8f5c50f --- /dev/null +++ b/245/instruction.md @@ -0,0 +1,3 @@ +# MBPP 245 + +Write a function that takes an array and finds the maximum sum of a bitonic subsequence for the given array, where a sequence is bitonic if it is first increasing and then decreasing. diff --git a/245/solution/__init__.py b/245/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/245/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/245/solution/_reference.py b/245/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..7fd0a26e146a32042d50a1961d063934e19fd182 --- /dev/null +++ b/245/solution/_reference.py @@ -0,0 +1,16 @@ + +def max_sum(arr): + MSIBS = arr[:] + for i in range(len(arr)): + for j in range(0, i): + if arr[i] > arr[j] and MSIBS[i] < MSIBS[j] + arr[i]: + MSIBS[i] = MSIBS[j] + arr[i] + MSDBS = arr[:] + for i in range(1, len(arr) + 1): + for j in range(1, i): + if arr[-i] > arr[-j] and MSDBS[-i] < MSDBS[-j] + arr[-i]: + MSDBS[-i] = MSDBS[-j] + arr[-i] + max_sum = float("-Inf") + for i, j, k in zip(MSIBS, MSDBS, arr): + max_sum = max(max_sum, i + j - k) + return max_sum \ No newline at end of file diff --git a/245/solution/solution.py b/245/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/245/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/245/solution/solve.sh b/245/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/245/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/245/task.toml b/245/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bdd4b62f0dcf85b5a052121dcc234e2b99dbe90c --- /dev/null +++ b/245/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/245" +name = "MBPP — 245" + +[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/245/tests/__init__.py b/245/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/245/tests/conftest.py b/245/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/245/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/245/tests/test_mbpp_0.py b/245/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c09a1d32930ebcabb871f273bb377ac29b85fdad --- /dev/null +++ b/245/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_sum([1, 15, 51, 45, 33, 100, 12, 18, 9]) == 194 diff --git a/245/tests/test_mbpp_1.py b/245/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..4294f7696fae3070d65301015817b9d0888a9f8c --- /dev/null +++ b/245/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_sum([80, 60, 30, 40, 20, 10]) == 210 diff --git a/245/tests/test_mbpp_2.py b/245/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..f64bc3647dd9b2cb5f55b7ee79bd34ac09a790b0 --- /dev/null +++ b/245/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_sum([2, 3 ,14, 16, 21, 23, 29, 30]) == 138 diff --git a/250/instruction.md b/250/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..70b10c5b2ed185a6d1c3fea4edad16ad1392e6d9 --- /dev/null +++ b/250/instruction.md @@ -0,0 +1,3 @@ +# MBPP 250 + +Write a python function that takes in a tuple and an element and counts the occcurences of the element in the tuple. diff --git a/250/solution/__init__.py b/250/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/250/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/250/solution/solution.py b/250/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/250/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/250/solution/solve.sh b/250/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/250/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/250/tests/test_mbpp_1.py b/250/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c6881b2a8fa83901eccbb8dab52442eac9acbc1b --- /dev/null +++ b/250/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_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),10) == 3 diff --git a/250/tests/test_mbpp_2.py b/250/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..20121f35ce15cbdc3f72cc0194f2a4a6851706f0 --- /dev/null +++ b/250/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 count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),8) == 4 diff --git a/259/instruction.md b/259/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..02b8cbe354e3a33b797016fd3a487444734d7582 --- /dev/null +++ b/259/instruction.md @@ -0,0 +1,3 @@ +# MBPP 259 + +Write a function to maximize the given two tuples. diff --git a/259/solution/__init__.py b/259/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/259/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/259/solution/_reference.py b/259/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..bb851a891813296403c2b23eb8c2f469ecd30d20 --- /dev/null +++ b/259/solution/_reference.py @@ -0,0 +1,5 @@ + +def maximize_elements(test_tup1, test_tup2): + res = tuple(tuple(max(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/259/solution/solution.py b/259/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/259/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/259/solution/solve.sh b/259/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/259/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/259/task.toml b/259/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a720f9abf1bf70d8f06493e27a8b5d6daa36c0ab --- /dev/null +++ b/259/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/259" +name = "MBPP — 259" + +[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/259/tests/__init__.py b/259/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/259/tests/conftest.py b/259/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/259/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/259/tests/test_mbpp_0.py b/259/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..b36685049dcf98794d7a7390db6f9309887efb3f --- /dev/null +++ b/259/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 maximize_elements(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((6, 7), (4, 9), (2, 9), (7, 10)) diff --git a/259/tests/test_mbpp_1.py b/259/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..18e728dc2716de393ac02ca8b149bcef7d9ed562 --- /dev/null +++ b/259/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 maximize_elements(((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))) == ((7, 8), (5, 10), (3, 10), (8, 11)) diff --git a/259/tests/test_mbpp_2.py b/259/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..666f599ba25f9643989ac11c77ea92d7ed757e0c --- /dev/null +++ b/259/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 maximize_elements(((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))) == ((8, 9), (6, 11), (4, 11), (9, 12)) diff --git a/260/instruction.md b/260/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8fc6dc4f3ee6b72770a26f62dd5bc42ac25f6d97 --- /dev/null +++ b/260/instruction.md @@ -0,0 +1,3 @@ +# MBPP 260 + +Write a function to find the nth newman–shanks–williams prime number. diff --git a/260/solution/__init__.py b/260/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/260/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/260/solution/_reference.py b/260/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..54ac27a200c7e02365bf31ce2068c17c307b1712 --- /dev/null +++ b/260/solution/_reference.py @@ -0,0 +1,5 @@ + +def newman_prime(n): + if n == 0 or n == 1: + return 1 + return 2 * newman_prime(n - 1) + newman_prime(n - 2) \ No newline at end of file diff --git a/260/solution/solution.py b/260/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/260/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/260/solution/solve.sh b/260/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/260/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/260/task.toml b/260/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6fba043389dd08306838fbeb7c0718f276babd38 --- /dev/null +++ b/260/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/260" +name = "MBPP — 260" + +[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/260/tests/__init__.py b/260/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/260/tests/conftest.py b/260/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/260/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/260/tests/test_mbpp_0.py b/260/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..3a1da6befac8c4047752dab572c7764733b8c983 --- /dev/null +++ b/260/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 newman_prime(3) == 7 diff --git a/260/tests/test_mbpp_1.py b/260/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..74be50fa50dedded4a7c00e2f19121029171f7bf --- /dev/null +++ b/260/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 newman_prime(4) == 17 diff --git a/260/tests/test_mbpp_2.py b/260/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..0b09e996af0bb7118e4fcdb88118f91fff064e69 --- /dev/null +++ b/260/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 newman_prime(5) == 41 diff --git a/262/instruction.md b/262/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c122df66aab87c63a5aabc0f66a0f89463d4c1c8 --- /dev/null +++ b/262/instruction.md @@ -0,0 +1,3 @@ +# MBPP 262 + +Write a function that takes in a list and an integer L and splits the given list into two parts where the length of the first part of the list is L, and returns the resulting lists in a tuple. diff --git a/262/solution/__init__.py b/262/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/262/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/262/solution/_reference.py b/262/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..a3ca1c2051f59dc671684aaf830872926fe6dd24 --- /dev/null +++ b/262/solution/_reference.py @@ -0,0 +1,3 @@ + +def split_two_parts(list1, L): + return list1[:L], list1[L:] \ No newline at end of file diff --git a/262/solution/solution.py b/262/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/262/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/262/solution/solve.sh b/262/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/262/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/262/task.toml b/262/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fea2f2b63d92f12e4919bc8a39f578f9cb2e0bb4 --- /dev/null +++ b/262/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/262" +name = "MBPP — 262" + +[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/262/tests/__init__.py b/262/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/262/tests/conftest.py b/262/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/262/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/262/tests/test_mbpp_0.py b/262/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..1d042f44bfa84c729a4d7227c1d52d2a924ce25a --- /dev/null +++ b/262/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 split_two_parts([1,1,2,3,4,4,5,1],3)==([1, 1, 2], [3, 4, 4, 5, 1]) diff --git a/262/tests/test_mbpp_1.py b/262/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..3ff63b2dc86dbc457e73e0507ddf91cca0abd338 --- /dev/null +++ b/262/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 split_two_parts(['a', 'b', 'c', 'd'],2)==(['a', 'b'], ['c', 'd']) diff --git a/262/tests/test_mbpp_2.py b/262/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..85637969fa822619555d99cff2e73c8c14017b76 --- /dev/null +++ b/262/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 split_two_parts(['p', 'y', 't', 'h', 'o', 'n'],4)==(['p', 'y', 't', 'h'], ['o', 'n']) diff --git a/264/instruction.md b/264/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..aef572a9848499ff36604ef97b72f0135f1a8be5 --- /dev/null +++ b/264/instruction.md @@ -0,0 +1,3 @@ +# MBPP 264 + +Write a function to calculate a dog's age in dog's years. diff --git a/264/solution/solution.py b/264/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/264/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/264/solution/solve.sh b/264/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/264/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/264/task.toml b/264/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fb40fa1c0791c20d3f8715156becbd934c02d509 --- /dev/null +++ b/264/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/264" +name = "MBPP — 264" + +[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/264/tests/test_mbpp_0.py b/264/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..3d26ff23e72286800e7626dde552a3335e5f7f2d --- /dev/null +++ b/264/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 dog_age(12)==61 diff --git a/264/tests/test_mbpp_2.py b/264/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..fa451aa2bd2c0c37a3b5e5f4921d9dda4d898489 --- /dev/null +++ b/264/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 dog_age(24)==109 diff --git a/270/instruction.md b/270/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..12b7a68d457356f5eb3d3c575a3f073966eac5f0 --- /dev/null +++ b/270/instruction.md @@ -0,0 +1,3 @@ +# MBPP 270 + +Write a python function to find the sum of even numbers at even positions of a list. diff --git a/270/solution/__init__.py b/270/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/270/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/270/solution/_reference.py b/270/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..779eacee3f6f97bea142480ad8363c55d0ffa41c --- /dev/null +++ b/270/solution/_reference.py @@ -0,0 +1,8 @@ + +def sum_even_and_even_index(arr): + i = 0 + sum = 0 + for i in range(0, len(arr),2): + if (arr[i] % 2 == 0) : + sum += arr[i] + return sum \ No newline at end of file diff --git a/270/solution/solution.py b/270/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/270/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/270/solution/solve.sh b/270/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/270/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/270/task.toml b/270/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4651b93706acec43e28c2c4b8e6881964267f3e5 --- /dev/null +++ b/270/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/270" +name = "MBPP — 270" + +[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/270/tests/__init__.py b/270/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/270/tests/conftest.py b/270/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/270/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/270/tests/test_mbpp_0.py b/270/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..7265718f2fb2d7d60a33609702e391c4c7a7f945 --- /dev/null +++ b/270/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 sum_even_and_even_index([5, 6, 12, 1, 18, 8]) == 30 diff --git a/270/tests/test_mbpp_1.py b/270/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..cd10eb267e81e85c272d0425f0ba8a742112ff65 --- /dev/null +++ b/270/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 sum_even_and_even_index([3, 20, 17, 9, 2, 10, 18, 13, 6, 18]) == 26 diff --git a/270/tests/test_mbpp_2.py b/270/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..970be06b8a52d57ed59effe96a620a8fc464b508 --- /dev/null +++ b/270/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 sum_even_and_even_index([5, 6, 12, 1]) == 12 diff --git a/273/instruction.md b/273/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5360116ec8e1aa7b25fce25f49e618fe5f1bc992 --- /dev/null +++ b/273/instruction.md @@ -0,0 +1,3 @@ +# MBPP 273 + +Write a function that takes in two tuples and subtracts the elements of the first tuple by the elements of the second tuple with the same index. diff --git a/273/solution/__init__.py b/273/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/273/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/273/solution/_reference.py b/273/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..885bf7e6050f410fbcbfe84411aa801b277cb435 --- /dev/null +++ b/273/solution/_reference.py @@ -0,0 +1,4 @@ + +def substract_elements(test_tup1, test_tup2): + res = tuple(map(lambda i, j: i - j, test_tup1, test_tup2)) + return (res) \ No newline at end of file diff --git a/273/solution/solution.py b/273/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/273/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/273/solution/solve.sh b/273/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/273/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/273/task.toml b/273/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4cf540051df40a53d526ce1a8cb420bab2ce22bc --- /dev/null +++ b/273/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/273" +name = "MBPP — 273" + +[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/273/tests/__init__.py b/273/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/273/tests/conftest.py b/273/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/273/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/273/tests/test_mbpp_0.py b/273/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c1b6b7e9e43cf416db7a849c790b2c00d2d9a7bb --- /dev/null +++ b/273/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 substract_elements((10, 4, 5), (2, 5, 18)) == (8, -1, -13) diff --git a/273/tests/test_mbpp_1.py b/273/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..b6e36e78d60454cd9131a7cb0b1cbb826586f3ef --- /dev/null +++ b/273/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 substract_elements((11, 2, 3), (24, 45 ,16)) == (-13, -43, -13) diff --git a/273/tests/test_mbpp_2.py b/273/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..c39b006a3bc8d424de4e800edff6e02a23a16866 --- /dev/null +++ b/273/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 substract_elements((7, 18, 9), (10, 11, 12)) == (-3, 7, -3) diff --git a/280/instruction.md b/280/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e456278587d09254dedf7e3e27e507093083a834 --- /dev/null +++ b/280/instruction.md @@ -0,0 +1,3 @@ +# MBPP 280 + +Write a function that takes in an array and element and returns a tuple containing a boolean that indicates if the element is in the array and the index position of the element (or -1 if the element is not found). diff --git a/280/solution/__init__.py b/280/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/280/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/280/solution/_reference.py b/280/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..86f083f6c30b8d83e5b39556e80263ad843fafae --- /dev/null +++ b/280/solution/_reference.py @@ -0,0 +1,10 @@ + +def sequential_search(dlist, item): + pos = 0 + found = False + while pos < len(dlist) and not found: + if dlist[pos] == item: + found = True + else: + pos = pos + 1 + return found, pos \ No newline at end of file diff --git a/280/solution/solution.py b/280/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/280/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/280/solution/solve.sh b/280/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/280/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/280/task.toml b/280/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a6a4fde208bab2266b60eebfedca1668eb7aa436 --- /dev/null +++ b/280/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/280" +name = "MBPP — 280" + +[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/280/tests/__init__.py b/280/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/280/tests/conftest.py b/280/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/280/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/280/tests/test_mbpp_0.py b/280/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..f128144a44296d58c69ee1a48558419792ff49b4 --- /dev/null +++ b/280/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 sequential_search([11,23,58,31,56,77,43,12,65,19],31) == (True, 3) diff --git a/280/tests/test_mbpp_1.py b/280/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..51ec0314d6921e96b9fb93d09d1d0a0b2365ecdf --- /dev/null +++ b/280/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 sequential_search([12, 32, 45, 62, 35, 47, 44, 61],61) == (True, 7) diff --git a/280/tests/test_mbpp_2.py b/280/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..9b6c577c4e9069217d5f8569cecc98e455e4b45f --- /dev/null +++ b/280/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 sequential_search([9, 10, 17, 19, 22, 39, 48, 56],48) == (True, 6) diff --git a/284/instruction.md b/284/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..68bb3eef295c7c3b7884a820eab87e9fd4083b0e --- /dev/null +++ b/284/instruction.md @@ -0,0 +1,3 @@ +# MBPP 284 + +Write a function that takes in a list and element and checks whether all items in the list are equal to the given element. diff --git a/284/solution/__init__.py b/284/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/284/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/284/solution/_reference.py b/284/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..06056c4751939e1f2c247c947f0addd39e529499 --- /dev/null +++ b/284/solution/_reference.py @@ -0,0 +1,4 @@ + +def check_element(list,element): + check_element=all(v== element for v in list) + return check_element \ No newline at end of file diff --git a/284/solution/solution.py b/284/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/284/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/284/solution/solve.sh b/284/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/284/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/284/task.toml b/284/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..408184ec89fda836739c55bdadb34c32a695ee10 --- /dev/null +++ b/284/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/284" +name = "MBPP — 284" + +[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/284/tests/__init__.py b/284/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/284/tests/conftest.py b/284/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/284/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/284/tests/test_mbpp_0.py b/284/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..b79f050ba752e6613d00145d18f5663802a00f78 --- /dev/null +++ b/284/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 check_element(["green", "orange", "black", "white"],'blue')==False diff --git a/284/tests/test_mbpp_1.py b/284/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..5d977e8164d03e908d6f0a893bff2cb786f397c3 --- /dev/null +++ b/284/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 check_element([1,2,3,4],7)==False diff --git a/284/tests/test_mbpp_2.py b/284/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..d7663db55bb1a1c87e46b85d9a4a6408533f552e --- /dev/null +++ b/284/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 check_element(["green", "green", "green", "green"],'green')==True diff --git a/287/instruction.md b/287/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2694ff36ec510142746ea77ffd72baf2c266acd3 --- /dev/null +++ b/287/instruction.md @@ -0,0 +1,3 @@ +# MBPP 287 + +Write a python function takes in an integer n and returns the sum of squares of first n even natural numbers. diff --git a/287/solution/__init__.py b/287/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/287/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/287/solution/_reference.py b/287/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..9a4c96cdd444ac6b5a32005d084bf47378688449 --- /dev/null +++ b/287/solution/_reference.py @@ -0,0 +1,3 @@ + +def square_Sum(n): + return int(2*n*(n+1)*(2*n+1)/3) \ No newline at end of file diff --git a/287/solution/solution.py b/287/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/287/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/287/solution/solve.sh b/287/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/287/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/287/task.toml b/287/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..057bdc1d31f41a2aff9d970c3dfd36a8ed23b0e5 --- /dev/null +++ b/287/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/287" +name = "MBPP — 287" + +[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/287/tests/__init__.py b/287/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/287/tests/conftest.py b/287/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/287/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/287/tests/test_mbpp_0.py b/287/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c9e5576ddd4f9df5c8c5404a5b7a5dbeb22887b1 --- /dev/null +++ b/287/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 square_Sum(2) == 20 diff --git a/287/tests/test_mbpp_1.py b/287/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..4008f2164d35c3d1312585b4173238f1ba6dc38f --- /dev/null +++ b/287/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 square_Sum(3) == 56 diff --git a/287/tests/test_mbpp_2.py b/287/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..6c0b7a73f80b774090d036e576bca65178c86db9 --- /dev/null +++ b/287/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 square_Sum(4) == 120 diff --git a/291/instruction.md b/291/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b0333be4e0c64edd044d7669e628fa5883b7345 --- /dev/null +++ b/291/instruction.md @@ -0,0 +1,3 @@ +# MBPP 291 + +Write a function to find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n posts and k colors. diff --git a/291/solution/__init__.py b/291/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/291/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/291/tests/__init__.py b/291/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/291/tests/conftest.py b/291/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/291/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/291/tests/test_mbpp_0.py b/291/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..ae8f9daa0e1626cf12a434018930f350d34b5428 --- /dev/null +++ b/291/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 count_no_of_ways(2, 4) == 16 diff --git a/291/tests/test_mbpp_1.py b/291/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c989509fdcc15d07c6c3c0e144387363adc4c190 --- /dev/null +++ b/291/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_no_of_ways(3, 2) == 6 diff --git a/291/tests/test_mbpp_2.py b/291/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..e9855bf2954ecffecb3d844e7e8d36c1db74f545 --- /dev/null +++ b/291/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 count_no_of_ways(4, 4) == 228 diff --git a/292/tests/conftest.py b/292/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/292/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/306/instruction.md b/306/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c45f78cb0792e8e92630abfcbcc0e1a946cd4e54 --- /dev/null +++ b/306/instruction.md @@ -0,0 +1,3 @@ +# MBPP 306 + +Write a function to find the maximum sum of increasing subsequence from prefix until ith index and also including a given kth element which is after i, i.e., k > i . diff --git a/306/solution/__init__.py b/306/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/306/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/306/solution/_reference.py b/306/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..af3aebf5b0fb1c98c29b8f2682c78681570fdd02 --- /dev/null +++ b/306/solution/_reference.py @@ -0,0 +1,19 @@ + +def max_sum_increasing_subseq(a, n, index, k): + dp = [[0 for i in range(n)] + for i in range(n)] + for i in range(n): + if a[i] > a[0]: + dp[0][i] = a[i] + a[0] + else: + dp[0][i] = a[i] + for i in range(1, n): + for j in range(n): + if a[j] > a[i] and j > i: + if dp[i - 1][i] + a[j] > dp[i - 1][j]: + dp[i][j] = dp[i - 1][i] + a[j] + else: + dp[i][j] = dp[i - 1][j] + else: + dp[i][j] = dp[i - 1][j] + return dp[index][k] \ No newline at end of file diff --git a/306/solution/solution.py b/306/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/306/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/306/solution/solve.sh b/306/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/306/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/306/task.toml b/306/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9c671df180a640050b7fb2386a4c56051e9a5000 --- /dev/null +++ b/306/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/306" +name = "MBPP — 306" + +[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/306/tests/__init__.py b/306/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/306/tests/conftest.py b/306/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/306/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/306/tests/test_mbpp_0.py b/306/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..b963452198b13734e2f10b9e1fd458d02ead8dac --- /dev/null +++ b/306/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_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 4, 6) == 11 diff --git a/306/tests/test_mbpp_1.py b/306/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..8aae46eefa6fe2fcd857d7c9156fef0b36b3c30e --- /dev/null +++ b/306/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_sum_increasing_subseq([1, 101, 2, 3, 100, 4, 5 ], 7, 2, 5) == 7 diff --git a/306/tests/test_mbpp_2.py b/306/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..7083e129861c0d668b83f4c1a126b17833f2f5fe --- /dev/null +++ b/306/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_sum_increasing_subseq([11, 15, 19, 21, 26, 28, 31], 7, 2, 4) == 71 diff --git a/308/instruction.md b/308/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c73e86b8c3fa4b8fe9a1e47102213806c58e76a2 --- /dev/null +++ b/308/instruction.md @@ -0,0 +1,3 @@ +# MBPP 308 + +Write a function to find the specified number of largest products from two given lists, selecting one factor from each list. diff --git a/308/solution/__init__.py b/308/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/308/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/308/solution/_reference.py b/308/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..0c0fa903341bb8d332df674efe3a6be346bf4dc1 --- /dev/null +++ b/308/solution/_reference.py @@ -0,0 +1,4 @@ + +def large_product(nums1, nums2, N): + result = sorted([x*y for x in nums1 for y in nums2], reverse=True)[:N] + return result \ No newline at end of file diff --git a/308/solution/solution.py b/308/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/308/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/308/solution/solve.sh b/308/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/308/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/308/task.toml b/308/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f8bee0ade9a535bdaa0935518e146d9b5f13a550 --- /dev/null +++ b/308/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/308" +name = "MBPP — 308" + +[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/308/tests/__init__.py b/308/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/308/tests/conftest.py b/308/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/308/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/308/tests/test_mbpp_0.py b/308/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..935f51784da365d18382f1c983973c7f0eeccc36 --- /dev/null +++ b/308/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 large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],3)==[60, 54, 50] diff --git a/308/tests/test_mbpp_1.py b/308/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..0a2269443e01bcc306a43c932fb2200c5ca42b61 --- /dev/null +++ b/308/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 large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],4)==[60, 54, 50, 48] diff --git a/308/tests/test_mbpp_2.py b/308/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..fdba78bfac51973b79aced87f039f8d21717bf91 --- /dev/null +++ b/308/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 large_product([1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],5)==[60, 54, 50, 48, 45] diff --git a/388/instruction.md b/388/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bf0b12c55ed6630481721b30a1ea22c0a09f2ccd --- /dev/null +++ b/388/instruction.md @@ -0,0 +1,3 @@ +# MBPP 388 + +Write a python function to find the highest power of 2 that is less than or equal to n. diff --git a/388/solution/__init__.py b/388/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/388/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/388/solution/_reference.py b/388/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..7995f6fe5364a145f81ce6d217f5618cc0055594 --- /dev/null +++ b/388/solution/_reference.py @@ -0,0 +1,8 @@ + +def highest_Power_of_2(n): + res = 0 + for i in range(n, 0, -1): + if ((i & (i - 1)) == 0): + res = i + break + return res \ No newline at end of file diff --git a/388/solution/solution.py b/388/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/388/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/388/solution/solve.sh b/388/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/388/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/388/task.toml b/388/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..683344f264b61c46b8e8408d0dd555916c531481 --- /dev/null +++ b/388/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/388" +name = "MBPP — 388" + +[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/388/tests/__init__.py b/388/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/388/tests/conftest.py b/388/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/388/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/388/tests/test_mbpp_0.py b/388/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..5c17c458f7acc83452958297f3998c7ac059cc5c --- /dev/null +++ b/388/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 highest_Power_of_2(10) == 8 diff --git a/388/tests/test_mbpp_1.py b/388/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..7a41492f7124a8ea905c36b53d3f11b1e4ee9666 --- /dev/null +++ b/388/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 highest_Power_of_2(19) == 16 diff --git a/388/tests/test_mbpp_2.py b/388/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..f61072be9300010b953f045ed487a360759754f2 --- /dev/null +++ b/388/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 highest_Power_of_2(32) == 32 diff --git a/395/instruction.md b/395/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..81c5aa1d9485608a074aa01f2ff8b7b311cafb13 --- /dev/null +++ b/395/instruction.md @@ -0,0 +1,3 @@ +# MBPP 395 + +Write a python function to find the first non-repeated character in a given string. diff --git a/395/solution/_reference.py b/395/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..d9954aa8f4c8562ef513ac4dfe27b22a08cd11a3 --- /dev/null +++ b/395/solution/_reference.py @@ -0,0 +1,14 @@ + +def first_non_repeating_character(str1): + char_order = [] + ctr = {} + for c in str1: + if c in ctr: + ctr[c] += 1 + else: + ctr[c] = 1 + char_order.append(c) + for c in char_order: + if ctr[c] == 1: + return c + return None \ No newline at end of file diff --git a/395/solution/solution.py b/395/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/395/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/395/solution/solve.sh b/395/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/395/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/395/task.toml b/395/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..129b0d70e1f1ad00df0212a1ebb9843b6dcc906d --- /dev/null +++ b/395/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/395" +name = "MBPP — 395" + +[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/397/instruction.md b/397/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..76d460a27d5886da6446e99e956ea26fe590062a --- /dev/null +++ b/397/instruction.md @@ -0,0 +1,3 @@ +# MBPP 397 + +Write a function to find the median of three numbers. diff --git a/397/solution/__init__.py b/397/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/397/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/397/solution/_reference.py b/397/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..c628b580e9a9fdcf217a7456f507d33a5d2aa7cc --- /dev/null +++ b/397/solution/_reference.py @@ -0,0 +1,17 @@ + +def median_numbers(a,b,c): + if a > b: + if a < c: + median = a + elif b > c: + median = b + else: + median = c + else: + if a > c: + median = a + elif b < c: + median = b + else: + median = c + return median \ No newline at end of file diff --git a/397/solution/solution.py b/397/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/397/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/397/solution/solve.sh b/397/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/397/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/397/task.toml b/397/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ab4a338440179c58981dc3bb01e8c664b12579c5 --- /dev/null +++ b/397/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/397" +name = "MBPP — 397" + +[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/397/tests/__init__.py b/397/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/397/tests/conftest.py b/397/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/397/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/397/tests/test_mbpp_0.py b/397/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..143e16ffc292bb26a8fefb4fe011e7752c9afbba --- /dev/null +++ b/397/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 median_numbers(25,55,65)==55.0 diff --git a/397/tests/test_mbpp_1.py b/397/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..eef1e81a31c5c832f8fd5baff2a3c19de625f836 --- /dev/null +++ b/397/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 median_numbers(20,10,30)==20.0 diff --git a/397/tests/test_mbpp_2.py b/397/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..90e907a6b298b25539273576bcdc5dbd2aa34558 --- /dev/null +++ b/397/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 median_numbers(15,45,75)==45.0 diff --git a/401/instruction.md b/401/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2e7afb67af63339b5a43dba60783753fec985f00 --- /dev/null +++ b/401/instruction.md @@ -0,0 +1,3 @@ +# MBPP 401 + +Write a function to perform index wise addition of tuple elements in the given two nested tuples. diff --git a/401/solution/__init__.py b/401/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/401/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/401/solution/_reference.py b/401/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..db683ec9bc870da33d8666ad462da7af15429762 --- /dev/null +++ b/401/solution/_reference.py @@ -0,0 +1,5 @@ + +def add_nested_tuples(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/401/solution/solution.py b/401/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/401/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/401/solution/solve.sh b/401/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/401/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/401/task.toml b/401/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..500e92a715c498b3ff4496db4906252c3b0dd3c7 --- /dev/null +++ b/401/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/401" +name = "MBPP — 401" + +[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/401/tests/__init__.py b/401/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/401/tests/conftest.py b/401/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/401/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/401/tests/test_mbpp_0.py b/401/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..80c4f9ee7420a9043a064cf712e5d83967cab234 --- /dev/null +++ b/401/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 add_nested_tuples(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((7, 10), (7, 14), (3, 10), (8, 13)) diff --git a/401/tests/test_mbpp_1.py b/401/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..cae8f6e18e1984b483cd0689e75f6e9273c5535c --- /dev/null +++ b/401/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 add_nested_tuples(((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))) == ((9, 12), (9, 16), (5, 12), (10, 15)) diff --git a/401/tests/test_mbpp_2.py b/401/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..ce6f2184fa9995234dbc9fe6691b23c5d4639225 --- /dev/null +++ b/401/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 add_nested_tuples(((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))) == ((11, 14), (11, 18), (7, 14), (12, 17)) diff --git a/410/instruction.md b/410/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e4806dba8fc9aec079d2493d94d355b873487f13 --- /dev/null +++ b/410/instruction.md @@ -0,0 +1,3 @@ +# MBPP 410 + +Write a function to find the minimum value in a given heterogeneous list. diff --git a/410/solution/__init__.py b/410/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/410/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/410/solution/_reference.py b/410/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..0e9b0c7f5f03e4c339ae9dd482ddd4e6ae2727e4 --- /dev/null +++ b/410/solution/_reference.py @@ -0,0 +1,4 @@ + +def min_val(listval): + min_val = min(i for i in listval if isinstance(i, int)) + return min_val \ No newline at end of file diff --git a/410/solution/solution.py b/410/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/410/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/410/solution/solve.sh b/410/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/410/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/410/task.toml b/410/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c451fc11528945304b53034ce887e9fac029c90b --- /dev/null +++ b/410/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/410" +name = "MBPP — 410" + +[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/410/tests/__init__.py b/410/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/410/tests/conftest.py b/410/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/410/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/410/tests/test_mbpp_0.py b/410/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c26bd349b44e6b66fa507e30b64193ee12ce125f --- /dev/null +++ b/410/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 min_val(['Python', 3, 2, 4, 5, 'version'])==2 diff --git a/410/tests/test_mbpp_1.py b/410/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..f43ab4a640ed39a1cde5d7b62da94ae05e38e9d4 --- /dev/null +++ b/410/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 min_val(['Python', 15, 20, 25])==15 diff --git a/410/tests/test_mbpp_2.py b/410/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..2b25e737fc2d8a0c0ddd7188512cfb7680bdcd54 --- /dev/null +++ b/410/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 min_val(['Python', 30, 20, 40, 50, 'version'])==20 diff --git a/415/instruction.md b/415/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b4e8c90370e367c2b1fa1ed59577048ac436eb46 --- /dev/null +++ b/415/instruction.md @@ -0,0 +1,3 @@ +# MBPP 415 + +Write a python function to find a pair with highest product from a given array of integers. diff --git a/415/solution/__init__.py b/415/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/415/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/415/solution/_reference.py b/415/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..bc8529608da733facc61b68c9f52a34e2e99b965 --- /dev/null +++ b/415/solution/_reference.py @@ -0,0 +1,11 @@ + +def max_Product(arr): + arr_len = len(arr) + if (arr_len < 2): + return ("No pairs exists") + x = arr[0]; y = arr[1] + for i in range(0,arr_len): + for j in range(i + 1,arr_len): + if (arr[i] * arr[j] > x * y): + x = arr[i]; y = arr[j] + return x,y \ No newline at end of file diff --git a/415/solution/solution.py b/415/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/415/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/415/solution/solve.sh b/415/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/415/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/415/task.toml b/415/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ad21eacd459498ac205d5bcdb8380cb9631f51c7 --- /dev/null +++ b/415/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/415" +name = "MBPP — 415" + +[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/415/tests/__init__.py b/415/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/415/tests/conftest.py b/415/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/415/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/415/tests/test_mbpp_0.py b/415/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..c229df4e1db021172b1c1e3ad724cdf6a09cb4a3 --- /dev/null +++ b/415/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_Product([1,2,3,4,7,0,8,4]) == (7,8) diff --git a/415/tests/test_mbpp_1.py b/415/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..4c7c2236a0e448842faa18ccffd787e84b5e400b --- /dev/null +++ b/415/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_Product([0,-1,-2,-4,5,0,-6]) == (-4,-6) diff --git a/415/tests/test_mbpp_2.py b/415/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..89e3f6a343144c8237913e3e17379b98a77a661a --- /dev/null +++ b/415/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_Product([1,2,3]) == (2,3) diff --git a/418/instruction.md b/418/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dd8669258ed8da21ee83903c4eeafaf134995187 --- /dev/null +++ b/418/instruction.md @@ -0,0 +1,3 @@ +# MBPP 418 + +Write a python function to find the element of a list having maximum length. diff --git a/418/solution/__init__.py b/418/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/418/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/418/solution/_reference.py b/418/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..5b0d7f0b846d2000a857a58d25e4291c2ace5bb0 --- /dev/null +++ b/418/solution/_reference.py @@ -0,0 +1,4 @@ + +def Find_Max(lst): + maxList = max((x) for x in lst) + return maxList \ No newline at end of file diff --git a/418/solution/solution.py b/418/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/418/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/418/solution/solve.sh b/418/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/418/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/418/task.toml b/418/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..940fcc89f385074ff965ed22a06925bffef089f1 --- /dev/null +++ b/418/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/418" +name = "MBPP — 418" + +[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/418/tests/__init__.py b/418/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/418/tests/conftest.py b/418/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/418/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/418/tests/test_mbpp_0.py b/418/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..db07fd78d6631cc887f2f2a04bf443e295d57532 --- /dev/null +++ b/418/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 Find_Max([['A'],['A','B'],['A','B','C']]) == ['A','B','C'] diff --git a/418/tests/test_mbpp_1.py b/418/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..bf39ab61c80da3b855475fb6beed0c5b6d8fcada --- /dev/null +++ b/418/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_Max([[1],[1,2],[1,2,3]]) == [1,2,3] diff --git a/418/tests/test_mbpp_2.py b/418/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..2f93dac50279bddad9f480123286ec4344ec8e67 --- /dev/null +++ b/418/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_Max([[1,1],[1,2,3],[1,5,6,1]]) == [1,5,6,1] diff --git a/420/solution/__init__.py b/420/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/420/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/420/solution/_reference.py b/420/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..cfbec46337a11bae6a7a5b549290d287feaba056 --- /dev/null +++ b/420/solution/_reference.py @@ -0,0 +1,6 @@ + +def cube_Sum(n): + sum = 0 + for i in range(1,n + 1): + sum += (2*i)*(2*i)*(2*i) + return sum \ No newline at end of file diff --git a/420/tests/conftest.py b/420/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/420/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/420/tests/test_mbpp_2.py b/420/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..27631b8132160f68fa18099f1cf91be2316a9835 --- /dev/null +++ b/420/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 cube_Sum(4) == 800 diff --git a/421/instruction.md b/421/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..245193bf01f22c02c63a70318110bb84ea30d6a0 --- /dev/null +++ b/421/instruction.md @@ -0,0 +1,3 @@ +# MBPP 421 + +Write a function to concatenate each element of tuple by the delimiter. diff --git a/421/solution/__init__.py b/421/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/421/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/421/solution/_reference.py b/421/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..f04db1675f2a9a6e7c2fabf132c7840c6752b234 --- /dev/null +++ b/421/solution/_reference.py @@ -0,0 +1,6 @@ + +def concatenate_tuple(test_tup): + delim = "-" + res = ''.join([str(ele) + delim for ele in test_tup]) + res = res[ : len(res) - len(delim)] + return (str(res)) \ No newline at end of file diff --git a/421/solution/solution.py b/421/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/421/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/421/solution/solve.sh b/421/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/421/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/421/task.toml b/421/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bd7626b527c03654e2070ca8e66194a1204b3893 --- /dev/null +++ b/421/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/421" +name = "MBPP — 421" + +[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/421/tests/__init__.py b/421/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/421/tests/conftest.py b/421/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/421/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/421/tests/test_mbpp_0.py b/421/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..6ca6ad8705ec781c7cdb8b722d134289c3fc340d --- /dev/null +++ b/421/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 concatenate_tuple(("ID", "is", 4, "UTS") ) == 'ID-is-4-UTS' diff --git a/421/tests/test_mbpp_1.py b/421/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..01c933fe4e4bb414d71a8107e930f50aad24e4e3 --- /dev/null +++ b/421/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 concatenate_tuple(("QWE", "is", 4, "RTY") ) == 'QWE-is-4-RTY' diff --git a/421/tests/test_mbpp_2.py b/421/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..97ddb00d6d263d40815347ab87d8dd018804d5a5 --- /dev/null +++ b/421/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 concatenate_tuple(("ZEN", "is", 4, "OP") ) == 'ZEN-is-4-OP' diff --git a/425/instruction.md b/425/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e92aa78e6efb815c45ebaa7689db5c5b06c08ef0 --- /dev/null +++ b/425/instruction.md @@ -0,0 +1,3 @@ +# MBPP 425 + +Write a function to count the number of sublists containing a particular element. diff --git a/425/solution/__init__.py b/425/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/425/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/425/solution/_reference.py b/425/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..9f93e16507854ae6e0baf883ba32c2ae5e476afe --- /dev/null +++ b/425/solution/_reference.py @@ -0,0 +1,7 @@ + +def count_element_in_list(list1, x): + ctr = 0 + for i in range(len(list1)): + if x in list1[i]: + ctr+= 1 + return ctr \ No newline at end of file diff --git a/425/solution/solution.py b/425/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/425/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/425/solution/solve.sh b/425/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/425/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/425/task.toml b/425/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d8787866e51b11de79a3948ec37ab66341417684 --- /dev/null +++ b/425/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/425" +name = "MBPP — 425" + +[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/425/tests/__init__.py b/425/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/425/tests/conftest.py b/425/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/425/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/425/tests/test_mbpp_0.py b/425/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..6649d25c32d01918720aafa80edad34b1bfa3348 --- /dev/null +++ b/425/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 count_element_in_list([[1, 3], [5, 7], [1, 11], [1, 15, 7]],1)==3 diff --git a/425/tests/test_mbpp_1.py b/425/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..3de130e793e8a91782f64585c5cab1795a5726ff --- /dev/null +++ b/425/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_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'A')==3 diff --git a/425/tests/test_mbpp_2.py b/425/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..4d8567d2de58a87ade28ea7aca611024481ca53a --- /dev/null +++ b/425/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 count_element_in_list([['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'E')==1 diff --git a/426/instruction.md b/426/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..366b46d17a0562726737785cbbb00f2136bb2a57 --- /dev/null +++ b/426/instruction.md @@ -0,0 +1,3 @@ +# MBPP 426 + +Write a function to filter odd numbers. diff --git a/426/solution/__init__.py b/426/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/426/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/426/solution/_reference.py b/426/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..f6ba3b420ede36c53fe9c48a75fc576eab7de98e --- /dev/null +++ b/426/solution/_reference.py @@ -0,0 +1,4 @@ + +def filter_oddnumbers(nums): + odd_nums = list(filter(lambda x: x%2 != 0, nums)) + return odd_nums \ No newline at end of file diff --git a/426/solution/solution.py b/426/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/426/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/426/solution/solve.sh b/426/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/426/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/426/task.toml b/426/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..98e082c170c42c1363c19cfb1aae3c224a59230a --- /dev/null +++ b/426/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/426" +name = "MBPP — 426" + +[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/426/tests/__init__.py b/426/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/426/tests/conftest.py b/426/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/426/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/426/tests/test_mbpp_0.py b/426/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..5b63de27daa52f572d7078f3fe5646805792b20a --- /dev/null +++ b/426/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 filter_oddnumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[1,3,5,7,9] diff --git a/426/tests/test_mbpp_1.py b/426/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..0f571b9849b4930b6c6e9cd2770481aa3f5fb912 --- /dev/null +++ b/426/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 filter_oddnumbers([10,20,45,67,84,93])==[45,67,93] diff --git a/426/tests/test_mbpp_2.py b/426/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..6fced1b710616916267e499ddd20f307c34afa14 --- /dev/null +++ b/426/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 filter_oddnumbers([5,7,9,8,6,4,3])==[5,7,9,3] diff --git a/427/instruction.md b/427/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..33a3fcbe840a0bf9bd363d534eb4fef4aa05accb --- /dev/null +++ b/427/instruction.md @@ -0,0 +1,3 @@ +# MBPP 427 + +Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format. diff --git a/427/solution/__init__.py b/427/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/427/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/427/solution/_reference.py b/427/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..2a28f96d488e11781caa6394e92284563e2dee75 --- /dev/null +++ b/427/solution/_reference.py @@ -0,0 +1,4 @@ + +import re +def change_date_format(dt): + return re.sub(r'(\d{4})-(\d{1,2})-(\d{1,2})', '\\3-\\2-\\1', dt) \ No newline at end of file diff --git a/427/solution/solution.py b/427/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/427/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/427/solution/solve.sh b/427/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/427/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/427/task.toml b/427/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b27f8cefa2ca272cdcf6617b32e7acfff5ab4a3e --- /dev/null +++ b/427/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/427" +name = "MBPP — 427" + +[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/427/tests/__init__.py b/427/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/427/tests/conftest.py b/427/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/427/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/427/tests/test_mbpp_0.py b/427/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..be090d438470cf712b9f74cf19c25d590cca2835 --- /dev/null +++ b/427/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 change_date_format("2026-01-02") == '02-01-2026' diff --git a/427/tests/test_mbpp_1.py b/427/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..d976d66737bacad01cd33ee85e17767b1645e790 --- /dev/null +++ b/427/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 change_date_format("2020-11-13") == '13-11-2020' diff --git a/427/tests/test_mbpp_2.py b/427/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..15841e92a3f0f304d720d093bb160c36370658e2 --- /dev/null +++ b/427/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 change_date_format("2021-04-26") == '26-04-2021' diff --git a/430/instruction.md b/430/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a08f80069c0e2a65eef55fbb5e7fcc2f5ce6ba93 --- /dev/null +++ b/430/instruction.md @@ -0,0 +1,3 @@ +# MBPP 430 + +Write a function to find the directrix of a parabola. diff --git a/430/solution/__init__.py b/430/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/430/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/430/solution/_reference.py b/430/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4395dcc62e36a272e40fdb4f7b7e57899abd1786 --- /dev/null +++ b/430/solution/_reference.py @@ -0,0 +1,4 @@ + +def parabola_directrix(a, b, c): + directrix=((int)(c - ((b * b) + 1) * 4 * a )) + return directrix \ No newline at end of file diff --git a/430/solution/solution.py b/430/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/430/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/430/solution/solve.sh b/430/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/430/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/430/task.toml b/430/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..08ca107e1aea2f8d4409b053bad2461ef51d8172 --- /dev/null +++ b/430/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/430" +name = "MBPP — 430" + +[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/430/tests/__init__.py b/430/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/430/tests/conftest.py b/430/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/430/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/430/tests/test_mbpp_0.py b/430/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..39c95190d2ff56959b445d38a9e31d596197030d --- /dev/null +++ b/430/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 parabola_directrix(5,3,2)==-198 diff --git a/430/tests/test_mbpp_1.py b/430/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..674fe72eabec3f76582201c5aabb198feed17446 --- /dev/null +++ b/430/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 parabola_directrix(9,8,4)==-2336 diff --git a/430/tests/test_mbpp_2.py b/430/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..1b29656a08fa91c24b558697f4ac17d54f77454e --- /dev/null +++ b/430/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 parabola_directrix(2,4,6)==-130 diff --git a/431/instruction.md b/431/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9131a13c7621b2db84727db364e531fc8b17c887 --- /dev/null +++ b/431/instruction.md @@ -0,0 +1,3 @@ +# MBPP 431 + +Write a function that takes two lists and returns true if they have at least one common element. diff --git a/431/solution/__init__.py b/431/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/431/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/431/solution/_reference.py b/431/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..8a9f7121f76fd96884113455b301ef0540b16f23 --- /dev/null +++ b/431/solution/_reference.py @@ -0,0 +1,8 @@ + +def common_element(list1, list2): + result = False + for x in list1: + for y in list2: + if x == y: + result = True + return result \ No newline at end of file diff --git a/431/solution/solution.py b/431/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/431/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/431/solution/solve.sh b/431/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/431/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/431/task.toml b/431/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee556d42c01932508248a2967b9b308af31d1765 --- /dev/null +++ b/431/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/431" +name = "MBPP — 431" + +[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/431/tests/__init__.py b/431/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/431/tests/conftest.py b/431/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/431/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/431/tests/test_mbpp_0.py b/431/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..5a47ceb31e0792b3443f377af3666f8f7c150afd --- /dev/null +++ b/431/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 common_element([1,2,3,4,5], [5,6,7,8,9])==True diff --git a/431/tests/test_mbpp_1.py b/431/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..e189d8e93a039f92a9fa41657e4722489a19438e --- /dev/null +++ b/431/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 common_element([1,2,3,4,5], [6,7,8,9])==None diff --git a/431/tests/test_mbpp_2.py b/431/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..6b45060790f68e4a2d1938a492b5d58cf2632699 --- /dev/null +++ b/431/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 common_element(['a','b','c'], ['d','b','e'])==True diff --git a/437/instruction.md b/437/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..898bd5898fe2ef84339604ce956d054afef926f2 --- /dev/null +++ b/437/instruction.md @@ -0,0 +1,3 @@ +# MBPP 437 + +Write a function to remove odd characters in a string. diff --git a/437/solution/__init__.py b/437/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/437/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/437/solution/_reference.py b/437/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..887c108f03c599388df9f5b94f119f3fb8d47d36 --- /dev/null +++ b/437/solution/_reference.py @@ -0,0 +1,7 @@ + +def remove_odd(str1): + str2 = '' + for i in range(1, len(str1) + 1): + if(i % 2 == 0): + str2 = str2 + str1[i - 1] + return str2 \ No newline at end of file diff --git a/437/solution/solution.py b/437/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/437/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/437/solution/solve.sh b/437/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/437/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/437/task.toml b/437/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d595291251e7c62a1fd1f846ce8e740598578208 --- /dev/null +++ b/437/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/437" +name = "MBPP — 437" + +[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/437/tests/__init__.py b/437/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/437/tests/conftest.py b/437/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/437/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/437/tests/test_mbpp_0.py b/437/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..5e60296bb8c70a852acbd4cae631772dc89063da --- /dev/null +++ b/437/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 remove_odd("python")==("yhn") diff --git a/437/tests/test_mbpp_1.py b/437/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c5978c5e52535c84e5b8b961006ee2efbc4b343d --- /dev/null +++ b/437/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 remove_odd("program")==("rga") diff --git a/437/tests/test_mbpp_2.py b/437/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..cc6fefc3aa37b001c14af5fe6918341a41f43e9a --- /dev/null +++ b/437/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 remove_odd("language")==("agae") diff --git a/439/instruction.md b/439/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7a711030be762949fc95ebc6b66ed137d7c389c4 --- /dev/null +++ b/439/instruction.md @@ -0,0 +1,3 @@ +# MBPP 439 + +Write a function to join a list of multiple integers into a single integer. diff --git a/439/solution/__init__.py b/439/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/439/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/439/solution/_reference.py b/439/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..5353f93e845ce033f65701c793802064665db803 --- /dev/null +++ b/439/solution/_reference.py @@ -0,0 +1,4 @@ + +def multiple_to_single(L): + x = int("".join(map(str, L))) + return x \ No newline at end of file diff --git a/439/solution/solution.py b/439/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/439/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/439/solution/solve.sh b/439/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/439/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/439/task.toml b/439/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1249eac34acaafdd887db4ca1748ac87354e28b1 --- /dev/null +++ b/439/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/439" +name = "MBPP — 439" + +[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/439/tests/__init__.py b/439/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/439/tests/conftest.py b/439/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/439/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/439/tests/test_mbpp_0.py b/439/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..abfd4d3d873ea4af517c1a0e35d4a39055fd5a7a --- /dev/null +++ b/439/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 multiple_to_single([11, 33, 50])==113350 diff --git a/439/tests/test_mbpp_1.py b/439/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..f1f923f87d45867d40068dabd53d5e83d4c2954f --- /dev/null +++ b/439/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 multiple_to_single([-1,2,3,4,5,6])==-123456 diff --git a/439/tests/test_mbpp_2.py b/439/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..cc44c39b0a5e32b42f508f8b0d6a26eb0c781be2 --- /dev/null +++ b/439/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 multiple_to_single([10,15,20,25])==10152025 diff --git a/443/instruction.md b/443/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f0af53df79f0972b46e852a07dada4a4d1c16bf2 --- /dev/null +++ b/443/instruction.md @@ -0,0 +1,3 @@ +# MBPP 443 + +Write a python function to find the largest negative number from the given list. diff --git a/443/solution/__init__.py b/443/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/443/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/443/solution/_reference.py b/443/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..71ea7ef7f9ed18b03378997431564572431f7243 --- /dev/null +++ b/443/solution/_reference.py @@ -0,0 +1,7 @@ + +def largest_neg(list1): + max = list1[0] + for x in list1: + if x < max : + max = x + return max \ No newline at end of file diff --git a/443/solution/solution.py b/443/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/443/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/443/solution/solve.sh b/443/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/443/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/443/task.toml b/443/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f8eaec813bde0b61ac6a07a79e7c941f37974c97 --- /dev/null +++ b/443/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/443" +name = "MBPP — 443" + +[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/443/tests/__init__.py b/443/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/443/tests/conftest.py b/443/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/443/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/443/tests/test_mbpp_0.py b/443/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..cf90b507c21731c95cc0bda2e77907beda2ea5f9 --- /dev/null +++ b/443/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 largest_neg([1,2,3,-4,-6]) == -6 diff --git a/443/tests/test_mbpp_1.py b/443/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c356609efb5e653f863030c547ccc921bddd328d --- /dev/null +++ b/443/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 largest_neg([1,2,3,-8,-9]) == -9 diff --git a/443/tests/test_mbpp_2.py b/443/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..04d26ab5c1e9f757212b5096f7c246451d954af7 --- /dev/null +++ b/443/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 largest_neg([1,2,3,4,-1]) == -1 diff --git a/448/instruction.md b/448/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..465eec8f646d66cad8b895e4366c35a8a68e9d9d --- /dev/null +++ b/448/instruction.md @@ -0,0 +1,3 @@ +# MBPP 448 + +Write a function to calculate the sum of perrin numbers. diff --git a/448/solution/__init__.py b/448/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/448/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/448/solution/_reference.py b/448/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..06e27f120bc7a0394921cb9976cd6c43e5787c7f --- /dev/null +++ b/448/solution/_reference.py @@ -0,0 +1,20 @@ + +def cal_sum(n): + a = 3 + b = 0 + c = 2 + if (n == 0): + return 3 + if (n == 1): + return 3 + if (n == 2): + return 5 + sum = 5 + while (n > 2): + d = a + b + sum = sum + d + a = b + b = c + c = d + n = n-1 + return sum \ No newline at end of file diff --git a/448/solution/solution.py b/448/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/448/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/448/solution/solve.sh b/448/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/448/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/448/task.toml b/448/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ce552825d9a08a3d2958018b284ff8fd407650e9 --- /dev/null +++ b/448/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/448" +name = "MBPP — 448" + +[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/448/tests/__init__.py b/448/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/448/tests/conftest.py b/448/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/448/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/448/tests/test_mbpp_0.py b/448/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..db9c620704df233db7e1554ad0848f6201fa92e9 --- /dev/null +++ b/448/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 cal_sum(9) == 49 diff --git a/448/tests/test_mbpp_1.py b/448/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..3b53cbf626bbdf1e66e0327119427a08c3c0ee58 --- /dev/null +++ b/448/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 cal_sum(10) == 66 diff --git a/448/tests/test_mbpp_2.py b/448/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..3039be1685b88baa3ef4e2c5220bea413855220c --- /dev/null +++ b/448/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 cal_sum(11) == 88 diff --git a/460/tests/__init__.py b/460/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/468/instruction.md b/468/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..12eea45415385c5efae49757bd07a9c0737029f2 --- /dev/null +++ b/468/instruction.md @@ -0,0 +1,3 @@ +# MBPP 468 + +Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. diff --git a/468/solution/__init__.py b/468/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/468/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/468/solution/_reference.py b/468/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4fd98e198b9b73ee94ea3d7a7ea8ec33c9165bcf --- /dev/null +++ b/468/solution/_reference.py @@ -0,0 +1,15 @@ + +def max_product(arr): + n = len(arr) + mpis = arr[:] + for i in range(n): + current_prod = arr[i] + j = i + 1 + while j < n: + if arr[j-1] > arr[j]: + break + current_prod *= arr[j] + if current_prod > mpis[j]: + mpis[j] = current_prod + j = j + 1 + return max(mpis) \ No newline at end of file diff --git a/468/solution/solution.py b/468/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/468/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/468/solution/solve.sh b/468/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/468/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/468/task.toml b/468/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cb483b55eb1ff562011bd919f87a518cdeb34d02 --- /dev/null +++ b/468/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/468" +name = "MBPP — 468" + +[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/468/tests/__init__.py b/468/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/468/tests/conftest.py b/468/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/468/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/468/tests/test_mbpp_0.py b/468/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..0e014c28bcd85ab58bfe75846ae2d51cf37ee96a --- /dev/null +++ b/468/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_product([3, 100, 4, 5, 150, 6]) == 3000 diff --git a/468/tests/test_mbpp_1.py b/468/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..fdcebae5c9347ec0155bfd372c39fc44b0d68d54 --- /dev/null +++ b/468/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_product([4, 42, 55, 68, 80]) == 50265600 diff --git a/468/tests/test_mbpp_2.py b/468/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..d5c64914fcf5db8a6529bc94483f8aa437b76c22 --- /dev/null +++ b/468/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_product([10, 22, 9, 33, 21, 50, 41, 60]) == 2460 diff --git a/471/instruction.md b/471/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..67372efdd761c8dccb757a2e52a5e0f6fa01d1ad --- /dev/null +++ b/471/instruction.md @@ -0,0 +1,3 @@ +# MBPP 471 + +Write a python function to find the product of the array multiplication modulo n. diff --git a/471/solution/__init__.py b/471/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/471/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/471/solution/_reference.py b/471/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..a33c6b33d38b977972fa975ccc6b25e34cb1fcf7 --- /dev/null +++ b/471/solution/_reference.py @@ -0,0 +1,6 @@ + +def find_remainder(arr, n): + mul = 1 + for i in range(len(arr)): + mul = (mul * (arr[i] % n)) % n + return mul % n \ No newline at end of file diff --git a/471/solution/solution.py b/471/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/471/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/471/solution/solve.sh b/471/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/471/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/471/task.toml b/471/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6d95b343562a1d8b3551b8038d6b5d0c67618743 --- /dev/null +++ b/471/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/471" +name = "MBPP — 471" + +[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/471/tests/__init__.py b/471/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/471/tests/conftest.py b/471/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/471/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/471/tests/test_mbpp_0.py b/471/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..f88737072d3ba3f7e55d28f41462e3a145a07ff5 --- /dev/null +++ b/471/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 find_remainder([ 100, 10, 5, 25, 35, 14 ],11) ==9 diff --git a/471/tests/test_mbpp_1.py b/471/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..40ef6d70c7bb6fea7cbf48aca7041f03fc1cf8f3 --- /dev/null +++ b/471/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_remainder([1,1,1],1) == 0 diff --git a/471/tests/test_mbpp_2.py b/471/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..5f841f9ef2469b4f2d58630c092d6a56349b54af --- /dev/null +++ b/471/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_remainder([1,2,1],2) == 0 diff --git a/475/instruction.md b/475/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..57dc232fb634fb148e5d25b5c1062ed5c2927302 --- /dev/null +++ b/475/instruction.md @@ -0,0 +1,3 @@ +# MBPP 475 + +Write a function to sort a dictionary by value. diff --git a/475/solution/__init__.py b/475/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/475/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/475/solution/_reference.py b/475/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..3b7f7f527f619e8b3e50a8c6916056ae1a30ff12 --- /dev/null +++ b/475/solution/_reference.py @@ -0,0 +1,6 @@ + +from collections import Counter +def sort_counter(dict1): + x = Counter(dict1) + sort_counter=x.most_common() + return sort_counter \ No newline at end of file diff --git a/475/solution/solution.py b/475/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/475/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/475/solution/solve.sh b/475/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/475/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/475/task.toml b/475/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a23be115cc9c169959f245ccc0d21b4c5cacd7b5 --- /dev/null +++ b/475/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/475" +name = "MBPP — 475" + +[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/475/tests/__init__.py b/475/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/475/tests/conftest.py b/475/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/475/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/475/tests/test_mbpp_0.py b/475/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..667da87d1df7ce3a1cd1c1c4ab91d48b1dfe76d3 --- /dev/null +++ b/475/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 sort_counter({'Math':81, 'Physics':83, 'Chemistry':87})==[('Chemistry', 87), ('Physics', 83), ('Math', 81)] diff --git a/475/tests/test_mbpp_1.py b/475/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..49f7dff157f15e80ed47440f306b65edd79bed5c --- /dev/null +++ b/475/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 sort_counter({'Math':400, 'Physics':300, 'Chemistry':250})==[('Math', 400), ('Physics', 300), ('Chemistry', 250)] diff --git a/475/tests/test_mbpp_2.py b/475/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..8b8b2161dd664ad5e382c7fe7ccabae7925d9adf --- /dev/null +++ b/475/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 sort_counter({'Math':900, 'Physics':1000, 'Chemistry':1250})==[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)] diff --git a/477/instruction.md b/477/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ba226d402cbc4c9b1ec50497a1d360dad7971f4f --- /dev/null +++ b/477/instruction.md @@ -0,0 +1,3 @@ +# MBPP 477 + +Write a python function to convert the given string to lower case. diff --git a/477/solution/__init__.py b/477/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/477/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/477/solution/_reference.py b/477/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..de89901b7db61bccbc63cd3b95b910db77c31a3e --- /dev/null +++ b/477/solution/_reference.py @@ -0,0 +1,3 @@ + +def is_lower(string): + return (string.lower()) \ No newline at end of file diff --git a/477/solution/solution.py b/477/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/477/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/477/solution/solve.sh b/477/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/477/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/477/task.toml b/477/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b726a1bf3534082c05a7c679af7ca0401efa9fb6 --- /dev/null +++ b/477/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/477" +name = "MBPP — 477" + +[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/477/tests/__init__.py b/477/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/477/tests/conftest.py b/477/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/477/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/477/tests/test_mbpp_0.py b/477/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..d3d561609a8887206c204c01c1f9886e02375d29 --- /dev/null +++ b/477/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 is_lower("InValid") == "invalid" diff --git a/477/tests/test_mbpp_1.py b/477/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..38c04ee6a7260b90b3c61ac7b86a00d8bb0be584 --- /dev/null +++ b/477/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 is_lower("TruE") == "true" diff --git a/477/tests/test_mbpp_2.py b/477/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..63201ccbcf1a216685da88f5a59803a6a056c1da --- /dev/null +++ b/477/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 is_lower("SenTenCE") == "sentence" diff --git a/479/solution/_reference.py b/479/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..6b2883b574d672e23a71c618311510357d0d38a8 --- /dev/null +++ b/479/solution/_reference.py @@ -0,0 +1,5 @@ + +def first_Digit(n) : + while n >= 10: + n = n / 10 + return int(n) \ No newline at end of file diff --git a/479/tests/test_mbpp_2.py b/479/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..757e8d48f22000b62aabaa39498d32632abf2535 --- /dev/null +++ b/479/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 first_Digit(12) == 1 diff --git a/61/instruction.md b/61/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1fc6cba4201b73f3804944ede88b0f4ed200b61b --- /dev/null +++ b/61/instruction.md @@ -0,0 +1,3 @@ +# MBPP 61 + +Write a python function to count the number of substrings with the sum of digits equal to their length. diff --git a/61/solution/__init__.py b/61/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/61/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/61/solution/_reference.py b/61/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..f005d7b469ff85833952cbc42328a8f06b7a1357 --- /dev/null +++ b/61/solution/_reference.py @@ -0,0 +1,12 @@ + +from collections import defaultdict +def count_Substrings(s): + n = len(s) + count,sum = 0,0 + mp = defaultdict(lambda : 0) + mp[0] += 1 + for i in range(n): + sum += ord(s[i]) - ord('0') + count += mp[sum - (i + 1)] + mp[sum - (i + 1)] += 1 + return count \ No newline at end of file diff --git a/61/solution/solution.py b/61/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/61/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/61/solution/solve.sh b/61/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/61/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/61/task.toml b/61/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e10712635e399514f02e73ca6af2b29cd4e5e96c --- /dev/null +++ b/61/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/61" +name = "MBPP — 61" + +[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/61/tests/__init__.py b/61/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/61/tests/conftest.py b/61/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/61/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/61/tests/test_mbpp_0.py b/61/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..3961e54acc6882bfee804a74d8c19000e90d69f2 --- /dev/null +++ b/61/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 count_Substrings('112112') == 6 diff --git a/61/tests/test_mbpp_1.py b/61/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..fdd343fc4e7515c8332385c947bab94b3b9275c4 --- /dev/null +++ b/61/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_Substrings('111') == 6 diff --git a/61/tests/test_mbpp_2.py b/61/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..18ad17e6050ebe3fea8d1995bca5d0cf3fbc3f48 --- /dev/null +++ b/61/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 count_Substrings('1101112') == 12 diff --git a/65/instruction.md b/65/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..76c9f18f03efbe502ed683b222e17887db9f2bd5 --- /dev/null +++ b/65/instruction.md @@ -0,0 +1,3 @@ +# MBPP 65 + +Write a function to flatten a list and sum all of its elements. diff --git a/65/solution/__init__.py b/65/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/65/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/65/solution/_reference.py b/65/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4d739e7edefa0054aa9c850a3fc2228ba3a2c1ee --- /dev/null +++ b/65/solution/_reference.py @@ -0,0 +1,9 @@ + +def recursive_list_sum(data_list): + total = 0 + for element in data_list: + if type(element) == type([]): + total = total + recursive_list_sum(element) + else: + total = total + element + return total \ No newline at end of file diff --git a/65/solution/solution.py b/65/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/65/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/65/solution/solve.sh b/65/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/65/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/65/task.toml b/65/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..47d2c39d90421a342680eeb37254510a81cf3145 --- /dev/null +++ b/65/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/65" +name = "MBPP — 65" + +[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/65/tests/__init__.py b/65/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/65/tests/conftest.py b/65/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/65/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/65/tests/test_mbpp_0.py b/65/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..115310685708a01d7587cab50e9f6d9bf41fa630 --- /dev/null +++ b/65/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 recursive_list_sum(([1, 2, [3,4],[5,6]]))==21 diff --git a/65/tests/test_mbpp_1.py b/65/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..ce609fbcff7459215ddd5d0336d7a22e9e1fbec9 --- /dev/null +++ b/65/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 recursive_list_sum(([7, 10, [15,14],[19,41]]))==106 diff --git a/68/instruction.md b/68/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6bad4a5834a8927bf5cddd495554c0ada42a60a0 --- /dev/null +++ b/68/instruction.md @@ -0,0 +1,3 @@ +# MBPP 68 + +Write a python function to check whether the given array is monotonic or not. diff --git a/68/solution/__init__.py b/68/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/68/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/68/solution/_reference.py b/68/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..ebf6964e36fe13d7225509592440fef04284a924 --- /dev/null +++ b/68/solution/_reference.py @@ -0,0 +1,4 @@ + +def is_Monotonic(A): + return (all(A[i] <= A[i + 1] for i in range(len(A) - 1)) or + all(A[i] >= A[i + 1] for i in range(len(A) - 1))) \ No newline at end of file diff --git a/68/solution/solution.py b/68/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/68/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/68/solution/solve.sh b/68/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/68/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/68/task.toml b/68/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6d8bf68d6f4070e29a234bf98f482df15593075b --- /dev/null +++ b/68/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/68" +name = "MBPP — 68" + +[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/68/tests/__init__.py b/68/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/68/tests/conftest.py b/68/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/68/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/68/tests/test_mbpp_0.py b/68/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..3dd2bb3380796d6540592ae2fed31d6f45107254 --- /dev/null +++ b/68/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 is_Monotonic([6, 5, 4, 4]) == True diff --git a/68/tests/test_mbpp_1.py b/68/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..d2fdf7c8a8f3f46683f9404ff9b75189771d0fe9 --- /dev/null +++ b/68/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 is_Monotonic([1, 2, 2, 3]) == True diff --git a/68/tests/test_mbpp_2.py b/68/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..3dee38796d9b409d5115da3a623fe0bba266b56e --- /dev/null +++ b/68/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 is_Monotonic([1, 3, 2]) == False diff --git a/70/tests/__init__.py b/70/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/80/instruction.md b/80/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bbf90c43ba8870ea647e45da36cc5765b94242d8 --- /dev/null +++ b/80/instruction.md @@ -0,0 +1,3 @@ +# MBPP 80 + +Write a function to find the nth tetrahedral number. diff --git a/80/solution/__init__.py b/80/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/80/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/80/solution/_reference.py b/80/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..ca44e4205f84558394efdf83e866c9e990f21655 --- /dev/null +++ b/80/solution/_reference.py @@ -0,0 +1,3 @@ + +def tetrahedral_number(n): + return (n * (n + 1) * (n + 2)) / 6 \ No newline at end of file diff --git a/80/solution/solution.py b/80/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/80/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/80/solution/solve.sh b/80/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/80/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/80/task.toml b/80/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..46253c251693b58861e7cf9752d94ee49d7bf857 --- /dev/null +++ b/80/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/80" +name = "MBPP — 80" + +[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/80/tests/__init__.py b/80/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/80/tests/conftest.py b/80/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/80/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/80/tests/test_mbpp_0.py b/80/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..57c7777c0a2bda9d15ee5dccdd50abf1726a717a --- /dev/null +++ b/80/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 tetrahedral_number(5) == 35 diff --git a/80/tests/test_mbpp_1.py b/80/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c1026903f2bb48e088675994ebb233f46f88ce80 --- /dev/null +++ b/80/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 tetrahedral_number(6) == 56 diff --git a/80/tests/test_mbpp_2.py b/80/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..62753cc21eb35de8540f2ad4108306f534db3f72 --- /dev/null +++ b/80/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 tetrahedral_number(7) == 84 diff --git a/86/instruction.md b/86/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4347464b900572512f754a53331bdcc3f4f17d08 --- /dev/null +++ b/86/instruction.md @@ -0,0 +1,3 @@ +# MBPP 86 + +Write a function to find nth centered hexagonal number. diff --git a/86/solution/__init__.py b/86/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/86/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/86/solution/_reference.py b/86/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..02b0d7dc8576234df2745e8f258d5394255740bb --- /dev/null +++ b/86/solution/_reference.py @@ -0,0 +1,3 @@ + +def centered_hexagonal_number(n): + return 3 * n * (n - 1) + 1 \ No newline at end of file diff --git a/86/solution/solution.py b/86/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/86/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/86/solution/solve.sh b/86/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/86/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/86/task.toml b/86/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a47205c99d343cca3f4262dd68a119d3a9ab55e0 --- /dev/null +++ b/86/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/86" +name = "MBPP — 86" + +[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/86/tests/__init__.py b/86/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/86/tests/conftest.py b/86/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/86/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/86/tests/test_mbpp_0.py b/86/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..102a9ee6de301c1cb7f0f6609698be668cce0e8e --- /dev/null +++ b/86/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 centered_hexagonal_number(10) == 271 diff --git a/86/tests/test_mbpp_1.py b/86/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..812b013ac2dc4a2d039568c1cc83e00cbd2b340f --- /dev/null +++ b/86/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 centered_hexagonal_number(2) == 7 diff --git a/86/tests/test_mbpp_2.py b/86/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..ac8586ca3baa8d8371f9485ee2a9af66939a88b5 --- /dev/null +++ b/86/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 centered_hexagonal_number(9) == 217 diff --git a/89/solution/__init__.py b/89/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/89/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/89/solution/_reference.py b/89/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4e37aab881a6f45e2a47268bbd7864c216545834 --- /dev/null +++ b/89/solution/_reference.py @@ -0,0 +1,3 @@ + +def closest_num(N): + return (N - 1) \ No newline at end of file diff --git a/89/solution/solution.py b/89/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/89/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/89/solution/solve.sh b/89/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/89/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/89/tests/__init__.py b/89/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/89/tests/conftest.py b/89/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/89/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/89/tests/test_mbpp_0.py b/89/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..1e5776c3de8f6e186d1ca7e8f527a3652aaec379 --- /dev/null +++ b/89/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 closest_num(11) == 10 diff --git a/89/tests/test_mbpp_1.py b/89/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..2dc6b96588d2838e9d05aa1d38bcca7e20261bc3 --- /dev/null +++ b/89/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 closest_num(7) == 6 diff --git a/89/tests/test_mbpp_2.py b/89/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..b1396ca4d5e26bb0c460d5014b693373f7128ba9 --- /dev/null +++ b/89/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 closest_num(12) == 11 diff --git a/91/instruction.md b/91/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..efea3d38c7dc8f8c071eecd36059d3f31062d386 --- /dev/null +++ b/91/instruction.md @@ -0,0 +1,3 @@ +# MBPP 91 + +Write a function to check if a string is present as a substring in a given list of string values. diff --git a/91/solution/__init__.py b/91/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/91/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/91/solution/_reference.py b/91/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..f461000d3e71350cfe8ee4992c21e5dbda422416 --- /dev/null +++ b/91/solution/_reference.py @@ -0,0 +1,5 @@ + +def find_substring(str1, sub_str): + if any(sub_str in s for s in str1): + return True + return False \ No newline at end of file diff --git a/91/solution/solution.py b/91/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/91/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/91/solution/solve.sh b/91/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/91/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/91/task.toml b/91/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6320e1753bf93dd226f8e7f442aac53d0ecedf7c --- /dev/null +++ b/91/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/91" +name = "MBPP — 91" + +[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/91/tests/__init__.py b/91/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/91/tests/conftest.py b/91/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/91/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/91/tests/test_mbpp_0.py b/91/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..23432b69da4ab62ff56a380bcc93d90e3b60c774 --- /dev/null +++ b/91/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 find_substring(["red", "black", "white", "green", "orange"],"ack")==True diff --git a/91/tests/test_mbpp_1.py b/91/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..cd00510c5c356628561a400eed2bf799ad22d0d7 --- /dev/null +++ b/91/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_substring(["red", "black", "white", "green", "orange"],"abc")==False diff --git a/91/tests/test_mbpp_2.py b/91/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..f76cba891e37f80a2470be177514a65c41f44597 --- /dev/null +++ b/91/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_substring(["red", "black", "white", "green", "orange"],"ange")==True diff --git a/93/instruction.md b/93/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ce26360ace7e6382fee31c45514d977680b92f4e --- /dev/null +++ b/93/instruction.md @@ -0,0 +1,3 @@ +# MBPP 93 + +Write a function to calculate the value of 'a' to the power 'b'. diff --git a/93/solution/__init__.py b/93/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62ea3cdf9d652175e42198b21ae6d71dc49d3471 --- /dev/null +++ b/93/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import * # noqa: F401,F403 diff --git a/93/solution/_reference.py b/93/solution/_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..8d2d046a0be7bd71fc0033ba1caef3bd2a15eba4 --- /dev/null +++ b/93/solution/_reference.py @@ -0,0 +1,10 @@ + +def power(a,b): + if b==0: + return 1 + elif a==0: + return 0 + elif b==1: + return a + else: + return a*power(a,b-1) \ No newline at end of file diff --git a/93/solution/solution.py b/93/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ab75ed7fbf399f024e3405ba11b08b4ba3da70 --- /dev/null +++ b/93/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/93/solution/solve.sh b/93/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..e0271f470918d28239240e27f502057047a05593 --- /dev/null +++ b/93/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/93/task.toml b/93/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8112471aba52c8402507c47f9f6202b5522c3cd6 --- /dev/null +++ b/93/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "mbpp/93" +name = "MBPP — 93" + +[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/93/tests/__init__.py b/93/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/93/tests/conftest.py b/93/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/93/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/93/tests/test_mbpp_0.py b/93/tests/test_mbpp_0.py new file mode 100644 index 0000000000000000000000000000000000000000..67e5ecc0f4fa4d1bd00c9c35868787dbd2d774fa --- /dev/null +++ b/93/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 power(3,4) == 81 diff --git a/93/tests/test_mbpp_1.py b/93/tests/test_mbpp_1.py new file mode 100644 index 0000000000000000000000000000000000000000..a3e260fdf840b0762f711a29b42a4385effb9069 --- /dev/null +++ b/93/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 power(2,3) == 8 diff --git a/93/tests/test_mbpp_2.py b/93/tests/test_mbpp_2.py new file mode 100644 index 0000000000000000000000000000000000000000..f80913d2b4e02e6fb22168bcb854366b76e29e4d --- /dev/null +++ b/93/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 power(5,5) == 3125