sqy201x commited on
Commit
98afead
·
verified ·
1 Parent(s): e0656d2

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
129/instruction.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # MBPP 129
2
+
3
+ Write a function to calculate whether the matrix is a magic square.
129/solution/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from solution.solution import * # noqa: F401,F403
129/solution/_reference.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ def magic_square_test(my_matrix):
3
+ iSize = len(my_matrix[0])
4
+ sum_list = []
5
+ sum_list.extend([sum (lines) for lines in my_matrix])
6
+ for col in range(iSize):
7
+ sum_list.append(sum(row[col] for row in my_matrix))
8
+ result1 = 0
9
+ for i in range(0,iSize):
10
+ result1 +=my_matrix[i][i]
11
+ sum_list.append(result1)
12
+ result2 = 0
13
+ for i in range(iSize-1,-1,-1):
14
+ result2 +=my_matrix[i][i]
15
+ sum_list.append(result2)
16
+ if len(set(sum_list))>1:
17
+ return False
18
+ return True
129/solution/solution.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stub solution module — agents must overwrite this file.
2
+
3
+ Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
4
+ canonical upstream solution at `solution/_reference.py` and this
5
+ stub at `solution/solution.py`. The pytest verifier imports from
6
+ `solution.solution`, so any attempt to run the tests against this
7
+ stub fails loudly with NotImplementedError instead of silently
8
+ passing on a pre-shipped answer.
9
+
10
+ - Non-oracle agents: must overwrite `solution.py` with their own
11
+ attempt (the file the pytest tests import from).
12
+ - OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
13
+ copies `_reference.py` over `solution.py` before the verifier runs,
14
+ so oracle smoke trials still pass.
15
+ """
16
+
17
+ def __getattr__(name: str):
18
+ raise NotImplementedError(
19
+ f"solution.solution.{name!r} not implemented — the agent must "
20
+ f"replace this file with a real solution. Oracle agents do "
21
+ f"this via solve.sh, which copies _reference.py."
22
+ )
129/solution/solve.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ HERE="$(dirname "$0")"
4
+ if [ -f "$HERE/_reference.py" ]; then
5
+ cd "$HERE"
6
+ elif [ -f "$HERE/solution/_reference.py" ]; then
7
+ cd "$HERE/solution"
8
+ else
9
+ echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
10
+ exit 1
11
+ fi
12
+ cp -f _reference.py solution.py
129/task.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1"
2
+
3
+ [task]
4
+ id = "mbpp/129"
5
+ name = "MBPP — 129"
6
+
7
+ [environment]
8
+ os = "linux"
9
+ docker_image = "python:3.11-slim"
10
+
11
+ [agent]
12
+ name = "oracle"
13
+
14
+ [verifier]
15
+ name = "pytest"
16
+
17
+ [[steps]]
18
+ name = "main"
19
+ artifacts = ["solution/solution.py"]
129/tests/__init__.py ADDED
File without changes
129/tests/conftest.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ sys.path.insert(0, str(Path(__file__).parent.parent))
129/tests/test_mbpp_1.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_1() -> None:
6
+ assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 8]])==True
129/tests/test_mbpp_2.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_2() -> None:
6
+ assert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 7]])==False
160/instruction.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # MBPP 160
2
+
3
+ Write a function that returns integers x and y that satisfy ax + by = n as a tuple, or return None if no solution exists.
160/solution/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from solution.solution import * # noqa: F401,F403
160/solution/_reference.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ def find_solution(a, b, n):
3
+ i = 0
4
+ while i * a <= n:
5
+ if (n - (i * a)) % b == 0:
6
+ return (i, (n - (i * a)) // b)
7
+ i = i + 1
8
+ return None
160/solution/solution.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stub solution module — agents must overwrite this file.
2
+
3
+ Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
4
+ canonical upstream solution at `solution/_reference.py` and this
5
+ stub at `solution/solution.py`. The pytest verifier imports from
6
+ `solution.solution`, so any attempt to run the tests against this
7
+ stub fails loudly with NotImplementedError instead of silently
8
+ passing on a pre-shipped answer.
9
+
10
+ - Non-oracle agents: must overwrite `solution.py` with their own
11
+ attempt (the file the pytest tests import from).
12
+ - OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
13
+ copies `_reference.py` over `solution.py` before the verifier runs,
14
+ so oracle smoke trials still pass.
15
+ """
16
+
17
+ def __getattr__(name: str):
18
+ raise NotImplementedError(
19
+ f"solution.solution.{name!r} not implemented — the agent must "
20
+ f"replace this file with a real solution. Oracle agents do "
21
+ f"this via solve.sh, which copies _reference.py."
22
+ )
160/solution/solve.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ HERE="$(dirname "$0")"
4
+ if [ -f "$HERE/_reference.py" ]; then
5
+ cd "$HERE"
6
+ elif [ -f "$HERE/solution/_reference.py" ]; then
7
+ cd "$HERE/solution"
8
+ else
9
+ echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
10
+ exit 1
11
+ fi
12
+ cp -f _reference.py solution.py
160/task.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1"
2
+
3
+ [task]
4
+ id = "mbpp/160"
5
+ name = "MBPP — 160"
6
+
7
+ [environment]
8
+ os = "linux"
9
+ docker_image = "python:3.11-slim"
10
+
11
+ [agent]
12
+ name = "oracle"
13
+
14
+ [verifier]
15
+ name = "pytest"
16
+
17
+ [[steps]]
18
+ name = "main"
19
+ artifacts = ["solution/solution.py"]
160/tests/__init__.py ADDED
File without changes
160/tests/conftest.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ sys.path.insert(0, str(Path(__file__).parent.parent))
160/tests/test_mbpp_1.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_1() -> None:
6
+ assert find_solution(4, 2, 7) == None
160/tests/test_mbpp_2.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_2() -> None:
6
+ assert find_solution(1, 13, 17) == (4, 1)
171/instruction.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # MBPP 171
2
+
3
+ Write a function to find the perimeter of a regular pentagon from the length of its sides.
171/solution/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from solution.solution import * # noqa: F401,F403
171/solution/_reference.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+
2
+ import math
3
+ def perimeter_pentagon(a):
4
+ perimeter=(5*a)
5
+ return perimeter
171/solution/solution.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stub solution module — agents must overwrite this file.
2
+
3
+ Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
4
+ canonical upstream solution at `solution/_reference.py` and this
5
+ stub at `solution/solution.py`. The pytest verifier imports from
6
+ `solution.solution`, so any attempt to run the tests against this
7
+ stub fails loudly with NotImplementedError instead of silently
8
+ passing on a pre-shipped answer.
9
+
10
+ - Non-oracle agents: must overwrite `solution.py` with their own
11
+ attempt (the file the pytest tests import from).
12
+ - OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
13
+ copies `_reference.py` over `solution.py` before the verifier runs,
14
+ so oracle smoke trials still pass.
15
+ """
16
+
17
+ def __getattr__(name: str):
18
+ raise NotImplementedError(
19
+ f"solution.solution.{name!r} not implemented — the agent must "
20
+ f"replace this file with a real solution. Oracle agents do "
21
+ f"this via solve.sh, which copies _reference.py."
22
+ )
171/solution/solve.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ HERE="$(dirname "$0")"
4
+ if [ -f "$HERE/_reference.py" ]; then
5
+ cd "$HERE"
6
+ elif [ -f "$HERE/solution/_reference.py" ]; then
7
+ cd "$HERE/solution"
8
+ else
9
+ echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
10
+ exit 1
11
+ fi
12
+ cp -f _reference.py solution.py
171/task.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1"
2
+
3
+ [task]
4
+ id = "mbpp/171"
5
+ name = "MBPP — 171"
6
+
7
+ [environment]
8
+ os = "linux"
9
+ docker_image = "python:3.11-slim"
10
+
11
+ [agent]
12
+ name = "oracle"
13
+
14
+ [verifier]
15
+ name = "pytest"
16
+
17
+ [[steps]]
18
+ name = "main"
19
+ artifacts = ["solution/solution.py"]
171/tests/__init__.py ADDED
File without changes
171/tests/conftest.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ sys.path.insert(0, str(Path(__file__).parent.parent))
171/tests/test_mbpp_0.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_0() -> None:
6
+ assert perimeter_pentagon(5) == 25
171/tests/test_mbpp_1.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_1() -> None:
6
+ assert perimeter_pentagon(10) == 50
171/tests/test_mbpp_2.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_2() -> None:
6
+ assert perimeter_pentagon(15) == 75
223/task.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1"
2
+
3
+ [task]
4
+ id = "mbpp/223"
5
+ name = "MBPP — 223"
6
+
7
+ [environment]
8
+ os = "linux"
9
+ docker_image = "python:3.11-slim"
10
+
11
+ [agent]
12
+ name = "oracle"
13
+
14
+ [verifier]
15
+ name = "pytest"
16
+
17
+ [[steps]]
18
+ name = "main"
19
+ artifacts = ["solution/solution.py"]
240/instruction.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # MBPP 240
2
+
3
+ Write a function that takes in two lists and replaces the last element of the first list with the elements of the second list.
240/solution/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from solution.solution import * # noqa: F401,F403
240/solution/_reference.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+
2
+ def replace_list(list1,list2):
3
+ list1[-1:] = list2
4
+ replace_list=list1
5
+ return replace_list
240/solution/solution.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stub solution module — agents must overwrite this file.
2
+
3
+ Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
4
+ canonical upstream solution at `solution/_reference.py` and this
5
+ stub at `solution/solution.py`. The pytest verifier imports from
6
+ `solution.solution`, so any attempt to run the tests against this
7
+ stub fails loudly with NotImplementedError instead of silently
8
+ passing on a pre-shipped answer.
9
+
10
+ - Non-oracle agents: must overwrite `solution.py` with their own
11
+ attempt (the file the pytest tests import from).
12
+ - OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
13
+ copies `_reference.py` over `solution.py` before the verifier runs,
14
+ so oracle smoke trials still pass.
15
+ """
16
+
17
+ def __getattr__(name: str):
18
+ raise NotImplementedError(
19
+ f"solution.solution.{name!r} not implemented — the agent must "
20
+ f"replace this file with a real solution. Oracle agents do "
21
+ f"this via solve.sh, which copies _reference.py."
22
+ )
240/solution/solve.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ HERE="$(dirname "$0")"
4
+ if [ -f "$HERE/_reference.py" ]; then
5
+ cd "$HERE"
6
+ elif [ -f "$HERE/solution/_reference.py" ]; then
7
+ cd "$HERE/solution"
8
+ else
9
+ echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
10
+ exit 1
11
+ fi
12
+ cp -f _reference.py solution.py
240/task.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1"
2
+
3
+ [task]
4
+ id = "mbpp/240"
5
+ name = "MBPP — 240"
6
+
7
+ [environment]
8
+ os = "linux"
9
+ docker_image = "python:3.11-slim"
10
+
11
+ [agent]
12
+ name = "oracle"
13
+
14
+ [verifier]
15
+ name = "pytest"
16
+
17
+ [[steps]]
18
+ name = "main"
19
+ artifacts = ["solution/solution.py"]
240/tests/__init__.py ADDED
File without changes
240/tests/conftest.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ import sys
2
+ from pathlib import Path
3
+ sys.path.insert(0, str(Path(__file__).parent.parent))
240/tests/test_mbpp_0.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_0() -> None:
6
+ assert replace_list([1, 3, 5, 7, 9, 10],[2, 4, 6, 8])==[1, 3, 5, 7, 9, 2, 4, 6, 8]
240/tests/test_mbpp_1.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_1() -> None:
6
+ assert replace_list([1,2,3,4,5],[5,6,7,8])==[1,2,3,4,5,6,7,8]
240/tests/test_mbpp_2.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # Auto-generated by loom_benchmarks.util.pytest_from_test_strings.
2
+ from solution import * # noqa: F401,F403
3
+
4
+
5
+ def test_mbpp_2() -> None:
6
+ assert replace_list(["red","blue","green"],["yellow"])==["red","blue","yellow"]
246/instruction.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # MBPP 246
2
+
3
+ Write a function for computing square roots using the babylonian method.
246/solution/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from solution.solution import * # noqa: F401,F403
246/solution/_reference.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ def babylonian_squareroot(number):
3
+ if(number == 0):
4
+ return 0;
5
+ g = number/2.0;
6
+ g2 = g + 1;
7
+ while(g != g2):
8
+ n = number/ g;
9
+ g2 = g;
10
+ g = (g + n)/2;
11
+ return g;
246/solution/solution.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Stub solution module — agents must overwrite this file.
2
+
3
+ Code-task bundles (HumanEval, MBPP, LiveCodeBench, ...) ship the
4
+ canonical upstream solution at `solution/_reference.py` and this
5
+ stub at `solution/solution.py`. The pytest verifier imports from
6
+ `solution.solution`, so any attempt to run the tests against this
7
+ stub fails loudly with NotImplementedError instead of silently
8
+ passing on a pre-shipped answer.
9
+
10
+ - Non-oracle agents: must overwrite `solution.py` with their own
11
+ attempt (the file the pytest tests import from).
12
+ - OracleAgent: `solve.sh` (written by `oracle_copy_reference_solve_script`)
13
+ copies `_reference.py` over `solution.py` before the verifier runs,
14
+ so oracle smoke trials still pass.
15
+ """
16
+
17
+ def __getattr__(name: str):
18
+ raise NotImplementedError(
19
+ f"solution.solution.{name!r} not implemented — the agent must "
20
+ f"replace this file with a real solution. Oracle agents do "
21
+ f"this via solve.sh, which copies _reference.py."
22
+ )
246/solution/solve.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ HERE="$(dirname "$0")"
4
+ if [ -f "$HERE/_reference.py" ]; then
5
+ cd "$HERE"
6
+ elif [ -f "$HERE/solution/_reference.py" ]; then
7
+ cd "$HERE/solution"
8
+ else
9
+ echo "solve.sh: cannot locate _reference.py relative to $HERE" >&2
10
+ exit 1
11
+ fi
12
+ cp -f _reference.py solution.py
246/task.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1"
2
+
3
+ [task]
4
+ id = "mbpp/246"
5
+ name = "MBPP — 246"
6
+
7
+ [environment]
8
+ os = "linux"
9
+ docker_image = "python:3.11-slim"
10
+
11
+ [agent]
12
+ name = "oracle"
13
+
14
+ [verifier]
15
+ name = "pytest"
16
+
17
+ [[steps]]
18
+ name = "main"
19
+ artifacts = ["solution/solution.py"]
246/tests/__init__.py ADDED
File without changes