diff --git a/HumanEval_0/instruction.md b/HumanEval_0/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d09c09db5867365f2027ebe5a7a3307a3b9bcdcb --- /dev/null +++ b/HumanEval_0/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/0 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def has_close_elements(numbers: List[float], threshold: float) -> bool: + """ Check if in given list of numbers, are any two numbers closer to each other than + given threshold. + >>> has_close_elements([1.0, 2.0, 3.0], 0.5) + False + >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) + True + """ +``` diff --git a/HumanEval_0/solution/__init__.py b/HumanEval_0/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f37142f87677f86bfb2bc4c854e426383370ef41 --- /dev/null +++ b/HumanEval_0/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import has_close_elements diff --git a/HumanEval_0/solution/solution.py b/HumanEval_0/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..882a362a0a9375c48af51566f9fe743fe3a627f4 --- /dev/null +++ b/HumanEval_0/solution/solution.py @@ -0,0 +1,19 @@ +from typing import List + + +def has_close_elements(numbers: List[float], threshold: float) -> bool: + """ Check if in given list of numbers, are any two numbers closer to each other than + given threshold. + >>> has_close_elements([1.0, 2.0, 3.0], 0.5) + False + >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) + True + """ + for idx, elem in enumerate(numbers): + for idx2, elem2 in enumerate(numbers): + if idx != idx2: + distance = abs(elem - elem2) + if distance < threshold: + return True + + return False diff --git a/HumanEval_0/task.toml b/HumanEval_0/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c35a9c49ec4709f34793147577abfe8eb97f7d75 --- /dev/null +++ b/HumanEval_0/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/0" +name = "HumanEval — HumanEval/0" + +[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/HumanEval_0/tests/__init__.py b/HumanEval_0/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_0/tests/conftest.py b/HumanEval_0/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_0/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/HumanEval_0/tests/test_humaneval.py b/HumanEval_0/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..b836f9ce2f457fab39f6ba15ce4780c52ef7e660 --- /dev/null +++ b/HumanEval_0/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import has_close_elements as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3) == True + assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05) == False + assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.95) == True + assert candidate([1.0, 2.0, 5.9, 4.0, 5.0], 0.8) == False + assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1) == True + assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) == True + assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_1/instruction.md b/HumanEval_1/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..775eca5cbf3878f73f526ba8adb684d83f8235df --- /dev/null +++ b/HumanEval_1/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/1 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def separate_paren_groups(paren_string: str) -> List[str]: + """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to + separate those group into separate strings and return the list of those. + Separate groups are balanced (each open brace is properly closed) and not nested within each other + Ignore any spaces in the input string. + >>> separate_paren_groups('( ) (( )) (( )( ))') + ['()', '(())', '(()())'] + """ +``` diff --git a/HumanEval_1/solution/__init__.py b/HumanEval_1/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..15659f362545da4219cc8e679109cf3044039959 --- /dev/null +++ b/HumanEval_1/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import separate_paren_groups diff --git a/HumanEval_1/solution/solution.py b/HumanEval_1/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..268c1f48b8705129e09e38cbc894cd80d5cb3e12 --- /dev/null +++ b/HumanEval_1/solution/solution.py @@ -0,0 +1,28 @@ +from typing import List + + +def separate_paren_groups(paren_string: str) -> List[str]: + """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to + separate those group into separate strings and return the list of those. + Separate groups are balanced (each open brace is properly closed) and not nested within each other + Ignore any spaces in the input string. + >>> separate_paren_groups('( ) (( )) (( )( ))') + ['()', '(())', '(()())'] + """ + result = [] + current_string = [] + current_depth = 0 + + for c in paren_string: + if c == '(': + current_depth += 1 + current_string.append(c) + elif c == ')': + current_depth -= 1 + current_string.append(c) + + if current_depth == 0: + result.append(''.join(current_string)) + current_string.clear() + + return result diff --git a/HumanEval_1/task.toml b/HumanEval_1/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..01e63998f41abc2bb4c9f19c583e07f356d8f2cd --- /dev/null +++ b/HumanEval_1/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/1" +name = "HumanEval — HumanEval/1" + +[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/HumanEval_1/tests/__init__.py b/HumanEval_1/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_1/tests/conftest.py b/HumanEval_1/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_1/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/HumanEval_1/tests/test_humaneval.py b/HumanEval_1/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..821eff9ef9292682da4e782f051058adae344aed --- /dev/null +++ b/HumanEval_1/tests/test_humaneval.py @@ -0,0 +1,25 @@ +from solution import separate_paren_groups as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('(()()) ((())) () ((())()())') == [ + '(()())', '((()))', '()', '((())()())' + ] + assert candidate('() (()) ((())) (((())))') == [ + '()', '(())', '((()))', '(((())))' + ] + assert candidate('(()(())((())))') == [ + '(()(())((())))' + ] + assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())'] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_10/instruction.md b/HumanEval_10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4e8b66cee2df6e429fb8a8c7aef00f016eef9169 --- /dev/null +++ b/HumanEval_10/instruction.md @@ -0,0 +1,25 @@ +# HumanEval — HumanEval/10 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def is_palindrome(string: str) -> bool: + """ Test if given string is a palindrome """ + return string == string[::-1] + + +def make_palindrome(string: str) -> str: + """ Find the shortest palindrome that begins with a supplied string. + Algorithm idea is simple: + - Find the longest postfix of supplied string that is a palindrome. + - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix. + >>> make_palindrome('') + '' + >>> make_palindrome('cat') + 'catac' + >>> make_palindrome('cata') + 'catac' + """ +``` diff --git a/HumanEval_10/solution/__init__.py b/HumanEval_10/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f0d8d3e41a4100fb43877ea65d7850df9b92b2a8 --- /dev/null +++ b/HumanEval_10/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import make_palindrome diff --git a/HumanEval_10/solution/solution.py b/HumanEval_10/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..0e1b90f24631716c3cf69c79a1f604ee32c27c77 --- /dev/null +++ b/HumanEval_10/solution/solution.py @@ -0,0 +1,28 @@ + + +def is_palindrome(string: str) -> bool: + """ Test if given string is a palindrome """ + return string == string[::-1] + + +def make_palindrome(string: str) -> str: + """ Find the shortest palindrome that begins with a supplied string. + Algorithm idea is simple: + - Find the longest postfix of supplied string that is a palindrome. + - Append to the end of the string reverse of a string prefix that comes before the palindromic suffix. + >>> make_palindrome('') + '' + >>> make_palindrome('cat') + 'catac' + >>> make_palindrome('cata') + 'catac' + """ + if not string: + return '' + + beginning_of_suffix = 0 + + while not is_palindrome(string[beginning_of_suffix:]): + beginning_of_suffix += 1 + + return string + string[:beginning_of_suffix][::-1] diff --git a/HumanEval_10/task.toml b/HumanEval_10/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e9cd062c63913fbb4d98a8e136d133efc19966a7 --- /dev/null +++ b/HumanEval_10/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/10" +name = "HumanEval — HumanEval/10" + +[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/HumanEval_10/tests/__init__.py b/HumanEval_10/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_10/tests/conftest.py b/HumanEval_10/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_10/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/HumanEval_10/tests/test_humaneval.py b/HumanEval_10/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3c4b6a6cf0e6c4e70ded7ec85f72427703c0eed9 --- /dev/null +++ b/HumanEval_10/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import make_palindrome as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('') == '' + assert candidate('x') == 'x' + assert candidate('xyz') == 'xyzyx' + assert candidate('xyx') == 'xyx' + assert candidate('jerry') == 'jerryrrej' + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_100/instruction.md b/HumanEval_100/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c3041cfaef7b6968d965c5add785cac5a3e4ceb6 --- /dev/null +++ b/HumanEval_100/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/100 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def make_a_pile(n): + """ + Given a positive integer n, you have to make a pile of n levels of stones. + The first level has n stones. + The number of stones in the next level is: + - the next odd number if n is odd. + - the next even number if n is even. + Return the number of stones in each level in a list, where element at index + i represents the number of stones in the level (i+1). + + Examples: + >>> make_a_pile(3) + [3, 5, 7] + """ +``` diff --git a/HumanEval_100/solution/__init__.py b/HumanEval_100/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bc46ab0a09508ddc5d3f24447f7295acecb9b98a --- /dev/null +++ b/HumanEval_100/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import make_a_pile diff --git a/HumanEval_100/solution/solution.py b/HumanEval_100/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..42108b788e26ad2fdf06f7295be7a11645d8782d --- /dev/null +++ b/HumanEval_100/solution/solution.py @@ -0,0 +1,16 @@ + +def make_a_pile(n): + """ + Given a positive integer n, you have to make a pile of n levels of stones. + The first level has n stones. + The number of stones in the next level is: + - the next odd number if n is odd. + - the next even number if n is even. + Return the number of stones in each level in a list, where element at index + i represents the number of stones in the level (i+1). + + Examples: + >>> make_a_pile(3) + [3, 5, 7] + """ + return [n + 2*i for i in range(n)] diff --git a/HumanEval_100/task.toml b/HumanEval_100/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..065d5ab24494539642035a9c81ecc7fbfb4f8a26 --- /dev/null +++ b/HumanEval_100/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/100" +name = "HumanEval — HumanEval/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/HumanEval_100/tests/__init__.py b/HumanEval_100/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_100/tests/conftest.py b/HumanEval_100/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_100/tests/test_humaneval.py b/HumanEval_100/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..bb9193139371592feb66b31e08ed01b3b44868c9 --- /dev/null +++ b/HumanEval_100/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import make_a_pile as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(3) == [3, 5, 7], "Test 3" + assert candidate(4) == [4,6,8,10], "Test 4" + assert candidate(5) == [5, 7, 9, 11, 13] + assert candidate(6) == [6, 8, 10, 12, 14, 16] + assert candidate(8) == [8, 10, 12, 14, 16, 18, 20, 22] + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_101/instruction.md b/HumanEval_101/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..841f22551c95b6ea497952a58a714923951a3ea7 --- /dev/null +++ b/HumanEval_101/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/101 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def words_string(s): + """ + You will be given a string of words separated by commas or spaces. Your task is + to split the string into words and return an array of the words. + + For example: + words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"] + words_string("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"] + """ +``` diff --git a/HumanEval_101/solution/__init__.py b/HumanEval_101/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..eea1f83eeb2fa3681777972939034841a02cb0b0 --- /dev/null +++ b/HumanEval_101/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import words_string diff --git a/HumanEval_101/solution/solution.py b/HumanEval_101/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..20321fdf50f1e1c6ddf645a030993c7e57839b01 --- /dev/null +++ b/HumanEval_101/solution/solution.py @@ -0,0 +1,23 @@ + +def words_string(s): + """ + You will be given a string of words separated by commas or spaces. Your task is + to split the string into words and return an array of the words. + + For example: + words_string("Hi, my name is John") == ["Hi", "my", "name", "is", "John"] + words_string("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"] + """ + if not s: + return [] + + s_list = [] + + for letter in s: + if letter == ',': + s_list.append(' ') + else: + s_list.append(letter) + + s_list = "".join(s_list) + return s_list.split() diff --git a/HumanEval_101/task.toml b/HumanEval_101/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0a68db5c34a61e439b04dfc9b8e972bc08a96d25 --- /dev/null +++ b/HumanEval_101/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/101" +name = "HumanEval — HumanEval/101" + +[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/HumanEval_101/tests/__init__.py b/HumanEval_101/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_101/tests/conftest.py b/HumanEval_101/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_101/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/HumanEval_101/tests/test_humaneval.py b/HumanEval_101/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..f7d1592ccf5ed77f8f58522dfb7da5895a26cd71 --- /dev/null +++ b/HumanEval_101/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import words_string as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate("Hi, my name is John") == ["Hi", "my", "name", "is", "John"] + assert candidate("One, two, three, four, five, six") == ["One", "two", "three", "four", "five", "six"] + assert candidate("Hi, my name") == ["Hi", "my", "name"] + assert candidate("One,, two, three, four, five, six,") == ["One", "two", "three", "four", "five", "six"] + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate("") == [] + assert candidate("ahmed , gamal") == ["ahmed", "gamal"] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_102/instruction.md b/HumanEval_102/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..dea24fe7272e872132b9d0ce77490f7ded53dd96 --- /dev/null +++ b/HumanEval_102/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/102 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def choose_num(x, y): + """This function takes two positive numbers x and y and returns the + biggest even integer number that is in the range [x, y] inclusive. If + there's no such number, then the function should return -1. + + For example: + choose_num(12, 15) = 14 + choose_num(13, 12) = -1 + """ +``` diff --git a/HumanEval_102/solution/__init__.py b/HumanEval_102/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f230c7a0673557b904e318b48bfda2cde91564d4 --- /dev/null +++ b/HumanEval_102/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import choose_num diff --git a/HumanEval_102/solution/solution.py b/HumanEval_102/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c5d023f1fbce1f8ea12941150fad97bafcfd89fb --- /dev/null +++ b/HumanEval_102/solution/solution.py @@ -0,0 +1,17 @@ + +def choose_num(x, y): + """This function takes two positive numbers x and y and returns the + biggest even integer number that is in the range [x, y] inclusive. If + there's no such number, then the function should return -1. + + For example: + choose_num(12, 15) = 14 + choose_num(13, 12) = -1 + """ + if x > y: + return -1 + if y % 2 == 0: + return y + if x == y: + return -1 + return y - 1 diff --git a/HumanEval_102/task.toml b/HumanEval_102/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cc661d5233ed3126045687e35ae74b7466f65b01 --- /dev/null +++ b/HumanEval_102/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/102" +name = "HumanEval — HumanEval/102" + +[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/HumanEval_102/tests/__init__.py b/HumanEval_102/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_102/tests/conftest.py b/HumanEval_102/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_102/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/HumanEval_102/tests/test_humaneval.py b/HumanEval_102/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3457bc63df477b0fec00b942a5ded67b2ead5847 --- /dev/null +++ b/HumanEval_102/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import choose_num as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(12, 15) == 14 + assert candidate(13, 12) == -1 + assert candidate(33, 12354) == 12354 + assert candidate(5234, 5233) == -1 + assert candidate(6, 29) == 28 + assert candidate(27, 10) == -1 + + # Check some edge cases that are easy to work out by hand. + assert candidate(7, 7) == -1 + assert candidate(546, 546) == 546 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_103/instruction.md b/HumanEval_103/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..df2d41af384b016566eabff7aa50504c5e3c07b4 --- /dev/null +++ b/HumanEval_103/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/103 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def rounded_avg(n, m): + """You are given two positive integers n and m, and your task is to compute the + average of the integers from n through m (including n and m). + Round the answer to the nearest integer and convert that to binary. + If n is greater than m, return -1. + Example: + rounded_avg(1, 5) => "0b11" + rounded_avg(7, 5) => -1 + rounded_avg(10, 20) => "0b1111" + rounded_avg(20, 33) => "0b11010" + """ +``` diff --git a/HumanEval_103/solution/__init__.py b/HumanEval_103/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f45813868cffb4b2fc71903bf1eb784b4c083772 --- /dev/null +++ b/HumanEval_103/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import rounded_avg diff --git a/HumanEval_103/solution/solution.py b/HumanEval_103/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..add1b91eee7beaa03365e1ed1cce9c2335f06591 --- /dev/null +++ b/HumanEval_103/solution/solution.py @@ -0,0 +1,18 @@ + +def rounded_avg(n, m): + """You are given two positive integers n and m, and your task is to compute the + average of the integers from n through m (including n and m). + Round the answer to the nearest integer and convert that to binary. + If n is greater than m, return -1. + Example: + rounded_avg(1, 5) => "0b11" + rounded_avg(7, 5) => -1 + rounded_avg(10, 20) => "0b1111" + rounded_avg(20, 33) => "0b11010" + """ + if m < n: + return -1 + summation = 0 + for i in range(n, m+1): + summation += i + return bin(round(summation/(m - n + 1))) diff --git a/HumanEval_103/task.toml b/HumanEval_103/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6cc7f5042fd48dddd19b88ab5fe3d3f2343f9afb --- /dev/null +++ b/HumanEval_103/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/103" +name = "HumanEval — HumanEval/103" + +[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/HumanEval_103/tests/__init__.py b/HumanEval_103/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_103/tests/conftest.py b/HumanEval_103/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_103/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/HumanEval_103/tests/test_humaneval.py b/HumanEval_103/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..b2f2f3c08c11c2a3d2b5a46636a089854170b5a8 --- /dev/null +++ b/HumanEval_103/tests/test_humaneval.py @@ -0,0 +1,25 @@ +from solution import rounded_avg as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(1, 5) == "0b11" + assert candidate(7, 13) == "0b1010" + assert candidate(964,977) == "0b1111001010" + assert candidate(996,997) == "0b1111100100" + assert candidate(560,851) == "0b1011000010" + assert candidate(185,546) == "0b101101110" + assert candidate(362,496) == "0b110101101" + assert candidate(350,902) == "0b1001110010" + assert candidate(197,233) == "0b11010111" + + + # Check some edge cases that are easy to work out by hand. + assert candidate(7, 5) == -1 + assert candidate(5, 1) == -1 + assert candidate(5, 5) == "0b101" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_104/instruction.md b/HumanEval_104/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9f48bf24bf15a58d111c7d88ca405e78b1bb7e0e --- /dev/null +++ b/HumanEval_104/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/104 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def unique_digits(x): + """Given a list of positive integers x. return a sorted list of all + elements that hasn't any even digit. + + Note: Returned list should be sorted in increasing order. + + For example: + >>> unique_digits([15, 33, 1422, 1]) + [1, 15, 33] + >>> unique_digits([152, 323, 1422, 10]) + [] + """ +``` diff --git a/HumanEval_104/solution/__init__.py b/HumanEval_104/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7cb757934bd91e5f686634825a775a130e3043fc --- /dev/null +++ b/HumanEval_104/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import unique_digits diff --git a/HumanEval_104/solution/solution.py b/HumanEval_104/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..0fa33c0d37b6dfbdeb925e72e375eea4d8461a08 --- /dev/null +++ b/HumanEval_104/solution/solution.py @@ -0,0 +1,18 @@ + +def unique_digits(x): + """Given a list of positive integers x. return a sorted list of all + elements that hasn't any even digit. + + Note: Returned list should be sorted in increasing order. + + For example: + >>> unique_digits([15, 33, 1422, 1]) + [1, 15, 33] + >>> unique_digits([152, 323, 1422, 10]) + [] + """ + odd_digit_elements = [] + for i in x: + if all (int(c) % 2 == 1 for c in str(i)): + odd_digit_elements.append(i) + return sorted(odd_digit_elements) diff --git a/HumanEval_104/task.toml b/HumanEval_104/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..76607f75f16d6983485f4269546e8162b7444fb4 --- /dev/null +++ b/HumanEval_104/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/104" +name = "HumanEval — HumanEval/104" + +[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/HumanEval_104/tests/__init__.py b/HumanEval_104/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_104/tests/conftest.py b/HumanEval_104/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_104/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/HumanEval_104/tests/test_humaneval.py b/HumanEval_104/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..985a98bc1cea65f8ad1047642b165b864e21d95a --- /dev/null +++ b/HumanEval_104/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import unique_digits as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([15, 33, 1422, 1]) == [1, 15, 33] + assert candidate([152, 323, 1422, 10]) == [] + assert candidate([12345, 2033, 111, 151]) == [111, 151] + assert candidate([135, 103, 31]) == [31, 135] + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_105/instruction.md b/HumanEval_105/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1bd8b833459469ecb64f99a9ef2458c734a39cb3 --- /dev/null +++ b/HumanEval_105/instruction.md @@ -0,0 +1,29 @@ +# HumanEval — HumanEval/105 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def by_length(arr): + """ + Given an array of integers, sort the integers that are between 1 and 9 inclusive, + reverse the resulting array, and then replace each digit by its corresponding name from + "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine". + + For example: + arr = [2, 1, 1, 4, 5, 8, 2, 3] + -> sort arr -> [1, 1, 2, 2, 3, 4, 5, 8] + -> reverse arr -> [8, 5, 4, 3, 2, 2, 1, 1] + return ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"] + + If the array is empty, return an empty array: + arr = [] + return [] + + If the array has any strange number ignore it: + arr = [1, -1 , 55] + -> sort arr -> [-1, 1, 55] + -> reverse arr -> [55, 1, -1] + return = ['One'] + """ +``` diff --git a/HumanEval_105/solution/__init__.py b/HumanEval_105/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e05e5a63a4a6e4a920efb081f0a62a910eeb3961 --- /dev/null +++ b/HumanEval_105/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import by_length diff --git a/HumanEval_105/solution/solution.py b/HumanEval_105/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..4cec8a20c5a29c442094e2602b5fb199065a8750 --- /dev/null +++ b/HumanEval_105/solution/solution.py @@ -0,0 +1,42 @@ + +def by_length(arr): + """ + Given an array of integers, sort the integers that are between 1 and 9 inclusive, + reverse the resulting array, and then replace each digit by its corresponding name from + "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine". + + For example: + arr = [2, 1, 1, 4, 5, 8, 2, 3] + -> sort arr -> [1, 1, 2, 2, 3, 4, 5, 8] + -> reverse arr -> [8, 5, 4, 3, 2, 2, 1, 1] + return ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"] + + If the array is empty, return an empty array: + arr = [] + return [] + + If the array has any strange number ignore it: + arr = [1, -1 , 55] + -> sort arr -> [-1, 1, 55] + -> reverse arr -> [55, 1, -1] + return = ['One'] + """ + dic = { + 1: "One", + 2: "Two", + 3: "Three", + 4: "Four", + 5: "Five", + 6: "Six", + 7: "Seven", + 8: "Eight", + 9: "Nine", + } + sorted_arr = sorted(arr, reverse=True) + new_arr = [] + for var in sorted_arr: + try: + new_arr.append(dic[var]) + except: + pass + return new_arr diff --git a/HumanEval_105/task.toml b/HumanEval_105/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f98ef8b057d129489dd2c0e00651bf948af83047 --- /dev/null +++ b/HumanEval_105/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/105" +name = "HumanEval — HumanEval/105" + +[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/HumanEval_105/tests/__init__.py b/HumanEval_105/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_105/tests/conftest.py b/HumanEval_105/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_105/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/HumanEval_105/tests/test_humaneval.py b/HumanEval_105/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..cadb4029f55409a11116d75bb939411b83719d90 --- /dev/null +++ b/HumanEval_105/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import by_length as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([2, 1, 1, 4, 5, 8, 2, 3]) == ["Eight", "Five", "Four", "Three", "Two", "Two", "One", "One"], "Error" + assert candidate([]) == [], "Error" + assert candidate([1, -1 , 55]) == ['One'], "Error" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([1, -1, 3, 2]) == ["Three", "Two", "One"] + assert candidate([9, 4, 8]) == ["Nine", "Eight", "Four"] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_106/instruction.md b/HumanEval_106/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f3d7e6cbfe70f6da63b99109949b73d5a3e89eca --- /dev/null +++ b/HumanEval_106/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/106 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def f(n): + """ Implement the function f that takes n as a parameter, + and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even + or the sum of numbers from 1 to i otherwise. + i starts from 1. + the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i). + Example: + f(5) == [1, 2, 6, 24, 15] + """ +``` diff --git a/HumanEval_106/solution/__init__.py b/HumanEval_106/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b6d1a342328dc9f851d2cfc0b4a63a955a5d9464 --- /dev/null +++ b/HumanEval_106/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import f diff --git a/HumanEval_106/solution/solution.py b/HumanEval_106/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..2e1ba189bb408168faa70eb5d5e751be4ccb3201 --- /dev/null +++ b/HumanEval_106/solution/solution.py @@ -0,0 +1,21 @@ + +def f(n): + """ Implement the function f that takes n as a parameter, + and returns a list of size n, such that the value of the element at index i is the factorial of i if i is even + or the sum of numbers from 1 to i otherwise. + i starts from 1. + the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i). + Example: + f(5) == [1, 2, 6, 24, 15] + """ + ret = [] + for i in range(1,n+1): + if i%2 == 0: + x = 1 + for j in range(1,i+1): x *= j + ret += [x] + else: + x = 0 + for j in range(1,i+1): x += j + ret += [x] + return ret diff --git a/HumanEval_106/task.toml b/HumanEval_106/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fbd4ee8168caf14d70f108cf746292fbff540bb9 --- /dev/null +++ b/HumanEval_106/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/106" +name = "HumanEval — HumanEval/106" + +[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/HumanEval_106/tests/__init__.py b/HumanEval_106/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_106/tests/conftest.py b/HumanEval_106/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_106/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/HumanEval_106/tests/test_humaneval.py b/HumanEval_106/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..de74410676de7a88bccef3be5900f836efd85a3c --- /dev/null +++ b/HumanEval_106/tests/test_humaneval.py @@ -0,0 +1,12 @@ +from solution import f as candidate + +def check(candidate): + + assert candidate(5) == [1, 2, 6, 24, 15] + assert candidate(7) == [1, 2, 6, 24, 15, 720, 28] + assert candidate(1) == [1] + assert candidate(3) == [1, 2, 6] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_107/instruction.md b/HumanEval_107/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c81b6370765e1a797f8fb227380a8e7792b8ed89 --- /dev/null +++ b/HumanEval_107/instruction.md @@ -0,0 +1,30 @@ +# HumanEval — HumanEval/107 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def even_odd_palindrome(n): + """ + Given a positive integer n, return a tuple that has the number of even and odd + integer palindromes that fall within the range(1, n), inclusive. + + Example 1: + + Input: 3 + Output: (1, 2) + Explanation: + Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. + + Example 2: + + Input: 12 + Output: (4, 6) + Explanation: + Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd. + + Note: + 1. 1 <= n <= 10^3 + 2. returned tuple has the number of even and odd integer palindromes respectively. + """ +``` diff --git a/HumanEval_107/solution/__init__.py b/HumanEval_107/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..569a42ccf785a3a554a3f050757bdc76f232ee81 --- /dev/null +++ b/HumanEval_107/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import even_odd_palindrome diff --git a/HumanEval_107/solution/solution.py b/HumanEval_107/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..bace7312de253e70521728b4043e95bdd133c711 --- /dev/null +++ b/HumanEval_107/solution/solution.py @@ -0,0 +1,36 @@ + +def even_odd_palindrome(n): + """ + Given a positive integer n, return a tuple that has the number of even and odd + integer palindromes that fall within the range(1, n), inclusive. + + Example 1: + + Input: 3 + Output: (1, 2) + Explanation: + Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd. + + Example 2: + + Input: 12 + Output: (4, 6) + Explanation: + Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd. + + Note: + 1. 1 <= n <= 10^3 + 2. returned tuple has the number of even and odd integer palindromes respectively. + """ + def is_palindrome(n): + return str(n) == str(n)[::-1] + + even_palindrome_count = 0 + odd_palindrome_count = 0 + + for i in range(1, n+1): + if i%2 == 1 and is_palindrome(i): + odd_palindrome_count += 1 + elif i%2 == 0 and is_palindrome(i): + even_palindrome_count += 1 + return (even_palindrome_count, odd_palindrome_count) diff --git a/HumanEval_107/task.toml b/HumanEval_107/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..65f609803a32e58167a1b8e39e60d4b227cbe4b2 --- /dev/null +++ b/HumanEval_107/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/107" +name = "HumanEval — HumanEval/107" + +[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/HumanEval_107/tests/__init__.py b/HumanEval_107/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_107/tests/conftest.py b/HumanEval_107/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_107/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/HumanEval_107/tests/test_humaneval.py b/HumanEval_107/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..662d1a9ad8afb0abccd2e7208440c51cdbee3e5d --- /dev/null +++ b/HumanEval_107/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import even_odd_palindrome as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(123) == (8, 13) + assert candidate(12) == (4, 6) + assert candidate(3) == (1, 2) + assert candidate(63) == (6, 8) + assert candidate(25) == (5, 6) + assert candidate(19) == (4, 6) + assert candidate(9) == (4, 5), "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate(1) == (0, 1), "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_108/instruction.md b/HumanEval_108/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9c66c76a648c0dc60a9c51a1f1065e676c4d7d8c --- /dev/null +++ b/HumanEval_108/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/108 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def count_nums(arr): + """ + Write a function count_nums which takes an array of integers and returns + the number of elements which has a sum of digits > 0. + If a number is negative, then its first signed digit will be negative: + e.g. -123 has signed digits -1, 2, and 3. + >>> count_nums([]) == 0 + >>> count_nums([-1, 11, -11]) == 1 + >>> count_nums([1, 1, 2]) == 3 + """ +``` diff --git a/HumanEval_108/solution/__init__.py b/HumanEval_108/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..655737d413a2f5c0556c8bdb100cd4f965ffd045 --- /dev/null +++ b/HumanEval_108/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import count_nums diff --git a/HumanEval_108/solution/solution.py b/HumanEval_108/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ba3dcf8a22d675668cd2eff8c8436809d6329137 --- /dev/null +++ b/HumanEval_108/solution/solution.py @@ -0,0 +1,18 @@ + +def count_nums(arr): + """ + Write a function count_nums which takes an array of integers and returns + the number of elements which has a sum of digits > 0. + If a number is negative, then its first signed digit will be negative: + e.g. -123 has signed digits -1, 2, and 3. + >>> count_nums([]) == 0 + >>> count_nums([-1, 11, -11]) == 1 + >>> count_nums([1, 1, 2]) == 3 + """ + def digits_sum(n): + neg = 1 + if n < 0: n, neg = -1 * n, -1 + n = [int(i) for i in str(n)] + n[0] = n[0] * neg + return sum(n) + return len(list(filter(lambda x: x > 0, [digits_sum(i) for i in arr]))) diff --git a/HumanEval_108/task.toml b/HumanEval_108/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..751566e80d678f257a8be7fb21fc7ac3f1d17f8d --- /dev/null +++ b/HumanEval_108/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/108" +name = "HumanEval — HumanEval/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/HumanEval_108/tests/__init__.py b/HumanEval_108/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_108/tests/conftest.py b/HumanEval_108/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_108/tests/test_humaneval.py b/HumanEval_108/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..4f989111a36adde443b45dc60cfe2053b328c90f --- /dev/null +++ b/HumanEval_108/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import count_nums as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([]) == 0 + assert candidate([-1, -2, 0]) == 0 + assert candidate([1, 1, 2, -2, 3, 4, 5]) == 6 + assert candidate([1, 6, 9, -6, 0, 1, 5]) == 5 + assert candidate([1, 100, 98, -7, 1, -1]) == 4 + assert candidate([12, 23, 34, -45, -56, 0]) == 5 + assert candidate([-0, 1**0]) == 1 + assert candidate([1]) == 1 + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_109/instruction.md b/HumanEval_109/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a93232b73171a88d0954f8c807fdb57df52405ad --- /dev/null +++ b/HumanEval_109/instruction.md @@ -0,0 +1,34 @@ +# HumanEval — HumanEval/109 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def move_one_ball(arr): + """We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The + numbers in the array will be randomly ordered. Your task is to determine if + it is possible to get an array sorted in non-decreasing order by performing + the following operation on the given array: + You are allowed to perform right shift operation any number of times. + + One right shift operation means shifting all elements of the array by one + position in the right direction. The last element of the array will be moved to + the starting position in the array i.e. 0th index. + + If it is possible to obtain the sorted array by performing the above operation + then return True else return False. + If the given array is empty then return True. + + Note: The given list is guaranteed to have unique elements. + + For Example: + + move_one_ball([3, 4, 5, 1, 2])==>True + Explanation: By performin 2 right shift operations, non-decreasing order can + be achieved for the given array. + move_one_ball([3, 5, 4, 1, 2])==>False + Explanation:It is not possible to get non-decreasing order for the given + array by performing any number of right shift operations. + + """ +``` diff --git a/HumanEval_109/solution/__init__.py b/HumanEval_109/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..962c0b0046cf857d6d5517c3946a94adb4f136de --- /dev/null +++ b/HumanEval_109/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import move_one_ball diff --git a/HumanEval_109/solution/solution.py b/HumanEval_109/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..0093d8ab97be58e0deabe760361d39721bb5c148 --- /dev/null +++ b/HumanEval_109/solution/solution.py @@ -0,0 +1,40 @@ + +def move_one_ball(arr): + """We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The + numbers in the array will be randomly ordered. Your task is to determine if + it is possible to get an array sorted in non-decreasing order by performing + the following operation on the given array: + You are allowed to perform right shift operation any number of times. + + One right shift operation means shifting all elements of the array by one + position in the right direction. The last element of the array will be moved to + the starting position in the array i.e. 0th index. + + If it is possible to obtain the sorted array by performing the above operation + then return True else return False. + If the given array is empty then return True. + + Note: The given list is guaranteed to have unique elements. + + For Example: + + move_one_ball([3, 4, 5, 1, 2])==>True + Explanation: By performin 2 right shift operations, non-decreasing order can + be achieved for the given array. + move_one_ball([3, 5, 4, 1, 2])==>False + Explanation:It is not possible to get non-decreasing order for the given + array by performing any number of right shift operations. + + """ + if len(arr)==0: + return True + sorted_array=sorted(arr) + my_arr=[] + + min_value=min(arr) + min_index=arr.index(min_value) + my_arr=arr[min_index:]+arr[0:min_index] + for i in range(len(arr)): + if my_arr[i]!=sorted_array[i]: + return False + return True diff --git a/HumanEval_109/task.toml b/HumanEval_109/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a697b896c58f68ab6a4627eecd287f74defefa39 --- /dev/null +++ b/HumanEval_109/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/109" +name = "HumanEval — HumanEval/109" + +[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/HumanEval_109/tests/__init__.py b/HumanEval_109/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_109/tests/conftest.py b/HumanEval_109/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_109/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/HumanEval_109/tests/test_humaneval.py b/HumanEval_109/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..466c1cc27a19eca1a33460398b11e846079417bc --- /dev/null +++ b/HumanEval_109/tests/test_humaneval.py @@ -0,0 +1,15 @@ +from solution import move_one_ball as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([3, 4, 5, 1, 2])==True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([3, 5, 10, 1, 2])==True + assert candidate([4, 3, 1, 2])==False + # Check some edge cases that are easy to work out by hand. + assert candidate([3, 5, 4, 1, 2])==False, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([])==True + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_11/instruction.md b/HumanEval_11/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b3da8be7190c4421f06dc3fc9900cb54dd4c76d1 --- /dev/null +++ b/HumanEval_11/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/11 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def string_xor(a: str, b: str) -> str: + """ Input are two strings a and b consisting only of 1s and 0s. + Perform binary XOR on these inputs and return result also as a string. + >>> string_xor('010', '110') + '100' + """ +``` diff --git a/HumanEval_11/solution/__init__.py b/HumanEval_11/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1eb17a5c3e5953399cfa2a2f637f18c224e0bc64 --- /dev/null +++ b/HumanEval_11/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import string_xor diff --git a/HumanEval_11/solution/solution.py b/HumanEval_11/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..58ba524f1a0d32686db4944fae669f9b7126717b --- /dev/null +++ b/HumanEval_11/solution/solution.py @@ -0,0 +1,16 @@ +from typing import List + + +def string_xor(a: str, b: str) -> str: + """ Input are two strings a and b consisting only of 1s and 0s. + Perform binary XOR on these inputs and return result also as a string. + >>> string_xor('010', '110') + '100' + """ + def xor(i, j): + if i == j: + return '0' + else: + return '1' + + return ''.join(xor(x, y) for x, y in zip(a, b)) diff --git a/HumanEval_11/task.toml b/HumanEval_11/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e8355d52f8b26d2e76549defae883ed6ed2b8c7a --- /dev/null +++ b/HumanEval_11/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/11" +name = "HumanEval — HumanEval/11" + +[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/HumanEval_11/tests/__init__.py b/HumanEval_11/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_11/tests/conftest.py b/HumanEval_11/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_11/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/HumanEval_11/tests/test_humaneval.py b/HumanEval_11/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..16de52264bff1e7be36200a37f24dfaceb5bad6b --- /dev/null +++ b/HumanEval_11/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import string_xor as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('111000', '101010') == '010010' + assert candidate('1', '1') == '0' + assert candidate('0101', '0000') == '0101' + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_110/instruction.md b/HumanEval_110/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..60f860e694ac0a3bcac28db95e4eb62cbcbcf9c9 --- /dev/null +++ b/HumanEval_110/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/110 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def exchange(lst1, lst2): + """In this problem, you will implement a function that takes two lists of numbers, + and determines whether it is possible to perform an exchange of elements + between them to make lst1 a list of only even numbers. + There is no limit on the number of exchanged elements between lst1 and lst2. + If it is possible to exchange elements between the lst1 and lst2 to make + all the elements of lst1 to be even, return "YES". + Otherwise, return "NO". + For example: + exchange([1, 2, 3, 4], [1, 2, 3, 4]) => "YES" + exchange([1, 2, 3, 4], [1, 5, 3, 4]) => "NO" + It is assumed that the input lists will be non-empty. + """ +``` diff --git a/HumanEval_110/solution/__init__.py b/HumanEval_110/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3afe6aea154066588859bc7b2fcf2749d7533deb --- /dev/null +++ b/HumanEval_110/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import exchange diff --git a/HumanEval_110/solution/solution.py b/HumanEval_110/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..6f6f0fbb81c9d239a398cf5305000a483c5b5e59 --- /dev/null +++ b/HumanEval_110/solution/solution.py @@ -0,0 +1,26 @@ + +def exchange(lst1, lst2): + """In this problem, you will implement a function that takes two lists of numbers, + and determines whether it is possible to perform an exchange of elements + between them to make lst1 a list of only even numbers. + There is no limit on the number of exchanged elements between lst1 and lst2. + If it is possible to exchange elements between the lst1 and lst2 to make + all the elements of lst1 to be even, return "YES". + Otherwise, return "NO". + For example: + exchange([1, 2, 3, 4], [1, 2, 3, 4]) => "YES" + exchange([1, 2, 3, 4], [1, 5, 3, 4]) => "NO" + It is assumed that the input lists will be non-empty. + """ + odd = 0 + even = 0 + for i in lst1: + if i%2 == 1: + odd += 1 + for i in lst2: + if i%2 == 0: + even += 1 + if even >= odd: + return "YES" + return "NO" + diff --git a/HumanEval_110/task.toml b/HumanEval_110/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..35475e619684eec995ad12348262ba04f1797057 --- /dev/null +++ b/HumanEval_110/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/110" +name = "HumanEval — HumanEval/110" + +[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/HumanEval_110/tests/__init__.py b/HumanEval_110/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_110/tests/conftest.py b/HumanEval_110/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_110/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/HumanEval_110/tests/test_humaneval.py b/HumanEval_110/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..c817cff64af2be054c67ad749e2042782c773589 --- /dev/null +++ b/HumanEval_110/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import exchange as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1, 2, 3, 4], [1, 2, 3, 4]) == "YES" + assert candidate([1, 2, 3, 4], [1, 5, 3, 4]) == "NO" + assert candidate([1, 2, 3, 4], [2, 1, 4, 3]) == "YES" + assert candidate([5, 7, 3], [2, 6, 4]) == "YES" + assert candidate([5, 7, 3], [2, 6, 3]) == "NO" + assert candidate([3, 2, 6, 1, 8, 9], [3, 5, 5, 1, 1, 1]) == "NO" + + # Check some edge cases that are easy to work out by hand. + assert candidate([100, 200], [200, 200]) == "YES" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_111/instruction.md b/HumanEval_111/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..27422c8646bed9688db35de4453fac7c4a161a0d --- /dev/null +++ b/HumanEval_111/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/111 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def histogram(test): + """Given a string representing a space separated lowercase letters, return a dictionary + of the letter with the most repetition and containing the corresponding count. + If several letters have the same occurrence, return all of them. + + Example: + histogram('a b c') == {'a': 1, 'b': 1, 'c': 1} + histogram('a b b a') == {'a': 2, 'b': 2} + histogram('a b c a b') == {'a': 2, 'b': 2} + histogram('b b b b a') == {'b': 4} + histogram('') == {} + + """ +``` diff --git a/HumanEval_111/solution/__init__.py b/HumanEval_111/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..541c36d07838823bdad0586537f8f866c0b47233 --- /dev/null +++ b/HumanEval_111/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import histogram diff --git a/HumanEval_111/solution/solution.py b/HumanEval_111/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..022cff7c89f843e7e3570b2c95b61999ffcb1a86 --- /dev/null +++ b/HumanEval_111/solution/solution.py @@ -0,0 +1,27 @@ + +def histogram(test): + """Given a string representing a space separated lowercase letters, return a dictionary + of the letter with the most repetition and containing the corresponding count. + If several letters have the same occurrence, return all of them. + + Example: + histogram('a b c') == {'a': 1, 'b': 1, 'c': 1} + histogram('a b b a') == {'a': 2, 'b': 2} + histogram('a b c a b') == {'a': 2, 'b': 2} + histogram('b b b b a') == {'b': 4} + histogram('') == {} + + """ + dict1={} + list1=test.split(" ") + t=0 + + for i in list1: + if(list1.count(i)>t) and i!='': + t=list1.count(i) + if t>0: + for i in list1: + if(list1.count(i)==t): + + dict1[i]=t + return dict1 diff --git a/HumanEval_111/task.toml b/HumanEval_111/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4ec2d1b24063afbc1c50e4631c42e8368dc05132 --- /dev/null +++ b/HumanEval_111/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/111" +name = "HumanEval — HumanEval/111" + +[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/HumanEval_111/tests/__init__.py b/HumanEval_111/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_111/tests/conftest.py b/HumanEval_111/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_111/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/HumanEval_111/tests/test_humaneval.py b/HumanEval_111/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..0ee74abf98cd48fa638e6443376adcd0b3149dbf --- /dev/null +++ b/HumanEval_111/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import histogram as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('a b b a') == {'a':2,'b': 2}, "This prints if this assert fails 1 (good for debugging!)" + assert candidate('a b c a b') == {'a': 2, 'b': 2}, "This prints if this assert fails 2 (good for debugging!)" + assert candidate('a b c d g') == {'a': 1, 'b': 1, 'c': 1, 'd': 1, 'g': 1}, "This prints if this assert fails 3 (good for debugging!)" + assert candidate('r t g') == {'r': 1,'t': 1,'g': 1}, "This prints if this assert fails 4 (good for debugging!)" + assert candidate('b b b b a') == {'b': 4}, "This prints if this assert fails 5 (good for debugging!)" + assert candidate('r t g') == {'r': 1,'t': 1,'g': 1}, "This prints if this assert fails 6 (good for debugging!)" + + + # Check some edge cases that are easy to work out by hand. + assert candidate('') == {}, "This prints if this assert fails 7 (also good for debugging!)" + assert candidate('a') == {'a': 1}, "This prints if this assert fails 8 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_112/instruction.md b/HumanEval_112/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a22b26418a9ee2cb3a57898c642bf4dfd62f987e --- /dev/null +++ b/HumanEval_112/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/112 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def reverse_delete(s,c): + """Task + We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c + then check if the result string is palindrome. + A string is called palindrome if it reads the same backward as forward. + You should return a tuple containing the result string and True/False for the check. + Example + For s = "abcde", c = "ae", the result should be ('bcd',False) + For s = "abcdef", c = "b" the result should be ('acdef',False) + For s = "abcdedcba", c = "ab", the result should be ('cdedc',True) + """ +``` diff --git a/HumanEval_112/solution/__init__.py b/HumanEval_112/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a1157cc73863327010535e10ad021a3fe5320db3 --- /dev/null +++ b/HumanEval_112/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import reverse_delete diff --git a/HumanEval_112/solution/solution.py b/HumanEval_112/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..211b8b5fe85be9decc6e3dc9528dd01e6649aa70 --- /dev/null +++ b/HumanEval_112/solution/solution.py @@ -0,0 +1,14 @@ + +def reverse_delete(s,c): + """Task + We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c + then check if the result string is palindrome. + A string is called palindrome if it reads the same backward as forward. + You should return a tuple containing the result string and True/False for the check. + Example + For s = "abcde", c = "ae", the result should be ('bcd',False) + For s = "abcdef", c = "b" the result should be ('acdef',False) + For s = "abcdedcba", c = "ab", the result should be ('cdedc',True) + """ + s = ''.join([char for char in s if char not in c]) + return (s,s[::-1] == s) diff --git a/HumanEval_112/task.toml b/HumanEval_112/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c493b6a943126e5c456db64b759388a301f0dc78 --- /dev/null +++ b/HumanEval_112/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/112" +name = "HumanEval — HumanEval/112" + +[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/HumanEval_112/tests/__init__.py b/HumanEval_112/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_112/tests/conftest.py b/HumanEval_112/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_112/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/HumanEval_112/tests/test_humaneval.py b/HumanEval_112/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..4fe3d6a5ffac9cd799b276dcc8644a3127d3faee --- /dev/null +++ b/HumanEval_112/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import reverse_delete as candidate + +def check(candidate): + + assert candidate("abcde","ae") == ('bcd',False) + assert candidate("abcdef", "b") == ('acdef',False) + assert candidate("abcdedcba","ab") == ('cdedc',True) + assert candidate("dwik","w") == ('dik',False) + assert candidate("a","a") == ('',True) + assert candidate("abcdedcba","") == ('abcdedcba',True) + assert candidate("abcdedcba","v") == ('abcdedcba',True) + assert candidate("vabba","v") == ('abba',True) + assert candidate("mamma", "mia") == ("", True) + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_113/instruction.md b/HumanEval_113/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..06ad53240074584f6a8248d720dd2f02b59147c7 --- /dev/null +++ b/HumanEval_113/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/113 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def odd_count(lst): + """Given a list of strings, where each string consists of only digits, return a list. + Each element i of the output should be "the number of odd elements in the + string i of the input." where all the i's should be replaced by the number + of odd digits in the i'th string of the input. + + >>> odd_count(['1234567']) + ["the number of odd elements 4n the str4ng 4 of the 4nput."] + >>> odd_count(['3',"11111111"]) + ["the number of odd elements 1n the str1ng 1 of the 1nput.", + "the number of odd elements 8n the str8ng 8 of the 8nput."] + """ +``` diff --git a/HumanEval_113/solution/__init__.py b/HumanEval_113/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b5ff4762c92512e329c2fdd3901a97c250695d9c --- /dev/null +++ b/HumanEval_113/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import odd_count diff --git a/HumanEval_113/solution/solution.py b/HumanEval_113/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..689593b41d72aa31a0f771326283c182cd843a91 --- /dev/null +++ b/HumanEval_113/solution/solution.py @@ -0,0 +1,18 @@ + +def odd_count(lst): + """Given a list of strings, where each string consists of only digits, return a list. + Each element i of the output should be "the number of odd elements in the + string i of the input." where all the i's should be replaced by the number + of odd digits in the i'th string of the input. + + >>> odd_count(['1234567']) + ["the number of odd elements 4n the str4ng 4 of the 4nput."] + >>> odd_count(['3',"11111111"]) + ["the number of odd elements 1n the str1ng 1 of the 1nput.", + "the number of odd elements 8n the str8ng 8 of the 8nput."] + """ + res = [] + for arr in lst: + n = sum(int(d)%2==1 for d in arr) + res.append("the number of odd elements " + str(n) + "n the str"+ str(n) +"ng "+ str(n) +" of the "+ str(n) +"nput.") + return res diff --git a/HumanEval_113/task.toml b/HumanEval_113/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e08b628ec484c7e060b6966d07ef70a8cd651366 --- /dev/null +++ b/HumanEval_113/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/113" +name = "HumanEval — HumanEval/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/HumanEval_113/tests/__init__.py b/HumanEval_113/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_113/tests/conftest.py b/HumanEval_113/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_113/tests/test_humaneval.py b/HumanEval_113/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2bd3d6f4b22d782eac7079169deeec941201024f --- /dev/null +++ b/HumanEval_113/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import odd_count as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(['1234567']) == ["the number of odd elements 4n the str4ng 4 of the 4nput."], "Test 1" + assert candidate(['3',"11111111"]) == ["the number of odd elements 1n the str1ng 1 of the 1nput.", "the number of odd elements 8n the str8ng 8 of the 8nput."], "Test 2" + assert candidate(['271', '137', '314']) == [ + 'the number of odd elements 2n the str2ng 2 of the 2nput.', + 'the number of odd elements 3n the str3ng 3 of the 3nput.', + 'the number of odd elements 2n the str2ng 2 of the 2nput.' + ] + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_114/instruction.md b/HumanEval_114/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e8881cace7c19a306060662b24b7c223aa839bb9 --- /dev/null +++ b/HumanEval_114/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/114 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def minSubArraySum(nums): + """ + Given an array of integers nums, find the minimum sum of any non-empty sub-array + of nums. + Example + minSubArraySum([2, 3, 4, 1, 2, 4]) == 1 + minSubArraySum([-1, -2, -3]) == -6 + """ +``` diff --git a/HumanEval_114/solution/__init__.py b/HumanEval_114/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3d0b51958b986f5e990cac56fc7ff2a4a9289002 --- /dev/null +++ b/HumanEval_114/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import minSubArraySum diff --git a/HumanEval_114/solution/solution.py b/HumanEval_114/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..3580e1ebff0c9cf5d5afdee173db586e3457907d --- /dev/null +++ b/HumanEval_114/solution/solution.py @@ -0,0 +1,20 @@ + +def minSubArraySum(nums): + """ + Given an array of integers nums, find the minimum sum of any non-empty sub-array + of nums. + Example + minSubArraySum([2, 3, 4, 1, 2, 4]) == 1 + minSubArraySum([-1, -2, -3]) == -6 + """ + max_sum = 0 + s = 0 + for num in nums: + s += -num + if (s < 0): + s = 0 + max_sum = max(s, max_sum) + if max_sum == 0: + max_sum = max(-i for i in nums) + min_sum = -max_sum + return min_sum diff --git a/HumanEval_114/task.toml b/HumanEval_114/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9e5aa41cb2fd9a9ebaf5d8b197f3fbf6f59c3885 --- /dev/null +++ b/HumanEval_114/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/114" +name = "HumanEval — HumanEval/114" + +[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/HumanEval_114/tests/__init__.py b/HumanEval_114/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_114/tests/conftest.py b/HumanEval_114/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_114/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/HumanEval_114/tests/test_humaneval.py b/HumanEval_114/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9ad49d20e6aa5e91c282104e007fbec466cc49aa --- /dev/null +++ b/HumanEval_114/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import minSubArraySum as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([2, 3, 4, 1, 2, 4]) == 1, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([-1, -2, -3]) == -6 + assert candidate([-1, -2, -3, 2, -10]) == -14 + assert candidate([-9999999999999999]) == -9999999999999999 + assert candidate([0, 10, 20, 1000000]) == 0 + assert candidate([-1, -2, -3, 10, -5]) == -6 + assert candidate([100, -1, -2, -3, 10, -5]) == -6 + assert candidate([10, 11, 13, 8, 3, 4]) == 3 + assert candidate([100, -33, 32, -1, 0, -2]) == -33 + + # Check some edge cases that are easy to work out by hand. + assert candidate([-10]) == -10, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([7]) == 7 + assert candidate([1, -1]) == -1 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_115/instruction.md b/HumanEval_115/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1e44fdeec70f270573a414127b051fe549b547a5 --- /dev/null +++ b/HumanEval_115/instruction.md @@ -0,0 +1,42 @@ +# HumanEval — HumanEval/115 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def max_fill(grid, capacity): + import math + """ + You are given a rectangular grid of wells. Each row represents a single well, + and each 1 in a row represents a single unit of water. + Each well has a corresponding bucket that can be used to extract water from it, + and all buckets have the same capacity. + Your task is to use the buckets to empty the wells. + Output the number of times you need to lower the buckets. + + Example 1: + Input: + grid : [[0,0,1,0], [0,1,0,0], [1,1,1,1]] + bucket_capacity : 1 + Output: 6 + + Example 2: + Input: + grid : [[0,0,1,1], [0,0,0,0], [1,1,1,1], [0,1,1,1]] + bucket_capacity : 2 + Output: 5 + + Example 3: + Input: + grid : [[0,0,0], [0,0,0]] + bucket_capacity : 5 + Output: 0 + + Constraints: + * all wells have the same length + * 1 <= grid.length <= 10^2 + * 1 <= grid[:,1].length <= 10^2 + * grid[i][j] -> 0 | 1 + * 1 <= capacity <= 10 + """ +``` diff --git a/HumanEval_115/solution/__init__.py b/HumanEval_115/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..304bd5f133dae1020b297da45922b6c44b88ffce --- /dev/null +++ b/HumanEval_115/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import max_fill diff --git a/HumanEval_115/solution/solution.py b/HumanEval_115/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..a71296e9a7f4651819754a97ce3eb985afe40832 --- /dev/null +++ b/HumanEval_115/solution/solution.py @@ -0,0 +1,37 @@ + +def max_fill(grid, capacity): + import math + """ + You are given a rectangular grid of wells. Each row represents a single well, + and each 1 in a row represents a single unit of water. + Each well has a corresponding bucket that can be used to extract water from it, + and all buckets have the same capacity. + Your task is to use the buckets to empty the wells. + Output the number of times you need to lower the buckets. + + Example 1: + Input: + grid : [[0,0,1,0], [0,1,0,0], [1,1,1,1]] + bucket_capacity : 1 + Output: 6 + + Example 2: + Input: + grid : [[0,0,1,1], [0,0,0,0], [1,1,1,1], [0,1,1,1]] + bucket_capacity : 2 + Output: 5 + + Example 3: + Input: + grid : [[0,0,0], [0,0,0]] + bucket_capacity : 5 + Output: 0 + + Constraints: + * all wells have the same length + * 1 <= grid.length <= 10^2 + * 1 <= grid[:,1].length <= 10^2 + * grid[i][j] -> 0 | 1 + * 1 <= capacity <= 10 + """ + return sum([math.ceil(sum(arr)/capacity) for arr in grid]) diff --git a/HumanEval_115/task.toml b/HumanEval_115/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee4a733518880f8829b657477dc534007eaf3e9d --- /dev/null +++ b/HumanEval_115/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/115" +name = "HumanEval — HumanEval/115" + +[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/HumanEval_115/tests/__init__.py b/HumanEval_115/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_115/tests/conftest.py b/HumanEval_115/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_115/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/HumanEval_115/tests/test_humaneval.py b/HumanEval_115/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..fa98f02ae894ede6af72a87b9a9a1cff12ef2603 --- /dev/null +++ b/HumanEval_115/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import max_fill as candidate + +def check(candidate): + + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([[0,0,1,0], [0,1,0,0], [1,1,1,1]], 1) == 6, "Error" + assert candidate([[0,0,1,1], [0,0,0,0], [1,1,1,1], [0,1,1,1]], 2) == 5, "Error" + assert candidate([[0,0,0], [0,0,0]], 5) == 0, "Error" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([[1,1,1,1], [1,1,1,1]], 2) == 4, "Error" + assert candidate([[1,1,1,1], [1,1,1,1]], 9) == 2, "Error" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_116/instruction.md b/HumanEval_116/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7bb527575ab4722d229c95d8c3889a3753e55b1e --- /dev/null +++ b/HumanEval_116/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/116 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def sort_array(arr): + """ + In this Kata, you have to sort an array of non-negative integers according to + number of ones in their binary representation in ascending order. + For similar number of ones, sort based on decimal value. + + It must be implemented like this: + >>> sort_array([1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5] + >>> sort_array([-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2] + >>> sort_array([1, 0, 2, 3, 4]) [0, 1, 2, 3, 4] + """ +``` diff --git a/HumanEval_116/solution/__init__.py b/HumanEval_116/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e76c8bd33e870760b00ac1256a65ba27831b9f30 --- /dev/null +++ b/HumanEval_116/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sort_array diff --git a/HumanEval_116/solution/solution.py b/HumanEval_116/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..2b0d7821c2f6984ff81dfd731a00a07bcbe48140 --- /dev/null +++ b/HumanEval_116/solution/solution.py @@ -0,0 +1,13 @@ + +def sort_array(arr): + """ + In this Kata, you have to sort an array of non-negative integers according to + number of ones in their binary representation in ascending order. + For similar number of ones, sort based on decimal value. + + It must be implemented like this: + >>> sort_array([1, 5, 2, 3, 4]) == [1, 2, 3, 4, 5] + >>> sort_array([-2, -3, -4, -5, -6]) == [-6, -5, -4, -3, -2] + >>> sort_array([1, 0, 2, 3, 4]) [0, 1, 2, 3, 4] + """ + return sorted(sorted(arr), key=lambda x: bin(x)[2:].count('1')) diff --git a/HumanEval_116/task.toml b/HumanEval_116/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..29f03aa8f9e924f56018e8ca7039817c88685c8e --- /dev/null +++ b/HumanEval_116/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/116" +name = "HumanEval — HumanEval/116" + +[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/HumanEval_116/tests/__init__.py b/HumanEval_116/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_116/tests/conftest.py b/HumanEval_116/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_116/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/HumanEval_116/tests/test_humaneval.py b/HumanEval_116/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9ecc90b557507ffe10ee2a84f2fd77ee8d9a7a91 --- /dev/null +++ b/HumanEval_116/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import sort_array as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([1,5,2,3,4]) == [1, 2, 4, 3, 5] + assert candidate([-2,-3,-4,-5,-6]) == [-4, -2, -6, -5, -3] + assert candidate([1,0,2,3,4]) == [0, 1, 2, 4, 3] + assert candidate([]) == [] + assert candidate([2,5,77,4,5,3,5,7,2,3,4]) == [2, 2, 4, 4, 3, 3, 5, 5, 5, 7, 77] + assert candidate([3,6,44,12,32,5]) == [32, 3, 5, 6, 12, 44] + assert candidate([2,4,8,16,32]) == [2, 4, 8, 16, 32] + assert candidate([2,4,8,16,32]) == [2, 4, 8, 16, 32] + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_117/instruction.md b/HumanEval_117/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0388a2f7f68fc90de5c1fb7aef870af4df6bcd1b --- /dev/null +++ b/HumanEval_117/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/117 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def select_words(s, n): + """Given a string s and a natural number n, you have been tasked to implement + a function that returns a list of all words from string s that contain exactly + n consonants, in order these words appear in the string s. + If the string s is empty then the function should return an empty list. + Note: you may assume the input string contains only letters and spaces. + Examples: + select_words("Mary had a little lamb", 4) ==> ["little"] + select_words("Mary had a little lamb", 3) ==> ["Mary", "lamb"] + select_words("simple white space", 2) ==> [] + select_words("Hello world", 4) ==> ["world"] + select_words("Uncle sam", 3) ==> ["Uncle"] + """ +``` diff --git a/HumanEval_117/solution/__init__.py b/HumanEval_117/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..05e080da8f6267c04eb05705c7bdb21677f2c576 --- /dev/null +++ b/HumanEval_117/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import select_words diff --git a/HumanEval_117/solution/solution.py b/HumanEval_117/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..72dbd54b34721cce3d94d18a4806a2e52a66dda1 --- /dev/null +++ b/HumanEval_117/solution/solution.py @@ -0,0 +1,24 @@ + +def select_words(s, n): + """Given a string s and a natural number n, you have been tasked to implement + a function that returns a list of all words from string s that contain exactly + n consonants, in order these words appear in the string s. + If the string s is empty then the function should return an empty list. + Note: you may assume the input string contains only letters and spaces. + Examples: + select_words("Mary had a little lamb", 4) ==> ["little"] + select_words("Mary had a little lamb", 3) ==> ["Mary", "lamb"] + select_words("simple white space", 2) ==> [] + select_words("Hello world", 4) ==> ["world"] + select_words("Uncle sam", 3) ==> ["Uncle"] + """ + result = [] + for word in s.split(): + n_consonants = 0 + for i in range(0, len(word)): + if word[i].lower() not in ["a","e","i","o","u"]: + n_consonants += 1 + if n_consonants == n: + result.append(word) + return result + diff --git a/HumanEval_117/task.toml b/HumanEval_117/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9445ee073543658239905f74ac1dd20409ab70a9 --- /dev/null +++ b/HumanEval_117/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/117" +name = "HumanEval — HumanEval/117" + +[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/HumanEval_117/tests/__init__.py b/HumanEval_117/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_117/tests/conftest.py b/HumanEval_117/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_117/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/HumanEval_117/tests/test_humaneval.py b/HumanEval_117/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..7efe5b35598bdf828d8d3e53892d2e33de3640e2 --- /dev/null +++ b/HumanEval_117/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import select_words as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("Mary had a little lamb", 4) == ["little"], "First test error: " + str(candidate("Mary had a little lamb", 4)) + assert candidate("Mary had a little lamb", 3) == ["Mary", "lamb"], "Second test error: " + str(candidate("Mary had a little lamb", 3)) + assert candidate("simple white space", 2) == [], "Third test error: " + str(candidate("simple white space", 2)) + assert candidate("Hello world", 4) == ["world"], "Fourth test error: " + str(candidate("Hello world", 4)) + assert candidate("Uncle sam", 3) == ["Uncle"], "Fifth test error: " + str(candidate("Uncle sam", 3)) + + + # Check some edge cases that are easy to work out by hand. + assert candidate("", 4) == [], "1st edge test error: " + str(candidate("", 4)) + assert candidate("a b c d e f", 1) == ["b", "c", "d", "f"], "2nd edge test error: " + str(candidate("a b c d e f", 1)) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_118/instruction.md b/HumanEval_118/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..eae43589a01c7b428946795086cbdaf39ce0f407 --- /dev/null +++ b/HumanEval_118/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/118 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def get_closest_vowel(word): + """You are given a word. Your task is to find the closest vowel that stands between + two consonants from the right side of the word (case sensitive). + + Vowels in the beginning and ending doesn't count. Return empty string if you didn't + find any vowel met the above condition. + + You may assume that the given string contains English letter only. + + Example: + get_closest_vowel("yogurt") ==> "u" + get_closest_vowel("FULL") ==> "U" + get_closest_vowel("quick") ==> "" + get_closest_vowel("ab") ==> "" + """ +``` diff --git a/HumanEval_118/solution/__init__.py b/HumanEval_118/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..085db613bd3cad1ad8717236f1b495ad56972d73 --- /dev/null +++ b/HumanEval_118/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import get_closest_vowel diff --git a/HumanEval_118/solution/solution.py b/HumanEval_118/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..a5558aa79ff86ec9990095741cdeaf1f87ece915 --- /dev/null +++ b/HumanEval_118/solution/solution.py @@ -0,0 +1,25 @@ + +def get_closest_vowel(word): + """You are given a word. Your task is to find the closest vowel that stands between + two consonants from the right side of the word (case sensitive). + + Vowels in the beginning and ending doesn't count. Return empty string if you didn't + find any vowel met the above condition. + + You may assume that the given string contains English letter only. + + Example: + get_closest_vowel("yogurt") ==> "u" + get_closest_vowel("FULL") ==> "U" + get_closest_vowel("quick") ==> "" + get_closest_vowel("ab") ==> "" + """ + if len(word) < 3: + return "" + + vowels = {"a", "e", "i", "o", "u", "A", "E", 'O', 'U', 'I'} + for i in range(len(word)-2, 0, -1): + if word[i] in vowels: + if (word[i+1] not in vowels) and (word[i-1] not in vowels): + return word[i] + return "" diff --git a/HumanEval_118/task.toml b/HumanEval_118/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d84599e80f8a53c9e9db2b0c65b2a8459fa6bb8c --- /dev/null +++ b/HumanEval_118/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/118" +name = "HumanEval — HumanEval/118" + +[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/HumanEval_118/tests/__init__.py b/HumanEval_118/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_118/tests/conftest.py b/HumanEval_118/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_118/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/HumanEval_118/tests/test_humaneval.py b/HumanEval_118/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..e3ee968d7675d02d929592e69a3472a7d5406ed6 --- /dev/null +++ b/HumanEval_118/tests/test_humaneval.py @@ -0,0 +1,26 @@ +from solution import get_closest_vowel as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("yogurt") == "u" + assert candidate("full") == "u" + assert candidate("easy") == "" + assert candidate("eAsy") == "" + assert candidate("ali") == "" + assert candidate("bad") == "a" + assert candidate("most") == "o" + assert candidate("ab") == "" + assert candidate("ba") == "" + assert candidate("quick") == "" + assert candidate("anime") == "i" + assert candidate("Asia") == "" + assert candidate("Above") == "o" + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_119/instruction.md b/HumanEval_119/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b7a8ded7e1df4c8066c1dddd9b878029602c22d1 --- /dev/null +++ b/HumanEval_119/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/119 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def match_parens(lst): + ''' + You are given a list of two strings, both strings consist of open + parentheses '(' or close parentheses ')' only. + Your job is to check if it is possible to concatenate the two strings in + some order, that the resulting string will be good. + A string S is considered to be good if and only if all parentheses in S + are balanced. For example: the string '(())()' is good, while the string + '())' is not. + Return 'Yes' if there's a way to make a good string, and return 'No' otherwise. + + Examples: + match_parens(['()(', ')']) == 'Yes' + match_parens([')', ')']) == 'No' + ''' +``` diff --git a/HumanEval_119/solution/__init__.py b/HumanEval_119/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2124e0c89a66a4a6b7eff18a8935bd1d5d1d821f --- /dev/null +++ b/HumanEval_119/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import match_parens diff --git a/HumanEval_119/solution/solution.py b/HumanEval_119/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ed18c43ffb2a2b4804964174039f32368666b692 --- /dev/null +++ b/HumanEval_119/solution/solution.py @@ -0,0 +1,30 @@ + +def match_parens(lst): + ''' + You are given a list of two strings, both strings consist of open + parentheses '(' or close parentheses ')' only. + Your job is to check if it is possible to concatenate the two strings in + some order, that the resulting string will be good. + A string S is considered to be good if and only if all parentheses in S + are balanced. For example: the string '(())()' is good, while the string + '())' is not. + Return 'Yes' if there's a way to make a good string, and return 'No' otherwise. + + Examples: + match_parens(['()(', ')']) == 'Yes' + match_parens([')', ')']) == 'No' + ''' + def check(s): + val = 0 + for i in s: + if i == '(': + val = val + 1 + else: + val = val - 1 + if val < 0: + return False + return True if val == 0 else False + + S1 = lst[0] + lst[1] + S2 = lst[1] + lst[0] + return 'Yes' if check(S1) or check(S2) else 'No' diff --git a/HumanEval_119/task.toml b/HumanEval_119/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b173144fd63437af40618912907a511df0c2a52f --- /dev/null +++ b/HumanEval_119/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/119" +name = "HumanEval — HumanEval/119" + +[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/HumanEval_119/tests/__init__.py b/HumanEval_119/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_119/tests/conftest.py b/HumanEval_119/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_119/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/HumanEval_119/tests/test_humaneval.py b/HumanEval_119/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..5b38a4b429279caec74a96fda297f02d1f74f13f --- /dev/null +++ b/HumanEval_119/tests/test_humaneval.py @@ -0,0 +1,25 @@ +from solution import match_parens as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(['()(', ')']) == 'Yes' + assert candidate([')', ')']) == 'No' + assert candidate(['(()(())', '())())']) == 'No' + assert candidate([')())', '(()()(']) == 'Yes' + assert candidate(['(())))', '(()())((']) == 'Yes' + assert candidate(['()', '())']) == 'No' + assert candidate(['(()(', '()))()']) == 'Yes' + assert candidate(['((((', '((())']) == 'No' + assert candidate([')(()', '(()(']) == 'No' + assert candidate([')(', ')(']) == 'No' + + + # Check some edge cases that are easy to work out by hand. + assert candidate(['(', ')']) == 'Yes' + assert candidate([')', '(']) == 'Yes' + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_12/instruction.md b/HumanEval_12/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cfcf61ee60d86b3277bedff58e0c8b6e347c2050 --- /dev/null +++ b/HumanEval_12/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/12 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List, Optional + + +def longest(strings: List[str]) -> Optional[str]: + """ Out of list of strings, return the longest one. Return the first one in case of multiple + strings of the same length. Return None in case the input list is empty. + >>> longest([]) + + >>> longest(['a', 'b', 'c']) + 'a' + >>> longest(['a', 'bb', 'ccc']) + 'ccc' + """ +``` diff --git a/HumanEval_12/solution/__init__.py b/HumanEval_12/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..28eb8dfcf527901edebd8a1aa3b3362dd520d6f7 --- /dev/null +++ b/HumanEval_12/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import longest diff --git a/HumanEval_12/solution/solution.py b/HumanEval_12/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..00d98d3e7e776d3b0fd7cdab7a2d904eb0ed21f0 --- /dev/null +++ b/HumanEval_12/solution/solution.py @@ -0,0 +1,20 @@ +from typing import List, Optional + + +def longest(strings: List[str]) -> Optional[str]: + """ Out of list of strings, return the longest one. Return the first one in case of multiple + strings of the same length. Return None in case the input list is empty. + >>> longest([]) + + >>> longest(['a', 'b', 'c']) + 'a' + >>> longest(['a', 'bb', 'ccc']) + 'ccc' + """ + if not strings: + return None + + maxlen = max(len(x) for x in strings) + for s in strings: + if len(s) == maxlen: + return s diff --git a/HumanEval_12/task.toml b/HumanEval_12/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0d465118875624f858169d774ff98f421a115b3c --- /dev/null +++ b/HumanEval_12/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/12" +name = "HumanEval — HumanEval/12" + +[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/HumanEval_12/tests/__init__.py b/HumanEval_12/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_12/tests/conftest.py b/HumanEval_12/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_12/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/HumanEval_12/tests/test_humaneval.py b/HumanEval_12/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..c2aeb061eb3c69e4751229a79b65caed6d7ef32d --- /dev/null +++ b/HumanEval_12/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import longest as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([]) == None + assert candidate(['x', 'y', 'z']) == 'x' + assert candidate(['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']) == 'zzzz' + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_120/instruction.md b/HumanEval_120/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b485cedf80a09c78c6f17678514008d00550d5b6 --- /dev/null +++ b/HumanEval_120/instruction.md @@ -0,0 +1,32 @@ +# HumanEval — HumanEval/120 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def maximum(arr, k): + """ + Given an array arr of integers and a positive integer k, return a sorted list + of length k with the maximum k numbers in arr. + + Example 1: + + Input: arr = [-3, -4, 5], k = 3 + Output: [-4, -3, 5] + + Example 2: + + Input: arr = [4, -4, 4], k = 2 + Output: [4, 4] + + Example 3: + + Input: arr = [-3, 2, 1, 2, -1, -2, 1], k = 1 + Output: [2] + + Note: + 1. The length of the array will be in the range of [1, 1000]. + 2. The elements in the array will be in the range of [-1000, 1000]. + 3. 0 <= k <= len(arr) + """ +``` diff --git a/HumanEval_120/solution/__init__.py b/HumanEval_120/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9c59921a53be7ac18e5c867b3c175225bc53c5e2 --- /dev/null +++ b/HumanEval_120/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import maximum diff --git a/HumanEval_120/solution/solution.py b/HumanEval_120/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..4a43667b57501ab78f1b816cf455cd2106f72573 --- /dev/null +++ b/HumanEval_120/solution/solution.py @@ -0,0 +1,31 @@ + +def maximum(arr, k): + """ + Given an array arr of integers and a positive integer k, return a sorted list + of length k with the maximum k numbers in arr. + + Example 1: + + Input: arr = [-3, -4, 5], k = 3 + Output: [-4, -3, 5] + + Example 2: + + Input: arr = [4, -4, 4], k = 2 + Output: [4, 4] + + Example 3: + + Input: arr = [-3, 2, 1, 2, -1, -2, 1], k = 1 + Output: [2] + + Note: + 1. The length of the array will be in the range of [1, 1000]. + 2. The elements in the array will be in the range of [-1000, 1000]. + 3. 0 <= k <= len(arr) + """ + if k == 0: + return [] + arr.sort() + ans = arr[-k:] + return ans diff --git a/HumanEval_120/task.toml b/HumanEval_120/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5d1b8e43fd9b59bcc534a9e24637ea219b475538 --- /dev/null +++ b/HumanEval_120/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/120" +name = "HumanEval — HumanEval/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/HumanEval_120/tests/__init__.py b/HumanEval_120/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_120/tests/conftest.py b/HumanEval_120/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_120/tests/test_humaneval.py b/HumanEval_120/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..a8446c4508e74a7ff81d4882f054ba0a611f67b6 --- /dev/null +++ b/HumanEval_120/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import maximum as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([-3, -4, 5], 3) == [-4, -3, 5] + assert candidate([4, -4, 4], 2) == [4, 4] + assert candidate([-3, 2, 1, 2, -1, -2, 1], 1) == [2] + assert candidate([123, -123, 20, 0 , 1, 2, -3], 3) == [2, 20, 123] + assert candidate([-123, 20, 0 , 1, 2, -3], 4) == [0, 1, 2, 20] + assert candidate([5, 15, 0, 3, -13, -8, 0], 7) == [-13, -8, 0, 0, 3, 5, 15] + assert candidate([-1, 0, 2, 5, 3, -10], 2) == [3, 5] + assert candidate([1, 0, 5, -7], 1) == [5] + assert candidate([4, -4], 2) == [-4, 4] + assert candidate([-10, 10], 2) == [-10, 10] + + # Check some edge cases that are easy to work out by hand. + assert candidate([1, 2, 3, -23, 243, -400, 0], 0) == [] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_121/instruction.md b/HumanEval_121/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3e2b1b7a507415fb480297d6e84debc446b5a36c --- /dev/null +++ b/HumanEval_121/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/121 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def solution(lst): + """Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. + + + Examples + solution([5, 8, 7, 1]) ==> 12 + solution([3, 3, 3, 3, 3]) ==> 9 + solution([30, 13, 24, 321]) ==>0 + """ +``` diff --git a/HumanEval_121/solution/__init__.py b/HumanEval_121/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..04e1b1f03fbf6efe09d27e2a04a911fc785ddbe7 --- /dev/null +++ b/HumanEval_121/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import solution diff --git a/HumanEval_121/solution/solution.py b/HumanEval_121/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c7a30e514232497eb3eca5c2c88c13c54c7bdb71 --- /dev/null +++ b/HumanEval_121/solution/solution.py @@ -0,0 +1,11 @@ + +def solution(lst): + """Given a non-empty list of integers, return the sum of all of the odd elements that are in even positions. + + + Examples + solution([5, 8, 7, 1]) ==> 12 + solution([3, 3, 3, 3, 3]) ==> 9 + solution([30, 13, 24, 321]) ==>0 + """ + return sum([x for idx, x in enumerate(lst) if idx%2==0 and x%2==1]) diff --git a/HumanEval_121/task.toml b/HumanEval_121/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6d538f9d715cf791d76aca25dae25b78a4f5734b --- /dev/null +++ b/HumanEval_121/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/121" +name = "HumanEval — HumanEval/121" + +[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/HumanEval_121/tests/__init__.py b/HumanEval_121/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_121/tests/conftest.py b/HumanEval_121/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_121/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/HumanEval_121/tests/test_humaneval.py b/HumanEval_121/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..dd62b4145c5566507f9c2e138727a26590f65ad9 --- /dev/null +++ b/HumanEval_121/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import solution as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([5, 8, 7, 1]) == 12 + assert candidate([3, 3, 3, 3, 3]) == 9 + assert candidate([30, 13, 24, 321]) == 0 + assert candidate([5, 9]) == 5 + assert candidate([2, 4, 8]) == 0 + assert candidate([30, 13, 23, 32]) == 23 + assert candidate([3, 13, 2, 9]) == 3 + + # Check some edge cases that are easy to work out by hand. + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_122/instruction.md b/HumanEval_122/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ff53f9b75362bf35674df20af26574ede8cc135c --- /dev/null +++ b/HumanEval_122/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/122 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def add_elements(arr, k): + """ + Given a non-empty array of integers arr and an integer k, return + the sum of the elements with at most two digits from the first k elements of arr. + + Example: + + Input: arr = [111,21,3,4000,5,6,7,8,9], k = 4 + Output: 24 # sum of 21 + 3 + + Constraints: + 1. 1 <= len(arr) <= 100 + 2. 1 <= k <= len(arr) + """ +``` diff --git a/HumanEval_122/solution/__init__.py b/HumanEval_122/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fe424b827edfabd036427807e70a6619da03b230 --- /dev/null +++ b/HumanEval_122/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import add_elements diff --git a/HumanEval_122/solution/solution.py b/HumanEval_122/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..e7b2e6ff566cd39b3a71d7d1754767f7bc5db99f --- /dev/null +++ b/HumanEval_122/solution/solution.py @@ -0,0 +1,16 @@ + +def add_elements(arr, k): + """ + Given a non-empty array of integers arr and an integer k, return + the sum of the elements with at most two digits from the first k elements of arr. + + Example: + + Input: arr = [111,21,3,4000,5,6,7,8,9], k = 4 + Output: 24 # sum of 21 + 3 + + Constraints: + 1. 1 <= len(arr) <= 100 + 2. 1 <= k <= len(arr) + """ + return sum(elem for elem in arr[:k] if len(str(elem)) <= 2) diff --git a/HumanEval_122/task.toml b/HumanEval_122/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9842ecd3489de3d699c74a9833d573677ce5c281 --- /dev/null +++ b/HumanEval_122/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/122" +name = "HumanEval — HumanEval/122" + +[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/HumanEval_122/tests/__init__.py b/HumanEval_122/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_122/tests/conftest.py b/HumanEval_122/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_122/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/HumanEval_122/tests/test_humaneval.py b/HumanEval_122/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8db44aa91f2859ac9efdde56a24217684746c896 --- /dev/null +++ b/HumanEval_122/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import add_elements as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1,-2,-3,41,57,76,87,88,99], 3) == -4 + assert candidate([111,121,3,4000,5,6], 2) == 0 + assert candidate([11,21,3,90,5,6,7,8,9], 4) == 125 + assert candidate([111,21,3,4000,5,6,7,8,9], 4) == 24, "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate([1], 1) == 1, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_123/instruction.md b/HumanEval_123/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1f1bca93db4e09ea6b2a4abcf022141adbb6ba3f --- /dev/null +++ b/HumanEval_123/instruction.md @@ -0,0 +1,24 @@ +# HumanEval — HumanEval/123 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def get_odd_collatz(n): + """ + Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. + + The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined + as follows: start with any positive integer n. Then each term is obtained from the + previous term as follows: if the previous term is even, the next term is one half of + the previous term. If the previous term is odd, the next term is 3 times the previous + term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1. + + Note: + 1. Collatz(1) is [1]. + 2. returned list sorted in increasing order. + + For example: + get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5. + """ +``` diff --git a/HumanEval_123/solution/__init__.py b/HumanEval_123/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a67891cc5821add28085929aaae156cfca2dc327 --- /dev/null +++ b/HumanEval_123/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import get_odd_collatz diff --git a/HumanEval_123/solution/solution.py b/HumanEval_123/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..faa877c70d2824bd8a629ba015fbabbc7f6b9c3e --- /dev/null +++ b/HumanEval_123/solution/solution.py @@ -0,0 +1,32 @@ + +def get_odd_collatz(n): + """ + Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence. + + The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined + as follows: start with any positive integer n. Then each term is obtained from the + previous term as follows: if the previous term is even, the next term is one half of + the previous term. If the previous term is odd, the next term is 3 times the previous + term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1. + + Note: + 1. Collatz(1) is [1]. + 2. returned list sorted in increasing order. + + For example: + get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5. + """ + if n%2==0: + odd_collatz = [] + else: + odd_collatz = [n] + while n > 1: + if n % 2 == 0: + n = n/2 + else: + n = n*3 + 1 + + if n%2 == 1: + odd_collatz.append(int(n)) + + return sorted(odd_collatz) diff --git a/HumanEval_123/task.toml b/HumanEval_123/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f0338ee223603773dad4211214c7224713813689 --- /dev/null +++ b/HumanEval_123/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/123" +name = "HumanEval — HumanEval/123" + +[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/HumanEval_123/tests/__init__.py b/HumanEval_123/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_123/tests/conftest.py b/HumanEval_123/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_123/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/HumanEval_123/tests/test_humaneval.py b/HumanEval_123/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..c0abc1e39da6c6057510a87b12c85cdea34f76ef --- /dev/null +++ b/HumanEval_123/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import get_odd_collatz as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(14) == [1, 5, 7, 11, 13, 17] + assert candidate(5) == [1, 5] + assert candidate(12) == [1, 3, 5], "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate(1) == [1], "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_124/instruction.md b/HumanEval_124/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c3f17160b0eaaaf45e438faf35275e6f990142cd --- /dev/null +++ b/HumanEval_124/instruction.md @@ -0,0 +1,27 @@ +# HumanEval — HumanEval/124 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def valid_date(date): + """You have to write a function which validates a given date string and + returns True if the date is valid otherwise False. + The date is valid if all of the following rules are satisfied: + 1. The date string is not empty. + 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2. + 3. The months should not be less than 1 or higher than 12. + 4. The date should be in the format: mm-dd-yyyy + + for example: + valid_date('03-11-2000') => True + + valid_date('15-01-2012') => False + + valid_date('04-0-2040') => False + + valid_date('06-04-2020') => True + + valid_date('06/04/2020') => False + """ +``` diff --git a/HumanEval_124/solution/__init__.py b/HumanEval_124/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ce7ba3528dd5f0bf00213e8dc32eee0f37d6d617 --- /dev/null +++ b/HumanEval_124/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import valid_date diff --git a/HumanEval_124/solution/solution.py b/HumanEval_124/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..fb64f761861d002920b568f657dd3d2cef8210b7 --- /dev/null +++ b/HumanEval_124/solution/solution.py @@ -0,0 +1,37 @@ + +def valid_date(date): + """You have to write a function which validates a given date string and + returns True if the date is valid otherwise False. + The date is valid if all of the following rules are satisfied: + 1. The date string is not empty. + 2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2. + 3. The months should not be less than 1 or higher than 12. + 4. The date should be in the format: mm-dd-yyyy + + for example: + valid_date('03-11-2000') => True + + valid_date('15-01-2012') => False + + valid_date('04-0-2040') => False + + valid_date('06-04-2020') => True + + valid_date('06/04/2020') => False + """ + try: + date = date.strip() + month, day, year = date.split('-') + month, day, year = int(month), int(day), int(year) + if month < 1 or month > 12: + return False + if month in [1,3,5,7,8,10,12] and day < 1 or day > 31: + return False + if month in [4,6,9,11] and day < 1 or day > 30: + return False + if month == 2 and day < 1 or day > 29: + return False + except: + return False + + return True diff --git a/HumanEval_124/task.toml b/HumanEval_124/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e64059cd5ac433ac672e19fc7e5f2fa68a532d5b --- /dev/null +++ b/HumanEval_124/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/124" +name = "HumanEval — HumanEval/124" + +[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/HumanEval_124/tests/__init__.py b/HumanEval_124/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_124/tests/conftest.py b/HumanEval_124/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_124/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/HumanEval_124/tests/test_humaneval.py b/HumanEval_124/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..819a796e434c8313a5154c305181ccb6ecccb0cc --- /dev/null +++ b/HumanEval_124/tests/test_humaneval.py @@ -0,0 +1,40 @@ +from solution import valid_date as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('03-11-2000') == True + + assert candidate('15-01-2012') == False + + assert candidate('04-0-2040') == False + + assert candidate('06-04-2020') == True + + assert candidate('01-01-2007') == True + + assert candidate('03-32-2011') == False + + assert candidate('') == False + + assert candidate('04-31-3000') == False + + assert candidate('06-06-2005') == True + + assert candidate('21-31-2000') == False + + assert candidate('04-12-2003') == True + + assert candidate('04122003') == False + + assert candidate('20030412') == False + + assert candidate('2003-04') == False + + assert candidate('2003-04-12') == False + + assert candidate('04-2003') == False + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_125/instruction.md b/HumanEval_125/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9ec6e2d3cd7066d017e8899e462ad4fd1c6a2db2 --- /dev/null +++ b/HumanEval_125/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/125 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def split_words(txt): + ''' + Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you + should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the + alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25 + Examples + split_words("Hello world!") ➞ ["Hello", "world!"] + split_words("Hello,world!") ➞ ["Hello", "world!"] + split_words("abcdef") == 3 + ''' +``` diff --git a/HumanEval_125/solution/__init__.py b/HumanEval_125/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f9d712b74916825382c80be24763b84a09cbf021 --- /dev/null +++ b/HumanEval_125/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import split_words diff --git a/HumanEval_125/solution/solution.py b/HumanEval_125/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..5e8b6f17877723cb2a5f8d3f15158b1e63a06225 --- /dev/null +++ b/HumanEval_125/solution/solution.py @@ -0,0 +1,17 @@ + +def split_words(txt): + ''' + Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you + should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the + alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25 + Examples + split_words("Hello world!") ➞ ["Hello", "world!"] + split_words("Hello,world!") ➞ ["Hello", "world!"] + split_words("abcdef") == 3 + ''' + if " " in txt: + return txt.split() + elif "," in txt: + return txt.replace(',',' ').split() + else: + return len([i for i in txt if i.islower() and ord(i)%2 == 0]) diff --git a/HumanEval_125/task.toml b/HumanEval_125/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ab79cb265026f707f9a3ec60df8db04b22979a5a --- /dev/null +++ b/HumanEval_125/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/125" +name = "HumanEval — HumanEval/125" + +[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/HumanEval_125/tests/__init__.py b/HumanEval_125/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_125/tests/conftest.py b/HumanEval_125/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_125/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/HumanEval_125/tests/test_humaneval.py b/HumanEval_125/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..0b7345dda381e64395c6c607f37be448effef7f4 --- /dev/null +++ b/HumanEval_125/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import split_words as candidate + +def check(candidate): + + assert candidate("Hello world!") == ["Hello","world!"] + assert candidate("Hello,world!") == ["Hello","world!"] + assert candidate("Hello world,!") == ["Hello","world,!"] + assert candidate("Hello,Hello,world !") == ["Hello,Hello,world","!"] + assert candidate("abcdef") == 3 + assert candidate("aaabb") == 2 + assert candidate("aaaBb") == 1 + assert candidate("") == 0 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_126/instruction.md b/HumanEval_126/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..34deedbeeb7922d06a52aa9ee76370b01d25ccd0 --- /dev/null +++ b/HumanEval_126/instruction.md @@ -0,0 +1,23 @@ +# HumanEval — HumanEval/126 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def is_sorted(lst): + ''' + Given a list of numbers, return whether or not they are sorted + in ascending order. If list has more than 1 duplicate of the same + number, return False. Assume no negative numbers and only integers. + + Examples + is_sorted([5]) ➞ True + is_sorted([1, 2, 3, 4, 5]) ➞ True + is_sorted([1, 3, 2, 4, 5]) ➞ False + is_sorted([1, 2, 3, 4, 5, 6]) ➞ True + is_sorted([1, 2, 3, 4, 5, 6, 7]) ➞ True + is_sorted([1, 3, 2, 4, 5, 6, 7]) ➞ False + is_sorted([1, 2, 2, 3, 3, 4]) ➞ True + is_sorted([1, 2, 2, 2, 3, 4]) ➞ False + ''' +``` diff --git a/HumanEval_126/solution/__init__.py b/HumanEval_126/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f77627f6e983ac20dd5841a693e45615097c1a6c --- /dev/null +++ b/HumanEval_126/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_sorted diff --git a/HumanEval_126/solution/solution.py b/HumanEval_126/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1ae3d2306569373bff70336647a949c0a2c93661 --- /dev/null +++ b/HumanEval_126/solution/solution.py @@ -0,0 +1,28 @@ + +def is_sorted(lst): + ''' + Given a list of numbers, return whether or not they are sorted + in ascending order. If list has more than 1 duplicate of the same + number, return False. Assume no negative numbers and only integers. + + Examples + is_sorted([5]) ➞ True + is_sorted([1, 2, 3, 4, 5]) ➞ True + is_sorted([1, 3, 2, 4, 5]) ➞ False + is_sorted([1, 2, 3, 4, 5, 6]) ➞ True + is_sorted([1, 2, 3, 4, 5, 6, 7]) ➞ True + is_sorted([1, 3, 2, 4, 5, 6, 7]) ➞ False + is_sorted([1, 2, 2, 3, 3, 4]) ➞ True + is_sorted([1, 2, 2, 2, 3, 4]) ➞ False + ''' + count_digit = dict([(i, 0) for i in lst]) + for i in lst: + count_digit[i]+=1 + if any(count_digit[i] > 2 for i in lst): + return False + if all(lst[i-1] <= lst[i] for i in range(1, len(lst))): + return True + else: + return False + + diff --git a/HumanEval_126/task.toml b/HumanEval_126/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b4974924df2dcb160f1f1c9f59768ed9b73f9c69 --- /dev/null +++ b/HumanEval_126/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/126" +name = "HumanEval — HumanEval/126" + +[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/HumanEval_126/tests/__init__.py b/HumanEval_126/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_126/tests/conftest.py b/HumanEval_126/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_126/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/HumanEval_126/tests/test_humaneval.py b/HumanEval_126/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2e0bb1721346e89c71965dd4e67e6f1df2427b3c --- /dev/null +++ b/HumanEval_126/tests/test_humaneval.py @@ -0,0 +1,25 @@ +from solution import is_sorted as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([5]) == True + assert candidate([1, 2, 3, 4, 5]) == True + assert candidate([1, 3, 2, 4, 5]) == False + assert candidate([1, 2, 3, 4, 5, 6]) == True + assert candidate([1, 2, 3, 4, 5, 6, 7]) == True + assert candidate([1, 3, 2, 4, 5, 6, 7]) == False, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([]) == True, "This prints if this assert fails 2 (good for debugging!)" + assert candidate([1]) == True, "This prints if this assert fails 3 (good for debugging!)" + assert candidate([3, 2, 1]) == False, "This prints if this assert fails 4 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate([1, 2, 2, 2, 3, 4]) == False, "This prints if this assert fails 5 (good for debugging!)" + assert candidate([1, 2, 3, 3, 3, 4]) == False, "This prints if this assert fails 6 (good for debugging!)" + assert candidate([1, 2, 2, 3, 3, 4]) == True, "This prints if this assert fails 7 (good for debugging!)" + assert candidate([1, 2, 3, 4]) == True, "This prints if this assert fails 8 (good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_127/instruction.md b/HumanEval_127/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..71069268ab98a70ee9d8746c878ab818a2884171 --- /dev/null +++ b/HumanEval_127/instruction.md @@ -0,0 +1,27 @@ +# HumanEval — HumanEval/127 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def intersection(interval1, interval2): + """You are given two intervals, + where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). + The given intervals are closed which means that the interval (start, end) + includes both start and end. + For each given interval, it is assumed that its start is less or equal its end. + Your task is to determine whether the length of intersection of these two + intervals is a prime number. + Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3) + which its length is 1, which not a prime number. + If the length of the intersection is a prime number, return "YES", + otherwise, return "NO". + If the two intervals don't intersect, return "NO". + + + [input/output] samples: + intersection((1, 2), (2, 3)) ==> "NO" + intersection((-1, 1), (0, 4)) ==> "NO" + intersection((-3, -1), (-5, 5)) ==> "YES" + """ +``` diff --git a/HumanEval_127/solution/__init__.py b/HumanEval_127/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ad3a2317c7f875ab9df8fba8e943087ee4d0d3d2 --- /dev/null +++ b/HumanEval_127/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import intersection diff --git a/HumanEval_127/solution/solution.py b/HumanEval_127/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..095d13c2042e7d2ed937039fc827674b06089bb8 --- /dev/null +++ b/HumanEval_127/solution/solution.py @@ -0,0 +1,37 @@ + +def intersection(interval1, interval2): + """You are given two intervals, + where each interval is a pair of integers. For example, interval = (start, end) = (1, 2). + The given intervals are closed which means that the interval (start, end) + includes both start and end. + For each given interval, it is assumed that its start is less or equal its end. + Your task is to determine whether the length of intersection of these two + intervals is a prime number. + Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3) + which its length is 1, which not a prime number. + If the length of the intersection is a prime number, return "YES", + otherwise, return "NO". + If the two intervals don't intersect, return "NO". + + + [input/output] samples: + intersection((1, 2), (2, 3)) ==> "NO" + intersection((-1, 1), (0, 4)) ==> "NO" + intersection((-3, -1), (-5, 5)) ==> "YES" + """ + def is_prime(num): + if num == 1 or num == 0: + return False + if num == 2: + return True + for i in range(2, num): + if num%i == 0: + return False + return True + + l = max(interval1[0], interval2[0]) + r = min(interval1[1], interval2[1]) + length = r - l + if length > 0 and is_prime(length): + return "YES" + return "NO" diff --git a/HumanEval_127/task.toml b/HumanEval_127/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..46a8e5faefec49ae879f49505191b121f6b6ce37 --- /dev/null +++ b/HumanEval_127/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/127" +name = "HumanEval — HumanEval/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/HumanEval_127/tests/__init__.py b/HumanEval_127/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_127/tests/conftest.py b/HumanEval_127/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_127/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/HumanEval_127/tests/test_humaneval.py b/HumanEval_127/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..6312d3548cde1104ad1e8fdc57cb8a6ae76b4537 --- /dev/null +++ b/HumanEval_127/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import intersection as candidate + +def check(candidate): + + # Check some simple cases + assert candidate((1, 2), (2, 3)) == "NO" + assert candidate((-1, 1), (0, 4)) == "NO" + assert candidate((-3, -1), (-5, 5)) == "YES" + assert candidate((-2, 2), (-4, 0)) == "YES" + + # Check some edge cases that are easy to work out by hand. + assert candidate((-11, 2), (-1, -1)) == "NO" + assert candidate((1, 2), (3, 5)) == "NO" + assert candidate((1, 2), (1, 2)) == "NO" + assert candidate((-2, -2), (-3, -2)) == "NO" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_128/instruction.md b/HumanEval_128/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..56ca257342d4b9211ba6d3c50c54eadd9ff88263 --- /dev/null +++ b/HumanEval_128/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/128 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def prod_signs(arr): + """ + You are given an array arr of integers and you need to return + sum of magnitudes of integers multiplied by product of all signs + of each number in the array, represented by 1, -1 or 0. + Note: return None for empty arr. + + Example: + >>> prod_signs([1, 2, 2, -4]) == -9 + >>> prod_signs([0, 1]) == 0 + >>> prod_signs([]) == None + """ +``` diff --git a/HumanEval_128/solution/__init__.py b/HumanEval_128/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..902004c371a2931b460a0b71ec6c97cecb707231 --- /dev/null +++ b/HumanEval_128/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import prod_signs diff --git a/HumanEval_128/solution/solution.py b/HumanEval_128/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..2faa62c27931a6f3a3978b2aa0e29c678e1a5f68 --- /dev/null +++ b/HumanEval_128/solution/solution.py @@ -0,0 +1,16 @@ + +def prod_signs(arr): + """ + You are given an array arr of integers and you need to return + sum of magnitudes of integers multiplied by product of all signs + of each number in the array, represented by 1, -1 or 0. + Note: return None for empty arr. + + Example: + >>> prod_signs([1, 2, 2, -4]) == -9 + >>> prod_signs([0, 1]) == 0 + >>> prod_signs([]) == None + """ + if not arr: return None + prod = 0 if 0 in arr else (-1) ** len(list(filter(lambda x: x < 0, arr))) + return prod * sum([abs(i) for i in arr]) diff --git a/HumanEval_128/task.toml b/HumanEval_128/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f55aee365db36dea090fbfeb42b0b5f4e783f2a0 --- /dev/null +++ b/HumanEval_128/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/128" +name = "HumanEval — HumanEval/128" + +[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/HumanEval_128/tests/__init__.py b/HumanEval_128/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_128/tests/conftest.py b/HumanEval_128/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_128/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/HumanEval_128/tests/test_humaneval.py b/HumanEval_128/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..575e69f4be37b5400bed977d333782c08990df23 --- /dev/null +++ b/HumanEval_128/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import prod_signs as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([1, 2, 2, -4]) == -9 + assert candidate([0, 1]) == 0 + assert candidate([1, 1, 1, 2, 3, -1, 1]) == -10 + assert candidate([]) == None + assert candidate([2, 4,1, 2, -1, -1, 9]) == 20 + assert candidate([-1, 1, -1, 1]) == 4 + assert candidate([-1, 1, 1, 1]) == -4 + assert candidate([-1, 1, 1, 0]) == 0 + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_129/instruction.md b/HumanEval_129/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..db73f624929bdaeab858929352ba19e9641c0f7e --- /dev/null +++ b/HumanEval_129/instruction.md @@ -0,0 +1,37 @@ +# HumanEval — HumanEval/129 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def minPath(grid, k): + """ + Given a grid with N rows and N columns (N >= 2) and a positive integer k, + each cell of the grid contains a value. Every integer in the range [1, N * N] + inclusive appears exactly once on the cells of the grid. + + You have to find the minimum path of length k in the grid. You can start + from any cell, and in each step you can move to any of the neighbor cells, + in other words, you can go to cells which share an edge with you current + cell. + Please note that a path of length k means visiting exactly k cells (not + necessarily distinct). + You CANNOT go off the grid. + A path A (of length k) is considered less than a path B (of length k) if + after making the ordered lists of the values on the cells that A and B go + through (let's call them lst_A and lst_B), lst_A is lexicographically less + than lst_B, in other words, there exist an integer index i (1 <= i <= k) + such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have + lst_A[j] = lst_B[j]. + It is guaranteed that the answer is unique. + Return an ordered list of the values on the cells that the minimum path go through. + + Examples: + + Input: grid = [ [1,2,3], [4,5,6], [7,8,9]], k = 3 + Output: [1, 2, 1] + + Input: grid = [ [5,9,3], [4,1,6], [7,8,2]], k = 1 + Output: [1] + """ +``` diff --git a/HumanEval_129/solution/__init__.py b/HumanEval_129/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..66ca23ebf72a70263006a42e9c3658fc2f15060b --- /dev/null +++ b/HumanEval_129/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import minPath diff --git a/HumanEval_129/solution/solution.py b/HumanEval_129/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..628a56ffe9bc814833d3c1623bc85a20acf507c3 --- /dev/null +++ b/HumanEval_129/solution/solution.py @@ -0,0 +1,58 @@ + +def minPath(grid, k): + """ + Given a grid with N rows and N columns (N >= 2) and a positive integer k, + each cell of the grid contains a value. Every integer in the range [1, N * N] + inclusive appears exactly once on the cells of the grid. + + You have to find the minimum path of length k in the grid. You can start + from any cell, and in each step you can move to any of the neighbor cells, + in other words, you can go to cells which share an edge with you current + cell. + Please note that a path of length k means visiting exactly k cells (not + necessarily distinct). + You CANNOT go off the grid. + A path A (of length k) is considered less than a path B (of length k) if + after making the ordered lists of the values on the cells that A and B go + through (let's call them lst_A and lst_B), lst_A is lexicographically less + than lst_B, in other words, there exist an integer index i (1 <= i <= k) + such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have + lst_A[j] = lst_B[j]. + It is guaranteed that the answer is unique. + Return an ordered list of the values on the cells that the minimum path go through. + + Examples: + + Input: grid = [ [1,2,3], [4,5,6], [7,8,9]], k = 3 + Output: [1, 2, 1] + + Input: grid = [ [5,9,3], [4,1,6], [7,8,2]], k = 1 + Output: [1] + """ + n = len(grid) + val = n * n + 1 + for i in range(n): + for j in range(n): + if grid[i][j] == 1: + temp = [] + if i != 0: + temp.append(grid[i - 1][j]) + + if j != 0: + temp.append(grid[i][j - 1]) + + if i != n - 1: + temp.append(grid[i + 1][j]) + + if j != n - 1: + temp.append(grid[i][j + 1]) + + val = min(temp) + + ans = [] + for i in range(k): + if i % 2 == 0: + ans.append(1) + else: + ans.append(val) + return ans diff --git a/HumanEval_129/task.toml b/HumanEval_129/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c2e8cff2cf4c6a1965082de97dc026d1761c1550 --- /dev/null +++ b/HumanEval_129/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/129" +name = "HumanEval — HumanEval/129" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/HumanEval_129/tests/__init__.py b/HumanEval_129/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_129/tests/conftest.py b/HumanEval_129/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_129/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/HumanEval_129/tests/test_humaneval.py b/HumanEval_129/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..c8b0dd72ceff5f08a46e1d194444f2e5cffab456 --- /dev/null +++ b/HumanEval_129/tests/test_humaneval.py @@ -0,0 +1,24 @@ +from solution import minPath as candidate + +def check(candidate): + + # Check some simple cases + print + assert candidate([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3) == [1, 2, 1] + assert candidate([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1) == [1] + assert candidate([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]], 4) == [1, 2, 1, 2] + assert candidate([[6, 4, 13, 10], [5, 7, 12, 1], [3, 16, 11, 15], [8, 14, 9, 2]], 7) == [1, 10, 1, 10, 1, 10, 1] + assert candidate([[8, 14, 9, 2], [6, 4, 13, 15], [5, 7, 1, 12], [3, 10, 11, 16]], 5) == [1, 7, 1, 7, 1] + assert candidate([[11, 8, 7, 2], [5, 16, 14, 4], [9, 3, 15, 6], [12, 13, 10, 1]], 9) == [1, 6, 1, 6, 1, 6, 1, 6, 1] + assert candidate([[12, 13, 10, 1], [9, 3, 15, 6], [5, 16, 14, 4], [11, 8, 7, 2]], 12) == [1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6] + assert candidate([[2, 7, 4], [3, 1, 5], [6, 8, 9]], 8) == [1, 3, 1, 3, 1, 3, 1, 3] + assert candidate([[6, 1, 5], [3, 8, 9], [2, 7, 4]], 8) == [1, 5, 1, 5, 1, 5, 1, 5] + + # Check some edge cases that are easy to work out by hand. + assert candidate([[1, 2], [3, 4]], 10) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2] + assert candidate([[1, 3], [3, 2]], 10) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 3] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_13/instruction.md b/HumanEval_13/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..63b6d16795537445949d16b9cc289fb2c51c1b34 --- /dev/null +++ b/HumanEval_13/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/13 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def greatest_common_divisor(a: int, b: int) -> int: + """ Return a greatest common divisor of two integers a and b + >>> greatest_common_divisor(3, 5) + 1 + >>> greatest_common_divisor(25, 15) + 5 + """ +``` diff --git a/HumanEval_13/solution/__init__.py b/HumanEval_13/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3a742009eecbcf9ed3254087eefcf010291f4fe3 --- /dev/null +++ b/HumanEval_13/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import greatest_common_divisor diff --git a/HumanEval_13/solution/solution.py b/HumanEval_13/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..e8d8f4628be84ed588762d7a4c7c2b4574dfb54d --- /dev/null +++ b/HumanEval_13/solution/solution.py @@ -0,0 +1,12 @@ + + +def greatest_common_divisor(a: int, b: int) -> int: + """ Return a greatest common divisor of two integers a and b + >>> greatest_common_divisor(3, 5) + 1 + >>> greatest_common_divisor(25, 15) + 5 + """ + while b: + a, b = b, a % b + return a diff --git a/HumanEval_13/task.toml b/HumanEval_13/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c3bc1563a2b085fba4712486686fb4cd5bce673d --- /dev/null +++ b/HumanEval_13/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/13" +name = "HumanEval — HumanEval/13" + +[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/HumanEval_13/tests/__init__.py b/HumanEval_13/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_13/tests/conftest.py b/HumanEval_13/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_13/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/HumanEval_13/tests/test_humaneval.py b/HumanEval_13/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..a8825c439f4dae242c0fc7ffa051b226554281a7 --- /dev/null +++ b/HumanEval_13/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import greatest_common_divisor as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate(3, 7) == 1 + assert candidate(10, 15) == 5 + assert candidate(49, 14) == 7 + assert candidate(144, 60) == 12 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_130/instruction.md b/HumanEval_130/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..55ffa3f8f7c9c0002ebfa9f079a04eb7f3f4a566 --- /dev/null +++ b/HumanEval_130/instruction.md @@ -0,0 +1,24 @@ +# HumanEval — HumanEval/130 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def tri(n): + """Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in + the last couple centuries. However, what people don't know is Tribonacci sequence. + Tribonacci sequence is defined by the recurrence: + tri(1) = 3 + tri(n) = 1 + n / 2, if n is even. + tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd. + For example: + tri(2) = 1 + (2 / 2) = 2 + tri(4) = 3 + tri(3) = tri(2) + tri(1) + tri(4) + = 2 + 3 + 3 = 8 + You are given a non-negative integer number n, you have to a return a list of the + first n + 1 numbers of the Tribonacci sequence. + Examples: + tri(3) = [1, 3, 2, 8] + """ +``` diff --git a/HumanEval_130/solution/__init__.py b/HumanEval_130/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..94d389bcf7d9db1f524f60cd86e19b9b444ffd86 --- /dev/null +++ b/HumanEval_130/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import tri diff --git a/HumanEval_130/solution/solution.py b/HumanEval_130/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..4cc705bcd26808ebf1393bb195d21dd39c442869 --- /dev/null +++ b/HumanEval_130/solution/solution.py @@ -0,0 +1,27 @@ + +def tri(n): + """Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in + the last couple centuries. However, what people don't know is Tribonacci sequence. + Tribonacci sequence is defined by the recurrence: + tri(1) = 3 + tri(n) = 1 + n / 2, if n is even. + tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd. + For example: + tri(2) = 1 + (2 / 2) = 2 + tri(4) = 3 + tri(3) = tri(2) + tri(1) + tri(4) + = 2 + 3 + 3 = 8 + You are given a non-negative integer number n, you have to a return a list of the + first n + 1 numbers of the Tribonacci sequence. + Examples: + tri(3) = [1, 3, 2, 8] + """ + if n == 0: + return [1] + my_tri = [1, 3] + for i in range(2, n + 1): + if i % 2 == 0: + my_tri.append(i / 2 + 1) + else: + my_tri.append(my_tri[i - 1] + my_tri[i - 2] + (i + 3) / 2) + return my_tri diff --git a/HumanEval_130/task.toml b/HumanEval_130/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c04618e22ce5c18379581eb01a056c608f62a180 --- /dev/null +++ b/HumanEval_130/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/130" +name = "HumanEval — HumanEval/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/HumanEval_130/tests/__init__.py b/HumanEval_130/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_130/tests/conftest.py b/HumanEval_130/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_130/tests/test_humaneval.py b/HumanEval_130/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..13c2e73ac7a169b97573e77921ff43870612a3e3 --- /dev/null +++ b/HumanEval_130/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import tri as candidate + +def check(candidate): + + # Check some simple cases + + assert candidate(3) == [1, 3, 2.0, 8.0] + assert candidate(4) == [1, 3, 2.0, 8.0, 3.0] + assert candidate(5) == [1, 3, 2.0, 8.0, 3.0, 15.0] + assert candidate(6) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0] + assert candidate(7) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0] + assert candidate(8) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0] + assert candidate(9) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0, 35.0] + assert candidate(20) == [1, 3, 2.0, 8.0, 3.0, 15.0, 4.0, 24.0, 5.0, 35.0, 6.0, 48.0, 7.0, 63.0, 8.0, 80.0, 9.0, 99.0, 10.0, 120.0, 11.0] + + # Check some edge cases that are easy to work out by hand. + assert candidate(0) == [1] + assert candidate(1) == [1, 3] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_131/instruction.md b/HumanEval_131/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..54831825dfda28cd52261ab07db0f0566527047c --- /dev/null +++ b/HumanEval_131/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/131 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def digits(n): + """Given a positive integer n, return the product of the odd digits. + Return 0 if all digits are even. + For example: + digits(1) == 1 + digits(4) == 0 + digits(235) == 15 + """ +``` diff --git a/HumanEval_131/solution/__init__.py b/HumanEval_131/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..327037b55ce9445262e30eef8482c4fc59db31fa --- /dev/null +++ b/HumanEval_131/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import digits diff --git a/HumanEval_131/solution/solution.py b/HumanEval_131/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..892a6c582b8aff56992abc691c4b43cf2d45c2e5 --- /dev/null +++ b/HumanEval_131/solution/solution.py @@ -0,0 +1,20 @@ + +def digits(n): + """Given a positive integer n, return the product of the odd digits. + Return 0 if all digits are even. + For example: + digits(1) == 1 + digits(4) == 0 + digits(235) == 15 + """ + product = 1 + odd_count = 0 + for digit in str(n): + int_digit = int(digit) + if int_digit%2 == 1: + product= product*int_digit + odd_count+=1 + if odd_count ==0: + return 0 + else: + return product diff --git a/HumanEval_131/task.toml b/HumanEval_131/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8ed5c79066cb58bf464962535a949e3b3af4b702 --- /dev/null +++ b/HumanEval_131/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/131" +name = "HumanEval — HumanEval/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/HumanEval_131/tests/__init__.py b/HumanEval_131/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_131/tests/conftest.py b/HumanEval_131/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_131/tests/test_humaneval.py b/HumanEval_131/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..41410462a7d243ef441f05fc53cbe81f356112dd --- /dev/null +++ b/HumanEval_131/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import digits as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(5) == 5 + assert candidate(54) == 5 + assert candidate(120) ==1 + assert candidate(5014) == 5 + assert candidate(98765) == 315 + assert candidate(5576543) == 2625 + + # Check some edge cases that are easy to work out by hand. + assert candidate(2468) == 0 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_132/instruction.md b/HumanEval_132/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3c828f75135d70a5bb402c2cf7ccacd7e750c5f1 --- /dev/null +++ b/HumanEval_132/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/132 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def is_nested(string): + ''' + Create a function that takes a string as input which contains only square brackets. + The function should return True if and only if there is a valid subsequence of brackets + where at least one bracket in the subsequence is nested. + + is_nested('[[]]') ➞ True + is_nested('[]]]]]]][[[[[]') ➞ False + is_nested('[][]') ➞ False + is_nested('[]') ➞ False + is_nested('[[][]]') ➞ True + is_nested('[[]][[') ➞ True + ''' +``` diff --git a/HumanEval_132/solution/__init__.py b/HumanEval_132/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2236a82339b405260e5842831ebfee589d3666f3 --- /dev/null +++ b/HumanEval_132/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_nested diff --git a/HumanEval_132/solution/solution.py b/HumanEval_132/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..50d646e52afd232baac4461eb7d0c1a2546d16d3 --- /dev/null +++ b/HumanEval_132/solution/solution.py @@ -0,0 +1,32 @@ + +def is_nested(string): + ''' + Create a function that takes a string as input which contains only square brackets. + The function should return True if and only if there is a valid subsequence of brackets + where at least one bracket in the subsequence is nested. + + is_nested('[[]]') ➞ True + is_nested('[]]]]]]][[[[[]') ➞ False + is_nested('[][]') ➞ False + is_nested('[]') ➞ False + is_nested('[[][]]') ➞ True + is_nested('[[]][[') ➞ True + ''' + opening_bracket_index = [] + closing_bracket_index = [] + for i in range(len(string)): + if string[i] == '[': + opening_bracket_index.append(i) + else: + closing_bracket_index.append(i) + closing_bracket_index.reverse() + cnt = 0 + i = 0 + l = len(closing_bracket_index) + for idx in opening_bracket_index: + if i < l and idx < closing_bracket_index[i]: + cnt += 1 + i += 1 + return cnt >= 2 + + diff --git a/HumanEval_132/task.toml b/HumanEval_132/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..51d8f4c4c3890ae420b405a5c5be73619fef2ca6 --- /dev/null +++ b/HumanEval_132/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/132" +name = "HumanEval — HumanEval/132" + +[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/HumanEval_132/tests/__init__.py b/HumanEval_132/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_132/tests/conftest.py b/HumanEval_132/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_132/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/HumanEval_132/tests/test_humaneval.py b/HumanEval_132/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3a670da8fda23fa74d3d6c2dc844832133bb2d64 --- /dev/null +++ b/HumanEval_132/tests/test_humaneval.py @@ -0,0 +1,26 @@ +from solution import is_nested as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('[[]]') == True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate('[]]]]]]][[[[[]') == False + assert candidate('[][]') == False + assert candidate(('[]')) == False + assert candidate('[[[[]]]]') == True + assert candidate('[]]]]]]]]]]') == False + assert candidate('[][][[]]') == True + assert candidate('[[]') == False + assert candidate('[]]') == False + assert candidate('[[]][[') == True + assert candidate('[[][]]') == True + + # Check some edge cases that are easy to work out by hand. + assert candidate('') == False, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate('[[[[[[[[') == False + assert candidate(']]]]]]]]') == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_133/instruction.md b/HumanEval_133/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..62a8916662ee79f7e321fd64e9d5df8de8ae7494 --- /dev/null +++ b/HumanEval_133/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/133 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def sum_squares(lst): + """You are given a list of numbers. + You need to return the sum of squared numbers in the given list, + round each element in the list to the upper int(Ceiling) first. + Examples: + For lst = [1,2,3] the output should be 14 + For lst = [1,4,9] the output should be 98 + For lst = [1,3,5,7] the output should be 84 + For lst = [1.4,4.2,0] the output should be 29 + For lst = [-2.4,1,1] the output should be 6 + + + """ +``` diff --git a/HumanEval_133/solution/__init__.py b/HumanEval_133/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..531008a2d402adcd2f44798bedb47c70f62bde92 --- /dev/null +++ b/HumanEval_133/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sum_squares diff --git a/HumanEval_133/solution/solution.py b/HumanEval_133/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..e669aad7e3af1434af36c5bb7d7b5b00487bae50 --- /dev/null +++ b/HumanEval_133/solution/solution.py @@ -0,0 +1,20 @@ + + +def sum_squares(lst): + """You are given a list of numbers. + You need to return the sum of squared numbers in the given list, + round each element in the list to the upper int(Ceiling) first. + Examples: + For lst = [1,2,3] the output should be 14 + For lst = [1,4,9] the output should be 98 + For lst = [1,3,5,7] the output should be 84 + For lst = [1.4,4.2,0] the output should be 29 + For lst = [-2.4,1,1] the output should be 6 + + + """ + import math + squared = 0 + for i in lst: + squared += math.ceil(i)**2 + return squared diff --git a/HumanEval_133/task.toml b/HumanEval_133/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e1796422bde37c29d3477462a485ac45a6b8ec20 --- /dev/null +++ b/HumanEval_133/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/133" +name = "HumanEval — HumanEval/133" + +[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/HumanEval_133/tests/__init__.py b/HumanEval_133/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_133/tests/conftest.py b/HumanEval_133/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_133/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/HumanEval_133/tests/test_humaneval.py b/HumanEval_133/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..644e40e1aae49f6087514efebfe8f29aa7b6767c --- /dev/null +++ b/HumanEval_133/tests/test_humaneval.py @@ -0,0 +1,26 @@ +from solution import sum_squares as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1,2,3])==14, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([1.0,2,3])==14, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([1,3,5,7])==84, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([1.4,4.2,0])==29, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([-2.4,1,1])==6, "This prints if this assert fails 1 (good for debugging!)" + + assert candidate([100,1,15,2])==10230, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([10000,10000])==200000000, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([-1.4,4.6,6.3])==75, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([-1.4,17.9,18.9,19.9])==1086, "This prints if this assert fails 1 (good for debugging!)" + + + # Check some edge cases that are easy to work out by hand. + assert candidate([0])==0, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([-1])==1, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([-1,1,0])==2, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_134/instruction.md b/HumanEval_134/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e0ace92bc9ee1996dce4a576eb33cd65b420fa61 --- /dev/null +++ b/HumanEval_134/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/134 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def check_if_last_char_is_a_letter(txt): + ''' + Create a function that returns True if the last character + of a given string is an alphabetical character and is not + a part of a word, and False otherwise. + Note: "word" is a group of characters separated by space. + + Examples: + check_if_last_char_is_a_letter("apple pie") ➞ False + check_if_last_char_is_a_letter("apple pi e") ➞ True + check_if_last_char_is_a_letter("apple pi e ") ➞ False + check_if_last_char_is_a_letter("") ➞ False + ''' +``` diff --git a/HumanEval_134/solution/__init__.py b/HumanEval_134/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3c2f0877805f141bdd42ffb898794631d322266e --- /dev/null +++ b/HumanEval_134/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import check_if_last_char_is_a_letter diff --git a/HumanEval_134/solution/solution.py b/HumanEval_134/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..d63261c0054d3d5fbe0bf043a8c0ded8899bb1ee --- /dev/null +++ b/HumanEval_134/solution/solution.py @@ -0,0 +1,17 @@ + +def check_if_last_char_is_a_letter(txt): + ''' + Create a function that returns True if the last character + of a given string is an alphabetical character and is not + a part of a word, and False otherwise. + Note: "word" is a group of characters separated by space. + + Examples: + check_if_last_char_is_a_letter("apple pie") ➞ False + check_if_last_char_is_a_letter("apple pi e") ➞ True + check_if_last_char_is_a_letter("apple pi e ") ➞ False + check_if_last_char_is_a_letter("") ➞ False + ''' + + check = txt.split(' ')[-1] + return True if len(check) == 1 and (97 <= ord(check.lower()) <= 122) else False diff --git a/HumanEval_134/task.toml b/HumanEval_134/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..37a57f95d09df90ff3bb549fd9c71cbdbd4d5379 --- /dev/null +++ b/HumanEval_134/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/134" +name = "HumanEval — HumanEval/134" + +[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/HumanEval_134/tests/__init__.py b/HumanEval_134/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_134/tests/conftest.py b/HumanEval_134/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_134/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/HumanEval_134/tests/test_humaneval.py b/HumanEval_134/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..73c42ab4114c0091b2ebb57d8fb90d50b8eb2cac --- /dev/null +++ b/HumanEval_134/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import check_if_last_char_is_a_letter as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("apple") == False + assert candidate("apple pi e") == True + assert candidate("eeeee") == False + assert candidate("A") == True + assert candidate("Pumpkin pie ") == False + assert candidate("Pumpkin pie 1") == False + assert candidate("") == False + assert candidate("eeeee e ") == False + assert candidate("apple pie") == False + assert candidate("apple pi e ") == False + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_135/instruction.md b/HumanEval_135/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b4db13f6a7848f2aa4f426fae54536cc5ea90864 --- /dev/null +++ b/HumanEval_135/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/135 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def can_arrange(arr): + """Create a function which returns the largest index of an element which + is not greater than or equal to the element immediately preceding it. If + no such element exists then return -1. The given array will not contain + duplicate values. + + Examples: + can_arrange([1,2,4,3,5]) = 3 + can_arrange([1,2,3]) = -1 + """ +``` diff --git a/HumanEval_135/solution/__init__.py b/HumanEval_135/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bf7d23afa1ffe4f949a6cd5b493400c3d25ce39e --- /dev/null +++ b/HumanEval_135/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import can_arrange diff --git a/HumanEval_135/solution/solution.py b/HumanEval_135/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ed2bb50dc313ce49befb4a931e8dcf28c2217700 --- /dev/null +++ b/HumanEval_135/solution/solution.py @@ -0,0 +1,18 @@ + +def can_arrange(arr): + """Create a function which returns the largest index of an element which + is not greater than or equal to the element immediately preceding it. If + no such element exists then return -1. The given array will not contain + duplicate values. + + Examples: + can_arrange([1,2,4,3,5]) = 3 + can_arrange([1,2,3]) = -1 + """ + ind=-1 + i=1 + while i None: + check(candidate) diff --git a/HumanEval_136/instruction.md b/HumanEval_136/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..575478c9338150ce349dbe64d90c58c3689d9e8f --- /dev/null +++ b/HumanEval_136/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/136 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def largest_smallest_integers(lst): + ''' + Create a function that returns a tuple (a, b), where 'a' is + the largest of negative integers, and 'b' is the smallest + of positive integers in a list. + If there is no negative or positive integers, return them as None. + + Examples: + largest_smallest_integers([2, 4, 1, 3, 5, 7]) == (None, 1) + largest_smallest_integers([]) == (None, None) + largest_smallest_integers([0]) == (None, None) + ''' +``` diff --git a/HumanEval_136/solution/__init__.py b/HumanEval_136/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0c855d2dd386b2bd1f6926ee5d6847a1c4ae31d3 --- /dev/null +++ b/HumanEval_136/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import largest_smallest_integers diff --git a/HumanEval_136/solution/solution.py b/HumanEval_136/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ad6f48ee2fd802a988da69aba3a9719d00883a14 --- /dev/null +++ b/HumanEval_136/solution/solution.py @@ -0,0 +1,16 @@ + +def largest_smallest_integers(lst): + ''' + Create a function that returns a tuple (a, b), where 'a' is + the largest of negative integers, and 'b' is the smallest + of positive integers in a list. + If there is no negative or positive integers, return them as None. + + Examples: + largest_smallest_integers([2, 4, 1, 3, 5, 7]) == (None, 1) + largest_smallest_integers([]) == (None, None) + largest_smallest_integers([0]) == (None, None) + ''' + smallest = list(filter(lambda x: x < 0, lst)) + largest = list(filter(lambda x: x > 0, lst)) + return (max(smallest) if smallest else None, min(largest) if largest else None) diff --git a/HumanEval_136/task.toml b/HumanEval_136/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..488f8a2fabcc91ffb7b7e86995fda4501f7ae93c --- /dev/null +++ b/HumanEval_136/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/136" +name = "HumanEval — HumanEval/136" + +[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/HumanEval_136/tests/__init__.py b/HumanEval_136/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_136/tests/conftest.py b/HumanEval_136/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_136/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/HumanEval_136/tests/test_humaneval.py b/HumanEval_136/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..ef6a34def3c7098786bddf53c757bd741fad1e23 --- /dev/null +++ b/HumanEval_136/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import largest_smallest_integers as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([2, 4, 1, 3, 5, 7]) == (None, 1) + assert candidate([2, 4, 1, 3, 5, 7, 0]) == (None, 1) + assert candidate([1, 3, 2, 4, 5, 6, -2]) == (-2, 1) + assert candidate([4, 5, 3, 6, 2, 7, -7]) == (-7, 2) + assert candidate([7, 3, 8, 4, 9, 2, 5, -9]) == (-9, 2) + assert candidate([]) == (None, None) + assert candidate([0]) == (None, None) + assert candidate([-1, -3, -5, -6]) == (-1, None) + assert candidate([-1, -3, -5, -6, 0]) == (-1, None) + assert candidate([-6, -4, -4, -3, 1]) == (-3, 1) + assert candidate([-6, -4, -4, -3, -100, 1]) == (-3, 1) + + # Check some edge cases that are easy to work out by hand. + assert True + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_137/instruction.md b/HumanEval_137/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8ebcfdfce1a96aaff1b814c36d398819d7b4f9d0 --- /dev/null +++ b/HumanEval_137/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/137 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def compare_one(a, b): + """ + Create a function that takes integers, floats, or strings representing + real numbers, and returns the larger variable in its given variable type. + Return None if the values are equal. + Note: If a real number is represented as a string, the floating point might be . or , + + compare_one(1, 2.5) ➞ 2.5 + compare_one(1, "2,3") ➞ "2,3" + compare_one("5,1", "6") ➞ "6" + compare_one("1", 1) ➞ None + """ +``` diff --git a/HumanEval_137/solution/__init__.py b/HumanEval_137/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e8ed5c6080465aa1a20079d97f8074a63975355c --- /dev/null +++ b/HumanEval_137/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import compare_one diff --git a/HumanEval_137/solution/solution.py b/HumanEval_137/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..410f06b8b8f87614c584afc87b33d7288887952b --- /dev/null +++ b/HumanEval_137/solution/solution.py @@ -0,0 +1,18 @@ + +def compare_one(a, b): + """ + Create a function that takes integers, floats, or strings representing + real numbers, and returns the larger variable in its given variable type. + Return None if the values are equal. + Note: If a real number is represented as a string, the floating point might be . or , + + compare_one(1, 2.5) ➞ 2.5 + compare_one(1, "2,3") ➞ "2,3" + compare_one("5,1", "6") ➞ "6" + compare_one("1", 1) ➞ None + """ + temp_a, temp_b = a, b + if isinstance(temp_a, str): temp_a = temp_a.replace(',','.') + if isinstance(temp_b, str): temp_b = temp_b.replace(',','.') + if float(temp_a) == float(temp_b): return None + return a if float(temp_a) > float(temp_b) else b diff --git a/HumanEval_137/task.toml b/HumanEval_137/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f60a5aa2dbb5d93db07373d61eb14d4912602261 --- /dev/null +++ b/HumanEval_137/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/137" +name = "HumanEval — HumanEval/137" + +[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/HumanEval_137/tests/__init__.py b/HumanEval_137/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_137/tests/conftest.py b/HumanEval_137/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_137/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/HumanEval_137/tests/test_humaneval.py b/HumanEval_137/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..4cdcbae7c0f77bbd848bf458636bd398ea5c069a --- /dev/null +++ b/HumanEval_137/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import compare_one as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(1, 2) == 2 + assert candidate(1, 2.5) == 2.5 + assert candidate(2, 3) == 3 + assert candidate(5, 6) == 6 + assert candidate(1, "2,3") == "2,3" + assert candidate("5,1", "6") == "6" + assert candidate("1", "2") == "2" + assert candidate("1", 1) == None + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_138/instruction.md b/HumanEval_138/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b5aff1291edc4843d92c6753bfd1f438bdb6aec7 --- /dev/null +++ b/HumanEval_138/instruction.md @@ -0,0 +1,14 @@ +# HumanEval — HumanEval/138 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def is_equal_to_sum_even(n): + """Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers + Example + is_equal_to_sum_even(4) == False + is_equal_to_sum_even(6) == False + is_equal_to_sum_even(8) == True + """ +``` diff --git a/HumanEval_138/solution/__init__.py b/HumanEval_138/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c515fad7219aaffe93effd6871c32df8312ca571 --- /dev/null +++ b/HumanEval_138/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_equal_to_sum_even diff --git a/HumanEval_138/solution/solution.py b/HumanEval_138/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..57dc921f3a8bec6cd71da0425f89267a74c9ae34 --- /dev/null +++ b/HumanEval_138/solution/solution.py @@ -0,0 +1,9 @@ + +def is_equal_to_sum_even(n): + """Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers + Example + is_equal_to_sum_even(4) == False + is_equal_to_sum_even(6) == False + is_equal_to_sum_even(8) == True + """ + return n%2 == 0 and n >= 8 diff --git a/HumanEval_138/task.toml b/HumanEval_138/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6302bca74587095decb3de46e5c48e2de5931aa6 --- /dev/null +++ b/HumanEval_138/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/138" +name = "HumanEval — HumanEval/138" + +[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/HumanEval_138/tests/__init__.py b/HumanEval_138/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_138/tests/conftest.py b/HumanEval_138/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_138/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/HumanEval_138/tests/test_humaneval.py b/HumanEval_138/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..4f086862cacb1c1f2a641999fa83ff91a11ae913 --- /dev/null +++ b/HumanEval_138/tests/test_humaneval.py @@ -0,0 +1,15 @@ +from solution import is_equal_to_sum_even as candidate + +def check(candidate): + assert candidate(4) == False + assert candidate(6) == False + assert candidate(8) == True + assert candidate(10) == True + assert candidate(11) == False + assert candidate(12) == True + assert candidate(13) == False + assert candidate(16) == True + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_139/instruction.md b/HumanEval_139/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..58f46ea0c078f1b004e3a2f6132e6fa9f8fa214e --- /dev/null +++ b/HumanEval_139/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/139 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def special_factorial(n): + """The Brazilian factorial is defined as: + brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! + where n > 0 + + For example: + >>> special_factorial(4) + 288 + + The function will receive an integer as input and should return the special + factorial of this integer. + """ +``` diff --git a/HumanEval_139/solution/__init__.py b/HumanEval_139/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a24da776b46190d9e2823d1b2402c3214d89f265 --- /dev/null +++ b/HumanEval_139/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import special_factorial diff --git a/HumanEval_139/solution/solution.py b/HumanEval_139/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..34a68d0f67b367b731ee145dfff867cfb18c8502 --- /dev/null +++ b/HumanEval_139/solution/solution.py @@ -0,0 +1,19 @@ + +def special_factorial(n): + """The Brazilian factorial is defined as: + brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1! + where n > 0 + + For example: + >>> special_factorial(4) + 288 + + The function will receive an integer as input and should return the special + factorial of this integer. + """ + fact_i = 1 + special_fact = 1 + for i in range(1, n+1): + fact_i *= i + special_fact *= fact_i + return special_fact diff --git a/HumanEval_139/task.toml b/HumanEval_139/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2029e2e4cee092226cf8dc65bc750f70139b9d87 --- /dev/null +++ b/HumanEval_139/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/139" +name = "HumanEval — HumanEval/139" + +[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/HumanEval_139/tests/__init__.py b/HumanEval_139/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_139/tests/conftest.py b/HumanEval_139/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_139/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/HumanEval_139/tests/test_humaneval.py b/HumanEval_139/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..fccce2c85891c6051ba5c0d47186477a42b5cae1 --- /dev/null +++ b/HumanEval_139/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import special_factorial as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(4) == 288, "Test 4" + assert candidate(5) == 34560, "Test 5" + assert candidate(7) == 125411328000, "Test 7" + + # Check some edge cases that are easy to work out by hand. + assert candidate(1) == 1, "Test 1" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_14/instruction.md b/HumanEval_14/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0febf45bc78e533665a2f77e37a512b74f12c092 --- /dev/null +++ b/HumanEval_14/instruction.md @@ -0,0 +1,14 @@ +# HumanEval — HumanEval/14 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def all_prefixes(string: str) -> List[str]: + """ Return list of all prefixes from shortest to longest of the input string + >>> all_prefixes('abc') + ['a', 'ab', 'abc'] + """ +``` diff --git a/HumanEval_14/solution/__init__.py b/HumanEval_14/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6f14577dddfcda3e3d6d5dccd876277674a8a968 --- /dev/null +++ b/HumanEval_14/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import all_prefixes diff --git a/HumanEval_14/solution/solution.py b/HumanEval_14/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..751f95d526d2a495c9e214c38919b9048beffe81 --- /dev/null +++ b/HumanEval_14/solution/solution.py @@ -0,0 +1,13 @@ +from typing import List + + +def all_prefixes(string: str) -> List[str]: + """ Return list of all prefixes from shortest to longest of the input string + >>> all_prefixes('abc') + ['a', 'ab', 'abc'] + """ + result = [] + + for i in range(len(string)): + result.append(string[:i+1]) + return result diff --git a/HumanEval_14/task.toml b/HumanEval_14/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2db7f989f59bea8d06e2c1a1bb7ccd5f2cd7e182 --- /dev/null +++ b/HumanEval_14/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/14" +name = "HumanEval — HumanEval/14" + +[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/HumanEval_14/tests/__init__.py b/HumanEval_14/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_14/tests/conftest.py b/HumanEval_14/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_14/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/HumanEval_14/tests/test_humaneval.py b/HumanEval_14/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..67a1743a106e9de9fef2d6e6554d2091608877d3 --- /dev/null +++ b/HumanEval_14/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import all_prefixes as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('') == [] + assert candidate('asdfgh') == ['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh'] + assert candidate('WWW') == ['W', 'WW', 'WWW'] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_140/instruction.md b/HumanEval_140/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7b4a161694b70d1e96b9c7548aaaa92d7660b3bc --- /dev/null +++ b/HumanEval_140/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/140 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def fix_spaces(text): + """ + Given a string text, replace all spaces in it with underscores, + and if a string has more than 2 consecutive spaces, + then replace all consecutive spaces with - + + fix_spaces("Example") == "Example" + fix_spaces("Example 1") == "Example_1" + fix_spaces(" Example 2") == "_Example_2" + fix_spaces(" Example 3") == "_Example-3" + """ +``` diff --git a/HumanEval_140/solution/__init__.py b/HumanEval_140/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..76f5894910861101ee6f34842a657c53aacf0d53 --- /dev/null +++ b/HumanEval_140/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import fix_spaces diff --git a/HumanEval_140/solution/solution.py b/HumanEval_140/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..5e8889d14662f142d00aaa04043b9a1a02778747 --- /dev/null +++ b/HumanEval_140/solution/solution.py @@ -0,0 +1,32 @@ + +def fix_spaces(text): + """ + Given a string text, replace all spaces in it with underscores, + and if a string has more than 2 consecutive spaces, + then replace all consecutive spaces with - + + fix_spaces("Example") == "Example" + fix_spaces("Example 1") == "Example_1" + fix_spaces(" Example 2") == "_Example_2" + fix_spaces(" Example 3") == "_Example-3" + """ + new_text = "" + i = 0 + start, end = 0, 0 + while i < len(text): + if text[i] == " ": + end += 1 + else: + if end - start > 2: + new_text += "-"+text[i] + elif end - start > 0: + new_text += "_"*(end - start)+text[i] + else: + new_text += text[i] + start, end = i+1, i+1 + i+=1 + if end - start > 2: + new_text += "-" + elif end - start > 0: + new_text += "_" + return new_text diff --git a/HumanEval_140/task.toml b/HumanEval_140/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f72c1e7f24d80f5932299116f662559d34586f17 --- /dev/null +++ b/HumanEval_140/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/140" +name = "HumanEval — HumanEval/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/HumanEval_140/tests/__init__.py b/HumanEval_140/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_140/tests/conftest.py b/HumanEval_140/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_140/tests/test_humaneval.py b/HumanEval_140/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9ae6de4dde48e5eec917156cdaed5a23b1eeb535 --- /dev/null +++ b/HumanEval_140/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import fix_spaces as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("Example") == "Example", "This prints if this assert fails 1 (good for debugging!)" + assert candidate("Mudasir Hanif ") == "Mudasir_Hanif_", "This prints if this assert fails 2 (good for debugging!)" + assert candidate("Yellow Yellow Dirty Fellow") == "Yellow_Yellow__Dirty__Fellow", "This prints if this assert fails 3 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate("Exa mple") == "Exa-mple", "This prints if this assert fails 4 (good for debugging!)" + assert candidate(" Exa 1 2 2 mple") == "-Exa_1_2_2_mple", "This prints if this assert fails 4 (good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_141/instruction.md b/HumanEval_141/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fe96dead0de1d4d686ba68fb1219a3e8a668ed21 --- /dev/null +++ b/HumanEval_141/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/141 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def file_name_check(file_name): + """Create a function which takes a string representing a file's name, and returns + 'Yes' if the the file's name is valid, and returns 'No' otherwise. + A file's name is considered to be valid if and only if all the following conditions + are met: + - There should not be more than three digits ('0'-'9') in the file's name. + - The file's name contains exactly one dot '.' + - The substring before the dot should not be empty, and it starts with a letter from + the latin alphapet ('a'-'z' and 'A'-'Z'). + - The substring after the dot should be one of these: ['txt', 'exe', 'dll'] + Examples: + file_name_check("example.txt") # => 'Yes' + file_name_check("1example.dll") # => 'No' (the name should start with a latin alphapet letter) + """ +``` diff --git a/HumanEval_141/solution/__init__.py b/HumanEval_141/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2298d05cf22f63a4f0b7cf8bf625f9a535d8ebf6 --- /dev/null +++ b/HumanEval_141/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import file_name_check diff --git a/HumanEval_141/solution/solution.py b/HumanEval_141/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..dc23ee58959aaf253e1df16867d84ee611fa7dbe --- /dev/null +++ b/HumanEval_141/solution/solution.py @@ -0,0 +1,29 @@ + +def file_name_check(file_name): + """Create a function which takes a string representing a file's name, and returns + 'Yes' if the the file's name is valid, and returns 'No' otherwise. + A file's name is considered to be valid if and only if all the following conditions + are met: + - There should not be more than three digits ('0'-'9') in the file's name. + - The file's name contains exactly one dot '.' + - The substring before the dot should not be empty, and it starts with a letter from + the latin alphapet ('a'-'z' and 'A'-'Z'). + - The substring after the dot should be one of these: ['txt', 'exe', 'dll'] + Examples: + file_name_check("example.txt") # => 'Yes' + file_name_check("1example.dll") # => 'No' (the name should start with a latin alphapet letter) + """ + suf = ['txt', 'exe', 'dll'] + lst = file_name.split(sep='.') + if len(lst) != 2: + return 'No' + if not lst[1] in suf: + return 'No' + if len(lst[0]) == 0: + return 'No' + if not lst[0][0].isalpha(): + return 'No' + t = len([x for x in lst[0] if x.isdigit()]) + if t > 3: + return 'No' + return 'Yes' diff --git a/HumanEval_141/task.toml b/HumanEval_141/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9f1830545d6b4f42d5fcb00384277f05f69179fd --- /dev/null +++ b/HumanEval_141/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/141" +name = "HumanEval — HumanEval/141" + +[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/HumanEval_141/tests/__init__.py b/HumanEval_141/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_141/tests/conftest.py b/HumanEval_141/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_141/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/HumanEval_141/tests/test_humaneval.py b/HumanEval_141/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..1dd418f3549b7a084c66e20f48739686d2bf4127 --- /dev/null +++ b/HumanEval_141/tests/test_humaneval.py @@ -0,0 +1,40 @@ +from solution import file_name_check as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("example.txt") == 'Yes' + assert candidate("1example.dll") == 'No' + assert candidate('s1sdf3.asd') == 'No' + assert candidate('K.dll') == 'Yes' + assert candidate('MY16FILE3.exe') == 'Yes' + assert candidate('His12FILE94.exe') == 'No' + assert candidate('_Y.txt') == 'No' + assert candidate('?aREYA.exe') == 'No' + assert candidate('/this_is_valid.dll') == 'No' + assert candidate('this_is_valid.wow') == 'No' + assert candidate('this_is_valid.txt') == 'Yes' + assert candidate('this_is_valid.txtexe') == 'No' + assert candidate('#this2_i4s_5valid.ten') == 'No' + assert candidate('@this1_is6_valid.exe') == 'No' + assert candidate('this_is_12valid.6exe4.txt') == 'No' + assert candidate('all.exe.txt') == 'No' + assert candidate('I563_No.exe') == 'Yes' + assert candidate('Is3youfault.txt') == 'Yes' + assert candidate('no_one#knows.dll') == 'Yes' + assert candidate('1I563_Yes3.exe') == 'No' + assert candidate('I563_Yes3.txtt') == 'No' + assert candidate('final..txt') == 'No' + assert candidate('final132') == 'No' + assert candidate('_f4indsartal132.') == 'No' + + + + # Check some edge cases that are easy to work out by hand. + assert candidate('.txt') == 'No' + assert candidate('s.') == 'No' + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_142/instruction.md b/HumanEval_142/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5a2a81928fcb3ab074edb8e84856bbabd7a0d02e --- /dev/null +++ b/HumanEval_142/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/142 + +Complete the following Python function so that it satisfies its docstring. + +```python + + + +def sum_squares(lst): + """" + This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a + multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not + change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries. + + Examples: + For lst = [1,2,3] the output should be 6 + For lst = [] the output should be 0 + For lst = [-1,-5,2,-1,-5] the output should be -126 + """ +``` diff --git a/HumanEval_142/solution/__init__.py b/HumanEval_142/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..531008a2d402adcd2f44798bedb47c70f62bde92 --- /dev/null +++ b/HumanEval_142/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sum_squares diff --git a/HumanEval_142/solution/solution.py b/HumanEval_142/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ee2703627db4d8c1eb2e8fceb956a584552bbd1e --- /dev/null +++ b/HumanEval_142/solution/solution.py @@ -0,0 +1,23 @@ + + + +def sum_squares(lst): + """" + This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a + multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not + change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries. + + Examples: + For lst = [1,2,3] the output should be 6 + For lst = [] the output should be 0 + For lst = [-1,-5,2,-1,-5] the output should be -126 + """ + result =[] + for i in range(len(lst)): + if i %3 == 0: + result.append(lst[i]**2) + elif i % 4 == 0 and i%3 != 0: + result.append(lst[i]**3) + else: + result.append(lst[i]) + return sum(result) diff --git a/HumanEval_142/task.toml b/HumanEval_142/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fdc0221c28ebf016a913441e2798e9e1e7774b71 --- /dev/null +++ b/HumanEval_142/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/142" +name = "HumanEval — HumanEval/142" + +[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/HumanEval_142/tests/__init__.py b/HumanEval_142/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_142/tests/conftest.py b/HumanEval_142/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_142/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/HumanEval_142/tests/test_humaneval.py b/HumanEval_142/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..0a13209d92af09083d074b2eb39e2f656e7671e9 --- /dev/null +++ b/HumanEval_142/tests/test_humaneval.py @@ -0,0 +1,24 @@ +from solution import sum_squares as candidate + +def check(candidate): + + # Check some simple cases + + assert candidate([1,2,3]) == 6 + assert candidate([1,4,9]) == 14 + assert candidate([]) == 0 + assert candidate([1,1,1,1,1,1,1,1,1]) == 9 + assert candidate([-1,-1,-1,-1,-1,-1,-1,-1,-1]) == -3 + assert candidate([0]) == 0 + assert candidate([-1,-5,2,-1,-5]) == -126 + assert candidate([-56,-99,1,0,-2]) == 3030 + assert candidate([-1,0,0,0,0,0,0,0,-1]) == 0 + assert candidate([-16, -9, -2, 36, 36, 26, -20, 25, -40, 20, -4, 12, -26, 35, 37]) == -14196 + assert candidate([-1, -3, 17, -1, -15, 13, -1, 14, -14, -12, -5, 14, -14, 6, 13, 11, 16, 16, 4, 10]) == -1448 + + + # Don't remove this line: + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_143/instruction.md b/HumanEval_143/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6a73df7d0435600eb4871cfe47e4bf504b1700e8 --- /dev/null +++ b/HumanEval_143/instruction.md @@ -0,0 +1,27 @@ +# HumanEval — HumanEval/143 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def words_in_sentence(sentence): + """ + You are given a string representing a sentence, + the sentence contains some words separated by a space, + and you have to return a string that contains the words from the original sentence, + whose lengths are prime numbers, + the order of the words in the new string should be the same as the original one. + + Example 1: + Input: sentence = "This is a test" + Output: "is" + + Example 2: + Input: sentence = "lets go for swimming" + Output: "go for" + + Constraints: + * 1 <= len(sentence) <= 100 + * sentence contains only letters + """ +``` diff --git a/HumanEval_143/solution/__init__.py b/HumanEval_143/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4f3152df3109400cdfb9fa24be67a068028e76f3 --- /dev/null +++ b/HumanEval_143/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import words_in_sentence diff --git a/HumanEval_143/solution/solution.py b/HumanEval_143/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..30b2a6793ca8c1cf93fb4253de45555fb023fa65 --- /dev/null +++ b/HumanEval_143/solution/solution.py @@ -0,0 +1,32 @@ + +def words_in_sentence(sentence): + """ + You are given a string representing a sentence, + the sentence contains some words separated by a space, + and you have to return a string that contains the words from the original sentence, + whose lengths are prime numbers, + the order of the words in the new string should be the same as the original one. + + Example 1: + Input: sentence = "This is a test" + Output: "is" + + Example 2: + Input: sentence = "lets go for swimming" + Output: "go for" + + Constraints: + * 1 <= len(sentence) <= 100 + * sentence contains only letters + """ + new_lst = [] + for word in sentence.split(): + flg = 0 + if len(word) == 1: + flg = 1 + for i in range(2, len(word)): + if len(word)%i == 0: + flg = 1 + if flg == 0 or len(word) == 2: + new_lst.append(word) + return " ".join(new_lst) diff --git a/HumanEval_143/task.toml b/HumanEval_143/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..504d8de03a55b02abd3fe271aa46989ae36a7ac8 --- /dev/null +++ b/HumanEval_143/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/143" +name = "HumanEval — HumanEval/143" + +[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/HumanEval_143/tests/__init__.py b/HumanEval_143/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_143/tests/conftest.py b/HumanEval_143/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_143/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/HumanEval_143/tests/test_humaneval.py b/HumanEval_143/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..472938567e9242b469206a14d9a3e6cb48fcc045 --- /dev/null +++ b/HumanEval_143/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import words_in_sentence as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("This is a test") == "is" + assert candidate("lets go for swimming") == "go for" + assert candidate("there is no place available here") == "there is no place" + assert candidate("Hi I am Hussein") == "Hi am Hussein" + assert candidate("go for it") == "go for it" + + # Check some edge cases that are easy to work out by hand. + assert candidate("here") == "" + assert candidate("here is") == "is" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_144/instruction.md b/HumanEval_144/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..55df709131f3fbde6d226df494c31fea4b829f3d --- /dev/null +++ b/HumanEval_144/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/144 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def simplify(x, n): + """Your task is to implement a function that will simplify the expression + x * n. The function returns True if x * n evaluates to a whole number and False + otherwise. Both x and n, are string representation of a fraction, and have the following format, + / where both numerator and denominator are positive whole numbers. + + You can assume that x, and n are valid fractions, and do not have zero as denominator. + + simplify("1/5", "5/1") = True + simplify("1/6", "2/1") = False + simplify("7/10", "10/2") = False + """ +``` diff --git a/HumanEval_144/solution/__init__.py b/HumanEval_144/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..acd8978831dccb5142e0ada50082fabde7a1628f --- /dev/null +++ b/HumanEval_144/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import simplify diff --git a/HumanEval_144/solution/solution.py b/HumanEval_144/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..4c7387fe5164b5f7ee7b9cf581f92721ac97b518 --- /dev/null +++ b/HumanEval_144/solution/solution.py @@ -0,0 +1,20 @@ + +def simplify(x, n): + """Your task is to implement a function that will simplify the expression + x * n. The function returns True if x * n evaluates to a whole number and False + otherwise. Both x and n, are string representation of a fraction, and have the following format, + / where both numerator and denominator are positive whole numbers. + + You can assume that x, and n are valid fractions, and do not have zero as denominator. + + simplify("1/5", "5/1") = True + simplify("1/6", "2/1") = False + simplify("7/10", "10/2") = False + """ + a, b = x.split("/") + c, d = n.split("/") + numerator = int(a) * int(c) + denom = int(b) * int(d) + if (numerator/denom == int(numerator/denom)): + return True + return False diff --git a/HumanEval_144/task.toml b/HumanEval_144/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..910cc4c784ff78b7bb4f307a967542f7d847012d --- /dev/null +++ b/HumanEval_144/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/144" +name = "HumanEval — HumanEval/144" + +[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/HumanEval_144/tests/__init__.py b/HumanEval_144/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_144/tests/conftest.py b/HumanEval_144/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_144/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/HumanEval_144/tests/test_humaneval.py b/HumanEval_144/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3ea9f9483609e1ef6555a398fa6f32d9f9a1c40e --- /dev/null +++ b/HumanEval_144/tests/test_humaneval.py @@ -0,0 +1,26 @@ +from solution import simplify as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("1/5", "5/1") == True, 'test1' + assert candidate("1/6", "2/1") == False, 'test2' + assert candidate("5/1", "3/1") == True, 'test3' + assert candidate("7/10", "10/2") == False, 'test4' + assert candidate("2/10", "50/10") == True, 'test5' + assert candidate("7/2", "4/2") == True, 'test6' + assert candidate("11/6", "6/1") == True, 'test7' + assert candidate("2/3", "5/2") == False, 'test8' + assert candidate("5/2", "3/5") == False, 'test9' + assert candidate("2/4", "8/4") == True, 'test10' + + + # Check some edge cases that are easy to work out by hand. + assert candidate("2/4", "4/2") == True, 'test11' + assert candidate("1/5", "5/1") == True, 'test12' + assert candidate("1/5", "1/5") == False, 'test13' + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_145/instruction.md b/HumanEval_145/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0413f374d3b0a98f6cb5003c55efee991252df1f --- /dev/null +++ b/HumanEval_145/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/145 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def order_by_points(nums): + """ + Write a function which sorts the given list of integers + in ascending order according to the sum of their digits. + Note: if there are several items with similar sum of their digits, + order them based on their index in original list. + + For example: + >>> order_by_points([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] + >>> order_by_points([]) == [] + """ +``` diff --git a/HumanEval_145/solution/__init__.py b/HumanEval_145/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..92a37e194972aca7d3f0fef9b2964d66086caa83 --- /dev/null +++ b/HumanEval_145/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import order_by_points diff --git a/HumanEval_145/solution/solution.py b/HumanEval_145/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..67c622bbe3e64c89e838297f78467d7156fd4d83 --- /dev/null +++ b/HumanEval_145/solution/solution.py @@ -0,0 +1,19 @@ + +def order_by_points(nums): + """ + Write a function which sorts the given list of integers + in ascending order according to the sum of their digits. + Note: if there are several items with similar sum of their digits, + order them based on their index in original list. + + For example: + >>> order_by_points([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] + >>> order_by_points([]) == [] + """ + def digits_sum(n): + neg = 1 + if n < 0: n, neg = -1 * n, -1 + n = [int(i) for i in str(n)] + n[0] = n[0] * neg + return sum(n) + return sorted(nums, key=digits_sum) diff --git a/HumanEval_145/task.toml b/HumanEval_145/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6fd02810cda7c4e42c22138e0a1474b19aaf1c89 --- /dev/null +++ b/HumanEval_145/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/145" +name = "HumanEval — HumanEval/145" + +[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/HumanEval_145/tests/__init__.py b/HumanEval_145/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_145/tests/conftest.py b/HumanEval_145/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_145/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/HumanEval_145/tests/test_humaneval.py b/HumanEval_145/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..dd0f19791f19434c3e696a690ad0adabe14d406e --- /dev/null +++ b/HumanEval_145/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import order_by_points as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1, 11, -1, -11, -12]) == [-1, -11, 1, -12, 11] + assert candidate([1234,423,463,145,2,423,423,53,6,37,3457,3,56,0,46]) == [0, 2, 3, 6, 53, 423, 423, 423, 1234, 145, 37, 46, 56, 463, 3457] + assert candidate([]) == [] + assert candidate([1, -11, -32, 43, 54, -98, 2, -3]) == [-3, -32, -98, -11, 1, 2, 43, 54] + assert candidate([1,2,3,4,5,6,7,8,9,10,11]) == [1, 10, 2, 11, 3, 4, 5, 6, 7, 8, 9] + assert candidate([0,6,6,-76,-21,23,4]) == [-76, -21, 0, 4, 23, 6, 6] + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_146/instruction.md b/HumanEval_146/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..40d19b17b6b239573420dd9ea4851a3ce1fff99a --- /dev/null +++ b/HumanEval_146/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/146 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def specialFilter(nums): + """Write a function that takes an array of numbers as input and returns + the number of elements in the array that are greater than 10 and both + first and last digits of a number are odd (1, 3, 5, 7, 9). + For example: + specialFilter([15, -73, 14, -15]) => 1 + specialFilter([33, -2, -3, 45, 21, 109]) => 2 + """ +``` diff --git a/HumanEval_146/solution/__init__.py b/HumanEval_146/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8486ee854fac5c834c7ccb8156990abc1245582e --- /dev/null +++ b/HumanEval_146/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import specialFilter diff --git a/HumanEval_146/solution/solution.py b/HumanEval_146/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..5862173cc49af071793d5c00ddadbf607783988c --- /dev/null +++ b/HumanEval_146/solution/solution.py @@ -0,0 +1,19 @@ + +def specialFilter(nums): + """Write a function that takes an array of numbers as input and returns + the number of elements in the array that are greater than 10 and both + first and last digits of a number are odd (1, 3, 5, 7, 9). + For example: + specialFilter([15, -73, 14, -15]) => 1 + specialFilter([33, -2, -3, 45, 21, 109]) => 2 + """ + + count = 0 + for num in nums: + if num > 10: + odd_digits = (1, 3, 5, 7, 9) + number_as_string = str(num) + if int(number_as_string[0]) in odd_digits and int(number_as_string[-1]) in odd_digits: + count += 1 + + return count diff --git a/HumanEval_146/task.toml b/HumanEval_146/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ac5c983c6826463e4f08f0a9d52ed8ad4959ebc0 --- /dev/null +++ b/HumanEval_146/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/146" +name = "HumanEval — HumanEval/146" + +[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/HumanEval_146/tests/__init__.py b/HumanEval_146/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_146/tests/conftest.py b/HumanEval_146/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_146/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/HumanEval_146/tests/test_humaneval.py b/HumanEval_146/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..1a0189e45dca30ff9e29d4008b3dbed0eeae0e1a --- /dev/null +++ b/HumanEval_146/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import specialFilter as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([5, -2, 1, -5]) == 0 + assert candidate([15, -73, 14, -15]) == 1 + assert candidate([33, -2, -3, 45, 21, 109]) == 2 + assert candidate([43, -12, 93, 125, 121, 109]) == 4 + assert candidate([71, -2, -33, 75, 21, 19]) == 3 + + + # Check some edge cases that are easy to work out by hand. + assert candidate([1]) == 0 + assert candidate([]) == 0 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_147/instruction.md b/HumanEval_147/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ffe453e750e024e28e896cc50e511862ca81fb7d --- /dev/null +++ b/HumanEval_147/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/147 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def get_max_triples(n): + """ + You are given a positive integer n. You have to create an integer array a of length n. + For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1. + Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, + and a[i] + a[j] + a[k] is a multiple of 3. + + Example : + Input: n = 5 + Output: 1 + Explanation: + a = [1, 3, 7, 13, 21] + The only valid triple is (1, 7, 13). + """ +``` diff --git a/HumanEval_147/solution/__init__.py b/HumanEval_147/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f353547012b882835958dac11a93212fd68ae5e2 --- /dev/null +++ b/HumanEval_147/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import get_max_triples diff --git a/HumanEval_147/solution/solution.py b/HumanEval_147/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..878b376a38318a1289bb3fe4d31ba42867327e22 --- /dev/null +++ b/HumanEval_147/solution/solution.py @@ -0,0 +1,23 @@ + +def get_max_triples(n): + """ + You are given a positive integer n. You have to create an integer array a of length n. + For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1. + Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, + and a[i] + a[j] + a[k] is a multiple of 3. + + Example : + Input: n = 5 + Output: 1 + Explanation: + a = [1, 3, 7, 13, 21] + The only valid triple is (1, 7, 13). + """ + A = [i*i - i + 1 for i in range(1,n+1)] + ans = [] + for i in range(n): + for j in range(i+1,n): + for k in range(j+1,n): + if (A[i]+A[j]+A[k])%3 == 0: + ans += [(A[i],A[j],A[k])] + return len(ans) diff --git a/HumanEval_147/task.toml b/HumanEval_147/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ba82d049a6d20e3e1045e66165bc2e8898c69f10 --- /dev/null +++ b/HumanEval_147/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/147" +name = "HumanEval — HumanEval/147" + +[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/HumanEval_147/tests/__init__.py b/HumanEval_147/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_147/tests/conftest.py b/HumanEval_147/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_147/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/HumanEval_147/tests/test_humaneval.py b/HumanEval_147/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..d4a213b4a53f5e030c7e288c9542d9b07dced6da --- /dev/null +++ b/HumanEval_147/tests/test_humaneval.py @@ -0,0 +1,12 @@ +from solution import get_max_triples as candidate + +def check(candidate): + + assert candidate(5) == 1 + assert candidate(6) == 4 + assert candidate(10) == 36 + assert candidate(100) == 53361 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_148/instruction.md b/HumanEval_148/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..24a31031b299ca910a84e14a73c8876593602d27 --- /dev/null +++ b/HumanEval_148/instruction.md @@ -0,0 +1,23 @@ +# HumanEval — HumanEval/148 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def bf(planet1, planet2): + ''' + There are eight planets in our solar system: the closerst to the Sun + is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, + Uranus, Neptune. + Write a function that takes two planet names as strings planet1 and planet2. + The function should return a tuple containing all planets whose orbits are + located between the orbit of planet1 and the orbit of planet2, sorted by + the proximity to the sun. + The function should return an empty tuple if planet1 or planet2 + are not correct planet names. + Examples + bf("Jupiter", "Neptune") ==> ("Saturn", "Uranus") + bf("Earth", "Mercury") ==> ("Venus") + bf("Mercury", "Uranus") ==> ("Venus", "Earth", "Mars", "Jupiter", "Saturn") + ''' +``` diff --git a/HumanEval_148/solution/__init__.py b/HumanEval_148/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fe90ac793c038ab7b3115befdd9473914401218a --- /dev/null +++ b/HumanEval_148/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import bf diff --git a/HumanEval_148/solution/solution.py b/HumanEval_148/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..8e68109436411786380cf42780eb718e3dec704b --- /dev/null +++ b/HumanEval_148/solution/solution.py @@ -0,0 +1,26 @@ + +def bf(planet1, planet2): + ''' + There are eight planets in our solar system: the closerst to the Sun + is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn, + Uranus, Neptune. + Write a function that takes two planet names as strings planet1 and planet2. + The function should return a tuple containing all planets whose orbits are + located between the orbit of planet1 and the orbit of planet2, sorted by + the proximity to the sun. + The function should return an empty tuple if planet1 or planet2 + are not correct planet names. + Examples + bf("Jupiter", "Neptune") ==> ("Saturn", "Uranus") + bf("Earth", "Mercury") ==> ("Venus") + bf("Mercury", "Uranus") ==> ("Venus", "Earth", "Mars", "Jupiter", "Saturn") + ''' + planet_names = ("Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune") + if planet1 not in planet_names or planet2 not in planet_names or planet1 == planet2: + return () + planet1_index = planet_names.index(planet1) + planet2_index = planet_names.index(planet2) + if planet1_index < planet2_index: + return (planet_names[planet1_index + 1: planet2_index]) + else: + return (planet_names[planet2_index + 1 : planet1_index]) diff --git a/HumanEval_148/task.toml b/HumanEval_148/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9200cffacca9ddedb7be706aa990e30d9b7adf79 --- /dev/null +++ b/HumanEval_148/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/148" +name = "HumanEval — HumanEval/148" + +[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/HumanEval_148/tests/__init__.py b/HumanEval_148/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_148/tests/conftest.py b/HumanEval_148/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_148/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/HumanEval_148/tests/test_humaneval.py b/HumanEval_148/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..171bfcdbbd73166c263580ef1598585f9357cd97 --- /dev/null +++ b/HumanEval_148/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import bf as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("Jupiter", "Neptune") == ("Saturn", "Uranus"), "First test error: " + str(len(candidate("Jupiter", "Neptune"))) + assert candidate("Earth", "Mercury") == ("Venus",), "Second test error: " + str(candidate("Earth", "Mercury")) + assert candidate("Mercury", "Uranus") == ("Venus", "Earth", "Mars", "Jupiter", "Saturn"), "Third test error: " + str(candidate("Mercury", "Uranus")) + assert candidate("Neptune", "Venus") == ("Earth", "Mars", "Jupiter", "Saturn", "Uranus"), "Fourth test error: " + str(candidate("Neptune", "Venus")) + + + # Check some edge cases that are easy to work out by hand. + assert candidate("Earth", "Earth") == () + assert candidate("Mars", "Earth") == () + assert candidate("Jupiter", "Makemake") == () + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_149/instruction.md b/HumanEval_149/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..39eabbf9331975e1a13e7955b1339cff8c0db446 --- /dev/null +++ b/HumanEval_149/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/149 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def sorted_list_sum(lst): + """Write a function that accepts a list of strings as a parameter, + deletes the strings that have odd lengths from it, + and returns the resulted list with a sorted order, + The list is always a list of strings and never an array of numbers, + and it may contain duplicates. + The order of the list should be ascending by length of each word, and you + should return the list sorted by that rule. + If two words have the same length, sort the list alphabetically. + The function should return a list of strings in sorted order. + You may assume that all words will have the same length. + For example: + assert list_sort(["aa", "a", "aaa"]) => ["aa"] + assert list_sort(["ab", "a", "aaa", "cd"]) => ["ab", "cd"] + """ +``` diff --git a/HumanEval_149/solution/__init__.py b/HumanEval_149/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8f6c8192240ff768fc5671f3496eba825b5baafe --- /dev/null +++ b/HumanEval_149/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sorted_list_sum diff --git a/HumanEval_149/solution/solution.py b/HumanEval_149/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..08a69f9e78775008aff76b81a836d646e27815e9 --- /dev/null +++ b/HumanEval_149/solution/solution.py @@ -0,0 +1,22 @@ + +def sorted_list_sum(lst): + """Write a function that accepts a list of strings as a parameter, + deletes the strings that have odd lengths from it, + and returns the resulted list with a sorted order, + The list is always a list of strings and never an array of numbers, + and it may contain duplicates. + The order of the list should be ascending by length of each word, and you + should return the list sorted by that rule. + If two words have the same length, sort the list alphabetically. + The function should return a list of strings in sorted order. + You may assume that all words will have the same length. + For example: + assert list_sort(["aa", "a", "aaa"]) => ["aa"] + assert list_sort(["ab", "a", "aaa", "cd"]) => ["ab", "cd"] + """ + lst.sort() + new_lst = [] + for i in lst: + if len(i)%2 == 0: + new_lst.append(i) + return sorted(new_lst, key=len) diff --git a/HumanEval_149/task.toml b/HumanEval_149/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..43669b2945da956b0a9e9eb13a7c6b0b8acf42e5 --- /dev/null +++ b/HumanEval_149/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/149" +name = "HumanEval — HumanEval/149" + +[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/HumanEval_149/tests/__init__.py b/HumanEval_149/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_149/tests/conftest.py b/HumanEval_149/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_149/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/HumanEval_149/tests/test_humaneval.py b/HumanEval_149/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..210c395b01588ab1553af2ffb1c6918a40faa9bd --- /dev/null +++ b/HumanEval_149/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import sorted_list_sum as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(["aa", "a", "aaa"]) == ["aa"] + assert candidate(["school", "AI", "asdf", "b"]) == ["AI", "asdf", "school"] + assert candidate(["d", "b", "c", "a"]) == [] + assert candidate(["d", "dcba", "abcd", "a"]) == ["abcd", "dcba"] + + # Check some edge cases that are easy to work out by hand. + assert candidate(["AI", "ai", "au"]) == ["AI", "ai", "au"] + assert candidate(["a", "b", "b", "c", "c", "a"]) == [] + assert candidate(['aaaa', 'bbbb', 'dd', 'cc']) == ["cc", "dd", "aaaa", "bbbb"] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_15/instruction.md b/HumanEval_15/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..231d74d605bd254dfda9e527904a1ac151628909 --- /dev/null +++ b/HumanEval_15/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/15 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def string_sequence(n: int) -> str: + """ Return a string containing space-delimited numbers starting from 0 upto n inclusive. + >>> string_sequence(0) + '0' + >>> string_sequence(5) + '0 1 2 3 4 5' + """ +``` diff --git a/HumanEval_15/solution/__init__.py b/HumanEval_15/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..aeb27fc646517c27470125b390f321a3246ac46d --- /dev/null +++ b/HumanEval_15/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import string_sequence diff --git a/HumanEval_15/solution/solution.py b/HumanEval_15/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..cbc14442517594a1595e7ab53dc515e045a1380e --- /dev/null +++ b/HumanEval_15/solution/solution.py @@ -0,0 +1,10 @@ + + +def string_sequence(n: int) -> str: + """ Return a string containing space-delimited numbers starting from 0 upto n inclusive. + >>> string_sequence(0) + '0' + >>> string_sequence(5) + '0 1 2 3 4 5' + """ + return ' '.join([str(x) for x in range(n + 1)]) diff --git a/HumanEval_15/task.toml b/HumanEval_15/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a03a94384da7df9ef80b89a06681c7ed9e550aec --- /dev/null +++ b/HumanEval_15/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/15" +name = "HumanEval — HumanEval/15" + +[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/HumanEval_15/tests/__init__.py b/HumanEval_15/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_15/tests/conftest.py b/HumanEval_15/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_15/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/HumanEval_15/tests/test_humaneval.py b/HumanEval_15/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..4c6fb52d180ca0e05418789ded21499e8259537d --- /dev/null +++ b/HumanEval_15/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import string_sequence as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate(0) == '0' + assert candidate(3) == '0 1 2 3' + assert candidate(10) == '0 1 2 3 4 5 6 7 8 9 10' + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_150/instruction.md b/HumanEval_150/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..af6735541edae43cb2b291e2a0bf906ac3aa9d24 --- /dev/null +++ b/HumanEval_150/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/150 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def x_or_y(n, x, y): + """A simple program which should return the value of x if n is + a prime number and should return the value of y otherwise. + + Examples: + for x_or_y(7, 34, 12) == 34 + for x_or_y(15, 8, 5) == 5 + + """ +``` diff --git a/HumanEval_150/solution/__init__.py b/HumanEval_150/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0a90f835ef3c55b9564f744ad4d03b063a4bf66a --- /dev/null +++ b/HumanEval_150/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import x_or_y diff --git a/HumanEval_150/solution/solution.py b/HumanEval_150/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..6a0eef954b783e84b44b3f66f90eb5a82ec06357 --- /dev/null +++ b/HumanEval_150/solution/solution.py @@ -0,0 +1,18 @@ + +def x_or_y(n, x, y): + """A simple program which should return the value of x if n is + a prime number and should return the value of y otherwise. + + Examples: + for x_or_y(7, 34, 12) == 34 + for x_or_y(15, 8, 5) == 5 + + """ + if n == 1: + return y + for i in range(2, n): + if n % i == 0: + return y + break + else: + return x diff --git a/HumanEval_150/task.toml b/HumanEval_150/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..17f55d02fef1f959bc1905f05d5689f404a931a6 --- /dev/null +++ b/HumanEval_150/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/150" +name = "HumanEval — HumanEval/150" + +[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/HumanEval_150/tests/__init__.py b/HumanEval_150/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_150/tests/conftest.py b/HumanEval_150/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_150/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/HumanEval_150/tests/test_humaneval.py b/HumanEval_150/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2581003b2199fe9ec0419be9dac335b08c1c806a --- /dev/null +++ b/HumanEval_150/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import x_or_y as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(7, 34, 12) == 34 + assert candidate(15, 8, 5) == 5 + assert candidate(3, 33, 5212) == 33 + assert candidate(1259, 3, 52) == 3 + assert candidate(7919, -1, 12) == -1 + assert candidate(3609, 1245, 583) == 583 + assert candidate(91, 56, 129) == 129 + assert candidate(6, 34, 1234) == 1234 + + + # Check some edge cases that are easy to work out by hand. + assert candidate(1, 2, 0) == 0 + assert candidate(2, 2, 0) == 2 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_151/instruction.md b/HumanEval_151/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..eeb67cb414576673d58c0733fd2377c443b602c5 --- /dev/null +++ b/HumanEval_151/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/151 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def double_the_difference(lst): + ''' + Given a list of numbers, return the sum of squares of the numbers + in the list that are odd. Ignore numbers that are negative or not integers. + + double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10 + double_the_difference([-1, -2, 0]) == 0 + double_the_difference([9, -2]) == 81 + double_the_difference([0]) == 0 + + If the input list is empty, return 0. + ''' +``` diff --git a/HumanEval_151/solution/__init__.py b/HumanEval_151/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3b79c27ca62dee5b24b501aee6570b0e3bb03b42 --- /dev/null +++ b/HumanEval_151/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import double_the_difference diff --git a/HumanEval_151/solution/solution.py b/HumanEval_151/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..434685526fd04ca7bcf987bbb904f6313ce7b349 --- /dev/null +++ b/HumanEval_151/solution/solution.py @@ -0,0 +1,14 @@ + +def double_the_difference(lst): + ''' + Given a list of numbers, return the sum of squares of the numbers + in the list that are odd. Ignore numbers that are negative or not integers. + + double_the_difference([1, 3, 2, 0]) == 1 + 9 + 0 + 0 = 10 + double_the_difference([-1, -2, 0]) == 0 + double_the_difference([9, -2]) == 81 + double_the_difference([0]) == 0 + + If the input list is empty, return 0. + ''' + return sum([i**2 for i in lst if i > 0 and i%2!=0 and "." not in str(i)]) diff --git a/HumanEval_151/task.toml b/HumanEval_151/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..81bc334e7e66a1c58cce84755f27197776861eaf --- /dev/null +++ b/HumanEval_151/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/151" +name = "HumanEval — HumanEval/151" + +[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/HumanEval_151/tests/__init__.py b/HumanEval_151/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_151/tests/conftest.py b/HumanEval_151/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_151/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/HumanEval_151/tests/test_humaneval.py b/HumanEval_151/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9f1b384ea6403bf9b4cfd808ae2a22b1622bbbb4 --- /dev/null +++ b/HumanEval_151/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import double_the_difference as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([]) == 0 , "This prints if this assert fails 1 (good for debugging!)" + assert candidate([5, 4]) == 25 , "This prints if this assert fails 2 (good for debugging!)" + assert candidate([0.1, 0.2, 0.3]) == 0 , "This prints if this assert fails 3 (good for debugging!)" + assert candidate([-10, -20, -30]) == 0 , "This prints if this assert fails 4 (good for debugging!)" + + + # Check some edge cases that are easy to work out by hand. + assert candidate([-1, -2, 8]) == 0, "This prints if this assert fails 5 (also good for debugging!)" + assert candidate([0.2, 3, 5]) == 34, "This prints if this assert fails 6 (also good for debugging!)" + lst = list(range(-99, 100, 2)) + odd_sum = sum([i**2 for i in lst if i%2!=0 and i > 0]) + assert candidate(lst) == odd_sum , "This prints if this assert fails 7 (good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_152/instruction.md b/HumanEval_152/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0143ce8d4651c27a7a430feddf6526f873a1dc1b --- /dev/null +++ b/HumanEval_152/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/152 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def compare(game,guess): + """I think we all remember that feeling when the result of some long-awaited + event is finally known. The feelings and thoughts you have at that moment are + definitely worth noting down and comparing. + Your task is to determine if a person correctly guessed the results of a number of matches. + You are given two arrays of scores and guesses of equal length, where each index shows a match. + Return an array of the same length denoting how far off each guess was. If they have guessed correctly, + the value is 0, and if not, the value is the absolute difference between the guess and the score. + + + example: + + compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3] + compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6] + """ +``` diff --git a/HumanEval_152/solution/__init__.py b/HumanEval_152/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..075ddb4e48e87e19fd2ab3cf7a99ec53122cbddb --- /dev/null +++ b/HumanEval_152/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import compare diff --git a/HumanEval_152/solution/solution.py b/HumanEval_152/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1df623aa353c52bf68e95b6c94840b8b895335d6 --- /dev/null +++ b/HumanEval_152/solution/solution.py @@ -0,0 +1,17 @@ + +def compare(game,guess): + """I think we all remember that feeling when the result of some long-awaited + event is finally known. The feelings and thoughts you have at that moment are + definitely worth noting down and comparing. + Your task is to determine if a person correctly guessed the results of a number of matches. + You are given two arrays of scores and guesses of equal length, where each index shows a match. + Return an array of the same length denoting how far off each guess was. If they have guessed correctly, + the value is 0, and if not, the value is the absolute difference between the guess and the score. + + + example: + + compare([1,2,3,4,5,1],[1,2,3,4,2,-2]) -> [0,0,0,0,3,3] + compare([0,5,0,0,0,4],[4,1,1,0,0,-2]) -> [4,4,1,0,0,6] + """ + return [abs(x-y) for x,y in zip(game,guess)] diff --git a/HumanEval_152/task.toml b/HumanEval_152/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..55476fba6b1b9ec21ee2495ed33b03e06b7f0480 --- /dev/null +++ b/HumanEval_152/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/152" +name = "HumanEval — HumanEval/152" + +[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/HumanEval_152/tests/__init__.py b/HumanEval_152/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_152/tests/conftest.py b/HumanEval_152/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_152/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/HumanEval_152/tests/test_humaneval.py b/HumanEval_152/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..c6eb60f7df417923e989f10cc147d02da8c97d6e --- /dev/null +++ b/HumanEval_152/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import compare as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1,2,3,4,5,1],[1,2,3,4,2,-2])==[0,0,0,0,3,3], "This prints if this assert fails 1 (good for debugging!)" + assert candidate([0,0,0,0,0,0],[0,0,0,0,0,0])==[0,0,0,0,0,0], "This prints if this assert fails 1 (good for debugging!)" + assert candidate([1,2,3],[-1,-2,-3])==[2,4,6], "This prints if this assert fails 1 (good for debugging!)" + assert candidate([1,2,3,5],[-1,2,3,4])==[2,0,0,1], "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_153/instruction.md b/HumanEval_153/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..53be0e01b2ae7e1cfa4952d1d26a071e54e74207 --- /dev/null +++ b/HumanEval_153/instruction.md @@ -0,0 +1,24 @@ +# HumanEval — HumanEval/153 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def Strongest_Extension(class_name, extensions): + """You will be given the name of a class (a string) and a list of extensions. + The extensions are to be used to load additional classes to the class. The + strength of the extension is as follows: Let CAP be the number of the uppercase + letters in the extension's name, and let SM be the number of lowercase letters + in the extension's name, the strength is given by the fraction CAP - SM. + You should find the strongest extension and return a string in this + format: ClassName.StrongestExtensionName. + If there are two or more extensions with the same strength, you should + choose the one that comes first in the list. + For example, if you are given "Slices" as the class and a list of the + extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should + return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension + (its strength is -1). + Example: + for Strongest_Extension('my_class', ['AA', 'Be', 'CC']) == 'my_class.AA' + """ +``` diff --git a/HumanEval_153/solution/__init__.py b/HumanEval_153/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..78975ea9698a3beaabf27f0d61b802443906e1a4 --- /dev/null +++ b/HumanEval_153/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import Strongest_Extension diff --git a/HumanEval_153/solution/solution.py b/HumanEval_153/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..f8284e54694cdb615f878a149f60c23709f6dea7 --- /dev/null +++ b/HumanEval_153/solution/solution.py @@ -0,0 +1,29 @@ + +def Strongest_Extension(class_name, extensions): + """You will be given the name of a class (a string) and a list of extensions. + The extensions are to be used to load additional classes to the class. The + strength of the extension is as follows: Let CAP be the number of the uppercase + letters in the extension's name, and let SM be the number of lowercase letters + in the extension's name, the strength is given by the fraction CAP - SM. + You should find the strongest extension and return a string in this + format: ClassName.StrongestExtensionName. + If there are two or more extensions with the same strength, you should + choose the one that comes first in the list. + For example, if you are given "Slices" as the class and a list of the + extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should + return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension + (its strength is -1). + Example: + for Strongest_Extension('my_class', ['AA', 'Be', 'CC']) == 'my_class.AA' + """ + strong = extensions[0] + my_val = len([x for x in extensions[0] if x.isalpha() and x.isupper()]) - len([x for x in extensions[0] if x.isalpha() and x.islower()]) + for s in extensions: + val = len([x for x in s if x.isalpha() and x.isupper()]) - len([x for x in s if x.isalpha() and x.islower()]) + if val > my_val: + strong = s + my_val = val + + ans = class_name + "." + strong + return ans + diff --git a/HumanEval_153/task.toml b/HumanEval_153/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5e33914aa487e52ecc1b3b3234874bb26b7e669f --- /dev/null +++ b/HumanEval_153/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/153" +name = "HumanEval — HumanEval/153" + +[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/HumanEval_153/tests/__init__.py b/HumanEval_153/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_153/tests/conftest.py b/HumanEval_153/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_153/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/HumanEval_153/tests/test_humaneval.py b/HumanEval_153/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..ec1c71a6e26fa655de773a81163f1a9965ebb77b --- /dev/null +++ b/HumanEval_153/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import Strongest_Extension as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('Watashi', ['tEN', 'niNE', 'eIGHt8OKe']) == 'Watashi.eIGHt8OKe' + assert candidate('Boku123', ['nani', 'NazeDa', 'YEs.WeCaNe', '32145tggg']) == 'Boku123.YEs.WeCaNe' + assert candidate('__YESIMHERE', ['t', 'eMptY', 'nothing', 'zeR00', 'NuLl__', '123NoooneB321']) == '__YESIMHERE.NuLl__' + assert candidate('K', ['Ta', 'TAR', 't234An', 'cosSo']) == 'K.TAR' + assert candidate('__HAHA', ['Tab', '123', '781345', '-_-']) == '__HAHA.123' + assert candidate('YameRore', ['HhAas', 'okIWILL123', 'WorkOut', 'Fails', '-_-']) == 'YameRore.okIWILL123' + assert candidate('finNNalLLly', ['Die', 'NowW', 'Wow', 'WoW']) == 'finNNalLLly.WoW' + + # Check some edge cases that are easy to work out by hand. + assert candidate('_', ['Bb', '91245']) == '_.Bb' + assert candidate('Sp', ['671235', 'Bb']) == 'Sp.671235' + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_154/instruction.md b/HumanEval_154/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ad72bec37725b1a59fbbccbb63ce899121534bc1 --- /dev/null +++ b/HumanEval_154/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/154 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def cycpattern_check(a , b): + """You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word + cycpattern_check("abcd","abd") => False + cycpattern_check("hello","ell") => True + cycpattern_check("whassup","psus") => False + cycpattern_check("abab","baa") => True + cycpattern_check("efef","eeff") => False + cycpattern_check("himenss","simen") => True + + """ +``` diff --git a/HumanEval_154/solution/__init__.py b/HumanEval_154/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..93d6e77a3ee36b09b7d0ceeb7bc1c2b1ad963e60 --- /dev/null +++ b/HumanEval_154/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import cycpattern_check diff --git a/HumanEval_154/solution/solution.py b/HumanEval_154/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..43e2fb8bdd02428bc4e1d2691b7429e825be983d --- /dev/null +++ b/HumanEval_154/solution/solution.py @@ -0,0 +1,18 @@ + +def cycpattern_check(a , b): + """You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word + cycpattern_check("abcd","abd") => False + cycpattern_check("hello","ell") => True + cycpattern_check("whassup","psus") => False + cycpattern_check("abab","baa") => True + cycpattern_check("efef","eeff") => False + cycpattern_check("himenss","simen") => True + + """ + l = len(b) + pat = b + b + for i in range(len(a) - l + 1): + for j in range(l + 1): + if a[i:i+l] == pat[j:j+l]: + return True + return False diff --git a/HumanEval_154/task.toml b/HumanEval_154/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1ab2b3230d2376223ed11464a3a0d1b7d2e96708 --- /dev/null +++ b/HumanEval_154/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/154" +name = "HumanEval — HumanEval/154" + +[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/HumanEval_154/tests/__init__.py b/HumanEval_154/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_154/tests/conftest.py b/HumanEval_154/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_154/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/HumanEval_154/tests/test_humaneval.py b/HumanEval_154/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9ca554009ccb8c2fd48b91b715e1db614949f09b --- /dev/null +++ b/HumanEval_154/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import cycpattern_check as candidate + +def check(candidate): + + # Check some simple cases + #assert True, "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + #assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate("xyzw","xyw") == False , "test #0" + assert candidate("yello","ell") == True , "test #1" + assert candidate("whattup","ptut") == False , "test #2" + assert candidate("efef","fee") == True , "test #3" + assert candidate("abab","aabb") == False , "test #4" + assert candidate("winemtt","tinem") == True , "test #5" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_155/instruction.md b/HumanEval_155/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..76f05a25fc6a7072ac0e3beb44a272d95c0857fe --- /dev/null +++ b/HumanEval_155/instruction.md @@ -0,0 +1,14 @@ +# HumanEval — HumanEval/155 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def even_odd_count(num): + """Given an integer. return a tuple that has the number of even and odd digits respectively. + + Example: + even_odd_count(-12) ==> (1, 1) + even_odd_count(123) ==> (1, 2) + """ +``` diff --git a/HumanEval_155/solution/__init__.py b/HumanEval_155/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bfde4d5cfc537dc5eafd698dd8e4e3fc6dbd5bba --- /dev/null +++ b/HumanEval_155/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import even_odd_count diff --git a/HumanEval_155/solution/solution.py b/HumanEval_155/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..67b538176c3c0d97a8af8d7409164b2d9e08bcee --- /dev/null +++ b/HumanEval_155/solution/solution.py @@ -0,0 +1,16 @@ + +def even_odd_count(num): + """Given an integer. return a tuple that has the number of even and odd digits respectively. + + Example: + even_odd_count(-12) ==> (1, 1) + even_odd_count(123) ==> (1, 2) + """ + even_count = 0 + odd_count = 0 + for i in str(abs(num)): + if int(i)%2==0: + even_count +=1 + else: + odd_count +=1 + return (even_count, odd_count) diff --git a/HumanEval_155/task.toml b/HumanEval_155/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9c8391deadc64320412ce53ed9ae84e214c468e0 --- /dev/null +++ b/HumanEval_155/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/155" +name = "HumanEval — HumanEval/155" + +[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/HumanEval_155/tests/__init__.py b/HumanEval_155/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_155/tests/conftest.py b/HumanEval_155/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_155/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/HumanEval_155/tests/test_humaneval.py b/HumanEval_155/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..6d145c6c3dd2b3f83c9241f1019ab4aaa159e859 --- /dev/null +++ b/HumanEval_155/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import even_odd_count as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(7) == (0, 1) + assert candidate(-78) == (1, 1) + assert candidate(3452) == (2, 2) + assert candidate(346211) == (3, 3) + assert candidate(-345821) == (3, 3) + assert candidate(-2) == (1, 0) + assert candidate(-45347) == (2, 3) + assert candidate(0) == (1, 0) + + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_156/instruction.md b/HumanEval_156/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c6cdcc21b3abbf5b0068a3c9386cf1595486659a --- /dev/null +++ b/HumanEval_156/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/156 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def int_to_mini_roman(number): + """ + Given a positive integer, obtain its roman numeral equivalent as a string, + and return it in lowercase. + Restrictions: 1 <= num <= 1000 + + Examples: + >>> int_to_mini_roman(19) == 'xix' + >>> int_to_mini_roman(152) == 'clii' + >>> int_to_mini_roman(426) == 'cdxxvi' + """ +``` diff --git a/HumanEval_156/solution/__init__.py b/HumanEval_156/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5e4d69314996f8a1f8c7ae4fa3f3ba3a45817cf4 --- /dev/null +++ b/HumanEval_156/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import int_to_mini_roman diff --git a/HumanEval_156/solution/solution.py b/HumanEval_156/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..86d1d00dc5ec5425aa9b3585d8d95c0e929f51e2 --- /dev/null +++ b/HumanEval_156/solution/solution.py @@ -0,0 +1,26 @@ + +def int_to_mini_roman(number): + """ + Given a positive integer, obtain its roman numeral equivalent as a string, + and return it in lowercase. + Restrictions: 1 <= num <= 1000 + + Examples: + >>> int_to_mini_roman(19) == 'xix' + >>> int_to_mini_roman(152) == 'clii' + >>> int_to_mini_roman(426) == 'cdxxvi' + """ + num = [1, 4, 5, 9, 10, 40, 50, 90, + 100, 400, 500, 900, 1000] + sym = ["I", "IV", "V", "IX", "X", "XL", + "L", "XC", "C", "CD", "D", "CM", "M"] + i = 12 + res = '' + while number: + div = number // num[i] + number %= num[i] + while div: + res += sym[i] + div -= 1 + i -= 1 + return res.lower() diff --git a/HumanEval_156/task.toml b/HumanEval_156/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3a3e78fae730908e8fcf9261ae03ea28254c2ccf --- /dev/null +++ b/HumanEval_156/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/156" +name = "HumanEval — HumanEval/156" + +[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/HumanEval_156/tests/__init__.py b/HumanEval_156/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_156/tests/conftest.py b/HumanEval_156/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_156/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/HumanEval_156/tests/test_humaneval.py b/HumanEval_156/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..13d7224c0caad706d8de37156cf6be43abf92ede --- /dev/null +++ b/HumanEval_156/tests/test_humaneval.py @@ -0,0 +1,27 @@ +from solution import int_to_mini_roman as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(19) == 'xix' + assert candidate(152) == 'clii' + assert candidate(251) == 'ccli' + assert candidate(426) == 'cdxxvi' + assert candidate(500) == 'd' + assert candidate(1) == 'i' + assert candidate(4) == 'iv' + assert candidate(43) == 'xliii' + assert candidate(90) == 'xc' + assert candidate(94) == 'xciv' + assert candidate(532) == 'dxxxii' + assert candidate(900) == 'cm' + assert candidate(994) == 'cmxciv' + assert candidate(1000) == 'm' + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_157/instruction.md b/HumanEval_157/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1e037d5b6761c1e873d75399efc5dbc6214b0a98 --- /dev/null +++ b/HumanEval_157/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/157 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def right_angle_triangle(a, b, c): + ''' + Given the lengths of the three sides of a triangle. Return True if the three + sides form a right-angled triangle, False otherwise. + A right-angled triangle is a triangle in which one angle is right angle or + 90 degree. + Example: + right_angle_triangle(3, 4, 5) == True + right_angle_triangle(1, 2, 3) == False + ''' +``` diff --git a/HumanEval_157/solution/__init__.py b/HumanEval_157/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d65ca920336909c50c7398fa8cc80d9b4e71a81b --- /dev/null +++ b/HumanEval_157/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import right_angle_triangle diff --git a/HumanEval_157/solution/solution.py b/HumanEval_157/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..660e7598c0b13392e1d011051f14a355d6d84aed --- /dev/null +++ b/HumanEval_157/solution/solution.py @@ -0,0 +1,12 @@ + +def right_angle_triangle(a, b, c): + ''' + Given the lengths of the three sides of a triangle. Return True if the three + sides form a right-angled triangle, False otherwise. + A right-angled triangle is a triangle in which one angle is right angle or + 90 degree. + Example: + right_angle_triangle(3, 4, 5) == True + right_angle_triangle(1, 2, 3) == False + ''' + return a*a == b*b + c*c or b*b == a*a + c*c or c*c == a*a + b*b diff --git a/HumanEval_157/task.toml b/HumanEval_157/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2764f64092dc7902230f34448ccf32ffd22b4d47 --- /dev/null +++ b/HumanEval_157/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/157" +name = "HumanEval — HumanEval/157" + +[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/HumanEval_157/tests/__init__.py b/HumanEval_157/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_157/tests/conftest.py b/HumanEval_157/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_157/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/HumanEval_157/tests/test_humaneval.py b/HumanEval_157/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3e891954543974b27248f82dc2f1524ba935affc --- /dev/null +++ b/HumanEval_157/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import right_angle_triangle as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(3, 4, 5) == True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(1, 2, 3) == False + assert candidate(10, 6, 8) == True + assert candidate(2, 2, 2) == False + assert candidate(7, 24, 25) == True + assert candidate(10, 5, 7) == False + assert candidate(5, 12, 13) == True + assert candidate(15, 8, 17) == True + assert candidate(48, 55, 73) == True + + # Check some edge cases that are easy to work out by hand. + assert candidate(1, 1, 1) == False, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate(2, 2, 10) == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_158/instruction.md b/HumanEval_158/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c9298c3e1a3219b824a4036857cfd9373b018464 --- /dev/null +++ b/HumanEval_158/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/158 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def find_max(words): + """Write a function that accepts a list of strings. + The list contains different words. Return the word with maximum number + of unique characters. If multiple strings have maximum number of unique + characters, return the one which comes first in lexicographical order. + + find_max(["name", "of", "string"]) == "string" + find_max(["name", "enam", "game"]) == "enam" + find_max(["aaaaaaa", "bb" ,"cc"]) == ""aaaaaaa" + """ +``` diff --git a/HumanEval_158/solution/__init__.py b/HumanEval_158/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ed3dc19b1f94b1b31f0609a77911224c087fb5f5 --- /dev/null +++ b/HumanEval_158/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import find_max diff --git a/HumanEval_158/solution/solution.py b/HumanEval_158/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..270ae659ac95be55b375375ced314650d0b61bec --- /dev/null +++ b/HumanEval_158/solution/solution.py @@ -0,0 +1,12 @@ + +def find_max(words): + """Write a function that accepts a list of strings. + The list contains different words. Return the word with maximum number + of unique characters. If multiple strings have maximum number of unique + characters, return the one which comes first in lexicographical order. + + find_max(["name", "of", "string"]) == "string" + find_max(["name", "enam", "game"]) == "enam" + find_max(["aaaaaaa", "bb" ,"cc"]) == ""aaaaaaa" + """ + return sorted(words, key = lambda x: (-len(set(x)), x))[0] diff --git a/HumanEval_158/task.toml b/HumanEval_158/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..108bb11c64a5edb06ad21d3eb94ae0ca8a8c5cf1 --- /dev/null +++ b/HumanEval_158/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/158" +name = "HumanEval — HumanEval/158" + +[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/HumanEval_158/tests/__init__.py b/HumanEval_158/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_158/tests/conftest.py b/HumanEval_158/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_158/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/HumanEval_158/tests/test_humaneval.py b/HumanEval_158/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..287da521db2b15ff1cf4adacdbb98929630d54f5 --- /dev/null +++ b/HumanEval_158/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import find_max as candidate + +def check(candidate): + + # Check some simple cases + assert (candidate(["name", "of", "string"]) == "string"), "t1" + assert (candidate(["name", "enam", "game"]) == "enam"), 't2' + assert (candidate(["aaaaaaa", "bb", "cc"]) == "aaaaaaa"), 't3' + assert (candidate(["abc", "cba"]) == "abc"), 't4' + assert (candidate(["play", "this", "game", "of","footbott"]) == "footbott"), 't5' + assert (candidate(["we", "are", "gonna", "rock"]) == "gonna"), 't6' + assert (candidate(["we", "are", "a", "mad", "nation"]) == "nation"), 't7' + assert (candidate(["this", "is", "a", "prrk"]) == "this"), 't8' + + # Check some edge cases that are easy to work out by hand. + assert (candidate(["b"]) == "b"), 't9' + assert (candidate(["play", "play", "play"]) == "play"), 't10' + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_159/instruction.md b/HumanEval_159/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..256d38d03095b7ee923b8cf216a137bd91f9c22f --- /dev/null +++ b/HumanEval_159/instruction.md @@ -0,0 +1,36 @@ +# HumanEval — HumanEval/159 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def eat(number, need, remaining): + """ + You're a hungry rabbit, and you already have eaten a certain number of carrots, + but now you need to eat more carrots to complete the day's meals. + you should return an array of [ total number of eaten carrots after your meals, + the number of carrots left after your meals ] + if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. + + Example: + * eat(5, 6, 10) -> [11, 4] + * eat(4, 8, 9) -> [12, 1] + * eat(1, 10, 10) -> [11, 0] + * eat(2, 11, 5) -> [7, 0] + + Variables: + @number : integer + the number of carrots that you have eaten. + @need : integer + the number of carrots that you need to eat. + @remaining : integer + the number of remaining carrots thet exist in stock + + Constrain: + * 0 <= number <= 1000 + * 0 <= need <= 1000 + * 0 <= remaining <= 1000 + + Have fun :) + """ +``` diff --git a/HumanEval_159/solution/__init__.py b/HumanEval_159/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b9350216ca9f61d6d6f4331e06391904b73bfc16 --- /dev/null +++ b/HumanEval_159/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import eat diff --git a/HumanEval_159/solution/solution.py b/HumanEval_159/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ea7efdced879192b01fdb20f3473918e8cc367de --- /dev/null +++ b/HumanEval_159/solution/solution.py @@ -0,0 +1,34 @@ + +def eat(number, need, remaining): + """ + You're a hungry rabbit, and you already have eaten a certain number of carrots, + but now you need to eat more carrots to complete the day's meals. + you should return an array of [ total number of eaten carrots after your meals, + the number of carrots left after your meals ] + if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry. + + Example: + * eat(5, 6, 10) -> [11, 4] + * eat(4, 8, 9) -> [12, 1] + * eat(1, 10, 10) -> [11, 0] + * eat(2, 11, 5) -> [7, 0] + + Variables: + @number : integer + the number of carrots that you have eaten. + @need : integer + the number of carrots that you need to eat. + @remaining : integer + the number of remaining carrots thet exist in stock + + Constrain: + * 0 <= number <= 1000 + * 0 <= need <= 1000 + * 0 <= remaining <= 1000 + + Have fun :) + """ + if(need <= remaining): + return [ number + need , remaining-need ] + else: + return [ number + remaining , 0] diff --git a/HumanEval_159/task.toml b/HumanEval_159/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..945f87342c159e1b23069b0dda0ca9a8fa89977b --- /dev/null +++ b/HumanEval_159/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/159" +name = "HumanEval — HumanEval/159" + +[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/HumanEval_159/tests/__init__.py b/HumanEval_159/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_159/tests/conftest.py b/HumanEval_159/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_159/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/HumanEval_159/tests/test_humaneval.py b/HumanEval_159/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3de249ec8db4b6ca94283beefc515a0e426849a4 --- /dev/null +++ b/HumanEval_159/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import eat as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(5, 6, 10) == [11, 4], "Error" + assert candidate(4, 8, 9) == [12, 1], "Error" + assert candidate(1, 10, 10) == [11, 0], "Error" + assert candidate(2, 11, 5) == [7, 0], "Error" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate(4, 5, 7) == [9, 2], "Error" + assert candidate(4, 5, 1) == [5, 0], "Error" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_16/instruction.md b/HumanEval_16/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4abcd8ca7ed95db93323a0d2ff5fc6c446e5c087 --- /dev/null +++ b/HumanEval_16/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/16 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def count_distinct_characters(string: str) -> int: + """ Given a string, find out how many distinct characters (regardless of case) does it consist of + >>> count_distinct_characters('xyzXYZ') + 3 + >>> count_distinct_characters('Jerry') + 4 + """ +``` diff --git a/HumanEval_16/solution/__init__.py b/HumanEval_16/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e1a270b0da7c6427ee04a5612d88e1fd20725f8f --- /dev/null +++ b/HumanEval_16/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import count_distinct_characters diff --git a/HumanEval_16/solution/solution.py b/HumanEval_16/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..53d8a946321231290103134065434a62c8a3ee9e --- /dev/null +++ b/HumanEval_16/solution/solution.py @@ -0,0 +1,10 @@ + + +def count_distinct_characters(string: str) -> int: + """ Given a string, find out how many distinct characters (regardless of case) does it consist of + >>> count_distinct_characters('xyzXYZ') + 3 + >>> count_distinct_characters('Jerry') + 4 + """ + return len(set(string.lower())) diff --git a/HumanEval_16/task.toml b/HumanEval_16/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ed40246e41991d9d3fa98ebbee676457027cf285 --- /dev/null +++ b/HumanEval_16/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/16" +name = "HumanEval — HumanEval/16" + +[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/HumanEval_16/tests/__init__.py b/HumanEval_16/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_16/tests/conftest.py b/HumanEval_16/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_16/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/HumanEval_16/tests/test_humaneval.py b/HumanEval_16/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..eb7f968271a15ccf03a4bd2cbaf420e67ddb91db --- /dev/null +++ b/HumanEval_16/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import count_distinct_characters as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('') == 0 + assert candidate('abcde') == 5 + assert candidate('abcde' + 'cade' + 'CADE') == 5 + assert candidate('aaaaAAAAaaaa') == 1 + assert candidate('Jerry jERRY JeRRRY') == 5 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_160/instruction.md b/HumanEval_160/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ab287d2b63d1ccbebb23586f9e5d185d9fda49ab --- /dev/null +++ b/HumanEval_160/instruction.md @@ -0,0 +1,32 @@ +# HumanEval — HumanEval/160 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def do_algebra(operator, operand): + """ + Given two lists operator, and operand. The first list has basic algebra operations, and + the second list is a list of integers. Use the two given lists to build the algebric + expression and return the evaluation of this expression. + + The basic algebra operations: + Addition ( + ) + Subtraction ( - ) + Multiplication ( * ) + Floor division ( // ) + Exponentiation ( ** ) + + Example: + operator['+', '*', '-'] + array = [2, 3, 4, 5] + result = 2 + 3 * 4 - 5 + => result = 9 + + Note: + The length of operator list is equal to the length of operand list minus one. + Operand is a list of of non-negative integers. + Operator list has at least one operator, and operand list has at least two operands. + + """ +``` diff --git a/HumanEval_160/solution/__init__.py b/HumanEval_160/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fedf0db5b3fa4953a4bbe41e50efbdf4c951e5f4 --- /dev/null +++ b/HumanEval_160/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import do_algebra diff --git a/HumanEval_160/solution/solution.py b/HumanEval_160/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..98911d6a97b95eb75e30f921c0bb68752e654db3 --- /dev/null +++ b/HumanEval_160/solution/solution.py @@ -0,0 +1,30 @@ + +def do_algebra(operator, operand): + """ + Given two lists operator, and operand. The first list has basic algebra operations, and + the second list is a list of integers. Use the two given lists to build the algebric + expression and return the evaluation of this expression. + + The basic algebra operations: + Addition ( + ) + Subtraction ( - ) + Multiplication ( * ) + Floor division ( // ) + Exponentiation ( ** ) + + Example: + operator['+', '*', '-'] + array = [2, 3, 4, 5] + result = 2 + 3 * 4 - 5 + => result = 9 + + Note: + The length of operator list is equal to the length of operand list minus one. + Operand is a list of of non-negative integers. + Operator list has at least one operator, and operand list has at least two operands. + + """ + expression = str(operand[0]) + for oprt, oprn in zip(operator, operand[1:]): + expression+= oprt + str(oprn) + return eval(expression) diff --git a/HumanEval_160/task.toml b/HumanEval_160/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..125e12df85abebf5e2a5a31085918d5ce67c4f30 --- /dev/null +++ b/HumanEval_160/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/160" +name = "HumanEval — HumanEval/160" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/HumanEval_160/tests/__init__.py b/HumanEval_160/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_160/tests/conftest.py b/HumanEval_160/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_160/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/HumanEval_160/tests/test_humaneval.py b/HumanEval_160/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..d9104eb333c162107624ef60bd1afe2df619e37d --- /dev/null +++ b/HumanEval_160/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import do_algebra as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(['**', '*', '+'], [2, 3, 4, 5]) == 37 + assert candidate(['+', '*', '-'], [2, 3, 4, 5]) == 9 + assert candidate(['//', '*'], [7, 3, 4]) == 8, "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_161/instruction.md b/HumanEval_161/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c7b440b8eae0239e2150ee254601de02243f901d --- /dev/null +++ b/HumanEval_161/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/161 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def solve(s): + """You are given a string s. + if s[i] is a letter, reverse its case from lower to upper or vise versa, + otherwise keep it as it is. + If the string contains no letters, reverse the string. + The function should return the resulted string. + Examples + solve("1234") = "4321" + solve("ab") = "AB" + solve("#a@C") = "#A@c" + """ +``` diff --git a/HumanEval_161/solution/__init__.py b/HumanEval_161/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ba22072926328a428ebbf607075059dedb2221d0 --- /dev/null +++ b/HumanEval_161/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import solve diff --git a/HumanEval_161/solution/solution.py b/HumanEval_161/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..e383cd2070884dfd77788e2bf668de7336138754 --- /dev/null +++ b/HumanEval_161/solution/solution.py @@ -0,0 +1,26 @@ + +def solve(s): + """You are given a string s. + if s[i] is a letter, reverse its case from lower to upper or vise versa, + otherwise keep it as it is. + If the string contains no letters, reverse the string. + The function should return the resulted string. + Examples + solve("1234") = "4321" + solve("ab") = "AB" + solve("#a@C") = "#A@c" + """ + flg = 0 + idx = 0 + new_str = list(s) + for i in s: + if i.isalpha(): + new_str[idx] = i.swapcase() + flg = 1 + idx += 1 + s = "" + for i in new_str: + s += i + if flg == 0: + return s[len(s)::-1] + return s diff --git a/HumanEval_161/task.toml b/HumanEval_161/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d775d73b5387b3cf8b4e6d3254ee0655c9d154c0 --- /dev/null +++ b/HumanEval_161/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/161" +name = "HumanEval — HumanEval/161" + +[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/HumanEval_161/tests/__init__.py b/HumanEval_161/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_161/tests/conftest.py b/HumanEval_161/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_161/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/HumanEval_161/tests/test_humaneval.py b/HumanEval_161/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..85eeb31d95236998f2605eac9377eaffa797b19e --- /dev/null +++ b/HumanEval_161/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import solve as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("AsDf") == "aSdF" + assert candidate("1234") == "4321" + assert candidate("ab") == "AB" + assert candidate("#a@C") == "#A@c" + assert candidate("#AsdfW^45") == "#aSDFw^45" + assert candidate("#6@2") == "2@6#" + + # Check some edge cases that are easy to work out by hand. + assert candidate("#$a^D") == "#$A^d" + assert candidate("#ccc") == "#CCC" + + # Don't remove this line: + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_162/instruction.md b/HumanEval_162/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e76353e950bb48ce8821837cb5a5a23d248f0af3 --- /dev/null +++ b/HumanEval_162/instruction.md @@ -0,0 +1,14 @@ +# HumanEval — HumanEval/162 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def string_to_md5(text): + """ + Given a string 'text', return its md5 hash equivalent string. + If 'text' is an empty string, return None. + + >>> string_to_md5('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62' + """ +``` diff --git a/HumanEval_162/solution/__init__.py b/HumanEval_162/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..948831f84275c25146754dde9ad242a42b806804 --- /dev/null +++ b/HumanEval_162/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import string_to_md5 diff --git a/HumanEval_162/solution/solution.py b/HumanEval_162/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..e32e2a468811d39c98006abf709e9aa13de47290 --- /dev/null +++ b/HumanEval_162/solution/solution.py @@ -0,0 +1,10 @@ + +def string_to_md5(text): + """ + Given a string 'text', return its md5 hash equivalent string. + If 'text' is an empty string, return None. + + >>> string_to_md5('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62' + """ + import hashlib + return hashlib.md5(text.encode('ascii')).hexdigest() if text else None diff --git a/HumanEval_162/task.toml b/HumanEval_162/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1e79ab2c2ffb68a94fd3f47a44437b147e67667c --- /dev/null +++ b/HumanEval_162/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/162" +name = "HumanEval — HumanEval/162" + +[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/HumanEval_162/tests/__init__.py b/HumanEval_162/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_162/tests/conftest.py b/HumanEval_162/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_162/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/HumanEval_162/tests/test_humaneval.py b/HumanEval_162/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..05f828103a858b6a4a584a7e3669d8e346fe7079 --- /dev/null +++ b/HumanEval_162/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import string_to_md5 as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62' + assert candidate('') == None + assert candidate('A B C') == '0ef78513b0cb8cef12743f5aeb35f888' + assert candidate('password') == '5f4dcc3b5aa765d61d8327deb882cf99' + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_163/instruction.md b/HumanEval_163/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..01e8a357a4aff8060ed31dae78c74d65c9489601 --- /dev/null +++ b/HumanEval_163/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/163 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def generate_integers(a, b): + """ + Given two positive integers a and b, return the even digits between a + and b, in ascending order. + + For example: + generate_integers(2, 8) => [2, 4, 6, 8] + generate_integers(8, 2) => [2, 4, 6, 8] + generate_integers(10, 14) => [] + """ +``` diff --git a/HumanEval_163/solution/__init__.py b/HumanEval_163/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2ffc1d5423215300c62e32ef0bdb1f7890bc234a --- /dev/null +++ b/HumanEval_163/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import generate_integers diff --git a/HumanEval_163/solution/solution.py b/HumanEval_163/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..b23f5816fdcb6631c461c225c64454ccb35110c9 --- /dev/null +++ b/HumanEval_163/solution/solution.py @@ -0,0 +1,15 @@ + +def generate_integers(a, b): + """ + Given two positive integers a and b, return the even digits between a + and b, in ascending order. + + For example: + generate_integers(2, 8) => [2, 4, 6, 8] + generate_integers(8, 2) => [2, 4, 6, 8] + generate_integers(10, 14) => [] + """ + lower = max(2, min(a, b)) + upper = min(8, max(a, b)) + + return [i for i in range(lower, upper+1) if i % 2 == 0] diff --git a/HumanEval_163/task.toml b/HumanEval_163/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..06cfaabe3bdd8b8a0a08d7bc87e5bf360e02967e --- /dev/null +++ b/HumanEval_163/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/163" +name = "HumanEval — HumanEval/163" + +[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/HumanEval_163/tests/__init__.py b/HumanEval_163/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_163/tests/conftest.py b/HumanEval_163/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_163/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/HumanEval_163/tests/test_humaneval.py b/HumanEval_163/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..e5ebaa0629dbc2eec860e7fc2ea22cbe54e4477a --- /dev/null +++ b/HumanEval_163/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import generate_integers as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(2, 10) == [2, 4, 6, 8], "Test 1" + assert candidate(10, 2) == [2, 4, 6, 8], "Test 2" + assert candidate(132, 2) == [2, 4, 6, 8], "Test 3" + assert candidate(17,89) == [], "Test 4" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_17/instruction.md b/HumanEval_17/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a159a92d3ec49765ea5c530d1c8a3730a1db9aa1 --- /dev/null +++ b/HumanEval_17/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/17 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def parse_music(music_string: str) -> List[int]: + """ Input to this function is a string representing musical notes in a special ASCII format. + Your task is to parse this string and return list of integers corresponding to how many beats does each + not last. + + Here is a legend: + 'o' - whole note, lasts four beats + 'o|' - half note, lasts two beats + '.|' - quater note, lasts one beat + + >>> parse_music('o o| .| o| o| .| .| .| .| o o') + [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4] + """ +``` diff --git a/HumanEval_17/solution/__init__.py b/HumanEval_17/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5003428d86b38a1a625098d58fc8cc42a936f855 --- /dev/null +++ b/HumanEval_17/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import parse_music diff --git a/HumanEval_17/solution/solution.py b/HumanEval_17/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..8904fc3d5f4f1cd1c62e5c931ee3222a81f24a3d --- /dev/null +++ b/HumanEval_17/solution/solution.py @@ -0,0 +1,18 @@ +from typing import List + + +def parse_music(music_string: str) -> List[int]: + """ Input to this function is a string representing musical notes in a special ASCII format. + Your task is to parse this string and return list of integers corresponding to how many beats does each + not last. + + Here is a legend: + 'o' - whole note, lasts four beats + 'o|' - half note, lasts two beats + '.|' - quater note, lasts one beat + + >>> parse_music('o o| .| o| o| .| .| .| .| o o') + [4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4] + """ + note_map = {'o': 4, 'o|': 2, '.|': 1} + return [note_map[x] for x in music_string.split(' ') if x] diff --git a/HumanEval_17/task.toml b/HumanEval_17/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ee132bc1b13b396f750a0260608f0e20709d0f3a --- /dev/null +++ b/HumanEval_17/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/17" +name = "HumanEval — HumanEval/17" + +[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/HumanEval_17/tests/__init__.py b/HumanEval_17/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_17/tests/conftest.py b/HumanEval_17/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_17/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/HumanEval_17/tests/test_humaneval.py b/HumanEval_17/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3454e0b314afe915174484f46eaed5ef32767836 --- /dev/null +++ b/HumanEval_17/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import parse_music as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('') == [] + assert candidate('o o o o') == [4, 4, 4, 4] + assert candidate('.| .| .| .|') == [1, 1, 1, 1] + assert candidate('o| o| .| .| o o o o') == [2, 2, 1, 1, 4, 4, 4, 4] + assert candidate('o| .| o| .| o o| o o|') == [2, 1, 2, 1, 4, 2, 4, 2] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_18/instruction.md b/HumanEval_18/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..25d13791bf4e6238c9ca36ae29d3a1341563518c --- /dev/null +++ b/HumanEval_18/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/18 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def how_many_times(string: str, substring: str) -> int: + """ Find how many times a given substring can be found in the original string. Count overlaping cases. + >>> how_many_times('', 'a') + 0 + >>> how_many_times('aaa', 'a') + 3 + >>> how_many_times('aaaa', 'aa') + 3 + """ +``` diff --git a/HumanEval_18/solution/__init__.py b/HumanEval_18/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..808d42e997080d1a5daf1f602a817c1e9f9572bf --- /dev/null +++ b/HumanEval_18/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import how_many_times diff --git a/HumanEval_18/solution/solution.py b/HumanEval_18/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..8b2ee331bbe25ced7d492324c766a5fd56e43c49 --- /dev/null +++ b/HumanEval_18/solution/solution.py @@ -0,0 +1,18 @@ + + +def how_many_times(string: str, substring: str) -> int: + """ Find how many times a given substring can be found in the original string. Count overlaping cases. + >>> how_many_times('', 'a') + 0 + >>> how_many_times('aaa', 'a') + 3 + >>> how_many_times('aaaa', 'aa') + 3 + """ + times = 0 + + for i in range(len(string) - len(substring) + 1): + if string[i:i+len(substring)] == substring: + times += 1 + + return times diff --git a/HumanEval_18/task.toml b/HumanEval_18/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0c6cd5fff0c76fee5752cf0dbca0de1f412dd73a --- /dev/null +++ b/HumanEval_18/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/18" +name = "HumanEval — HumanEval/18" + +[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/HumanEval_18/tests/__init__.py b/HumanEval_18/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_18/tests/conftest.py b/HumanEval_18/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_18/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/HumanEval_18/tests/test_humaneval.py b/HumanEval_18/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..e1f52857297d32f25110da05822b3b478f882e62 --- /dev/null +++ b/HumanEval_18/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import how_many_times as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('', 'x') == 0 + assert candidate('xyxyxyx', 'x') == 4 + assert candidate('cacacacac', 'cac') == 4 + assert candidate('john doe', 'john') == 1 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_19/instruction.md b/HumanEval_19/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cbb61895a5add1b97f0198363b0c2b41ac610ac2 --- /dev/null +++ b/HumanEval_19/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/19 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def sort_numbers(numbers: str) -> str: + """ Input is a space-delimited string of numberals from 'zero' to 'nine'. + Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'. + Return the string with numbers sorted from smallest to largest + >>> sort_numbers('three one five') + 'one three five' + """ +``` diff --git a/HumanEval_19/solution/__init__.py b/HumanEval_19/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d10839383688051ddbb8cf44e650a073f390e810 --- /dev/null +++ b/HumanEval_19/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sort_numbers diff --git a/HumanEval_19/solution/solution.py b/HumanEval_19/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1bb2f58d0792bd106f720d3203ac38898cd8a43c --- /dev/null +++ b/HumanEval_19/solution/solution.py @@ -0,0 +1,23 @@ +from typing import List + + +def sort_numbers(numbers: str) -> str: + """ Input is a space-delimited string of numberals from 'zero' to 'nine'. + Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'. + Return the string with numbers sorted from smallest to largest + >>> sort_numbers('three one five') + 'one three five' + """ + value_map = { + 'zero': 0, + 'one': 1, + 'two': 2, + 'three': 3, + 'four': 4, + 'five': 5, + 'six': 6, + 'seven': 7, + 'eight': 8, + 'nine': 9 + } + return ' '.join(sorted([x for x in numbers.split(' ') if x], key=lambda x: value_map[x])) diff --git a/HumanEval_19/task.toml b/HumanEval_19/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d195562f3f9024ddc220e7cd4ff6c55a80d02556 --- /dev/null +++ b/HumanEval_19/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/19" +name = "HumanEval — HumanEval/19" + +[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/HumanEval_19/tests/__init__.py b/HumanEval_19/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_19/tests/conftest.py b/HumanEval_19/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_19/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/HumanEval_19/tests/test_humaneval.py b/HumanEval_19/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..817c597fc3033fd888f1371704f943a90123ddd3 --- /dev/null +++ b/HumanEval_19/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import sort_numbers as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('') == '' + assert candidate('three') == 'three' + assert candidate('three five nine') == 'three five nine' + assert candidate('five zero four seven nine eight') == 'zero four five seven eight nine' + assert candidate('six five four three two one zero') == 'zero one two three four five six' + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_2/instruction.md b/HumanEval_2/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0322ccc25e9b2341b55c7cc2bd951bb36b1fda6c --- /dev/null +++ b/HumanEval_2/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/2 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def truncate_number(number: float) -> float: + """ Given a positive floating point number, it can be decomposed into + and integer part (largest integer smaller than given number) and decimals + (leftover part always smaller than 1). + + Return the decimal part of the number. + >>> truncate_number(3.5) + 0.5 + """ +``` diff --git a/HumanEval_2/solution/__init__.py b/HumanEval_2/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4a58de37fceda3c466d74a5e38d111344d5a5c05 --- /dev/null +++ b/HumanEval_2/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import truncate_number diff --git a/HumanEval_2/solution/solution.py b/HumanEval_2/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..6e214c1a8a99a5e41c3baef2b2c48ddeecb75a5b --- /dev/null +++ b/HumanEval_2/solution/solution.py @@ -0,0 +1,12 @@ + + +def truncate_number(number: float) -> float: + """ Given a positive floating point number, it can be decomposed into + and integer part (largest integer smaller than given number) and decimals + (leftover part always smaller than 1). + + Return the decimal part of the number. + >>> truncate_number(3.5) + 0.5 + """ + return number % 1.0 diff --git a/HumanEval_2/task.toml b/HumanEval_2/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4b1305aa2c6e30a1e11d9cb8676f1b865d0ef232 --- /dev/null +++ b/HumanEval_2/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/2" +name = "HumanEval — HumanEval/2" + +[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/HumanEval_2/tests/__init__.py b/HumanEval_2/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_2/tests/conftest.py b/HumanEval_2/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_2/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/HumanEval_2/tests/test_humaneval.py b/HumanEval_2/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..30e1cc6a86d46a3babd5600b66a232379e36cea9 --- /dev/null +++ b/HumanEval_2/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import truncate_number as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate(3.5) == 0.5 + assert abs(candidate(1.33) - 0.33) < 1e-6 + assert abs(candidate(123.456) - 0.456) < 1e-6 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_20/instruction.md b/HumanEval_20/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2d4ece23d455d53b5ab03cbb4c1356b307e3ebd9 --- /dev/null +++ b/HumanEval_20/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/20 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List, Tuple + + +def find_closest_elements(numbers: List[float]) -> Tuple[float, float]: + """ From a supplied list of numbers (of length at least two) select and return two that are the closest to each + other and return them in order (smaller number, larger number). + >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) + (2.0, 2.2) + >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) + (2.0, 2.0) + """ +``` diff --git a/HumanEval_20/solution/__init__.py b/HumanEval_20/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f9b13682a66816b97a4a0a98625553761d833d7c --- /dev/null +++ b/HumanEval_20/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import find_closest_elements diff --git a/HumanEval_20/solution/solution.py b/HumanEval_20/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..a4f6c877b524251ecbf886b11cf79d9178ce0ca1 --- /dev/null +++ b/HumanEval_20/solution/solution.py @@ -0,0 +1,27 @@ +from typing import List, Tuple + + +def find_closest_elements(numbers: List[float]) -> Tuple[float, float]: + """ From a supplied list of numbers (of length at least two) select and return two that are the closest to each + other and return them in order (smaller number, larger number). + >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) + (2.0, 2.2) + >>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) + (2.0, 2.0) + """ + closest_pair = None + distance = None + + for idx, elem in enumerate(numbers): + for idx2, elem2 in enumerate(numbers): + if idx != idx2: + if distance is None: + distance = abs(elem - elem2) + closest_pair = tuple(sorted([elem, elem2])) + else: + new_distance = abs(elem - elem2) + if new_distance < distance: + distance = new_distance + closest_pair = tuple(sorted([elem, elem2])) + + return closest_pair diff --git a/HumanEval_20/task.toml b/HumanEval_20/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..af0a1ede5cbc629be3685548f440a520ede7c73b --- /dev/null +++ b/HumanEval_20/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/20" +name = "HumanEval — HumanEval/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/HumanEval_20/tests/__init__.py b/HumanEval_20/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_20/tests/conftest.py b/HumanEval_20/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_20/tests/test_humaneval.py b/HumanEval_20/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..e5299df0ac15ac2b5e3a25b346efefbdf84d346f --- /dev/null +++ b/HumanEval_20/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import find_closest_elements as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0) + assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9) + assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2) + assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0) + assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_21/instruction.md b/HumanEval_21/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4f66ef1429ebbb87ca7da73546ba833596f34d6c --- /dev/null +++ b/HumanEval_21/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/21 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def rescale_to_unit(numbers: List[float]) -> List[float]: + """ Given list of numbers (of at least two elements), apply a linear transform to that list, + such that the smallest number will become 0 and the largest will become 1 + >>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0]) + [0.0, 0.25, 0.5, 0.75, 1.0] + """ +``` diff --git a/HumanEval_21/solution/__init__.py b/HumanEval_21/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8eaffac9520291f003e4281d0da885468e75316b --- /dev/null +++ b/HumanEval_21/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import rescale_to_unit diff --git a/HumanEval_21/solution/solution.py b/HumanEval_21/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..daaa122472f4543520a0683f7db373fd9fc641fd --- /dev/null +++ b/HumanEval_21/solution/solution.py @@ -0,0 +1,12 @@ +from typing import List + + +def rescale_to_unit(numbers: List[float]) -> List[float]: + """ Given list of numbers (of at least two elements), apply a linear transform to that list, + such that the smallest number will become 0 and the largest will become 1 + >>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0]) + [0.0, 0.25, 0.5, 0.75, 1.0] + """ + min_number = min(numbers) + max_number = max(numbers) + return [(x - min_number) / (max_number - min_number) for x in numbers] diff --git a/HumanEval_21/task.toml b/HumanEval_21/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bd3d3752a48657e9f21857a2a295ef95af96cef4 --- /dev/null +++ b/HumanEval_21/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/21" +name = "HumanEval — HumanEval/21" + +[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/HumanEval_21/tests/__init__.py b/HumanEval_21/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_21/tests/conftest.py b/HumanEval_21/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_21/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/HumanEval_21/tests/test_humaneval.py b/HumanEval_21/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..dab8ab4053fa6994051eb041f084dcc49eace77f --- /dev/null +++ b/HumanEval_21/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import rescale_to_unit as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([2.0, 49.9]) == [0.0, 1.0] + assert candidate([100.0, 49.9]) == [1.0, 0.0] + assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0] + assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75] + assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_22/instruction.md b/HumanEval_22/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fa74412db7292c03351caa5da5cc877c66c3c854 --- /dev/null +++ b/HumanEval_22/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/22 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List, Any + + +def filter_integers(values: List[Any]) -> List[int]: + """ Filter given list of any python values only for integers + >>> filter_integers(['a', 3.14, 5]) + [5] + >>> filter_integers([1, 2, 3, 'abc', {}, []]) + [1, 2, 3] + """ +``` diff --git a/HumanEval_22/solution/__init__.py b/HumanEval_22/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e1550017d7e2f0c3c4b851dedf068c1f813f25e8 --- /dev/null +++ b/HumanEval_22/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import filter_integers diff --git a/HumanEval_22/solution/solution.py b/HumanEval_22/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..b950d9c9e8699a1484abc01777de8824f2324074 --- /dev/null +++ b/HumanEval_22/solution/solution.py @@ -0,0 +1,11 @@ +from typing import List, Any + + +def filter_integers(values: List[Any]) -> List[int]: + """ Filter given list of any python values only for integers + >>> filter_integers(['a', 3.14, 5]) + [5] + >>> filter_integers([1, 2, 3, 'abc', {}, []]) + [1, 2, 3] + """ + return [x for x in values if isinstance(x, int)] diff --git a/HumanEval_22/task.toml b/HumanEval_22/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..71f77e70de071e7b1f51db35a741c75162d31845 --- /dev/null +++ b/HumanEval_22/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/22" +name = "HumanEval — HumanEval/22" + +[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/HumanEval_22/tests/__init__.py b/HumanEval_22/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_22/tests/conftest.py b/HumanEval_22/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_22/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/HumanEval_22/tests/test_humaneval.py b/HumanEval_22/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..53852554703922ec2c05caa819c9bc361a96d59e --- /dev/null +++ b/HumanEval_22/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import filter_integers as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([]) == [] + assert candidate([4, {}, [], 23.2, 9, 'adasd']) == [4, 9] + assert candidate([3, 'c', 3, 3, 'a', 'b']) == [3, 3, 3] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_23/instruction.md b/HumanEval_23/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f388fc307a2285842fc80b3804c7274e54e6a471 --- /dev/null +++ b/HumanEval_23/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/23 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def strlen(string: str) -> int: + """ Return length of given string + >>> strlen('') + 0 + >>> strlen('abc') + 3 + """ +``` diff --git a/HumanEval_23/solution/__init__.py b/HumanEval_23/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ed37c305d5fbc5f1bfd01372b239c388b874589 --- /dev/null +++ b/HumanEval_23/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import strlen diff --git a/HumanEval_23/solution/solution.py b/HumanEval_23/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..9f5e2c8f5f1a786dcd148d9fadffaa8abcbf766e --- /dev/null +++ b/HumanEval_23/solution/solution.py @@ -0,0 +1,10 @@ + + +def strlen(string: str) -> int: + """ Return length of given string + >>> strlen('') + 0 + >>> strlen('abc') + 3 + """ + return len(string) diff --git a/HumanEval_23/task.toml b/HumanEval_23/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..5cc6cec172469d2f349ab58b1bbadeb43dc2fca9 --- /dev/null +++ b/HumanEval_23/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/23" +name = "HumanEval — HumanEval/23" + +[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/HumanEval_23/tests/__init__.py b/HumanEval_23/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_23/tests/conftest.py b/HumanEval_23/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_23/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/HumanEval_23/tests/test_humaneval.py b/HumanEval_23/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8351170cced91271be8e68789997a394c37b4842 --- /dev/null +++ b/HumanEval_23/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import strlen as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('') == 0 + assert candidate('x') == 1 + assert candidate('asdasnakj') == 9 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_24/instruction.md b/HumanEval_24/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b8f7b69ea230a196e7aacd973b928fb79a93daff --- /dev/null +++ b/HumanEval_24/instruction.md @@ -0,0 +1,13 @@ +# HumanEval — HumanEval/24 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def largest_divisor(n: int) -> int: + """ For a given number n, find the largest number that divides n evenly, smaller than n + >>> largest_divisor(15) + 5 + """ +``` diff --git a/HumanEval_24/solution/__init__.py b/HumanEval_24/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..190711a872acfb17c3d95720ca62ba1886d025f7 --- /dev/null +++ b/HumanEval_24/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import largest_divisor diff --git a/HumanEval_24/solution/solution.py b/HumanEval_24/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..df0c25862a0d6c274a97d49c9ad4e4cd76a7c7be --- /dev/null +++ b/HumanEval_24/solution/solution.py @@ -0,0 +1,10 @@ + + +def largest_divisor(n: int) -> int: + """ For a given number n, find the largest number that divides n evenly, smaller than n + >>> largest_divisor(15) + 5 + """ + for i in reversed(range(n)): + if n % i == 0: + return i diff --git a/HumanEval_24/task.toml b/HumanEval_24/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8f1bd949ebccfff2a87075fae68daed3d6ec0433 --- /dev/null +++ b/HumanEval_24/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/24" +name = "HumanEval — HumanEval/24" + +[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/HumanEval_24/tests/__init__.py b/HumanEval_24/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_24/tests/conftest.py b/HumanEval_24/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_24/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/HumanEval_24/tests/test_humaneval.py b/HumanEval_24/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..df57629f014dc1af3a1a68b86248ce7deec36561 --- /dev/null +++ b/HumanEval_24/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import largest_divisor as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate(3) == 1 + assert candidate(7) == 1 + assert candidate(10) == 5 + assert candidate(100) == 50 + assert candidate(49) == 7 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_25/instruction.md b/HumanEval_25/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..3fe08b002c29f788cc1d56a7f741ac9b3564627f --- /dev/null +++ b/HumanEval_25/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/25 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def factorize(n: int) -> List[int]: + """ Return list of prime factors of given integer in the order from smallest to largest. + Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. + Input number should be equal to the product of all factors + >>> factorize(8) + [2, 2, 2] + >>> factorize(25) + [5, 5] + >>> factorize(70) + [2, 5, 7] + """ +``` diff --git a/HumanEval_25/solution/__init__.py b/HumanEval_25/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..24c79f60a303c4e0666c78217f7c0f9794e899f4 --- /dev/null +++ b/HumanEval_25/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import factorize diff --git a/HumanEval_25/solution/solution.py b/HumanEval_25/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..0d14851ba28ef918c4516b40629e2d3e1ceea7d9 --- /dev/null +++ b/HumanEval_25/solution/solution.py @@ -0,0 +1,27 @@ +from typing import List + + +def factorize(n: int) -> List[int]: + """ Return list of prime factors of given integer in the order from smallest to largest. + Each of the factors should be listed number of times corresponding to how many times it appeares in factorization. + Input number should be equal to the product of all factors + >>> factorize(8) + [2, 2, 2] + >>> factorize(25) + [5, 5] + >>> factorize(70) + [2, 5, 7] + """ + import math + fact = [] + i = 2 + while i <= int(math.sqrt(n) + 1): + if n % i == 0: + fact.append(i) + n //= i + else: + i += 1 + + if n > 1: + fact.append(n) + return fact diff --git a/HumanEval_25/task.toml b/HumanEval_25/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..db0eefe514f6b67d2c1c217889037e77cc9835c0 --- /dev/null +++ b/HumanEval_25/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/25" +name = "HumanEval — HumanEval/25" + +[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/HumanEval_25/tests/__init__.py b/HumanEval_25/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_25/tests/conftest.py b/HumanEval_25/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_25/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/HumanEval_25/tests/test_humaneval.py b/HumanEval_25/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..5619a3366e9f2611d71628675a4ededef2616ef2 --- /dev/null +++ b/HumanEval_25/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import factorize as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate(2) == [2] + assert candidate(4) == [2, 2] + assert candidate(8) == [2, 2, 2] + assert candidate(3 * 19) == [3, 19] + assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19] + assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19] + assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19] + assert candidate(3 * 2 * 3) == [2, 3, 3] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_26/instruction.md b/HumanEval_26/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0108b813f5edca0c3405deef82e639cc0a0ff05 --- /dev/null +++ b/HumanEval_26/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/26 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def remove_duplicates(numbers: List[int]) -> List[int]: + """ From a list of integers, remove all elements that occur more than once. + Keep order of elements left the same as in the input. + >>> remove_duplicates([1, 2, 3, 2, 4]) + [1, 3, 4] + """ +``` diff --git a/HumanEval_26/solution/__init__.py b/HumanEval_26/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2ddd4bdda0d01ae99b0374b9a4baf9697eb069b0 --- /dev/null +++ b/HumanEval_26/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import remove_duplicates diff --git a/HumanEval_26/solution/solution.py b/HumanEval_26/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..4fad7b1e8a9fef6c36863473d7ba740ae55fa4fc --- /dev/null +++ b/HumanEval_26/solution/solution.py @@ -0,0 +1,12 @@ +from typing import List + + +def remove_duplicates(numbers: List[int]) -> List[int]: + """ From a list of integers, remove all elements that occur more than once. + Keep order of elements left the same as in the input. + >>> remove_duplicates([1, 2, 3, 2, 4]) + [1, 3, 4] + """ + import collections + c = collections.Counter(numbers) + return [n for n in numbers if c[n] <= 1] diff --git a/HumanEval_26/task.toml b/HumanEval_26/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8d15068398e66b944dd724d5028bb8617df88ecb --- /dev/null +++ b/HumanEval_26/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/26" +name = "HumanEval — HumanEval/26" + +[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/HumanEval_26/tests/__init__.py b/HumanEval_26/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_26/tests/conftest.py b/HumanEval_26/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_26/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/HumanEval_26/tests/test_humaneval.py b/HumanEval_26/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..bc5b8e47c57f430102b09634d0e1c698d876139b --- /dev/null +++ b/HumanEval_26/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import remove_duplicates as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([]) == [] + assert candidate([1, 2, 3, 4]) == [1, 2, 3, 4] + assert candidate([1, 2, 3, 2, 4, 3, 5]) == [1, 4, 5] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_27/instruction.md b/HumanEval_27/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6642533fa2c1ef3e165134e605cd81895190b0e2 --- /dev/null +++ b/HumanEval_27/instruction.md @@ -0,0 +1,13 @@ +# HumanEval — HumanEval/27 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def flip_case(string: str) -> str: + """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase. + >>> flip_case('Hello') + 'hELLO' + """ +``` diff --git a/HumanEval_27/solution/__init__.py b/HumanEval_27/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f404c642396134ba292656ede45b8a07e7f47278 --- /dev/null +++ b/HumanEval_27/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import flip_case diff --git a/HumanEval_27/solution/solution.py b/HumanEval_27/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ee2cb04c75d9227f9c2689380d94722aa08886d9 --- /dev/null +++ b/HumanEval_27/solution/solution.py @@ -0,0 +1,8 @@ + + +def flip_case(string: str) -> str: + """ For a given string, flip lowercase characters to uppercase and uppercase to lowercase. + >>> flip_case('Hello') + 'hELLO' + """ + return string.swapcase() diff --git a/HumanEval_27/task.toml b/HumanEval_27/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e897902e07ff31166c590544393f591f433673f4 --- /dev/null +++ b/HumanEval_27/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/27" +name = "HumanEval — HumanEval/27" + +[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/HumanEval_27/tests/__init__.py b/HumanEval_27/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_27/tests/conftest.py b/HumanEval_27/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_27/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/HumanEval_27/tests/test_humaneval.py b/HumanEval_27/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..508ce836f81cbf11088bbf567228504398b5ce38 --- /dev/null +++ b/HumanEval_27/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import flip_case as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('') == '' + assert candidate('Hello!') == 'hELLO!' + assert candidate('These violent delights have violent ends') == 'tHESE VIOLENT DELIGHTS HAVE VIOLENT ENDS' + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_28/instruction.md b/HumanEval_28/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5289e6e215da41dbe1134b73ed14d35df135d61d --- /dev/null +++ b/HumanEval_28/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/28 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def concatenate(strings: List[str]) -> str: + """ Concatenate list of strings into a single string + >>> concatenate([]) + '' + >>> concatenate(['a', 'b', 'c']) + 'abc' + """ +``` diff --git a/HumanEval_28/solution/__init__.py b/HumanEval_28/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..600bbdbadd96d03f6a3c54fe57ccf08fdd67a581 --- /dev/null +++ b/HumanEval_28/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import concatenate diff --git a/HumanEval_28/solution/solution.py b/HumanEval_28/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..365bb973e20312367eeb24bce7661047f5db0d79 --- /dev/null +++ b/HumanEval_28/solution/solution.py @@ -0,0 +1,11 @@ +from typing import List + + +def concatenate(strings: List[str]) -> str: + """ Concatenate list of strings into a single string + >>> concatenate([]) + '' + >>> concatenate(['a', 'b', 'c']) + 'abc' + """ + return ''.join(strings) diff --git a/HumanEval_28/task.toml b/HumanEval_28/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..96fd82416b564e64004cdba795d51862e485f510 --- /dev/null +++ b/HumanEval_28/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/28" +name = "HumanEval — HumanEval/28" + +[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/HumanEval_28/tests/__init__.py b/HumanEval_28/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_28/tests/conftest.py b/HumanEval_28/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_28/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/HumanEval_28/tests/test_humaneval.py b/HumanEval_28/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..4ccd88d4a907949a2182feddd514b00eef1d6240 --- /dev/null +++ b/HumanEval_28/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import concatenate as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([]) == '' + assert candidate(['x', 'y', 'z']) == 'xyz' + assert candidate(['x', 'y', 'z', 'w', 'k']) == 'xyzwk' + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_29/instruction.md b/HumanEval_29/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..cc149ff427222cf06eb2f150be8fbae243d45b8a --- /dev/null +++ b/HumanEval_29/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/29 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def filter_by_prefix(strings: List[str], prefix: str) -> List[str]: + """ Filter an input list of strings only for ones that start with a given prefix. + >>> filter_by_prefix([], 'a') + [] + >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a') + ['abc', 'array'] + """ +``` diff --git a/HumanEval_29/solution/__init__.py b/HumanEval_29/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bcacdd5c675b8804fa84b18790557013fd893c33 --- /dev/null +++ b/HumanEval_29/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import filter_by_prefix diff --git a/HumanEval_29/solution/solution.py b/HumanEval_29/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..8632c6aa052bbb975735c61325d58cb602a5bcea --- /dev/null +++ b/HumanEval_29/solution/solution.py @@ -0,0 +1,11 @@ +from typing import List + + +def filter_by_prefix(strings: List[str], prefix: str) -> List[str]: + """ Filter an input list of strings only for ones that start with a given prefix. + >>> filter_by_prefix([], 'a') + [] + >>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a') + ['abc', 'array'] + """ + return [x for x in strings if x.startswith(prefix)] diff --git a/HumanEval_29/task.toml b/HumanEval_29/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..7141963c5ba05ba6b8b1b5a1a9c602002f92c7ea --- /dev/null +++ b/HumanEval_29/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/29" +name = "HumanEval — HumanEval/29" + +[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/HumanEval_29/tests/__init__.py b/HumanEval_29/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_29/tests/conftest.py b/HumanEval_29/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_29/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/HumanEval_29/tests/test_humaneval.py b/HumanEval_29/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..110b57fbf810763bd2213ba000b9a3d1f73c59f0 --- /dev/null +++ b/HumanEval_29/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import filter_by_prefix as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([], 'john') == [] + assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx'] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_3/instruction.md b/HumanEval_3/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e890dc2a5397966d39f1207ae698421e790e20fe --- /dev/null +++ b/HumanEval_3/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/3 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def below_zero(operations: List[int]) -> bool: + """ You're given a list of deposit and withdrawal operations on a bank account that starts with + zero balance. Your task is to detect if at any point the balance of account fallls below zero, and + at that point function should return True. Otherwise it should return False. + >>> below_zero([1, 2, 3]) + False + >>> below_zero([1, 2, -4, 5]) + True + """ +``` diff --git a/HumanEval_3/solution/__init__.py b/HumanEval_3/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fdb006c4b921db27a9f66b688c31f95ba2cbca68 --- /dev/null +++ b/HumanEval_3/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import below_zero diff --git a/HumanEval_3/solution/solution.py b/HumanEval_3/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..d8d20af07c22b16ebbf229166a18c7aeb42765b2 --- /dev/null +++ b/HumanEval_3/solution/solution.py @@ -0,0 +1,20 @@ +from typing import List + + +def below_zero(operations: List[int]) -> bool: + """ You're given a list of deposit and withdrawal operations on a bank account that starts with + zero balance. Your task is to detect if at any point the balance of account fallls below zero, and + at that point function should return True. Otherwise it should return False. + >>> below_zero([1, 2, 3]) + False + >>> below_zero([1, 2, -4, 5]) + True + """ + balance = 0 + + for op in operations: + balance += op + if balance < 0: + return True + + return False diff --git a/HumanEval_3/task.toml b/HumanEval_3/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0e9d5343fc5048e46fa38495af20473a0ab89deb --- /dev/null +++ b/HumanEval_3/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/3" +name = "HumanEval — HumanEval/3" + +[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/HumanEval_3/tests/__init__.py b/HumanEval_3/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_3/tests/conftest.py b/HumanEval_3/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_3/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/HumanEval_3/tests/test_humaneval.py b/HumanEval_3/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..213dc5217872b9da5009586430fccdafd3c7c4f9 --- /dev/null +++ b/HumanEval_3/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import below_zero as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([]) == False + assert candidate([1, 2, -3, 1, 2, -3]) == False + assert candidate([1, 2, -4, 5, 6]) == True + assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False + assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True + assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_30/instruction.md b/HumanEval_30/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0aa48e5ac9c8822e275777e488ffca2de9459495 --- /dev/null +++ b/HumanEval_30/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/30 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def get_positive(l: list): + """Return only positive numbers in the list. + >>> get_positive([-1, 2, -4, 5, 6]) + [2, 5, 6] + >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) + [5, 3, 2, 3, 9, 123, 1] + """ +``` diff --git a/HumanEval_30/solution/__init__.py b/HumanEval_30/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..230d89caad35555d5e953976adb1e34d73d3cb25 --- /dev/null +++ b/HumanEval_30/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import get_positive diff --git a/HumanEval_30/solution/solution.py b/HumanEval_30/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..16b5336f2f0e6467d3b94c670861b479624396a7 --- /dev/null +++ b/HumanEval_30/solution/solution.py @@ -0,0 +1,10 @@ + + +def get_positive(l: list): + """Return only positive numbers in the list. + >>> get_positive([-1, 2, -4, 5, 6]) + [2, 5, 6] + >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) + [5, 3, 2, 3, 9, 123, 1] + """ + return [e for e in l if e > 0] diff --git a/HumanEval_30/task.toml b/HumanEval_30/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..837ac36c9b67bce3394fe2334af111b85a416996 --- /dev/null +++ b/HumanEval_30/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/30" +name = "HumanEval — HumanEval/30" + +[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/HumanEval_30/tests/__init__.py b/HumanEval_30/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_30/tests/conftest.py b/HumanEval_30/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_30/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/HumanEval_30/tests/test_humaneval.py b/HumanEval_30/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..043a3ca81ea0abc5286eab78179b48a99c432f40 --- /dev/null +++ b/HumanEval_30/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import get_positive as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([-1, -2, 4, 5, 6]) == [4, 5, 6] + assert candidate([5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 3, 9, 123, 1] + assert candidate([-1, -2]) == [] + assert candidate([]) == [] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_31/instruction.md b/HumanEval_31/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..67c0d35f0173f24084fcefcfb7d95fca998333b3 --- /dev/null +++ b/HumanEval_31/instruction.md @@ -0,0 +1,25 @@ +# HumanEval — HumanEval/31 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def is_prime(n): + """Return true if a given number is prime, and false otherwise. + >>> is_prime(6) + False + >>> is_prime(101) + True + >>> is_prime(11) + True + >>> is_prime(13441) + True + >>> is_prime(61) + True + >>> is_prime(4) + False + >>> is_prime(1) + False + """ +``` diff --git a/HumanEval_31/solution/__init__.py b/HumanEval_31/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5a36ada06fbdae5610584671d96aad3f26de1621 --- /dev/null +++ b/HumanEval_31/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_prime diff --git a/HumanEval_31/solution/solution.py b/HumanEval_31/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c45692d2751112480f1ef2f0ad6d0cbd5d5ba1d4 --- /dev/null +++ b/HumanEval_31/solution/solution.py @@ -0,0 +1,25 @@ + + +def is_prime(n): + """Return true if a given number is prime, and false otherwise. + >>> is_prime(6) + False + >>> is_prime(101) + True + >>> is_prime(11) + True + >>> is_prime(13441) + True + >>> is_prime(61) + True + >>> is_prime(4) + False + >>> is_prime(1) + False + """ + if n < 2: + return False + for k in range(2, n - 1): + if n % k == 0: + return False + return True diff --git a/HumanEval_31/task.toml b/HumanEval_31/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..786d13027a5923b23a09e1b0ecea6f5a2bc97beb --- /dev/null +++ b/HumanEval_31/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/31" +name = "HumanEval — HumanEval/31" + +[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/HumanEval_31/tests/__init__.py b/HumanEval_31/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_31/tests/conftest.py b/HumanEval_31/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_31/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/HumanEval_31/tests/test_humaneval.py b/HumanEval_31/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2324cf9e48ed50636189168a84e8b03ad89bbb04 --- /dev/null +++ b/HumanEval_31/tests/test_humaneval.py @@ -0,0 +1,26 @@ +from solution import is_prime as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(6) == False + assert candidate(101) == True + assert candidate(11) == True + assert candidate(13441) == True + assert candidate(61) == True + assert candidate(4) == False + assert candidate(1) == False + assert candidate(5) == True + assert candidate(11) == True + assert candidate(17) == True + assert candidate(5 * 17) == False + assert candidate(11 * 7) == False + assert candidate(13441 * 19) == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_32/instruction.md b/HumanEval_32/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f6f62bebd3aaf93e840d61568075ed7a4c992bf6 --- /dev/null +++ b/HumanEval_32/instruction.md @@ -0,0 +1,29 @@ +# HumanEval — HumanEval/32 + +Complete the following Python function so that it satisfies its docstring. + +```python +import math + + +def poly(xs: list, x: float): + """ + Evaluates polynomial with coefficients xs at point x. + return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n + """ + return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)]) + + +def find_zero(xs: list): + """ xs are coefficients of a polynomial. + find_zero find x such that poly(x) = 0. + find_zero returns only only zero point, even if there are many. + Moreover, find_zero only takes list xs having even number of coefficients + and largest non zero coefficient as it guarantees + a solution. + >>> round(find_zero([1, 2]), 2) # f(x) = 1 + 2x + -0.5 + >>> round(find_zero([-6, 11, -6, 1]), 2) # (x - 1) * (x - 2) * (x - 3) = -6 + 11x - 6x^2 + x^3 + 1.0 + """ +``` diff --git a/HumanEval_32/solution/__init__.py b/HumanEval_32/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..086c4c6672291179897137174d827e58f5f59e43 --- /dev/null +++ b/HumanEval_32/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import find_zero diff --git a/HumanEval_32/solution/solution.py b/HumanEval_32/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..762ce94e5405ad1e66cd7223fa54168c18674ebb --- /dev/null +++ b/HumanEval_32/solution/solution.py @@ -0,0 +1,34 @@ +import math + + +def poly(xs: list, x: float): + """ + Evaluates polynomial with coefficients xs at point x. + return xs[0] + xs[1] * x + xs[1] * x^2 + .... xs[n] * x^n + """ + return sum([coeff * math.pow(x, i) for i, coeff in enumerate(xs)]) + + +def find_zero(xs: list): + """ xs are coefficients of a polynomial. + find_zero find x such that poly(x) = 0. + find_zero returns only only zero point, even if there are many. + Moreover, find_zero only takes list xs having even number of coefficients + and largest non zero coefficient as it guarantees + a solution. + >>> round(find_zero([1, 2]), 2) # f(x) = 1 + 2x + -0.5 + >>> round(find_zero([-6, 11, -6, 1]), 2) # (x - 1) * (x - 2) * (x - 3) = -6 + 11x - 6x^2 + x^3 + 1.0 + """ + begin, end = -1., 1. + while poly(xs, begin) * poly(xs, end) > 0: + begin *= 2.0 + end *= 2.0 + while end - begin > 1e-10: + center = (begin + end) / 2.0 + if poly(xs, center) * poly(xs, begin) > 0: + begin = center + else: + end = center + return begin diff --git a/HumanEval_32/task.toml b/HumanEval_32/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bd648f241c62e66fec280dc5118ef946f4eeb968 --- /dev/null +++ b/HumanEval_32/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/32" +name = "HumanEval — HumanEval/32" + +[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/HumanEval_32/tests/__init__.py b/HumanEval_32/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_32/tests/conftest.py b/HumanEval_32/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_32/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/HumanEval_32/tests/test_humaneval.py b/HumanEval_32/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..5380ac59b3a4887584381a5e51303415578ad8c1 --- /dev/null +++ b/HumanEval_32/tests/test_humaneval.py @@ -0,0 +1,27 @@ +from solution import find_zero as candidate + + + +METADATA = {} + + +def check(candidate): + import math + import random + rng = random.Random(42) + import copy + for _ in range(100): + ncoeff = 2 * rng.randint(1, 4) + coeffs = [] + for _ in range(ncoeff): + coeff = rng.randint(-10, 10) + if coeff == 0: + coeff = 1 + coeffs.append(coeff) + solution = candidate(copy.deepcopy(coeffs)) + assert math.fabs(poly(coeffs, solution)) < 1e-4 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_33/instruction.md b/HumanEval_33/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5a299527254ef097c1a9239ce4b33cfe8ffb2e26 --- /dev/null +++ b/HumanEval_33/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/33 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def sort_third(l: list): + """This function takes a list l and returns a list l' such that + l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal + to the values of the corresponding indicies of l, but sorted. + >>> sort_third([1, 2, 3]) + [1, 2, 3] + >>> sort_third([5, 6, 3, 4, 8, 9, 2]) + [2, 6, 3, 4, 8, 9, 5] + """ +``` diff --git a/HumanEval_33/solution/__init__.py b/HumanEval_33/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5e5d16ff3e5c554db86ecf402849dfdb642d4edd --- /dev/null +++ b/HumanEval_33/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sort_third diff --git a/HumanEval_33/solution/solution.py b/HumanEval_33/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..26c85564f13a8d50bc10666c0ef98665a47903d4 --- /dev/null +++ b/HumanEval_33/solution/solution.py @@ -0,0 +1,14 @@ + + +def sort_third(l: list): + """This function takes a list l and returns a list l' such that + l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal + to the values of the corresponding indicies of l, but sorted. + >>> sort_third([1, 2, 3]) + [1, 2, 3] + >>> sort_third([5, 6, 3, 4, 8, 9, 2]) + [2, 6, 3, 4, 8, 9, 5] + """ + l = list(l) + l[::3] = sorted(l[::3]) + return l diff --git a/HumanEval_33/task.toml b/HumanEval_33/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ef949211ece5692385dbce02785fbb13c2513310 --- /dev/null +++ b/HumanEval_33/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/33" +name = "HumanEval — HumanEval/33" + +[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/HumanEval_33/tests/__init__.py b/HumanEval_33/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_33/tests/conftest.py b/HumanEval_33/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_33/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/HumanEval_33/tests/test_humaneval.py b/HumanEval_33/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2e18e3e6d58452440882a5bf166e3919810bdbe3 --- /dev/null +++ b/HumanEval_33/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import sort_third as candidate + + + +METADATA = {} + + +def check(candidate): + assert tuple(candidate([1, 2, 3])) == tuple(sort_third([1, 2, 3])) + assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple(sort_third([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) + assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple(sort_third([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) + assert tuple(candidate([5, 6, 3, 4, 8, 9, 2])) == tuple([2, 6, 3, 4, 8, 9, 5]) + assert tuple(candidate([5, 8, 3, 4, 6, 9, 2])) == tuple([2, 8, 3, 4, 6, 9, 5]) + assert tuple(candidate([5, 6, 9, 4, 8, 3, 2])) == tuple([2, 6, 9, 4, 8, 3, 5]) + assert tuple(candidate([5, 6, 3, 4, 8, 9, 2, 1])) == tuple([2, 6, 3, 4, 8, 9, 5, 1]) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_34/instruction.md b/HumanEval_34/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f221e18c4c2fb9aad463ee681c0aa23e9783738f --- /dev/null +++ b/HumanEval_34/instruction.md @@ -0,0 +1,13 @@ +# HumanEval — HumanEval/34 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def unique(l: list): + """Return sorted unique elements in a list + >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) + [0, 2, 3, 5, 9, 123] + """ +``` diff --git a/HumanEval_34/solution/__init__.py b/HumanEval_34/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..467c230fb18a6f7004bc7a03e9ded9a7c6b16a66 --- /dev/null +++ b/HumanEval_34/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import unique diff --git a/HumanEval_34/solution/solution.py b/HumanEval_34/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ef1d995b50a214ecfefb2877b78b218bb26ef823 --- /dev/null +++ b/HumanEval_34/solution/solution.py @@ -0,0 +1,8 @@ + + +def unique(l: list): + """Return sorted unique elements in a list + >>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123]) + [0, 2, 3, 5, 9, 123] + """ + return sorted(list(set(l))) diff --git a/HumanEval_34/task.toml b/HumanEval_34/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6644994ab182993f6188035518cebf38956ed61f --- /dev/null +++ b/HumanEval_34/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/34" +name = "HumanEval — HumanEval/34" + +[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/HumanEval_34/tests/__init__.py b/HumanEval_34/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_34/tests/conftest.py b/HumanEval_34/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_34/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/HumanEval_34/tests/test_humaneval.py b/HumanEval_34/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9b207a9f226e88afbdd8eafdc055b1e97a57030d --- /dev/null +++ b/HumanEval_34/tests/test_humaneval.py @@ -0,0 +1,14 @@ +from solution import unique as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_35/instruction.md b/HumanEval_35/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a1306198c6018d761f3c3961859dad9949be962e --- /dev/null +++ b/HumanEval_35/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/35 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def max_element(l: list): + """Return maximum element in the list. + >>> max_element([1, 2, 3]) + 3 + >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) + 123 + """ +``` diff --git a/HumanEval_35/solution/__init__.py b/HumanEval_35/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..831c655553a68720479bd14c216118b0708f1df2 --- /dev/null +++ b/HumanEval_35/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import max_element diff --git a/HumanEval_35/solution/solution.py b/HumanEval_35/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..34764fdb1f7b5f2b3054255291e7eb044a667e9a --- /dev/null +++ b/HumanEval_35/solution/solution.py @@ -0,0 +1,14 @@ + + +def max_element(l: list): + """Return maximum element in the list. + >>> max_element([1, 2, 3]) + 3 + >>> max_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) + 123 + """ + m = l[0] + for e in l: + if e > m: + m = e + return m diff --git a/HumanEval_35/task.toml b/HumanEval_35/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..be5f1590a778f5f79a677726b6ae9593dd1b8ec5 --- /dev/null +++ b/HumanEval_35/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/35" +name = "HumanEval — HumanEval/35" + +[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/HumanEval_35/tests/__init__.py b/HumanEval_35/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_35/tests/conftest.py b/HumanEval_35/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_35/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/HumanEval_35/tests/test_humaneval.py b/HumanEval_35/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2e2cc6de79ad9e44b4e1090f8337056dd957d41e --- /dev/null +++ b/HumanEval_35/tests/test_humaneval.py @@ -0,0 +1,14 @@ +from solution import max_element as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([1, 2, 3]) == 3 + assert candidate([5, 3, -5, 2, -3, 3, 9, 0, 124, 1, -10]) == 124 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_36/instruction.md b/HumanEval_36/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..9383e1b4dffddc2a12d529b12838cb492e30abe6 --- /dev/null +++ b/HumanEval_36/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/36 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def fizz_buzz(n: int): + """Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. + >>> fizz_buzz(50) + 0 + >>> fizz_buzz(78) + 2 + >>> fizz_buzz(79) + 3 + """ +``` diff --git a/HumanEval_36/solution/__init__.py b/HumanEval_36/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b1ebd3d45af37d38334efbbf52e4cd40186c4691 --- /dev/null +++ b/HumanEval_36/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import fizz_buzz diff --git a/HumanEval_36/solution/solution.py b/HumanEval_36/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ca232454c66f0fd13232d68f30e1beb6976bd515 --- /dev/null +++ b/HumanEval_36/solution/solution.py @@ -0,0 +1,20 @@ + + +def fizz_buzz(n: int): + """Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13. + >>> fizz_buzz(50) + 0 + >>> fizz_buzz(78) + 2 + >>> fizz_buzz(79) + 3 + """ + ns = [] + for i in range(n): + if i % 11 == 0 or i % 13 == 0: + ns.append(i) + s = ''.join(list(map(str, ns))) + ans = 0 + for c in s: + ans += (c == '7') + return ans diff --git a/HumanEval_36/task.toml b/HumanEval_36/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..15366503730d49b50d08f6db8d8d173bebc5d158 --- /dev/null +++ b/HumanEval_36/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/36" +name = "HumanEval — HumanEval/36" + +[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/HumanEval_36/tests/__init__.py b/HumanEval_36/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_36/tests/conftest.py b/HumanEval_36/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_36/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/HumanEval_36/tests/test_humaneval.py b/HumanEval_36/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..1f2b02f8de6aa8f7ec5f003896a220252cae134e --- /dev/null +++ b/HumanEval_36/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import fizz_buzz as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(50) == 0 + assert candidate(78) == 2 + assert candidate(79) == 3 + assert candidate(100) == 3 + assert candidate(200) == 6 + assert candidate(4000) == 192 + assert candidate(10000) == 639 + assert candidate(100000) == 8026 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_37/instruction.md b/HumanEval_37/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d44b44cbb0526ece29c68567f74072416ed54ab4 --- /dev/null +++ b/HumanEval_37/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/37 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def sort_even(l: list): + """This function takes a list l and returns a list l' such that + l' is identical to l in the odd indicies, while its values at the even indicies are equal + to the values of the even indicies of l, but sorted. + >>> sort_even([1, 2, 3]) + [1, 2, 3] + >>> sort_even([5, 6, 3, 4]) + [3, 6, 5, 4] + """ +``` diff --git a/HumanEval_37/solution/__init__.py b/HumanEval_37/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..915d0a096e3a04c0c1def467e9891f8cd302b80b --- /dev/null +++ b/HumanEval_37/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sort_even diff --git a/HumanEval_37/solution/solution.py b/HumanEval_37/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..b48d6a7c512a93904408eb2811457b325a76baaa --- /dev/null +++ b/HumanEval_37/solution/solution.py @@ -0,0 +1,20 @@ + + +def sort_even(l: list): + """This function takes a list l and returns a list l' such that + l' is identical to l in the odd indicies, while its values at the even indicies are equal + to the values of the even indicies of l, but sorted. + >>> sort_even([1, 2, 3]) + [1, 2, 3] + >>> sort_even([5, 6, 3, 4]) + [3, 6, 5, 4] + """ + evens = l[::2] + odds = l[1::2] + evens.sort() + ans = [] + for e, o in zip(evens, odds): + ans.extend([e, o]) + if len(evens) > len(odds): + ans.append(evens[-1]) + return ans diff --git a/HumanEval_37/task.toml b/HumanEval_37/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cb2e876cd9b9222b9a2edb64991d4f44c717a142 --- /dev/null +++ b/HumanEval_37/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/37" +name = "HumanEval — HumanEval/37" + +[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/HumanEval_37/tests/__init__.py b/HumanEval_37/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_37/tests/conftest.py b/HumanEval_37/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_37/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/HumanEval_37/tests/test_humaneval.py b/HumanEval_37/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..940a8fbd00e725e68c7d556c88b9629fcdcc68b9 --- /dev/null +++ b/HumanEval_37/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import sort_even as candidate + + + +METADATA = {} + + +def check(candidate): + assert tuple(candidate([1, 2, 3])) == tuple([1, 2, 3]) + assert tuple(candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])) == tuple([-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]) + assert tuple(candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10])) == tuple([-12, 8, 3, 4, 5, 2, 12, 11, 23, -10]) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_38/instruction.md b/HumanEval_38/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a3130a8823388a9c52398f937bacb00ea6bdf93e --- /dev/null +++ b/HumanEval_38/instruction.md @@ -0,0 +1,23 @@ +# HumanEval — HumanEval/38 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def encode_cyclic(s: str): + """ + returns encoded string by cycling groups of three characters. + """ + # split string to groups. Each of length 3. + groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)] + # cycle elements in each group. Unless group has fewer elements than 3. + groups = [(group[1:] + group[0]) if len(group) == 3 else group for group in groups] + return "".join(groups) + + +def decode_cyclic(s: str): + """ + takes as input string encoded with encode_cyclic function. Returns decoded string. + """ +``` diff --git a/HumanEval_38/solution/__init__.py b/HumanEval_38/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..327c59f4c8b836a2a453448fc16a5a3a822fd086 --- /dev/null +++ b/HumanEval_38/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import decode_cyclic diff --git a/HumanEval_38/solution/solution.py b/HumanEval_38/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..d6542712f033911d80244152aa0852fb1c0ac340 --- /dev/null +++ b/HumanEval_38/solution/solution.py @@ -0,0 +1,18 @@ + + +def encode_cyclic(s: str): + """ + returns encoded string by cycling groups of three characters. + """ + # split string to groups. Each of length 3. + groups = [s[(3 * i):min((3 * i + 3), len(s))] for i in range((len(s) + 2) // 3)] + # cycle elements in each group. Unless group has fewer elements than 3. + groups = [(group[1:] + group[0]) if len(group) == 3 else group for group in groups] + return "".join(groups) + + +def decode_cyclic(s: str): + """ + takes as input string encoded with encode_cyclic function. Returns decoded string. + """ + return encode_cyclic(encode_cyclic(s)) diff --git a/HumanEval_38/task.toml b/HumanEval_38/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fa6c3ccb6034316faa3327ad9e980bac5e56cad4 --- /dev/null +++ b/HumanEval_38/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/38" +name = "HumanEval — HumanEval/38" + +[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/HumanEval_38/tests/__init__.py b/HumanEval_38/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_38/tests/conftest.py b/HumanEval_38/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_38/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/HumanEval_38/tests/test_humaneval.py b/HumanEval_38/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..f75fb112ca9e10d4b6d409a6463b7df625cb989f --- /dev/null +++ b/HumanEval_38/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import decode_cyclic as candidate + + + +METADATA = {} + + +def check(candidate): + from random import randint, choice + import string + + letters = string.ascii_lowercase + for _ in range(100): + str = ''.join(choice(letters) for i in range(randint(10, 20))) + encoded_str = encode_cyclic(str) + assert candidate(encoded_str) == str + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_39/instruction.md b/HumanEval_39/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f28ff0379dd3587477942a0b08b8697b6db5eacc --- /dev/null +++ b/HumanEval_39/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/39 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def prime_fib(n: int): + """ + prime_fib returns n-th number that is a Fibonacci number and it's also prime. + >>> prime_fib(1) + 2 + >>> prime_fib(2) + 3 + >>> prime_fib(3) + 5 + >>> prime_fib(4) + 13 + >>> prime_fib(5) + 89 + """ +``` diff --git a/HumanEval_39/solution/__init__.py b/HumanEval_39/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..86d8abd9a19b267fe4642020e2a0896cbe5873a6 --- /dev/null +++ b/HumanEval_39/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import prime_fib diff --git a/HumanEval_39/solution/solution.py b/HumanEval_39/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..53209ccf2841cf3f41ef4067abf42a23b9fc3cba --- /dev/null +++ b/HumanEval_39/solution/solution.py @@ -0,0 +1,32 @@ + + +def prime_fib(n: int): + """ + prime_fib returns n-th number that is a Fibonacci number and it's also prime. + >>> prime_fib(1) + 2 + >>> prime_fib(2) + 3 + >>> prime_fib(3) + 5 + >>> prime_fib(4) + 13 + >>> prime_fib(5) + 89 + """ + import math + + def is_prime(p): + if p < 2: + return False + for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): + if p % k == 0: + return False + return True + f = [0, 1] + while True: + f.append(f[-1] + f[-2]) + if is_prime(f[-1]): + n -= 1 + if n == 0: + return f[-1] diff --git a/HumanEval_39/task.toml b/HumanEval_39/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0ba806357c64706074a6c44cc787d553ccd3222e --- /dev/null +++ b/HumanEval_39/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/39" +name = "HumanEval — HumanEval/39" + +[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/HumanEval_39/tests/__init__.py b/HumanEval_39/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_39/tests/conftest.py b/HumanEval_39/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_39/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/HumanEval_39/tests/test_humaneval.py b/HumanEval_39/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..811bdfa4ad3518abe31f5ae9277b64226cb0ea97 --- /dev/null +++ b/HumanEval_39/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import prime_fib as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(1) == 2 + assert candidate(2) == 3 + assert candidate(3) == 5 + assert candidate(4) == 13 + assert candidate(5) == 89 + assert candidate(6) == 233 + assert candidate(7) == 1597 + assert candidate(8) == 28657 + assert candidate(9) == 514229 + assert candidate(10) == 433494437 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_4/instruction.md b/HumanEval_4/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..25572af9b7c4eb3fee9dab21ee957724b80d81a8 --- /dev/null +++ b/HumanEval_4/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/4 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def mean_absolute_deviation(numbers: List[float]) -> float: + """ For a given list of input numbers, calculate Mean Absolute Deviation + around the mean of this dataset. + Mean Absolute Deviation is the average absolute difference between each + element and a centerpoint (mean in this case): + MAD = average | x - x_mean | + >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) + 1.0 + """ +``` diff --git a/HumanEval_4/solution/__init__.py b/HumanEval_4/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9de90fd22b9701df84fa32b63d03d97e2c733f70 --- /dev/null +++ b/HumanEval_4/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import mean_absolute_deviation diff --git a/HumanEval_4/solution/solution.py b/HumanEval_4/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..d22e661a4b05df875253dae113e1d38e0b43218b --- /dev/null +++ b/HumanEval_4/solution/solution.py @@ -0,0 +1,14 @@ +from typing import List + + +def mean_absolute_deviation(numbers: List[float]) -> float: + """ For a given list of input numbers, calculate Mean Absolute Deviation + around the mean of this dataset. + Mean Absolute Deviation is the average absolute difference between each + element and a centerpoint (mean in this case): + MAD = average | x - x_mean | + >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) + 1.0 + """ + mean = sum(numbers) / len(numbers) + return sum(abs(x - mean) for x in numbers) / len(numbers) diff --git a/HumanEval_4/task.toml b/HumanEval_4/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f5deb5f4c5d59d70bb240ce115d87fac055c2dc0 --- /dev/null +++ b/HumanEval_4/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/4" +name = "HumanEval — HumanEval/4" + +[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/HumanEval_4/tests/__init__.py b/HumanEval_4/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_4/tests/conftest.py b/HumanEval_4/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_4/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/HumanEval_4/tests/test_humaneval.py b/HumanEval_4/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..214b65f338ba6404fa7cc33469a5d7b0a271e9b4 --- /dev/null +++ b/HumanEval_4/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import mean_absolute_deviation as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert abs(candidate([1.0, 2.0, 3.0]) - 2.0/3.0) < 1e-6 + assert abs(candidate([1.0, 2.0, 3.0, 4.0]) - 1.0) < 1e-6 + assert abs(candidate([1.0, 2.0, 3.0, 4.0, 5.0]) - 6.0/5.0) < 1e-6 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_40/instruction.md b/HumanEval_40/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b15665a1cdfda287fcf5ec53936bb8f86c3342b2 --- /dev/null +++ b/HumanEval_40/instruction.md @@ -0,0 +1,25 @@ +# HumanEval — HumanEval/40 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def triples_sum_to_zero(l: list): + """ + triples_sum_to_zero takes a list of integers as an input. + it returns True if there are three distinct elements in the list that + sum to zero, and False otherwise. + + >>> triples_sum_to_zero([1, 3, 5, 0]) + False + >>> triples_sum_to_zero([1, 3, -2, 1]) + True + >>> triples_sum_to_zero([1, 2, 3, 7]) + False + >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) + True + >>> triples_sum_to_zero([1]) + False + """ +``` diff --git a/HumanEval_40/solution/__init__.py b/HumanEval_40/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d2bb71d4ca2132456b451dc3583202a1c62cd1e8 --- /dev/null +++ b/HumanEval_40/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import triples_sum_to_zero diff --git a/HumanEval_40/solution/solution.py b/HumanEval_40/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..a95f5b79fed4c882fd412f7ff3a1826c1a25d3cc --- /dev/null +++ b/HumanEval_40/solution/solution.py @@ -0,0 +1,25 @@ + + +def triples_sum_to_zero(l: list): + """ + triples_sum_to_zero takes a list of integers as an input. + it returns True if there are three distinct elements in the list that + sum to zero, and False otherwise. + + >>> triples_sum_to_zero([1, 3, 5, 0]) + False + >>> triples_sum_to_zero([1, 3, -2, 1]) + True + >>> triples_sum_to_zero([1, 2, 3, 7]) + False + >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) + True + >>> triples_sum_to_zero([1]) + False + """ + for i in range(len(l)): + for j in range(i + 1, len(l)): + for k in range(j + 1, len(l)): + if l[i] + l[j] + l[k] == 0: + return True + return False diff --git a/HumanEval_40/task.toml b/HumanEval_40/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..440b016f5d4ad1727f6566504ce525d3c32079ea --- /dev/null +++ b/HumanEval_40/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/40" +name = "HumanEval — HumanEval/40" + +[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/HumanEval_40/tests/__init__.py b/HumanEval_40/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_40/tests/conftest.py b/HumanEval_40/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_40/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/HumanEval_40/tests/test_humaneval.py b/HumanEval_40/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..67e5d834f66062dd6a764bc191039c6b2c45412c --- /dev/null +++ b/HumanEval_40/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import triples_sum_to_zero as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([1, 3, 5, 0]) == False + assert candidate([1, 3, 5, -1]) == False + assert candidate([1, 3, -2, 1]) == True + assert candidate([1, 2, 3, 7]) == False + assert candidate([1, 2, 5, 7]) == False + assert candidate([2, 4, -5, 3, 9, 7]) == True + assert candidate([1]) == False + assert candidate([1, 3, 5, -100]) == False + assert candidate([100, 3, 5, -100]) == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_41/instruction.md b/HumanEval_41/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d4e53e961f2c166a3c06bb777d851943c2d12310 --- /dev/null +++ b/HumanEval_41/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/41 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def car_race_collision(n: int): + """ + Imagine a road that's a perfectly straight infinitely long line. + n cars are driving left to right; simultaneously, a different set of n cars + are driving right to left. The two sets of cars start out being very far from + each other. All cars move in the same speed. Two cars are said to collide + when a car that's moving left to right hits a car that's moving right to left. + However, the cars are infinitely sturdy and strong; as a result, they continue moving + in their trajectory as if they did not collide. + + This function outputs the number of such collisions. + """ +``` diff --git a/HumanEval_41/solution/__init__.py b/HumanEval_41/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cabe1574f1829bde1d96d76a355f4248e2149901 --- /dev/null +++ b/HumanEval_41/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import car_race_collision diff --git a/HumanEval_41/solution/solution.py b/HumanEval_41/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..589406d9bd280ecd6529941da73fe22c89f8adcc --- /dev/null +++ b/HumanEval_41/solution/solution.py @@ -0,0 +1,15 @@ + + +def car_race_collision(n: int): + """ + Imagine a road that's a perfectly straight infinitely long line. + n cars are driving left to right; simultaneously, a different set of n cars + are driving right to left. The two sets of cars start out being very far from + each other. All cars move in the same speed. Two cars are said to collide + when a car that's moving left to right hits a car that's moving right to left. + However, the cars are infinitely sturdy and strong; as a result, they continue moving + in their trajectory as if they did not collide. + + This function outputs the number of such collisions. + """ + return n**2 diff --git a/HumanEval_41/task.toml b/HumanEval_41/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ffa868ee805b7af02feaf8db7e4fb6fc0b1d5650 --- /dev/null +++ b/HumanEval_41/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/41" +name = "HumanEval — HumanEval/41" + +[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/HumanEval_41/tests/__init__.py b/HumanEval_41/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_41/tests/conftest.py b/HumanEval_41/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_41/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/HumanEval_41/tests/test_humaneval.py b/HumanEval_41/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3a9032519d32d41b8d0b4794ef67749ec90046c5 --- /dev/null +++ b/HumanEval_41/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import car_race_collision as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(2) == 4 + assert candidate(3) == 9 + assert candidate(4) == 16 + assert candidate(8) == 64 + assert candidate(10) == 100 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_42/instruction.md b/HumanEval_42/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a26f4f409f6b18ad536fe41896edcccb6e77c379 --- /dev/null +++ b/HumanEval_42/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/42 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def incr_list(l: list): + """Return list with elements incremented by 1. + >>> incr_list([1, 2, 3]) + [2, 3, 4] + >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123]) + [6, 4, 6, 3, 4, 4, 10, 1, 124] + """ +``` diff --git a/HumanEval_42/solution/__init__.py b/HumanEval_42/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1f1b6db75155528e51cb5643c4864fa120cee0f4 --- /dev/null +++ b/HumanEval_42/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import incr_list diff --git a/HumanEval_42/solution/solution.py b/HumanEval_42/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..36f8f96badaeab70733426411e8e0c2dddfb7b3d --- /dev/null +++ b/HumanEval_42/solution/solution.py @@ -0,0 +1,10 @@ + + +def incr_list(l: list): + """Return list with elements incremented by 1. + >>> incr_list([1, 2, 3]) + [2, 3, 4] + >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123]) + [6, 4, 6, 3, 4, 4, 10, 1, 124] + """ + return [(e + 1) for e in l] diff --git a/HumanEval_42/task.toml b/HumanEval_42/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..8f4d0c117d279438a90f800d12e13fdd2f45128d --- /dev/null +++ b/HumanEval_42/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/42" +name = "HumanEval — HumanEval/42" + +[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/HumanEval_42/tests/__init__.py b/HumanEval_42/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_42/tests/conftest.py b/HumanEval_42/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_42/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/HumanEval_42/tests/test_humaneval.py b/HumanEval_42/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..cc52555ddefdb67c5b9711f083a58b32263d0aa6 --- /dev/null +++ b/HumanEval_42/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import incr_list as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([]) == [] + assert candidate([3, 2, 1]) == [4, 3, 2] + assert candidate([5, 2, 5, 2, 3, 3, 9, 0, 123]) == [6, 3, 6, 3, 4, 4, 10, 1, 124] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_43/instruction.md b/HumanEval_43/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..75b6e9e0fb74b312f3d34e5fb5339247c27cc578 --- /dev/null +++ b/HumanEval_43/instruction.md @@ -0,0 +1,24 @@ +# HumanEval — HumanEval/43 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def pairs_sum_to_zero(l): + """ + pairs_sum_to_zero takes a list of integers as an input. + it returns True if there are two distinct elements in the list that + sum to zero, and False otherwise. + >>> pairs_sum_to_zero([1, 3, 5, 0]) + False + >>> pairs_sum_to_zero([1, 3, -2, 1]) + False + >>> pairs_sum_to_zero([1, 2, 3, 7]) + False + >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) + True + >>> pairs_sum_to_zero([1]) + False + """ +``` diff --git a/HumanEval_43/solution/__init__.py b/HumanEval_43/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3f0b172b4102eb13dbc01cfc96a330e164bdc372 --- /dev/null +++ b/HumanEval_43/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import pairs_sum_to_zero diff --git a/HumanEval_43/solution/solution.py b/HumanEval_43/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..122de1c6a0c35f03a4d47a6eb3e67421f21a534a --- /dev/null +++ b/HumanEval_43/solution/solution.py @@ -0,0 +1,23 @@ + + +def pairs_sum_to_zero(l): + """ + pairs_sum_to_zero takes a list of integers as an input. + it returns True if there are two distinct elements in the list that + sum to zero, and False otherwise. + >>> pairs_sum_to_zero([1, 3, 5, 0]) + False + >>> pairs_sum_to_zero([1, 3, -2, 1]) + False + >>> pairs_sum_to_zero([1, 2, 3, 7]) + False + >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) + True + >>> pairs_sum_to_zero([1]) + False + """ + for i, l1 in enumerate(l): + for j in range(i + 1, len(l)): + if l1 + l[j] == 0: + return True + return False diff --git a/HumanEval_43/task.toml b/HumanEval_43/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..def246ddd2c69976012105ce97102b351a9ce78c --- /dev/null +++ b/HumanEval_43/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/43" +name = "HumanEval — HumanEval/43" + +[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/HumanEval_43/tests/__init__.py b/HumanEval_43/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_43/tests/conftest.py b/HumanEval_43/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_43/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/HumanEval_43/tests/test_humaneval.py b/HumanEval_43/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..0b8bbd36796118275441ebbb3a9659e5acaa4972 --- /dev/null +++ b/HumanEval_43/tests/test_humaneval.py @@ -0,0 +1,23 @@ +from solution import pairs_sum_to_zero as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([1, 3, 5, 0]) == False + assert candidate([1, 3, -2, 1]) == False + assert candidate([1, 2, 3, 7]) == False + assert candidate([2, 4, -5, 3, 5, 7]) == True + assert candidate([1]) == False + + assert candidate([-3, 9, -1, 3, 2, 30]) == True + assert candidate([-3, 9, -1, 3, 2, 31]) == True + assert candidate([-3, 9, -1, 4, 2, 30]) == False + assert candidate([-3, 9, -1, 4, 2, 31]) == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_44/instruction.md b/HumanEval_44/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a0785badd85a476343be70165d2c7b62e3d9a65f --- /dev/null +++ b/HumanEval_44/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/44 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def change_base(x: int, base: int): + """Change numerical base of input number x to base. + return string representation after the conversion. + base numbers are less than 10. + >>> change_base(8, 3) + '22' + >>> change_base(8, 2) + '1000' + >>> change_base(7, 2) + '111' + """ +``` diff --git a/HumanEval_44/solution/__init__.py b/HumanEval_44/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c9c2c127ab33f390cbf6068b3861eca6cf45d703 --- /dev/null +++ b/HumanEval_44/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import change_base diff --git a/HumanEval_44/solution/solution.py b/HumanEval_44/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..cea9a2e85a4f65b25df128ebea464915b4cf425f --- /dev/null +++ b/HumanEval_44/solution/solution.py @@ -0,0 +1,18 @@ + + +def change_base(x: int, base: int): + """Change numerical base of input number x to base. + return string representation after the conversion. + base numbers are less than 10. + >>> change_base(8, 3) + '22' + >>> change_base(8, 2) + '1000' + >>> change_base(7, 2) + '111' + """ + ret = "" + while x > 0: + ret = str(x % base) + ret + x //= base + return ret diff --git a/HumanEval_44/task.toml b/HumanEval_44/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..619b79f71730ca4d23dbe544aac949b49e1acb85 --- /dev/null +++ b/HumanEval_44/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/44" +name = "HumanEval — HumanEval/44" + +[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/HumanEval_44/tests/__init__.py b/HumanEval_44/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_44/tests/conftest.py b/HumanEval_44/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_44/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/HumanEval_44/tests/test_humaneval.py b/HumanEval_44/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..89b1a0a5620ee0619fdd8fcbf0ef1c4fba5d966a --- /dev/null +++ b/HumanEval_44/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import change_base as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(8, 3) == "22" + assert candidate(9, 3) == "100" + assert candidate(234, 2) == "11101010" + assert candidate(16, 2) == "10000" + assert candidate(8, 2) == "1000" + assert candidate(7, 2) == "111" + for x in range(2, 8): + assert candidate(x, x + 1) == str(x) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_45/instruction.md b/HumanEval_45/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4617c5bd8f510cc3eaa15428895327c40fb63296 --- /dev/null +++ b/HumanEval_45/instruction.md @@ -0,0 +1,13 @@ +# HumanEval — HumanEval/45 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def triangle_area(a, h): + """Given length of a side and high return area for a triangle. + >>> triangle_area(5, 3) + 7.5 + """ +``` diff --git a/HumanEval_45/solution/__init__.py b/HumanEval_45/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e75b1940b0a8e9a241b607fda51a71a9142852be --- /dev/null +++ b/HumanEval_45/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import triangle_area diff --git a/HumanEval_45/solution/solution.py b/HumanEval_45/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..4ae97ce8b71d9053e2d59ea4445ec72963c5a4b5 --- /dev/null +++ b/HumanEval_45/solution/solution.py @@ -0,0 +1,8 @@ + + +def triangle_area(a, h): + """Given length of a side and high return area for a triangle. + >>> triangle_area(5, 3) + 7.5 + """ + return a * h / 2.0 diff --git a/HumanEval_45/task.toml b/HumanEval_45/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..41885deb553a5690dc20ef7026a6762c136b15f7 --- /dev/null +++ b/HumanEval_45/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/45" +name = "HumanEval — HumanEval/45" + +[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/HumanEval_45/tests/__init__.py b/HumanEval_45/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_45/tests/conftest.py b/HumanEval_45/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_45/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/HumanEval_45/tests/test_humaneval.py b/HumanEval_45/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..547f605fb7cabb73c82ddd43900de3f40f1a039e --- /dev/null +++ b/HumanEval_45/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import triangle_area as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(5, 3) == 7.5 + assert candidate(2, 2) == 2.0 + assert candidate(10, 8) == 40.0 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_46/instruction.md b/HumanEval_46/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..18dbf52d0ddf0a63eb27ce90f6e56930f391ce84 --- /dev/null +++ b/HumanEval_46/instruction.md @@ -0,0 +1,23 @@ +# HumanEval — HumanEval/46 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def fib4(n: int): + """The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: + fib4(0) -> 0 + fib4(1) -> 0 + fib4(2) -> 2 + fib4(3) -> 0 + fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). + Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion. + >>> fib4(5) + 4 + >>> fib4(6) + 8 + >>> fib4(7) + 14 + """ +``` diff --git a/HumanEval_46/solution/__init__.py b/HumanEval_46/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a4af717c085715900e1611138d161385f3a2a0ad --- /dev/null +++ b/HumanEval_46/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import fib4 diff --git a/HumanEval_46/solution/solution.py b/HumanEval_46/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c9bfbb9aa958d9ee584074c8a3aa1393071f0926 --- /dev/null +++ b/HumanEval_46/solution/solution.py @@ -0,0 +1,26 @@ + + +def fib4(n: int): + """The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: + fib4(0) -> 0 + fib4(1) -> 0 + fib4(2) -> 2 + fib4(3) -> 0 + fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). + Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion. + >>> fib4(5) + 4 + >>> fib4(6) + 8 + >>> fib4(7) + 14 + """ + results = [0, 0, 2, 0] + if n < 4: + return results[n] + + for _ in range(4, n + 1): + results.append(results[-1] + results[-2] + results[-3] + results[-4]) + results.pop(0) + + return results[-1] diff --git a/HumanEval_46/task.toml b/HumanEval_46/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..88de4e880c8d80c7ddd1d85decef94ea3b02bc9f --- /dev/null +++ b/HumanEval_46/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/46" +name = "HumanEval — HumanEval/46" + +[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/HumanEval_46/tests/__init__.py b/HumanEval_46/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_46/tests/conftest.py b/HumanEval_46/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_46/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/HumanEval_46/tests/test_humaneval.py b/HumanEval_46/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..1c8c3eec9f088813be2b04730bbabefb1c5229e9 --- /dev/null +++ b/HumanEval_46/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import fib4 as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(5) == 4 + assert candidate(8) == 28 + assert candidate(10) == 104 + assert candidate(12) == 386 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_47/instruction.md b/HumanEval_47/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4e911b9917531709d435539d693d2ed0bcf7afed --- /dev/null +++ b/HumanEval_47/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/47 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def median(l: list): + """Return median of elements in the list l. + >>> median([3, 1, 2, 4, 5]) + 3 + >>> median([-10, 4, 6, 1000, 10, 20]) + 15.0 + """ +``` diff --git a/HumanEval_47/solution/__init__.py b/HumanEval_47/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..57382d29e1397a6d5211692fe60cab071fdecd65 --- /dev/null +++ b/HumanEval_47/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import median diff --git a/HumanEval_47/solution/solution.py b/HumanEval_47/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..cecddec1eec9725246f7666ad54fee9df0422e4d --- /dev/null +++ b/HumanEval_47/solution/solution.py @@ -0,0 +1,14 @@ + + +def median(l: list): + """Return median of elements in the list l. + >>> median([3, 1, 2, 4, 5]) + 3 + >>> median([-10, 4, 6, 1000, 10, 20]) + 15.0 + """ + l = sorted(l) + if len(l) % 2 == 1: + return l[len(l) // 2] + else: + return (l[len(l) // 2 - 1] + l[len(l) // 2]) / 2.0 diff --git a/HumanEval_47/task.toml b/HumanEval_47/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f0e443dd673f10581a40903633561cb2d4100556 --- /dev/null +++ b/HumanEval_47/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/47" +name = "HumanEval — HumanEval/47" + +[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/HumanEval_47/tests/__init__.py b/HumanEval_47/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_47/tests/conftest.py b/HumanEval_47/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_47/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/HumanEval_47/tests/test_humaneval.py b/HumanEval_47/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8b1146d25f9410ab82cc85fc1d8747f6bde049fe --- /dev/null +++ b/HumanEval_47/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import median as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([3, 1, 2, 4, 5]) == 3 + assert candidate([-10, 4, 6, 1000, 10, 20]) == 8.0 + assert candidate([5]) == 5 + assert candidate([6, 5]) == 5.5 + assert candidate([8, 1, 3, 9, 9, 2, 7]) == 7 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_48/instruction.md b/HumanEval_48/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..156a447fd24498d70928459531f746ef858677ce --- /dev/null +++ b/HumanEval_48/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/48 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def is_palindrome(text: str): + """ + Checks if given string is a palindrome + >>> is_palindrome('') + True + >>> is_palindrome('aba') + True + >>> is_palindrome('aaaaa') + True + >>> is_palindrome('zbcd') + False + """ +``` diff --git a/HumanEval_48/solution/__init__.py b/HumanEval_48/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ef486044195fc5c17b8cc8142c4d445c89eec849 --- /dev/null +++ b/HumanEval_48/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_palindrome diff --git a/HumanEval_48/solution/solution.py b/HumanEval_48/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..b7f3c970fbf6c79efaefb7b9bc7002b3a6e883ba --- /dev/null +++ b/HumanEval_48/solution/solution.py @@ -0,0 +1,18 @@ + + +def is_palindrome(text: str): + """ + Checks if given string is a palindrome + >>> is_palindrome('') + True + >>> is_palindrome('aba') + True + >>> is_palindrome('aaaaa') + True + >>> is_palindrome('zbcd') + False + """ + for i in range(len(text)): + if text[i] != text[len(text) - 1 - i]: + return False + return True diff --git a/HumanEval_48/task.toml b/HumanEval_48/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..122a95756ce622fd2be06b4dc09b54cd974ffd81 --- /dev/null +++ b/HumanEval_48/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/48" +name = "HumanEval — HumanEval/48" + +[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/HumanEval_48/tests/__init__.py b/HumanEval_48/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_48/tests/conftest.py b/HumanEval_48/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_48/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/HumanEval_48/tests/test_humaneval.py b/HumanEval_48/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2b4c366698b1e3ba568d342532650cb3ffdb6193 --- /dev/null +++ b/HumanEval_48/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import is_palindrome as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate('') == True + assert candidate('aba') == True + assert candidate('aaaaa') == True + assert candidate('zbcd') == False + assert candidate('xywyx') == True + assert candidate('xywyz') == False + assert candidate('xywzx') == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_49/instruction.md b/HumanEval_49/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..fd57e9707b474579ff829903f3a95ff30e4c8c25 --- /dev/null +++ b/HumanEval_49/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/49 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def modp(n: int, p: int): + """Return 2^n modulo p (be aware of numerics). + >>> modp(3, 5) + 3 + >>> modp(1101, 101) + 2 + >>> modp(0, 101) + 1 + >>> modp(3, 11) + 8 + >>> modp(100, 101) + 1 + """ +``` diff --git a/HumanEval_49/solution/__init__.py b/HumanEval_49/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f0005f5f8aacd9d9c675f8765b8dd172dfafa889 --- /dev/null +++ b/HumanEval_49/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import modp diff --git a/HumanEval_49/solution/solution.py b/HumanEval_49/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..6f38b7126563d888a439c6af88fd09cdaa26f874 --- /dev/null +++ b/HumanEval_49/solution/solution.py @@ -0,0 +1,19 @@ + + +def modp(n: int, p: int): + """Return 2^n modulo p (be aware of numerics). + >>> modp(3, 5) + 3 + >>> modp(1101, 101) + 2 + >>> modp(0, 101) + 1 + >>> modp(3, 11) + 8 + >>> modp(100, 101) + 1 + """ + ret = 1 + for i in range(n): + ret = (2 * ret) % p + return ret diff --git a/HumanEval_49/task.toml b/HumanEval_49/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..0e3a173371e2ec1a4ccc14e53e7e29093031abfb --- /dev/null +++ b/HumanEval_49/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/49" +name = "HumanEval — HumanEval/49" + +[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/HumanEval_49/tests/__init__.py b/HumanEval_49/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_49/tests/conftest.py b/HumanEval_49/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_49/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/HumanEval_49/tests/test_humaneval.py b/HumanEval_49/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..e17f68045bce2013dd74f9afb33607f3cb1b728b --- /dev/null +++ b/HumanEval_49/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import modp as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(3, 5) == 3 + assert candidate(1101, 101) == 2 + assert candidate(0, 101) == 1 + assert candidate(3, 11) == 8 + assert candidate(100, 101) == 1 + assert candidate(30, 5) == 4 + assert candidate(31, 5) == 3 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_5/instruction.md b/HumanEval_5/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b6b2697b37c127d422668f070b40b5f43f106b5a --- /dev/null +++ b/HumanEval_5/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/5 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def intersperse(numbers: List[int], delimeter: int) -> List[int]: + """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' + >>> intersperse([], 4) + [] + >>> intersperse([1, 2, 3], 4) + [1, 4, 2, 4, 3] + """ +``` diff --git a/HumanEval_5/solution/__init__.py b/HumanEval_5/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a9b71e84a647aa8bcf5e243817866dec8bc6cbf5 --- /dev/null +++ b/HumanEval_5/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import intersperse diff --git a/HumanEval_5/solution/solution.py b/HumanEval_5/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..9954b7cc97eb2a483f45b0764ef1c65c08bd4060 --- /dev/null +++ b/HumanEval_5/solution/solution.py @@ -0,0 +1,22 @@ +from typing import List + + +def intersperse(numbers: List[int], delimeter: int) -> List[int]: + """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' + >>> intersperse([], 4) + [] + >>> intersperse([1, 2, 3], 4) + [1, 4, 2, 4, 3] + """ + if not numbers: + return [] + + result = [] + + for n in numbers[:-1]: + result.append(n) + result.append(delimeter) + + result.append(numbers[-1]) + + return result diff --git a/HumanEval_5/task.toml b/HumanEval_5/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2cfc9861d14d50c8de98e63cee0049636f2f178f --- /dev/null +++ b/HumanEval_5/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/5" +name = "HumanEval — HumanEval/5" + +[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/HumanEval_5/tests/__init__.py b/HumanEval_5/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_5/tests/conftest.py b/HumanEval_5/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_5/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/HumanEval_5/tests/test_humaneval.py b/HumanEval_5/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..a73f5955089e8f031606758cb8b8aada0299cf85 --- /dev/null +++ b/HumanEval_5/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import intersperse as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([], 7) == [] + assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] + assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_50/instruction.md b/HumanEval_50/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4001bcddaf5e51783e0f821051b1fdd0bbf4824b --- /dev/null +++ b/HumanEval_50/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/50 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def encode_shift(s: str): + """ + returns encoded string by shifting every character by 5 in the alphabet. + """ + return "".join([chr(((ord(ch) + 5 - ord("a")) % 26) + ord("a")) for ch in s]) + + +def decode_shift(s: str): + """ + takes as input string encoded with encode_shift function. Returns decoded string. + """ +``` diff --git a/HumanEval_50/solution/__init__.py b/HumanEval_50/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..750ff4f444bc8fca4adbbdd03ab7d72154e93b89 --- /dev/null +++ b/HumanEval_50/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import decode_shift diff --git a/HumanEval_50/solution/solution.py b/HumanEval_50/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..64e49d2a5b080480e079fff24208ab4006ec2808 --- /dev/null +++ b/HumanEval_50/solution/solution.py @@ -0,0 +1,14 @@ + + +def encode_shift(s: str): + """ + returns encoded string by shifting every character by 5 in the alphabet. + """ + return "".join([chr(((ord(ch) + 5 - ord("a")) % 26) + ord("a")) for ch in s]) + + +def decode_shift(s: str): + """ + takes as input string encoded with encode_shift function. Returns decoded string. + """ + return "".join([chr(((ord(ch) - 5 - ord("a")) % 26) + ord("a")) for ch in s]) diff --git a/HumanEval_50/task.toml b/HumanEval_50/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f739508a1aa7165daeb9b4bf7fd6d75ceb03b413 --- /dev/null +++ b/HumanEval_50/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/50" +name = "HumanEval — HumanEval/50" + +[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/HumanEval_50/tests/__init__.py b/HumanEval_50/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_50/tests/conftest.py b/HumanEval_50/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_50/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/HumanEval_50/tests/test_humaneval.py b/HumanEval_50/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..7759b26bd100661a6c70c665b9ce470ec00edce3 --- /dev/null +++ b/HumanEval_50/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import decode_shift as candidate + + + +METADATA = {} + + +def check(candidate): + from random import randint, choice + import copy + import string + + letters = string.ascii_lowercase + for _ in range(100): + str = ''.join(choice(letters) for i in range(randint(10, 20))) + encoded_str = encode_shift(str) + assert candidate(copy.deepcopy(encoded_str)) == str + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_51/instruction.md b/HumanEval_51/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c6173e101035e05b751756ec40efdf7279a0aed0 --- /dev/null +++ b/HumanEval_51/instruction.md @@ -0,0 +1,24 @@ +# HumanEval — HumanEval/51 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def remove_vowels(text): + """ + remove_vowels is a function that takes string and returns string without vowels. + >>> remove_vowels('') + '' + >>> remove_vowels("abcdef\nghijklm") + 'bcdf\nghjklm' + >>> remove_vowels('abcdef') + 'bcdf' + >>> remove_vowels('aaaaa') + '' + >>> remove_vowels('aaBAA') + 'B' + >>> remove_vowels('zbcd') + 'zbcd' + """ +``` diff --git a/HumanEval_51/solution/__init__.py b/HumanEval_51/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..04038a314cb3305d446b8a2adc632fd58db337a7 --- /dev/null +++ b/HumanEval_51/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import remove_vowels diff --git a/HumanEval_51/solution/solution.py b/HumanEval_51/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..242818ac06a28945b8158edbc3642088c748f605 --- /dev/null +++ b/HumanEval_51/solution/solution.py @@ -0,0 +1,19 @@ + + +def remove_vowels(text): + """ + remove_vowels is a function that takes string and returns string without vowels. + >>> remove_vowels('') + '' + >>> remove_vowels("abcdef\nghijklm") + 'bcdf\nghjklm' + >>> remove_vowels('abcdef') + 'bcdf' + >>> remove_vowels('aaaaa') + '' + >>> remove_vowels('aaBAA') + 'B' + >>> remove_vowels('zbcd') + 'zbcd' + """ + return "".join([s for s in text if s.lower() not in ["a", "e", "i", "o", "u"]]) diff --git a/HumanEval_51/task.toml b/HumanEval_51/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..40a31f9ddc2fc569437335c4e57b2b79184ee7e1 --- /dev/null +++ b/HumanEval_51/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/51" +name = "HumanEval — HumanEval/51" + +[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/HumanEval_51/tests/__init__.py b/HumanEval_51/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_51/tests/conftest.py b/HumanEval_51/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_51/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/HumanEval_51/tests/test_humaneval.py b/HumanEval_51/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..dcd6ac3db1ad9a3f88eae4d6a24a5881f235428b --- /dev/null +++ b/HumanEval_51/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import remove_vowels as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate('') == '' + assert candidate("abcdef\nghijklm") == 'bcdf\nghjklm' + assert candidate('fedcba') == 'fdcb' + assert candidate('eeeee') == '' + assert candidate('acBAA') == 'cB' + assert candidate('EcBOO') == 'cB' + assert candidate('ybcd') == 'ybcd' + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_52/instruction.md b/HumanEval_52/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e105d264b9bd2e0aab083b1deab831c3f162dd0a --- /dev/null +++ b/HumanEval_52/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/52 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def below_threshold(l: list, t: int): + """Return True if all numbers in the list l are below threshold t. + >>> below_threshold([1, 2, 4, 10], 100) + True + >>> below_threshold([1, 20, 4, 10], 5) + False + """ +``` diff --git a/HumanEval_52/solution/__init__.py b/HumanEval_52/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cde42907cdf983db658d5f156ab9198a5acfd6b0 --- /dev/null +++ b/HumanEval_52/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import below_threshold diff --git a/HumanEval_52/solution/solution.py b/HumanEval_52/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..acc113ef3bfa639f9c1e0e4c0e2e6790dcf4eb22 --- /dev/null +++ b/HumanEval_52/solution/solution.py @@ -0,0 +1,13 @@ + + +def below_threshold(l: list, t: int): + """Return True if all numbers in the list l are below threshold t. + >>> below_threshold([1, 2, 4, 10], 100) + True + >>> below_threshold([1, 20, 4, 10], 5) + False + """ + for e in l: + if e >= t: + return False + return True diff --git a/HumanEval_52/task.toml b/HumanEval_52/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e599e5f2ff674c7994acc6a419856aacd8a7dad6 --- /dev/null +++ b/HumanEval_52/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/52" +name = "HumanEval — HumanEval/52" + +[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/HumanEval_52/tests/__init__.py b/HumanEval_52/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_52/tests/conftest.py b/HumanEval_52/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_52/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/HumanEval_52/tests/test_humaneval.py b/HumanEval_52/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..1c5b17330b75f6183017c6b784d6f5f8dcbb7e59 --- /dev/null +++ b/HumanEval_52/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import below_threshold as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([1, 2, 4, 10], 100) + assert not candidate([1, 20, 4, 10], 5) + assert candidate([1, 20, 4, 10], 21) + assert candidate([1, 20, 4, 10], 22) + assert candidate([1, 8, 4, 10], 11) + assert not candidate([1, 8, 4, 10], 10) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_53/instruction.md b/HumanEval_53/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f2c10ea0b98067360aeecc2f0856b4d27e65e571 --- /dev/null +++ b/HumanEval_53/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/53 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def add(x: int, y: int): + """Add two numbers x and y + >>> add(2, 3) + 5 + >>> add(5, 7) + 12 + """ +``` diff --git a/HumanEval_53/solution/__init__.py b/HumanEval_53/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f347031b33901848e2c9d8661560ceb67a9264a2 --- /dev/null +++ b/HumanEval_53/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import add diff --git a/HumanEval_53/solution/solution.py b/HumanEval_53/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..90b8f92f3076bb50a6af6292d619270ba3579d6f --- /dev/null +++ b/HumanEval_53/solution/solution.py @@ -0,0 +1,10 @@ + + +def add(x: int, y: int): + """Add two numbers x and y + >>> add(2, 3) + 5 + >>> add(5, 7) + 12 + """ + return x + y diff --git a/HumanEval_53/task.toml b/HumanEval_53/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1b05eced1e887646b41b1534703e4dba6d81c927 --- /dev/null +++ b/HumanEval_53/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/53" +name = "HumanEval — HumanEval/53" + +[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/HumanEval_53/tests/__init__.py b/HumanEval_53/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_53/tests/conftest.py b/HumanEval_53/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_53/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/HumanEval_53/tests/test_humaneval.py b/HumanEval_53/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3bc8272f4326be8e756cd97f24961e776c500272 --- /dev/null +++ b/HumanEval_53/tests/test_humaneval.py @@ -0,0 +1,24 @@ +from solution import add as candidate + + + +METADATA = {} + + +def check(candidate): + import random + + assert candidate(0, 1) == 1 + assert candidate(1, 0) == 1 + assert candidate(2, 3) == 5 + assert candidate(5, 7) == 12 + assert candidate(7, 5) == 12 + + for i in range(100): + x, y = random.randint(0, 1000), random.randint(0, 1000) + assert candidate(x, y) == x + y + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_54/instruction.md b/HumanEval_54/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c71815e21c31329bebea333a73051a74a692cfea --- /dev/null +++ b/HumanEval_54/instruction.md @@ -0,0 +1,24 @@ +# HumanEval — HumanEval/54 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def same_chars(s0: str, s1: str): + """ + Check if two words have the same characters. + >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc') + True + >>> same_chars('abcd', 'dddddddabc') + True + >>> same_chars('dddddddabc', 'abcd') + True + >>> same_chars('eabcd', 'dddddddabc') + False + >>> same_chars('abcd', 'dddddddabce') + False + >>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc') + False + """ +``` diff --git a/HumanEval_54/solution/__init__.py b/HumanEval_54/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6b89b9fb3151afcc0fb7ad4d1a1808ef25011a77 --- /dev/null +++ b/HumanEval_54/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import same_chars diff --git a/HumanEval_54/solution/solution.py b/HumanEval_54/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..78a5dd8dce240945c216547784e6abb45ec35e2c --- /dev/null +++ b/HumanEval_54/solution/solution.py @@ -0,0 +1,19 @@ + + +def same_chars(s0: str, s1: str): + """ + Check if two words have the same characters. + >>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc') + True + >>> same_chars('abcd', 'dddddddabc') + True + >>> same_chars('dddddddabc', 'abcd') + True + >>> same_chars('eabcd', 'dddddddabc') + False + >>> same_chars('abcd', 'dddddddabce') + False + >>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc') + False + """ + return set(s0) == set(s1) diff --git a/HumanEval_54/task.toml b/HumanEval_54/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bc3ad0d5b5662c5cece94dc57b9c08f88eea8fe3 --- /dev/null +++ b/HumanEval_54/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/54" +name = "HumanEval — HumanEval/54" + +[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/HumanEval_54/tests/__init__.py b/HumanEval_54/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_54/tests/conftest.py b/HumanEval_54/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_54/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/HumanEval_54/tests/test_humaneval.py b/HumanEval_54/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..c632c2a0778f722ed2ae8a66a76abb7bd6b9884e --- /dev/null +++ b/HumanEval_54/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import same_chars as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate('eabcdzzzz', 'dddzzzzzzzddeddabc') == True + assert candidate('abcd', 'dddddddabc') == True + assert candidate('dddddddabc', 'abcd') == True + assert candidate('eabcd', 'dddddddabc') == False + assert candidate('abcd', 'dddddddabcf') == False + assert candidate('eabcdzzzz', 'dddzzzzzzzddddabc') == False + assert candidate('aabb', 'aaccc') == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_55/instruction.md b/HumanEval_55/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5a171b2a824ec0e0b9402d3a1e6b2bd5e1931bda --- /dev/null +++ b/HumanEval_55/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/55 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def fib(n: int): + """Return n-th Fibonacci number. + >>> fib(10) + 55 + >>> fib(1) + 1 + >>> fib(8) + 21 + """ +``` diff --git a/HumanEval_55/solution/__init__.py b/HumanEval_55/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f0a57ff3161e0975212e778fe793aeabcb25cb3c --- /dev/null +++ b/HumanEval_55/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import fib diff --git a/HumanEval_55/solution/solution.py b/HumanEval_55/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..2352fd0576f842c03333f097bcbcb65e5f39781e --- /dev/null +++ b/HumanEval_55/solution/solution.py @@ -0,0 +1,16 @@ + + +def fib(n: int): + """Return n-th Fibonacci number. + >>> fib(10) + 55 + >>> fib(1) + 1 + >>> fib(8) + 21 + """ + if n == 0: + return 0 + if n == 1: + return 1 + return fib(n - 1) + fib(n - 2) diff --git a/HumanEval_55/task.toml b/HumanEval_55/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..38e460512d1591ef5b9b06701ce84b53f0a541fd --- /dev/null +++ b/HumanEval_55/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/55" +name = "HumanEval — HumanEval/55" + +[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/HumanEval_55/tests/__init__.py b/HumanEval_55/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_55/tests/conftest.py b/HumanEval_55/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_55/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/HumanEval_55/tests/test_humaneval.py b/HumanEval_55/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..b990e6806f59284655771fa9862949d6a38f85bb --- /dev/null +++ b/HumanEval_55/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import fib as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(10) == 55 + assert candidate(1) == 1 + assert candidate(8) == 21 + assert candidate(11) == 89 + assert candidate(12) == 144 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_56/instruction.md b/HumanEval_56/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d0191991dbcfc9726c556dff8fa961bd73887a5b --- /dev/null +++ b/HumanEval_56/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/56 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def correct_bracketing(brackets: str): + """ brackets is a string of "<" and ">". + return True if every opening bracket has a corresponding closing bracket. + + >>> correct_bracketing("<") + False + >>> correct_bracketing("<>") + True + >>> correct_bracketing("<<><>>") + True + >>> correct_bracketing("><<>") + False + """ +``` diff --git a/HumanEval_56/solution/__init__.py b/HumanEval_56/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..134ec06d5a99686ea13c2608f9268050bb88c0fc --- /dev/null +++ b/HumanEval_56/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import correct_bracketing diff --git a/HumanEval_56/solution/solution.py b/HumanEval_56/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..9b6c53405030f1153ac20cd93588cec3afdf96e5 --- /dev/null +++ b/HumanEval_56/solution/solution.py @@ -0,0 +1,24 @@ + + +def correct_bracketing(brackets: str): + """ brackets is a string of "<" and ">". + return True if every opening bracket has a corresponding closing bracket. + + >>> correct_bracketing("<") + False + >>> correct_bracketing("<>") + True + >>> correct_bracketing("<<><>>") + True + >>> correct_bracketing("><<>") + False + """ + depth = 0 + for b in brackets: + if b == "<": + depth += 1 + else: + depth -= 1 + if depth < 0: + return False + return depth == 0 diff --git a/HumanEval_56/task.toml b/HumanEval_56/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4c64e9ff4f620e2050a659c7e69b1e059309d75b --- /dev/null +++ b/HumanEval_56/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/56" +name = "HumanEval — HumanEval/56" + +[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/HumanEval_56/tests/__init__.py b/HumanEval_56/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_56/tests/conftest.py b/HumanEval_56/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_56/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/HumanEval_56/tests/test_humaneval.py b/HumanEval_56/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..a48d24d2a48471ad4155bb3786c8108d746bd25d --- /dev/null +++ b/HumanEval_56/tests/test_humaneval.py @@ -0,0 +1,25 @@ +from solution import correct_bracketing as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate("<>") + assert candidate("<<><>>") + assert candidate("<><><<><>><>") + assert candidate("<><><<<><><>><>><<><><<>>>") + assert not candidate("<<<><>>>>") + assert not candidate("><<>") + assert not candidate("<") + assert not candidate("<<<<") + assert not candidate(">") + assert not candidate("<<>") + assert not candidate("<><><<><>><>><<>") + assert not candidate("<><><<><>><>>><>") + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_57/instruction.md b/HumanEval_57/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..11749e39ad6a0999c29af2cf2469d4efb1b33e38 --- /dev/null +++ b/HumanEval_57/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/57 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def monotonic(l: list): + """Return True is list elements are monotonically increasing or decreasing. + >>> monotonic([1, 2, 4, 20]) + True + >>> monotonic([1, 20, 4, 10]) + False + >>> monotonic([4, 1, 0, -10]) + True + """ +``` diff --git a/HumanEval_57/solution/__init__.py b/HumanEval_57/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c1edf57c9ccd9f9f5dcc8e29a0636a5dad979e91 --- /dev/null +++ b/HumanEval_57/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import monotonic diff --git a/HumanEval_57/solution/solution.py b/HumanEval_57/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..09272ac9b37b837dec44a6f27898b2dc25d833c7 --- /dev/null +++ b/HumanEval_57/solution/solution.py @@ -0,0 +1,14 @@ + + +def monotonic(l: list): + """Return True is list elements are monotonically increasing or decreasing. + >>> monotonic([1, 2, 4, 20]) + True + >>> monotonic([1, 20, 4, 10]) + False + >>> monotonic([4, 1, 0, -10]) + True + """ + if l == sorted(l) or l == sorted(l, reverse=True): + return True + return False diff --git a/HumanEval_57/task.toml b/HumanEval_57/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..419964bfc99d6720ea9e7c1163bafa72165f4e64 --- /dev/null +++ b/HumanEval_57/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/57" +name = "HumanEval — HumanEval/57" + +[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/HumanEval_57/tests/__init__.py b/HumanEval_57/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_57/tests/conftest.py b/HumanEval_57/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_57/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/HumanEval_57/tests/test_humaneval.py b/HumanEval_57/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..36d8c6419246386c9c14e4f8deb0a00703ceac81 --- /dev/null +++ b/HumanEval_57/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import monotonic as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([1, 2, 4, 10]) == True + assert candidate([1, 2, 4, 20]) == True + assert candidate([1, 20, 4, 10]) == False + assert candidate([4, 1, 0, -10]) == True + assert candidate([4, 1, 1, 0]) == True + assert candidate([1, 2, 3, 2, 5, 60]) == False + assert candidate([1, 2, 3, 4, 5, 60]) == True + assert candidate([9, 9, 9, 9]) == True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_58/instruction.md b/HumanEval_58/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c4e06a6f4c6f701261b36d1131d27392252404ea --- /dev/null +++ b/HumanEval_58/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/58 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def common(l1: list, l2: list): + """Return sorted unique common elements for two lists. + >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) + [1, 5, 653] + >>> common([5, 3, 2, 8], [3, 2]) + [2, 3] + + """ +``` diff --git a/HumanEval_58/solution/__init__.py b/HumanEval_58/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..76f788a1b66e75396cf687308b7eb46fa18033d1 --- /dev/null +++ b/HumanEval_58/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import common diff --git a/HumanEval_58/solution/solution.py b/HumanEval_58/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c36105e5aad77e6db60675d3d63c3fd5b0b3b31c --- /dev/null +++ b/HumanEval_58/solution/solution.py @@ -0,0 +1,16 @@ + + +def common(l1: list, l2: list): + """Return sorted unique common elements for two lists. + >>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) + [1, 5, 653] + >>> common([5, 3, 2, 8], [3, 2]) + [2, 3] + + """ + ret = set() + for e1 in l1: + for e2 in l2: + if e1 == e2: + ret.add(e1) + return sorted(list(ret)) diff --git a/HumanEval_58/task.toml b/HumanEval_58/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c2b9759dfd950886d359c066dd8ec7c6f4ad8063 --- /dev/null +++ b/HumanEval_58/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/58" +name = "HumanEval — HumanEval/58" + +[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/HumanEval_58/tests/__init__.py b/HumanEval_58/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_58/tests/conftest.py b/HumanEval_58/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_58/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/HumanEval_58/tests/test_humaneval.py b/HumanEval_58/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..02d40bcf35d8868d66aae5920586717564c150cb --- /dev/null +++ b/HumanEval_58/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import common as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653] + assert candidate([5, 3, 2, 8], [3, 2]) == [2, 3] + assert candidate([4, 3, 2, 8], [3, 2, 4]) == [2, 3, 4] + assert candidate([4, 3, 2, 8], []) == [] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_59/instruction.md b/HumanEval_59/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1d80b4231d268c4472a512397087a34a3d0b0277 --- /dev/null +++ b/HumanEval_59/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/59 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def largest_prime_factor(n: int): + """Return the largest prime factor of n. Assume n > 1 and is not a prime. + >>> largest_prime_factor(13195) + 29 + >>> largest_prime_factor(2048) + 2 + """ +``` diff --git a/HumanEval_59/solution/__init__.py b/HumanEval_59/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5602303b2dbe3791f8000bdc03504fc11e68a846 --- /dev/null +++ b/HumanEval_59/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import largest_prime_factor diff --git a/HumanEval_59/solution/solution.py b/HumanEval_59/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1c12bf676e61266ca31d63e3bfd7dc8afe5d3064 --- /dev/null +++ b/HumanEval_59/solution/solution.py @@ -0,0 +1,21 @@ + + +def largest_prime_factor(n: int): + """Return the largest prime factor of n. Assume n > 1 and is not a prime. + >>> largest_prime_factor(13195) + 29 + >>> largest_prime_factor(2048) + 2 + """ + def is_prime(k): + if k < 2: + return False + for i in range(2, k - 1): + if k % i == 0: + return False + return True + largest = 1 + for j in range(2, n + 1): + if n % j == 0 and is_prime(j): + largest = max(largest, j) + return largest diff --git a/HumanEval_59/task.toml b/HumanEval_59/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6da8caae8a511a2c7dd8c6fb60c76553b484682a --- /dev/null +++ b/HumanEval_59/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/59" +name = "HumanEval — HumanEval/59" + +[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/HumanEval_59/tests/__init__.py b/HumanEval_59/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_59/tests/conftest.py b/HumanEval_59/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_59/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/HumanEval_59/tests/test_humaneval.py b/HumanEval_59/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..6078444bf6a14cb8009a52b67f0a82b4ed8910cd --- /dev/null +++ b/HumanEval_59/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import largest_prime_factor as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(15) == 5 + assert candidate(27) == 3 + assert candidate(63) == 7 + assert candidate(330) == 11 + assert candidate(13195) == 29 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_6/instruction.md b/HumanEval_6/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0ab758f59334d7d03b1dec2fb12072b9f1944dd2 --- /dev/null +++ b/HumanEval_6/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/6 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def parse_nested_parens(paren_string: str) -> List[int]: + """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. + For each of the group, output the deepest level of nesting of parentheses. + E.g. (()()) has maximum two levels of nesting while ((())) has three. + + >>> parse_nested_parens('(()()) ((())) () ((())()())') + [2, 3, 1, 3] + """ +``` diff --git a/HumanEval_6/solution/__init__.py b/HumanEval_6/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..83460a4a05927a81a678d4a492f6fbe69660124a --- /dev/null +++ b/HumanEval_6/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import parse_nested_parens diff --git a/HumanEval_6/solution/solution.py b/HumanEval_6/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..33182828b1b806a3727a422855a0bb643798588b --- /dev/null +++ b/HumanEval_6/solution/solution.py @@ -0,0 +1,24 @@ +from typing import List + + +def parse_nested_parens(paren_string: str) -> List[int]: + """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. + For each of the group, output the deepest level of nesting of parentheses. + E.g. (()()) has maximum two levels of nesting while ((())) has three. + + >>> parse_nested_parens('(()()) ((())) () ((())()())') + [2, 3, 1, 3] + """ + def parse_paren_group(s): + depth = 0 + max_depth = 0 + for c in s: + if c == '(': + depth += 1 + max_depth = max(depth, max_depth) + else: + depth -= 1 + + return max_depth + + return [parse_paren_group(x) for x in paren_string.split(' ') if x] diff --git a/HumanEval_6/task.toml b/HumanEval_6/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..db98dcea4a6a8f216857241186ec41133437632b --- /dev/null +++ b/HumanEval_6/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/6" +name = "HumanEval — HumanEval/6" + +[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/HumanEval_6/tests/__init__.py b/HumanEval_6/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_6/tests/conftest.py b/HumanEval_6/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_6/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/HumanEval_6/tests/test_humaneval.py b/HumanEval_6/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..289cbf2d6c9e52973e3efdc3cb7b5e5f694b0436 --- /dev/null +++ b/HumanEval_6/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import parse_nested_parens as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3] + assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4] + assert candidate('(()(())((())))') == [4] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_60/instruction.md b/HumanEval_60/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..59aaa387c8c6b52a9bddd0af1a8ff8e9d7375a3e --- /dev/null +++ b/HumanEval_60/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/60 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def sum_to_n(n: int): + """sum_to_n is a function that sums numbers from 1 to n. + >>> sum_to_n(30) + 465 + >>> sum_to_n(100) + 5050 + >>> sum_to_n(5) + 15 + >>> sum_to_n(10) + 55 + >>> sum_to_n(1) + 1 + """ +``` diff --git a/HumanEval_60/solution/__init__.py b/HumanEval_60/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..45983540cdaca56073ff6ffb3ac3b8aac61f3fa5 --- /dev/null +++ b/HumanEval_60/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sum_to_n diff --git a/HumanEval_60/solution/solution.py b/HumanEval_60/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..5e4aeb24f065511b2414119c2d957c966d94d5fa --- /dev/null +++ b/HumanEval_60/solution/solution.py @@ -0,0 +1,16 @@ + + +def sum_to_n(n: int): + """sum_to_n is a function that sums numbers from 1 to n. + >>> sum_to_n(30) + 465 + >>> sum_to_n(100) + 5050 + >>> sum_to_n(5) + 15 + >>> sum_to_n(10) + 55 + >>> sum_to_n(1) + 1 + """ + return sum(range(n + 1)) diff --git a/HumanEval_60/task.toml b/HumanEval_60/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..3357a24a64c18f6b06b532a236e339ee56a7f302 --- /dev/null +++ b/HumanEval_60/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/60" +name = "HumanEval — HumanEval/60" + +[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/HumanEval_60/tests/__init__.py b/HumanEval_60/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_60/tests/conftest.py b/HumanEval_60/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_60/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/HumanEval_60/tests/test_humaneval.py b/HumanEval_60/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..36b8607fe80de4270eb3da5d049cf7acae557640 --- /dev/null +++ b/HumanEval_60/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import sum_to_n as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(1) == 1 + assert candidate(6) == 21 + assert candidate(11) == 66 + assert candidate(30) == 465 + assert candidate(100) == 5050 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_61/instruction.md b/HumanEval_61/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..0bf2c9ab06b99ff1dca0b68834541005a4ce54d0 --- /dev/null +++ b/HumanEval_61/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/61 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def correct_bracketing(brackets: str): + """ brackets is a string of "(" and ")". + return True if every opening bracket has a corresponding closing bracket. + + >>> correct_bracketing("(") + False + >>> correct_bracketing("()") + True + >>> correct_bracketing("(()())") + True + >>> correct_bracketing(")(()") + False + """ +``` diff --git a/HumanEval_61/solution/__init__.py b/HumanEval_61/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..134ec06d5a99686ea13c2608f9268050bb88c0fc --- /dev/null +++ b/HumanEval_61/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import correct_bracketing diff --git a/HumanEval_61/solution/solution.py b/HumanEval_61/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..bc8cf8f38799c61cd2846152e1171c4394c30c68 --- /dev/null +++ b/HumanEval_61/solution/solution.py @@ -0,0 +1,24 @@ + + +def correct_bracketing(brackets: str): + """ brackets is a string of "(" and ")". + return True if every opening bracket has a corresponding closing bracket. + + >>> correct_bracketing("(") + False + >>> correct_bracketing("()") + True + >>> correct_bracketing("(()())") + True + >>> correct_bracketing(")(()") + False + """ + depth = 0 + for b in brackets: + if b == "(": + depth += 1 + else: + depth -= 1 + if depth < 0: + return False + return depth == 0 diff --git a/HumanEval_61/task.toml b/HumanEval_61/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9074aa547d9821440691c1420eb9b40d61e3efe3 --- /dev/null +++ b/HumanEval_61/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/61" +name = "HumanEval — HumanEval/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/HumanEval_61/tests/__init__.py b/HumanEval_61/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_61/tests/conftest.py b/HumanEval_61/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_61/tests/test_humaneval.py b/HumanEval_61/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..7b082c23f84a6e3c575363a9675a0f5ae4d13297 --- /dev/null +++ b/HumanEval_61/tests/test_humaneval.py @@ -0,0 +1,25 @@ +from solution import correct_bracketing as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate("()") + assert candidate("(()())") + assert candidate("()()(()())()") + assert candidate("()()((()()())())(()()(()))") + assert not candidate("((()())))") + assert not candidate(")(()") + assert not candidate("(") + assert not candidate("((((") + assert not candidate(")") + assert not candidate("(()") + assert not candidate("()()(()())())(()") + assert not candidate("()()(()())()))()") + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_62/instruction.md b/HumanEval_62/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..d6c3395a123ead4ff025dffdade8504b42cce334 --- /dev/null +++ b/HumanEval_62/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/62 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def derivative(xs: list): + """ xs represent coefficients of a polynomial. + xs[0] + xs[1] * x + xs[2] * x^2 + .... + Return derivative of this polynomial in the same form. + >>> derivative([3, 1, 2, 4, 5]) + [1, 4, 12, 20] + >>> derivative([1, 2, 3]) + [2, 6] + """ +``` diff --git a/HumanEval_62/solution/__init__.py b/HumanEval_62/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..974c4208cfa325e2f4b89cacb99551cfedecef20 --- /dev/null +++ b/HumanEval_62/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import derivative diff --git a/HumanEval_62/solution/solution.py b/HumanEval_62/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..aa084e97b620f30e14e00c0a3090bb186a2b15b2 --- /dev/null +++ b/HumanEval_62/solution/solution.py @@ -0,0 +1,12 @@ + + +def derivative(xs: list): + """ xs represent coefficients of a polynomial. + xs[0] + xs[1] * x + xs[2] * x^2 + .... + Return derivative of this polynomial in the same form. + >>> derivative([3, 1, 2, 4, 5]) + [1, 4, 12, 20] + >>> derivative([1, 2, 3]) + [2, 6] + """ + return [(i * x) for i, x in enumerate(xs)][1:] diff --git a/HumanEval_62/task.toml b/HumanEval_62/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fe4444bf157ca42378c81de88925fd240715a0fa --- /dev/null +++ b/HumanEval_62/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/62" +name = "HumanEval — HumanEval/62" + +[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/HumanEval_62/tests/__init__.py b/HumanEval_62/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_62/tests/conftest.py b/HumanEval_62/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_62/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/HumanEval_62/tests/test_humaneval.py b/HumanEval_62/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8b1e4bcde378ab750d1b8adcdb30358ff8559f5d --- /dev/null +++ b/HumanEval_62/tests/test_humaneval.py @@ -0,0 +1,18 @@ +from solution import derivative as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate([3, 1, 2, 4, 5]) == [1, 4, 12, 20] + assert candidate([1, 2, 3]) == [2, 6] + assert candidate([3, 2, 1]) == [2, 2] + assert candidate([3, 2, 1, 0, 4]) == [2, 2, 0, 16] + assert candidate([1]) == [] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_63/instruction.md b/HumanEval_63/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8b1485ca240e2b12dad0550ffaf02fdf0a2427c5 --- /dev/null +++ b/HumanEval_63/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/63 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def fibfib(n: int): + """The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: + fibfib(0) == 0 + fibfib(1) == 0 + fibfib(2) == 1 + fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). + Please write a function to efficiently compute the n-th element of the fibfib number sequence. + >>> fibfib(1) + 0 + >>> fibfib(5) + 4 + >>> fibfib(8) + 24 + """ +``` diff --git a/HumanEval_63/solution/__init__.py b/HumanEval_63/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1eb25afa6759712b1cbfe12e64170fdade898090 --- /dev/null +++ b/HumanEval_63/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import fibfib diff --git a/HumanEval_63/solution/solution.py b/HumanEval_63/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ef337e6d33afde98542119c2b8e113474e260d7c --- /dev/null +++ b/HumanEval_63/solution/solution.py @@ -0,0 +1,23 @@ + + +def fibfib(n: int): + """The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: + fibfib(0) == 0 + fibfib(1) == 0 + fibfib(2) == 1 + fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3). + Please write a function to efficiently compute the n-th element of the fibfib number sequence. + >>> fibfib(1) + 0 + >>> fibfib(5) + 4 + >>> fibfib(8) + 24 + """ + if n == 0: + return 0 + if n == 1: + return 0 + if n == 2: + return 1 + return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3) diff --git a/HumanEval_63/task.toml b/HumanEval_63/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..496d65c6695d772002194715a2671d43538b1e3d --- /dev/null +++ b/HumanEval_63/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/63" +name = "HumanEval — HumanEval/63" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/HumanEval_63/tests/__init__.py b/HumanEval_63/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_63/tests/conftest.py b/HumanEval_63/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_63/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/HumanEval_63/tests/test_humaneval.py b/HumanEval_63/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..a71396e89c020b24b86f966d488af6b578517252 --- /dev/null +++ b/HumanEval_63/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import fibfib as candidate + + + +METADATA = {} + + +def check(candidate): + assert candidate(2) == 1 + assert candidate(1) == 0 + assert candidate(5) == 4 + assert candidate(8) == 24 + assert candidate(10) == 81 + assert candidate(12) == 274 + assert candidate(14) == 927 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_64/instruction.md b/HumanEval_64/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b46438f3b6dfcb28da27a6cd45151b90e210f39a --- /dev/null +++ b/HumanEval_64/instruction.md @@ -0,0 +1,23 @@ +# HumanEval — HumanEval/64 + +Complete the following Python function so that it satisfies its docstring. + +```python + +FIX = """ +Add more test cases. +""" + +def vowels_count(s): + """Write a function vowels_count which takes a string representing + a word as input and returns the number of vowels in the string. + Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a + vowel, but only when it is at the end of the given word. + + Example: + >>> vowels_count("abcde") + 2 + >>> vowels_count("ACEDY") + 3 + """ +``` diff --git a/HumanEval_64/solution/__init__.py b/HumanEval_64/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2e5d499076060e328b653e5315fc9e47fc370733 --- /dev/null +++ b/HumanEval_64/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import vowels_count diff --git a/HumanEval_64/solution/solution.py b/HumanEval_64/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..90bca71827f3a30e62ff99de3e8c1834d0ee4f78 --- /dev/null +++ b/HumanEval_64/solution/solution.py @@ -0,0 +1,22 @@ + +FIX = """ +Add more test cases. +""" + +def vowels_count(s): + """Write a function vowels_count which takes a string representing + a word as input and returns the number of vowels in the string. + Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a + vowel, but only when it is at the end of the given word. + + Example: + >>> vowels_count("abcde") + 2 + >>> vowels_count("ACEDY") + 3 + """ + vowels = "aeiouAEIOU" + n_vowels = sum(c in vowels for c in s) + if s[-1] == 'y' or s[-1] == 'Y': + n_vowels += 1 + return n_vowels diff --git a/HumanEval_64/task.toml b/HumanEval_64/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b799722e7ae391aa46ca64cfc39acd74c095f92a --- /dev/null +++ b/HumanEval_64/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/64" +name = "HumanEval — HumanEval/64" + +[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/HumanEval_64/tests/__init__.py b/HumanEval_64/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_64/tests/conftest.py b/HumanEval_64/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_64/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/HumanEval_64/tests/test_humaneval.py b/HumanEval_64/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..97a42e11dfb2761a760a8c1db30954c230fed14b --- /dev/null +++ b/HumanEval_64/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import vowels_count as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("abcde") == 2, "Test 1" + assert candidate("Alone") == 3, "Test 2" + assert candidate("key") == 2, "Test 3" + assert candidate("bye") == 1, "Test 4" + assert candidate("keY") == 2, "Test 5" + assert candidate("bYe") == 1, "Test 6" + assert candidate("ACEDY") == 3, "Test 7" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_65/instruction.md b/HumanEval_65/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..8ce76db4c845f8cb7fba7579767b6468f5c2ecbe --- /dev/null +++ b/HumanEval_65/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/65 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def circular_shift(x, shift): + """Circular shift the digits of the integer x, shift the digits right by shift + and return the result as a string. + If shift > number of digits, return digits reversed. + >>> circular_shift(12, 1) + "21" + >>> circular_shift(12, 2) + "12" + """ +``` diff --git a/HumanEval_65/solution/__init__.py b/HumanEval_65/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a410c8ce8ea09d51c8d711f310d73a8aee23e405 --- /dev/null +++ b/HumanEval_65/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import circular_shift diff --git a/HumanEval_65/solution/solution.py b/HumanEval_65/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..9aafa78e4ab77cc22fe94faf3eb6f67df4e86cbd --- /dev/null +++ b/HumanEval_65/solution/solution.py @@ -0,0 +1,15 @@ + +def circular_shift(x, shift): + """Circular shift the digits of the integer x, shift the digits right by shift + and return the result as a string. + If shift > number of digits, return digits reversed. + >>> circular_shift(12, 1) + "21" + >>> circular_shift(12, 2) + "12" + """ + s = str(x) + if shift > len(s): + return s[::-1] + else: + return s[len(s) - shift:] + s[:len(s) - shift] diff --git a/HumanEval_65/task.toml b/HumanEval_65/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4bcb74aec4b7cd6771fa7dbcfa7ba887927bdf4a --- /dev/null +++ b/HumanEval_65/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/65" +name = "HumanEval — HumanEval/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/HumanEval_65/tests/__init__.py b/HumanEval_65/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_65/tests/conftest.py b/HumanEval_65/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_65/tests/test_humaneval.py b/HumanEval_65/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..b5912e78385bc22450a2d9ca9dff20636dc2ffef --- /dev/null +++ b/HumanEval_65/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import circular_shift as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(100, 2) == "001" + assert candidate(12, 2) == "12" + assert candidate(97, 8) == "79" + assert candidate(12, 1) == "21", "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate(11, 101) == "11", "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_66/instruction.md b/HumanEval_66/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ac657ecd6e91fe6a6fa55ea6844f63a23a8259cf --- /dev/null +++ b/HumanEval_66/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/66 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def digitSum(s): + """Task + Write a function that takes a string as input and returns the sum of the upper characters only' + ASCII codes. + + Examples: + digitSum("") => 0 + digitSum("abAB") => 131 + digitSum("abcCd") => 67 + digitSum("helloE") => 69 + digitSum("woArBld") => 131 + digitSum("aAaaaXa") => 153 + """ +``` diff --git a/HumanEval_66/solution/__init__.py b/HumanEval_66/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e439ab9fddb5f961a84ab31bcfb8a566505a0144 --- /dev/null +++ b/HumanEval_66/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import digitSum diff --git a/HumanEval_66/solution/solution.py b/HumanEval_66/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..7ec66ae5d523c26863998ed2d7f836ea4dfa0e2c --- /dev/null +++ b/HumanEval_66/solution/solution.py @@ -0,0 +1,16 @@ + +def digitSum(s): + """Task + Write a function that takes a string as input and returns the sum of the upper characters only' + ASCII codes. + + Examples: + digitSum("") => 0 + digitSum("abAB") => 131 + digitSum("abcCd") => 67 + digitSum("helloE") => 69 + digitSum("woArBld") => 131 + digitSum("aAaaaXa") => 153 + """ + if s == "": return 0 + return sum(ord(char) if char.isupper() else 0 for char in s) diff --git a/HumanEval_66/task.toml b/HumanEval_66/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..112f6c65932153a080ecef236c7cf7086a13cec4 --- /dev/null +++ b/HumanEval_66/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/66" +name = "HumanEval — HumanEval/66" + +[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/HumanEval_66/tests/__init__.py b/HumanEval_66/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_66/tests/conftest.py b/HumanEval_66/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_66/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/HumanEval_66/tests/test_humaneval.py b/HumanEval_66/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8decb8372d335e0fab34e370abb66a828a7f6436 --- /dev/null +++ b/HumanEval_66/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import digitSum as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate("") == 0, "Error" + assert candidate("abAB") == 131, "Error" + assert candidate("abcCd") == 67, "Error" + assert candidate("helloE") == 69, "Error" + assert candidate("woArBld") == 131, "Error" + assert candidate("aAaaaXa") == 153, "Error" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate(" How are yOu?") == 151, "Error" + assert candidate("You arE Very Smart") == 327, "Error" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_67/instruction.md b/HumanEval_67/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..103c0638606fc32a8c4508a46dffc40610e5b4c6 --- /dev/null +++ b/HumanEval_67/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/67 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def fruit_distribution(s,n): + """ + In this task, you will be given a string that represents a number of apples and oranges + that are distributed in a basket of fruit this basket contains + apples, oranges, and mango fruits. Given the string that represents the total number of + the oranges and apples and an integer that represent the total number of the fruits + in the basket return the number of the mango fruits in the basket. + for examble: + fruit_distribution("5 apples and 6 oranges", 19) ->19 - 5 - 6 = 8 + fruit_distribution("0 apples and 1 oranges",3) -> 3 - 0 - 1 = 2 + fruit_distribution("2 apples and 3 oranges", 100) -> 100 - 2 - 3 = 95 + fruit_distribution("100 apples and 1 oranges",120) -> 120 - 100 - 1 = 19 + """ +``` diff --git a/HumanEval_67/solution/__init__.py b/HumanEval_67/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b10fe25c07c55e2ba40e6c120951dcd894f967a5 --- /dev/null +++ b/HumanEval_67/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import fruit_distribution diff --git a/HumanEval_67/solution/solution.py b/HumanEval_67/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..d3e40e82edd8980c62d75d2d5815276b32ce2a42 --- /dev/null +++ b/HumanEval_67/solution/solution.py @@ -0,0 +1,19 @@ + +def fruit_distribution(s,n): + """ + In this task, you will be given a string that represents a number of apples and oranges + that are distributed in a basket of fruit this basket contains + apples, oranges, and mango fruits. Given the string that represents the total number of + the oranges and apples and an integer that represent the total number of the fruits + in the basket return the number of the mango fruits in the basket. + for examble: + fruit_distribution("5 apples and 6 oranges", 19) ->19 - 5 - 6 = 8 + fruit_distribution("0 apples and 1 oranges",3) -> 3 - 0 - 1 = 2 + fruit_distribution("2 apples and 3 oranges", 100) -> 100 - 2 - 3 = 95 + fruit_distribution("100 apples and 1 oranges",120) -> 120 - 100 - 1 = 19 + """ + lis = list() + for i in s.split(' '): + if i.isdigit(): + lis.append(int(i)) + return n - sum(lis) diff --git a/HumanEval_67/task.toml b/HumanEval_67/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cf677e8c1bb9d001b6011763435d462d4fe8bf38 --- /dev/null +++ b/HumanEval_67/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/67" +name = "HumanEval — HumanEval/67" + +[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/HumanEval_67/tests/__init__.py b/HumanEval_67/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_67/tests/conftest.py b/HumanEval_67/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_67/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/HumanEval_67/tests/test_humaneval.py b/HumanEval_67/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..4095e27c9328e745ddb6492316f4d896ab39e7fa --- /dev/null +++ b/HumanEval_67/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import fruit_distribution as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("5 apples and 6 oranges",19) == 8 + assert candidate("5 apples and 6 oranges",21) == 10 + assert candidate("0 apples and 1 oranges",3) == 2 + assert candidate("1 apples and 0 oranges",3) == 2 + assert candidate("2 apples and 3 oranges",100) == 95 + assert candidate("2 apples and 3 oranges",5) == 0 + assert candidate("1 apples and 100 oranges",120) == 19 + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_68/instruction.md b/HumanEval_68/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..af4289f31d3206311ee79a8aa2044d9357dde740 --- /dev/null +++ b/HumanEval_68/instruction.md @@ -0,0 +1,41 @@ +# HumanEval — HumanEval/68 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def pluck(arr): + """ + "Given an array representing a branch of a tree that has non-negative integer nodes + your task is to pluck one of the nodes and return it. + The plucked node should be the node with the smallest even value. + If multiple nodes with the same smallest even value are found return the node that has smallest index. + + The plucked node should be returned in a list, [ smalest_value, its index ], + If there are no even values or the given array is empty, return []. + + Example 1: + Input: [4,2,3] + Output: [2, 1] + Explanation: 2 has the smallest even value, and 2 has the smallest index. + + Example 2: + Input: [1,2,3] + Output: [2, 1] + Explanation: 2 has the smallest even value, and 2 has the smallest index. + + Example 3: + Input: [] + Output: [] + + Example 4: + Input: [5, 0, 3, 0, 4, 2] + Output: [0, 1] + Explanation: 0 is the smallest value, but there are two zeros, + so we will choose the first zero, which has the smallest index. + + Constraints: + * 1 <= nodes.length <= 10000 + * 0 <= node.value + """ +``` diff --git a/HumanEval_68/solution/__init__.py b/HumanEval_68/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..652e301f0ca99b143ecc9fbfeb3f1d0e14c2b5f0 --- /dev/null +++ b/HumanEval_68/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import pluck diff --git a/HumanEval_68/solution/solution.py b/HumanEval_68/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..09332682a3752e7a3f1473fcf59da42a8002a897 --- /dev/null +++ b/HumanEval_68/solution/solution.py @@ -0,0 +1,39 @@ + +def pluck(arr): + """ + "Given an array representing a branch of a tree that has non-negative integer nodes + your task is to pluck one of the nodes and return it. + The plucked node should be the node with the smallest even value. + If multiple nodes with the same smallest even value are found return the node that has smallest index. + + The plucked node should be returned in a list, [ smalest_value, its index ], + If there are no even values or the given array is empty, return []. + + Example 1: + Input: [4,2,3] + Output: [2, 1] + Explanation: 2 has the smallest even value, and 2 has the smallest index. + + Example 2: + Input: [1,2,3] + Output: [2, 1] + Explanation: 2 has the smallest even value, and 2 has the smallest index. + + Example 3: + Input: [] + Output: [] + + Example 4: + Input: [5, 0, 3, 0, 4, 2] + Output: [0, 1] + Explanation: 0 is the smallest value, but there are two zeros, + so we will choose the first zero, which has the smallest index. + + Constraints: + * 1 <= nodes.length <= 10000 + * 0 <= node.value + """ + if(len(arr) == 0): return [] + evens = list(filter(lambda x: x%2 == 0, arr)) + if(evens == []): return [] + return [min(evens), arr.index(min(evens))] diff --git a/HumanEval_68/task.toml b/HumanEval_68/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..a2ca65d867eba72275a1cdf0c63097157a994e43 --- /dev/null +++ b/HumanEval_68/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/68" +name = "HumanEval — HumanEval/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/HumanEval_68/tests/__init__.py b/HumanEval_68/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_68/tests/conftest.py b/HumanEval_68/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_68/tests/test_humaneval.py b/HumanEval_68/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..26fa67184704dabbc5808ede68743ce0972de116 --- /dev/null +++ b/HumanEval_68/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import pluck as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([4,2,3]) == [2, 1], "Error" + assert candidate([1,2,3]) == [2, 1], "Error" + assert candidate([]) == [], "Error" + assert candidate([5, 0, 3, 0, 4, 2]) == [0, 1], "Error" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([1, 2, 3, 0, 5, 3]) == [0, 3], "Error" + assert candidate([5, 4, 8, 4 ,8]) == [4, 1], "Error" + assert candidate([7, 6, 7, 1]) == [6, 1], "Error" + assert candidate([7, 9, 7, 1]) == [], "Error" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_69/instruction.md b/HumanEval_69/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..481956503b4ad4caa26f803f4201fe5a5b8ba809 --- /dev/null +++ b/HumanEval_69/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/69 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def search(lst): + ''' + You are given a non-empty list of positive integers. Return the greatest integer that is greater than + zero, and has a frequency greater than or equal to the value of the integer itself. + The frequency of an integer is the number of times it appears in the list. + If no such a value exist, return -1. + Examples: + search([4, 1, 2, 2, 3, 1]) == 2 + search([1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3 + search([5, 5, 4, 4, 4]) == -1 + ''' +``` diff --git a/HumanEval_69/solution/__init__.py b/HumanEval_69/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..57fffd5c88d9a0c6b90f690c0c97bc85b36a7e61 --- /dev/null +++ b/HumanEval_69/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import search diff --git a/HumanEval_69/solution/solution.py b/HumanEval_69/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..53315d3e3522d9713bede76a08eef50e81970738 --- /dev/null +++ b/HumanEval_69/solution/solution.py @@ -0,0 +1,22 @@ + +def search(lst): + ''' + You are given a non-empty list of positive integers. Return the greatest integer that is greater than + zero, and has a frequency greater than or equal to the value of the integer itself. + The frequency of an integer is the number of times it appears in the list. + If no such a value exist, return -1. + Examples: + search([4, 1, 2, 2, 3, 1]) == 2 + search([1, 2, 2, 3, 3, 3, 4, 4, 4]) == 3 + search([5, 5, 4, 4, 4]) == -1 + ''' + frq = [0] * (max(lst) + 1) + for i in lst: + frq[i] += 1; + + ans = -1 + for i in range(1, len(frq)): + if frq[i] >= i: + ans = i + + return ans diff --git a/HumanEval_69/task.toml b/HumanEval_69/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..ec0a2fbded38a4d666f7d2c681269b4d35c69dd9 --- /dev/null +++ b/HumanEval_69/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/69" +name = "HumanEval — HumanEval/69" + +[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/HumanEval_69/tests/__init__.py b/HumanEval_69/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_69/tests/conftest.py b/HumanEval_69/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_69/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/HumanEval_69/tests/test_humaneval.py b/HumanEval_69/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..007008d4349398b65b14e644c554395750b839fd --- /dev/null +++ b/HumanEval_69/tests/test_humaneval.py @@ -0,0 +1,37 @@ +from solution import search as candidate + +def check(candidate): + + # manually generated tests + assert candidate([5, 5, 5, 5, 1]) == 1 + assert candidate([4, 1, 4, 1, 4, 4]) == 4 + assert candidate([3, 3]) == -1 + assert candidate([8, 8, 8, 8, 8, 8, 8, 8]) == 8 + assert candidate([2, 3, 3, 2, 2]) == 2 + + # automatically generated tests + assert candidate([2, 7, 8, 8, 4, 8, 7, 3, 9, 6, 5, 10, 4, 3, 6, 7, 1, 7, 4, 10, 8, 1]) == 1 + assert candidate([3, 2, 8, 2]) == 2 + assert candidate([6, 7, 1, 8, 8, 10, 5, 8, 5, 3, 10]) == 1 + assert candidate([8, 8, 3, 6, 5, 6, 4]) == -1 + assert candidate([6, 9, 6, 7, 1, 4, 7, 1, 8, 8, 9, 8, 10, 10, 8, 4, 10, 4, 10, 1, 2, 9, 5, 7, 9]) == 1 + assert candidate([1, 9, 10, 1, 3]) == 1 + assert candidate([6, 9, 7, 5, 8, 7, 5, 3, 7, 5, 10, 10, 3, 6, 10, 2, 8, 6, 5, 4, 9, 5, 3, 10]) == 5 + assert candidate([1]) == 1 + assert candidate([8, 8, 10, 6, 4, 3, 5, 8, 2, 4, 2, 8, 4, 6, 10, 4, 2, 1, 10, 2, 1, 1, 5]) == 4 + assert candidate([2, 10, 4, 8, 2, 10, 5, 1, 2, 9, 5, 5, 6, 3, 8, 6, 4, 10]) == 2 + assert candidate([1, 6, 10, 1, 6, 9, 10, 8, 6, 8, 7, 3]) == 1 + assert candidate([9, 2, 4, 1, 5, 1, 5, 2, 5, 7, 7, 7, 3, 10, 1, 5, 4, 2, 8, 4, 1, 9, 10, 7, 10, 2, 8, 10, 9, 4]) == 4 + assert candidate([2, 6, 4, 2, 8, 7, 5, 6, 4, 10, 4, 6, 3, 7, 8, 8, 3, 1, 4, 2, 2, 10, 7]) == 4 + assert candidate([9, 8, 6, 10, 2, 6, 10, 2, 7, 8, 10, 3, 8, 2, 6, 2, 3, 1]) == 2 + assert candidate([5, 5, 3, 9, 5, 6, 3, 2, 8, 5, 6, 10, 10, 6, 8, 4, 10, 7, 7, 10, 8]) == -1 + assert candidate([10]) == -1 + assert candidate([9, 7, 7, 2, 4, 7, 2, 10, 9, 7, 5, 7, 2]) == 2 + assert candidate([5, 4, 10, 2, 1, 1, 10, 3, 6, 1, 8]) == 1 + assert candidate([7, 9, 9, 9, 3, 4, 1, 5, 9, 1, 2, 1, 1, 10, 7, 5, 6, 7, 6, 7, 7, 6]) == 1 + assert candidate([3, 10, 10, 9, 2]) == -1 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_7/instruction.md b/HumanEval_7/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..136f6f1fb5b3ed5050a1c09e31b7f0bba345c95b --- /dev/null +++ b/HumanEval_7/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/7 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List + + +def filter_by_substring(strings: List[str], substring: str) -> List[str]: + """ Filter an input list of strings only for ones that contain given substring + >>> filter_by_substring([], 'a') + [] + >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a') + ['abc', 'bacd', 'array'] + """ +``` diff --git a/HumanEval_7/solution/__init__.py b/HumanEval_7/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..785ea1e88ff6f0eb34635841d39b88300d3eb1fb --- /dev/null +++ b/HumanEval_7/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import filter_by_substring diff --git a/HumanEval_7/solution/solution.py b/HumanEval_7/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..a12aaddba08527fb7ae019c3ba16f9d9f9b6a0d7 --- /dev/null +++ b/HumanEval_7/solution/solution.py @@ -0,0 +1,11 @@ +from typing import List + + +def filter_by_substring(strings: List[str], substring: str) -> List[str]: + """ Filter an input list of strings only for ones that contain given substring + >>> filter_by_substring([], 'a') + [] + >>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a') + ['abc', 'bacd', 'array'] + """ + return [x for x in strings if substring in x] diff --git a/HumanEval_7/task.toml b/HumanEval_7/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2cf4b76bff4ee90a87142faa0b775d7593ae1ed2 --- /dev/null +++ b/HumanEval_7/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/7" +name = "HumanEval — HumanEval/7" + +[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/HumanEval_7/tests/__init__.py b/HumanEval_7/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_7/tests/conftest.py b/HumanEval_7/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_7/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/HumanEval_7/tests/test_humaneval.py b/HumanEval_7/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..ed90037e1a5ace0c4d49f3cfeebb0acb9d50a67a --- /dev/null +++ b/HumanEval_7/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import filter_by_substring as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([], 'john') == [] + assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx'] + assert candidate(['xxx', 'asd', 'aaaxxy', 'john doe', 'xxxAAA', 'xxx'], 'xx') == ['xxx', 'aaaxxy', 'xxxAAA', 'xxx'] + assert candidate(['grunt', 'trumpet', 'prune', 'gruesome'], 'run') == ['grunt', 'prune'] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_70/instruction.md b/HumanEval_70/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..08ddc1196582938ced9ba740652754429f87a964 --- /dev/null +++ b/HumanEval_70/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/70 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def strange_sort_list(lst): + ''' + Given list of integers, return list in strange order. + Strange sorting, is when you start with the minimum value, + then maximum of the remaining integers, then minimum and so on. + + Examples: + strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3] + strange_sort_list([5, 5, 5, 5]) == [5, 5, 5, 5] + strange_sort_list([]) == [] + ''' +``` diff --git a/HumanEval_70/solution/__init__.py b/HumanEval_70/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..55e5c66ed58de014e3a2c928089c9c5c0102c4fa --- /dev/null +++ b/HumanEval_70/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import strange_sort_list diff --git a/HumanEval_70/solution/solution.py b/HumanEval_70/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1b3b065814dff26c1c6718124ece92e2eb48e4f7 --- /dev/null +++ b/HumanEval_70/solution/solution.py @@ -0,0 +1,18 @@ + +def strange_sort_list(lst): + ''' + Given list of integers, return list in strange order. + Strange sorting, is when you start with the minimum value, + then maximum of the remaining integers, then minimum and so on. + + Examples: + strange_sort_list([1, 2, 3, 4]) == [1, 4, 2, 3] + strange_sort_list([5, 5, 5, 5]) == [5, 5, 5, 5] + strange_sort_list([]) == [] + ''' + res, switch = [], True + while lst: + res.append(min(lst) if switch else max(lst)) + lst.remove(res[-1]) + switch = not switch + return res diff --git a/HumanEval_70/task.toml b/HumanEval_70/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..2e38ceb6d41ffc00ae20e78850e1e4a135fe73e0 --- /dev/null +++ b/HumanEval_70/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/70" +name = "HumanEval — HumanEval/70" + +[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/HumanEval_70/tests/__init__.py b/HumanEval_70/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_70/tests/conftest.py b/HumanEval_70/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_70/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/HumanEval_70/tests/test_humaneval.py b/HumanEval_70/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..dd4ec76e0550f0f9b715a75ddd48ad9ed32745ac --- /dev/null +++ b/HumanEval_70/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import strange_sort_list as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1, 2, 3, 4]) == [1, 4, 2, 3] + assert candidate([5, 6, 7, 8, 9]) == [5, 9, 6, 8, 7] + assert candidate([1, 2, 3, 4, 5]) == [1, 5, 2, 4, 3] + assert candidate([5, 6, 7, 8, 9, 1]) == [1, 9, 5, 8, 6, 7] + assert candidate([5, 5, 5, 5]) == [5, 5, 5, 5] + assert candidate([]) == [] + assert candidate([1,2,3,4,5,6,7,8]) == [1, 8, 2, 7, 3, 6, 4, 5] + assert candidate([0,2,2,2,5,5,-5,-5]) == [-5, 5, -5, 5, 0, 2, 2, 2] + assert candidate([111111]) == [111111] + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_71/instruction.md b/HumanEval_71/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..1a7c88b14352f0cf2cf173de5725d294d2701b61 --- /dev/null +++ b/HumanEval_71/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/71 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def triangle_area(a, b, c): + ''' + Given the lengths of the three sides of a triangle. Return the area of + the triangle rounded to 2 decimal points if the three sides form a valid triangle. + Otherwise return -1 + Three sides make a valid triangle when the sum of any two sides is greater + than the third side. + Example: + triangle_area(3, 4, 5) == 6.00 + triangle_area(1, 2, 10) == -1 + ''' +``` diff --git a/HumanEval_71/solution/__init__.py b/HumanEval_71/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e75b1940b0a8e9a241b607fda51a71a9142852be --- /dev/null +++ b/HumanEval_71/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import triangle_area diff --git a/HumanEval_71/solution/solution.py b/HumanEval_71/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..f3f109a384e42a20fbe0b60cef045a9f5ceeb0ad --- /dev/null +++ b/HumanEval_71/solution/solution.py @@ -0,0 +1,18 @@ + +def triangle_area(a, b, c): + ''' + Given the lengths of the three sides of a triangle. Return the area of + the triangle rounded to 2 decimal points if the three sides form a valid triangle. + Otherwise return -1 + Three sides make a valid triangle when the sum of any two sides is greater + than the third side. + Example: + triangle_area(3, 4, 5) == 6.00 + triangle_area(1, 2, 10) == -1 + ''' + if a + b <= c or a + c <= b or b + c <= a: + return -1 + s = (a + b + c)/2 + area = (s * (s - a) * (s - b) * (s - c)) ** 0.5 + area = round(area, 2) + return area diff --git a/HumanEval_71/task.toml b/HumanEval_71/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f55fdf9138d8588e6c89dd0501ae80a12233eb54 --- /dev/null +++ b/HumanEval_71/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/71" +name = "HumanEval — HumanEval/71" + +[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/HumanEval_71/tests/__init__.py b/HumanEval_71/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_71/tests/conftest.py b/HumanEval_71/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_71/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/HumanEval_71/tests/test_humaneval.py b/HumanEval_71/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..7827545f448b93db4cbf8c0e565f6a5024837986 --- /dev/null +++ b/HumanEval_71/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import triangle_area as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(3, 4, 5) == 6.00, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(1, 2, 10) == -1 + assert candidate(4, 8, 5) == 8.18 + assert candidate(2, 2, 2) == 1.73 + assert candidate(1, 2, 3) == -1 + assert candidate(10, 5, 7) == 16.25 + assert candidate(2, 6, 3) == -1 + + # Check some edge cases that are easy to work out by hand. + assert candidate(1, 1, 1) == 0.43, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate(2, 2, 10) == -1 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_72/instruction.md b/HumanEval_72/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b885505508862a99e3659c923a0a60602e7ac647 --- /dev/null +++ b/HumanEval_72/instruction.md @@ -0,0 +1,25 @@ +# HumanEval — HumanEval/72 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def will_it_fly(q,w): + ''' + Write a function that returns True if the object q will fly, and False otherwise. + The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w. + + Example: + will_it_fly([1, 2], 5) ➞ False + # 1+2 is less than the maximum possible weight, but it's unbalanced. + + will_it_fly([3, 2, 3], 1) ➞ False + # it's balanced, but 3+2+3 is more than the maximum possible weight. + + will_it_fly([3, 2, 3], 9) ➞ True + # 3+2+3 is less than the maximum possible weight, and it's balanced. + + will_it_fly([3], 5) ➞ True + # 3 is less than the maximum possible weight, and it's balanced. + ''' +``` diff --git a/HumanEval_72/solution/__init__.py b/HumanEval_72/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f709ce67bc404f529c0b00e3bab8bacc81b09447 --- /dev/null +++ b/HumanEval_72/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import will_it_fly diff --git a/HumanEval_72/solution/solution.py b/HumanEval_72/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..300f1268e9e580ce736d9887823cdb78aa9ef758 --- /dev/null +++ b/HumanEval_72/solution/solution.py @@ -0,0 +1,29 @@ + +def will_it_fly(q,w): + ''' + Write a function that returns True if the object q will fly, and False otherwise. + The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w. + + Example: + will_it_fly([1, 2], 5) ➞ False + # 1+2 is less than the maximum possible weight, but it's unbalanced. + + will_it_fly([3, 2, 3], 1) ➞ False + # it's balanced, but 3+2+3 is more than the maximum possible weight. + + will_it_fly([3, 2, 3], 9) ➞ True + # 3+2+3 is less than the maximum possible weight, and it's balanced. + + will_it_fly([3], 5) ➞ True + # 3 is less than the maximum possible weight, and it's balanced. + ''' + if sum(q) > w: + return False + + i, j = 0, len(q)-1 + while i None: + check(candidate) diff --git a/HumanEval_73/instruction.md b/HumanEval_73/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ae43ca57547f1a12940f140f2b40992eab835d2c --- /dev/null +++ b/HumanEval_73/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/73 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def smallest_change(arr): + """ + Given an array arr of integers, find the minimum number of elements that + need to be changed to make the array palindromic. A palindromic array is an array that + is read the same backwards and forwards. In one change, you can change one element to any other element. + + For example: + smallest_change([1,2,3,5,4,7,9,6]) == 4 + smallest_change([1, 2, 3, 4, 3, 2, 2]) == 1 + smallest_change([1, 2, 3, 2, 1]) == 0 + """ +``` diff --git a/HumanEval_73/solution/__init__.py b/HumanEval_73/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b84ed490f26048645179643271dfdfee7d5b2379 --- /dev/null +++ b/HumanEval_73/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import smallest_change diff --git a/HumanEval_73/solution/solution.py b/HumanEval_73/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..55fd59e296114ddf5defb71d7de078a3c463c07e --- /dev/null +++ b/HumanEval_73/solution/solution.py @@ -0,0 +1,17 @@ + +def smallest_change(arr): + """ + Given an array arr of integers, find the minimum number of elements that + need to be changed to make the array palindromic. A palindromic array is an array that + is read the same backwards and forwards. In one change, you can change one element to any other element. + + For example: + smallest_change([1,2,3,5,4,7,9,6]) == 4 + smallest_change([1, 2, 3, 4, 3, 2, 2]) == 1 + smallest_change([1, 2, 3, 2, 1]) == 0 + """ + ans = 0 + for i in range(len(arr) // 2): + if arr[i] != arr[len(arr) - i - 1]: + ans += 1 + return ans diff --git a/HumanEval_73/task.toml b/HumanEval_73/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d9213857199511270777fdf911458a55d56b9ca2 --- /dev/null +++ b/HumanEval_73/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/73" +name = "HumanEval — HumanEval/73" + +[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/HumanEval_73/tests/__init__.py b/HumanEval_73/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_73/tests/conftest.py b/HumanEval_73/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_73/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/HumanEval_73/tests/test_humaneval.py b/HumanEval_73/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..523cc774149d827a4935e30234f070fb02c448ee --- /dev/null +++ b/HumanEval_73/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import smallest_change as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1,2,3,5,4,7,9,6]) == 4 + assert candidate([1, 2, 3, 4, 3, 2, 2]) == 1 + assert candidate([1, 4, 2]) == 1 + assert candidate([1, 4, 4, 2]) == 1 + + # Check some edge cases that are easy to work out by hand. + assert candidate([1, 2, 3, 2, 1]) == 0 + assert candidate([3, 1, 1, 3]) == 0 + assert candidate([1]) == 0 + assert candidate([0, 1]) == 1 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_74/instruction.md b/HumanEval_74/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2aff630aa0a928eda96dd938d51bc09bf443575a --- /dev/null +++ b/HumanEval_74/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/74 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def total_match(lst1, lst2): + ''' + Write a function that accepts two lists of strings and returns the list that has + total number of chars in the all strings of the list less than the other list. + + if the two lists have the same number of chars, return the first list. + + Examples + total_match([], []) ➞ [] + total_match(['hi', 'admin'], ['hI', 'Hi']) ➞ ['hI', 'Hi'] + total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) ➞ ['hi', 'admin'] + total_match(['hi', 'admin'], ['hI', 'hi', 'hi']) ➞ ['hI', 'hi', 'hi'] + total_match(['4'], ['1', '2', '3', '4', '5']) ➞ ['4'] + ''' +``` diff --git a/HumanEval_74/solution/__init__.py b/HumanEval_74/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..11146343a78c50489a123eab0b2a4b70c071f8ae --- /dev/null +++ b/HumanEval_74/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import total_match diff --git a/HumanEval_74/solution/solution.py b/HumanEval_74/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..c886ca3989a12b44d640c6d4066d24cec006dbce --- /dev/null +++ b/HumanEval_74/solution/solution.py @@ -0,0 +1,27 @@ + +def total_match(lst1, lst2): + ''' + Write a function that accepts two lists of strings and returns the list that has + total number of chars in the all strings of the list less than the other list. + + if the two lists have the same number of chars, return the first list. + + Examples + total_match([], []) ➞ [] + total_match(['hi', 'admin'], ['hI', 'Hi']) ➞ ['hI', 'Hi'] + total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) ➞ ['hi', 'admin'] + total_match(['hi', 'admin'], ['hI', 'hi', 'hi']) ➞ ['hI', 'hi', 'hi'] + total_match(['4'], ['1', '2', '3', '4', '5']) ➞ ['4'] + ''' + l1 = 0 + for st in lst1: + l1 += len(st) + + l2 = 0 + for st in lst2: + l2 += len(st) + + if l1 <= l2: + return lst1 + else: + return lst2 diff --git a/HumanEval_74/task.toml b/HumanEval_74/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4395f784f4bb0617e6b8dbaed89f4cd98393b18e --- /dev/null +++ b/HumanEval_74/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/74" +name = "HumanEval — HumanEval/74" + +[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/HumanEval_74/tests/__init__.py b/HumanEval_74/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_74/tests/conftest.py b/HumanEval_74/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_74/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/HumanEval_74/tests/test_humaneval.py b/HumanEval_74/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..05b726953bc2a3a2e7fd361b2c6a5b2678a7fe6c --- /dev/null +++ b/HumanEval_74/tests/test_humaneval.py @@ -0,0 +1,24 @@ +from solution import total_match as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([], []) == [] + assert candidate(['hi', 'admin'], ['hi', 'hi']) == ['hi', 'hi'] + assert candidate(['hi', 'admin'], ['hi', 'hi', 'admin', 'project']) == ['hi', 'admin'] + assert candidate(['4'], ['1', '2', '3', '4', '5']) == ['4'] + assert candidate(['hi', 'admin'], ['hI', 'Hi']) == ['hI', 'Hi'] + assert candidate(['hi', 'admin'], ['hI', 'hi', 'hi']) == ['hI', 'hi', 'hi'] + assert candidate(['hi', 'admin'], ['hI', 'hi', 'hii']) == ['hi', 'admin'] + + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([], ['this']) == [] + assert candidate(['this'], []) == [] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_75/instruction.md b/HumanEval_75/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..e7f13b9c9c421b5bb5d3e59c08f4eafe7c6874a1 --- /dev/null +++ b/HumanEval_75/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/75 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def is_multiply_prime(a): + """Write a function that returns true if the given number is the multiplication of 3 prime numbers + and false otherwise. + Knowing that (a) is less then 100. + Example: + is_multiply_prime(30) == True + 30 = 2 * 3 * 5 + """ +``` diff --git a/HumanEval_75/solution/__init__.py b/HumanEval_75/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c0a07bb651a4df4d475fe3ed0e4224b6c7cef369 --- /dev/null +++ b/HumanEval_75/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_multiply_prime diff --git a/HumanEval_75/solution/solution.py b/HumanEval_75/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1b729beb7760c53df28142b534362708df8eff91 --- /dev/null +++ b/HumanEval_75/solution/solution.py @@ -0,0 +1,23 @@ + +def is_multiply_prime(a): + """Write a function that returns true if the given number is the multiplication of 3 prime numbers + and false otherwise. + Knowing that (a) is less then 100. + Example: + is_multiply_prime(30) == True + 30 = 2 * 3 * 5 + """ + def is_prime(n): + for j in range(2,n): + if n%j == 0: + return False + return True + + for i in range(2,101): + if not is_prime(i): continue + for j in range(2,101): + if not is_prime(j): continue + for k in range(2,101): + if not is_prime(k): continue + if i*j*k == a: return True + return False diff --git a/HumanEval_75/task.toml b/HumanEval_75/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..54f091147456441d0bc8e8e360b2c48ecaaed317 --- /dev/null +++ b/HumanEval_75/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/75" +name = "HumanEval — HumanEval/75" + +[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/HumanEval_75/tests/__init__.py b/HumanEval_75/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_75/tests/conftest.py b/HumanEval_75/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_75/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/HumanEval_75/tests/test_humaneval.py b/HumanEval_75/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..ea749bfc4766a9ccd38558c4d5b9ac9c3e6dc67d --- /dev/null +++ b/HumanEval_75/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import is_multiply_prime as candidate + +def check(candidate): + + assert candidate(5) == False + assert candidate(30) == True + assert candidate(8) == True + assert candidate(10) == False + assert candidate(125) == True + assert candidate(3 * 5 * 7) == True + assert candidate(3 * 6 * 7) == False + assert candidate(9 * 9 * 9) == False + assert candidate(11 * 9 * 9) == False + assert candidate(11 * 13 * 7) == True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_76/instruction.md b/HumanEval_76/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..68d2acdb2ea9b54ede05f5e9b0402c791eec48a4 --- /dev/null +++ b/HumanEval_76/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/76 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def is_simple_power(x, n): + """Your task is to write a function that returns true if a number x is a simple + power of n and false in other cases. + x is a simple power of n if n**int=x + For example: + is_simple_power(1, 4) => true + is_simple_power(2, 2) => true + is_simple_power(8, 2) => true + is_simple_power(3, 2) => false + is_simple_power(3, 1) => false + is_simple_power(5, 3) => false + """ +``` diff --git a/HumanEval_76/solution/__init__.py b/HumanEval_76/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..239e7de57f66581b149d6ee68b5935d4a6f9b658 --- /dev/null +++ b/HumanEval_76/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_simple_power diff --git a/HumanEval_76/solution/solution.py b/HumanEval_76/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..2102b3f128920de6b45820ab51ef178fc2263bbf --- /dev/null +++ b/HumanEval_76/solution/solution.py @@ -0,0 +1,19 @@ + +def is_simple_power(x, n): + """Your task is to write a function that returns true if a number x is a simple + power of n and false in other cases. + x is a simple power of n if n**int=x + For example: + is_simple_power(1, 4) => true + is_simple_power(2, 2) => true + is_simple_power(8, 2) => true + is_simple_power(3, 2) => false + is_simple_power(3, 1) => false + is_simple_power(5, 3) => false + """ + if (n == 1): + return (x == 1) + power = 1 + while (power < x): + power = power * n + return (power == x) diff --git a/HumanEval_76/task.toml b/HumanEval_76/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..963563a2a4aa522eb686b08f6cbca8b44fbb7df4 --- /dev/null +++ b/HumanEval_76/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/76" +name = "HumanEval — HumanEval/76" + +[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/HumanEval_76/tests/__init__.py b/HumanEval_76/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_76/tests/conftest.py b/HumanEval_76/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_76/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/HumanEval_76/tests/test_humaneval.py b/HumanEval_76/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..f1e74b4b8205c04db21e2acf102d736d5daf7860 --- /dev/null +++ b/HumanEval_76/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import is_simple_power as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(16, 2)== True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(143214, 16)== False, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(4, 2)==True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(9, 3)==True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(16, 4)==True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(24, 2)==False, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(128, 4)==False, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(12, 6)==False, "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate(1, 1)==True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate(1, 12)==True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_77/instruction.md b/HumanEval_77/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..294de7084aef161d11e0628c5f745d2ea80b78f5 --- /dev/null +++ b/HumanEval_77/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/77 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def iscube(a): + ''' + Write a function that takes an integer a and returns True + if this ingeger is a cube of some integer number. + Note: you may assume the input is always valid. + Examples: + iscube(1) ==> True + iscube(2) ==> False + iscube(-1) ==> True + iscube(64) ==> True + iscube(0) ==> True + iscube(180) ==> False + ''' +``` diff --git a/HumanEval_77/solution/__init__.py b/HumanEval_77/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2130b8f79cde6d86f8142e3cfa4c7302cd3fd455 --- /dev/null +++ b/HumanEval_77/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import iscube diff --git a/HumanEval_77/solution/solution.py b/HumanEval_77/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..522290287502ad7d88dcadbcbdef2f109ddfc64f --- /dev/null +++ b/HumanEval_77/solution/solution.py @@ -0,0 +1,16 @@ + +def iscube(a): + ''' + Write a function that takes an integer a and returns True + if this ingeger is a cube of some integer number. + Note: you may assume the input is always valid. + Examples: + iscube(1) ==> True + iscube(2) ==> False + iscube(-1) ==> True + iscube(64) ==> True + iscube(0) ==> True + iscube(180) ==> False + ''' + a = abs(a) + return int(round(a ** (1. / 3))) ** 3 == a diff --git a/HumanEval_77/task.toml b/HumanEval_77/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e6d4138a592c10885c658aab1aa8551d0d7e3ed6 --- /dev/null +++ b/HumanEval_77/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/77" +name = "HumanEval — HumanEval/77" + +[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/HumanEval_77/tests/__init__.py b/HumanEval_77/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_77/tests/conftest.py b/HumanEval_77/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_77/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/HumanEval_77/tests/test_humaneval.py b/HumanEval_77/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..d59d84824c253d0429ab54082a83f63d6d622d36 --- /dev/null +++ b/HumanEval_77/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import iscube as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(1) == True, "First test error: " + str(candidate(1)) + assert candidate(2) == False, "Second test error: " + str(candidate(2)) + assert candidate(-1) == True, "Third test error: " + str(candidate(-1)) + assert candidate(64) == True, "Fourth test error: " + str(candidate(64)) + assert candidate(180) == False, "Fifth test error: " + str(candidate(180)) + assert candidate(1000) == True, "Sixth test error: " + str(candidate(1000)) + + + # Check some edge cases that are easy to work out by hand. + assert candidate(0) == True, "1st edge test error: " + str(candidate(0)) + assert candidate(1729) == False, "2nd edge test error: " + str(candidate(1728)) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_78/instruction.md b/HumanEval_78/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7951062378be72d1a51efc6010486d8ad9fedc98 --- /dev/null +++ b/HumanEval_78/instruction.md @@ -0,0 +1,25 @@ +# HumanEval — HumanEval/78 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def hex_key(num): + """You have been tasked to write a function that receives + a hexadecimal number as a string and counts the number of hexadecimal + digits that are primes (prime number, or a prime, is a natural number + greater than 1 that is not a product of two smaller natural numbers). + Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. + Prime numbers are 2, 3, 5, 7, 11, 13, 17,... + So you have to determine a number of the following digits: 2, 3, 5, 7, + B (=decimal 11), D (=decimal 13). + Note: you may assume the input is always correct or empty string, + and symbols A,B,C,D,E,F are always uppercase. + Examples: + For num = "AB" the output should be 1. + For num = "1077E" the output should be 2. + For num = "ABED1A33" the output should be 4. + For num = "123456789ABCDEF0" the output should be 6. + For num = "2020" the output should be 2. + """ +``` diff --git a/HumanEval_78/solution/__init__.py b/HumanEval_78/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..43e2af3a51a6ef2fce541f45ad0034f9aa0aca19 --- /dev/null +++ b/HumanEval_78/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import hex_key diff --git a/HumanEval_78/solution/solution.py b/HumanEval_78/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..9524bda31cafdc45ced0f0ecde15875e70d4c8a3 --- /dev/null +++ b/HumanEval_78/solution/solution.py @@ -0,0 +1,25 @@ + +def hex_key(num): + """You have been tasked to write a function that receives + a hexadecimal number as a string and counts the number of hexadecimal + digits that are primes (prime number, or a prime, is a natural number + greater than 1 that is not a product of two smaller natural numbers). + Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. + Prime numbers are 2, 3, 5, 7, 11, 13, 17,... + So you have to determine a number of the following digits: 2, 3, 5, 7, + B (=decimal 11), D (=decimal 13). + Note: you may assume the input is always correct or empty string, + and symbols A,B,C,D,E,F are always uppercase. + Examples: + For num = "AB" the output should be 1. + For num = "1077E" the output should be 2. + For num = "ABED1A33" the output should be 4. + For num = "123456789ABCDEF0" the output should be 6. + For num = "2020" the output should be 2. + """ + primes = ('2', '3', '5', '7', 'B', 'D') + total = 0 + for i in range(0, len(num)): + if num[i] in primes: + total += 1 + return total diff --git a/HumanEval_78/task.toml b/HumanEval_78/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..64552404f2fd5cdf4ae5f204d70ba52ac96a587c --- /dev/null +++ b/HumanEval_78/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/78" +name = "HumanEval — HumanEval/78" + +[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/HumanEval_78/tests/__init__.py b/HumanEval_78/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_78/tests/conftest.py b/HumanEval_78/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_78/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/HumanEval_78/tests/test_humaneval.py b/HumanEval_78/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..93b0bec408b3b13c40080135bcd541316fb705d4 --- /dev/null +++ b/HumanEval_78/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import hex_key as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("AB") == 1, "First test error: " + str(candidate("AB")) + assert candidate("1077E") == 2, "Second test error: " + str(candidate("1077E")) + assert candidate("ABED1A33") == 4, "Third test error: " + str(candidate("ABED1A33")) + assert candidate("2020") == 2, "Fourth test error: " + str(candidate("2020")) + assert candidate("123456789ABCDEF0") == 6, "Fifth test error: " + str(candidate("123456789ABCDEF0")) + assert candidate("112233445566778899AABBCCDDEEFF00") == 12, "Sixth test error: " + str(candidate("112233445566778899AABBCCDDEEFF00")) + + + # Check some edge cases that are easy to work out by hand. + assert candidate([]) == 0 + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_79/instruction.md b/HumanEval_79/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f53054e22cccb01792b350ccd6edeaa1378a12bf --- /dev/null +++ b/HumanEval_79/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/79 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def decimal_to_binary(decimal): + """You will be given a number in decimal form and your task is to convert it to + binary format. The function should return a string, with each character representing a binary + number. Each character in the string will be '0' or '1'. + + There will be an extra couple of characters 'db' at the beginning and at the end of the string. + The extra characters are there to help with the format. + + Examples: + decimal_to_binary(15) # returns "db1111db" + decimal_to_binary(32) # returns "db100000db" + """ +``` diff --git a/HumanEval_79/solution/__init__.py b/HumanEval_79/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c4c88ad18e8d5b58e6670edbd56b078ff149856d --- /dev/null +++ b/HumanEval_79/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import decimal_to_binary diff --git a/HumanEval_79/solution/solution.py b/HumanEval_79/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..b4addface69dd2c8b9ecef7f7cacab2dab858f03 --- /dev/null +++ b/HumanEval_79/solution/solution.py @@ -0,0 +1,14 @@ + +def decimal_to_binary(decimal): + """You will be given a number in decimal form and your task is to convert it to + binary format. The function should return a string, with each character representing a binary + number. Each character in the string will be '0' or '1'. + + There will be an extra couple of characters 'db' at the beginning and at the end of the string. + The extra characters are there to help with the format. + + Examples: + decimal_to_binary(15) # returns "db1111db" + decimal_to_binary(32) # returns "db100000db" + """ + return "db" + bin(decimal)[2:] + "db" diff --git a/HumanEval_79/task.toml b/HumanEval_79/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..fef897cc5922ca1185a400824fd6d824f5f1c98d --- /dev/null +++ b/HumanEval_79/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/79" +name = "HumanEval — HumanEval/79" + +[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/HumanEval_79/tests/__init__.py b/HumanEval_79/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_79/tests/conftest.py b/HumanEval_79/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_79/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/HumanEval_79/tests/test_humaneval.py b/HumanEval_79/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..06deff8b63afcb6afc0bf93ec1d6e6f2f30acc73 --- /dev/null +++ b/HumanEval_79/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import decimal_to_binary as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(0) == "db0db" + assert candidate(32) == "db100000db" + assert candidate(103) == "db1100111db" + assert candidate(15) == "db1111db", "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_8/instruction.md b/HumanEval_8/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..af4cf48b57c8365f83526b14683feffaceac7f7c --- /dev/null +++ b/HumanEval_8/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/8 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List, Tuple + + +def sum_product(numbers: List[int]) -> Tuple[int, int]: + """ For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. + Empty sum should be equal to 0 and empty product should be equal to 1. + >>> sum_product([]) + (0, 1) + >>> sum_product([1, 2, 3, 4]) + (10, 24) + """ +``` diff --git a/HumanEval_8/solution/__init__.py b/HumanEval_8/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..04f2689764e6e4e26d01a312cf3e0e2945957865 --- /dev/null +++ b/HumanEval_8/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sum_product diff --git a/HumanEval_8/solution/solution.py b/HumanEval_8/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1d6e31770bf4838b51125c2df8347efc3e749f37 --- /dev/null +++ b/HumanEval_8/solution/solution.py @@ -0,0 +1,18 @@ +from typing import List, Tuple + + +def sum_product(numbers: List[int]) -> Tuple[int, int]: + """ For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list. + Empty sum should be equal to 0 and empty product should be equal to 1. + >>> sum_product([]) + (0, 1) + >>> sum_product([1, 2, 3, 4]) + (10, 24) + """ + sum_value = 0 + prod_value = 1 + + for n in numbers: + sum_value += n + prod_value *= n + return sum_value, prod_value diff --git a/HumanEval_8/task.toml b/HumanEval_8/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..25dac5b32b7595b14eada07d17ea500368c52f74 --- /dev/null +++ b/HumanEval_8/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/8" +name = "HumanEval — HumanEval/8" + +[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/HumanEval_8/tests/__init__.py b/HumanEval_8/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_8/tests/conftest.py b/HumanEval_8/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_8/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/HumanEval_8/tests/test_humaneval.py b/HumanEval_8/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..a69b7c203cd87fec1a40d98d070692a738a927d5 --- /dev/null +++ b/HumanEval_8/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import sum_product as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([]) == (0, 1) + assert candidate([1, 1, 1]) == (3, 1) + assert candidate([100, 0]) == (100, 0) + assert candidate([3, 5, 7]) == (3 + 5 + 7, 3 * 5 * 7) + assert candidate([10]) == (10, 10) + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_80/instruction.md b/HumanEval_80/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2c2206094cc4dcaabcbc56b8b51b020116520020 --- /dev/null +++ b/HumanEval_80/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/80 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def is_happy(s): + """You are given a string s. + Your task is to check if the string is happy or not. + A string is happy if its length is at least 3 and every 3 consecutive letters are distinct + For example: + is_happy(a) => False + is_happy(aa) => False + is_happy(abcd) => True + is_happy(aabb) => False + is_happy(adb) => True + is_happy(xyy) => False + """ +``` diff --git a/HumanEval_80/solution/__init__.py b/HumanEval_80/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c452918a9f62d66acfeb08ef3692507ea56725fb --- /dev/null +++ b/HumanEval_80/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_happy diff --git a/HumanEval_80/solution/solution.py b/HumanEval_80/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..d5149ada489668d51ac04d082007f3072a00b93f --- /dev/null +++ b/HumanEval_80/solution/solution.py @@ -0,0 +1,21 @@ + +def is_happy(s): + """You are given a string s. + Your task is to check if the string is happy or not. + A string is happy if its length is at least 3 and every 3 consecutive letters are distinct + For example: + is_happy(a) => False + is_happy(aa) => False + is_happy(abcd) => True + is_happy(aabb) => False + is_happy(adb) => True + is_happy(xyy) => False + """ + if len(s) < 3: + return False + + for i in range(len(s) - 2): + + if s[i] == s[i+1] or s[i+1] == s[i+2] or s[i] == s[i+2]: + return False + return True diff --git a/HumanEval_80/task.toml b/HumanEval_80/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..38fef394c2a312720ecaf10ea83a88e53e6ed450 --- /dev/null +++ b/HumanEval_80/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/80" +name = "HumanEval — HumanEval/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/HumanEval_80/tests/__init__.py b/HumanEval_80/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_80/tests/conftest.py b/HumanEval_80/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_80/tests/test_humaneval.py b/HumanEval_80/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8b7678aa5f5181b217afbdbfad4cb7fc7fe80765 --- /dev/null +++ b/HumanEval_80/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import is_happy as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("a") == False , "a" + assert candidate("aa") == False , "aa" + assert candidate("abcd") == True , "abcd" + assert candidate("aabb") == False , "aabb" + assert candidate("adb") == True , "adb" + assert candidate("xyy") == False , "xyy" + assert candidate("iopaxpoi") == True , "iopaxpoi" + assert candidate("iopaxioi") == False , "iopaxioi" + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_81/instruction.md b/HumanEval_81/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..ca8ee1406cb78ffc608c1405751e3c34d34b9328 --- /dev/null +++ b/HumanEval_81/instruction.md @@ -0,0 +1,32 @@ +# HumanEval — HumanEval/81 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def numerical_letter_grade(grades): + """It is the last week of the semester and the teacher has to give the grades + to students. The teacher has been making her own algorithm for grading. + The only problem is, she has lost the code she used for grading. + She has given you a list of GPAs for some students and you have to write + a function that can output a list of letter grades using the following table: + GPA | Letter grade + 4.0 A+ + > 3.7 A + > 3.3 A- + > 3.0 B+ + > 2.7 B + > 2.3 B- + > 2.0 C+ + > 1.7 C + > 1.3 C- + > 1.0 D+ + > 0.7 D + > 0.0 D- + 0.0 E + + + Example: + grade_equation([4.0, 3, 1.7, 2, 3.5]) ==> ['A+', 'B', 'C-', 'C', 'A-'] + """ +``` diff --git a/HumanEval_81/solution/__init__.py b/HumanEval_81/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7da99040c0e9a01aa601a479f56dc19f5992e139 --- /dev/null +++ b/HumanEval_81/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import numerical_letter_grade diff --git a/HumanEval_81/solution/solution.py b/HumanEval_81/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..4dd46344aadbdb4c86a41d12c97ff816600be243 --- /dev/null +++ b/HumanEval_81/solution/solution.py @@ -0,0 +1,57 @@ + +def numerical_letter_grade(grades): + """It is the last week of the semester and the teacher has to give the grades + to students. The teacher has been making her own algorithm for grading. + The only problem is, she has lost the code she used for grading. + She has given you a list of GPAs for some students and you have to write + a function that can output a list of letter grades using the following table: + GPA | Letter grade + 4.0 A+ + > 3.7 A + > 3.3 A- + > 3.0 B+ + > 2.7 B + > 2.3 B- + > 2.0 C+ + > 1.7 C + > 1.3 C- + > 1.0 D+ + > 0.7 D + > 0.0 D- + 0.0 E + + + Example: + grade_equation([4.0, 3, 1.7, 2, 3.5]) ==> ['A+', 'B', 'C-', 'C', 'A-'] + """ + + + letter_grade = [] + for gpa in grades: + if gpa == 4.0: + letter_grade.append("A+") + elif gpa > 3.7: + letter_grade.append("A") + elif gpa > 3.3: + letter_grade.append("A-") + elif gpa > 3.0: + letter_grade.append("B+") + elif gpa > 2.7: + letter_grade.append("B") + elif gpa > 2.3: + letter_grade.append("B-") + elif gpa > 2.0: + letter_grade.append("C+") + elif gpa > 1.7: + letter_grade.append("C") + elif gpa > 1.3: + letter_grade.append("C-") + elif gpa > 1.0: + letter_grade.append("D+") + elif gpa > 0.7: + letter_grade.append("D") + elif gpa > 0.0: + letter_grade.append("D-") + else: + letter_grade.append("E") + return letter_grade diff --git a/HumanEval_81/task.toml b/HumanEval_81/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..c2d7f2a5fac653bc95db91ab927d3bae0c4148e2 --- /dev/null +++ b/HumanEval_81/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/81" +name = "HumanEval — HumanEval/81" + +[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/HumanEval_81/tests/__init__.py b/HumanEval_81/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_81/tests/conftest.py b/HumanEval_81/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_81/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/HumanEval_81/tests/test_humaneval.py b/HumanEval_81/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..0e4736523f1b215a4a883c99aca01b6f7f648915 --- /dev/null +++ b/HumanEval_81/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import numerical_letter_grade as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([4.0, 3, 1.7, 2, 3.5]) == ['A+', 'B', 'C-', 'C', 'A-'] + assert candidate([1.2]) == ['D+'] + assert candidate([0.5]) == ['D-'] + assert candidate([0.0]) == ['E'] + assert candidate([1, 0.3, 1.5, 2.8, 3.3]) == ['D', 'D-', 'C-', 'B', 'B+'] + assert candidate([0, 0.7]) == ['E', 'D-'] + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_82/instruction.md b/HumanEval_82/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b1f618cb831c7512c8592d845e13defedddd11e6 --- /dev/null +++ b/HumanEval_82/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/82 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def prime_length(string): + """Write a function that takes a string and returns True if the string + length is a prime number or False otherwise + Examples + prime_length('Hello') == True + prime_length('abcdcba') == True + prime_length('kittens') == True + prime_length('orange') == False + """ +``` diff --git a/HumanEval_82/solution/__init__.py b/HumanEval_82/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..85ff4a5f1c6ed9c05beb860cf865c53ce5452beb --- /dev/null +++ b/HumanEval_82/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import prime_length diff --git a/HumanEval_82/solution/solution.py b/HumanEval_82/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..55f8139240586abd957f3554b86e622440526d62 --- /dev/null +++ b/HumanEval_82/solution/solution.py @@ -0,0 +1,17 @@ + +def prime_length(string): + """Write a function that takes a string and returns True if the string + length is a prime number or False otherwise + Examples + prime_length('Hello') == True + prime_length('abcdcba') == True + prime_length('kittens') == True + prime_length('orange') == False + """ + l = len(string) + if l == 0 or l == 1: + return False + for i in range(2, l): + if l % i == 0: + return False + return True diff --git a/HumanEval_82/task.toml b/HumanEval_82/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..999e6f2a227b4be40ceadebd4a8b576a920d72ac --- /dev/null +++ b/HumanEval_82/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/82" +name = "HumanEval — HumanEval/82" + +[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/HumanEval_82/tests/__init__.py b/HumanEval_82/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_82/tests/conftest.py b/HumanEval_82/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_82/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/HumanEval_82/tests/test_humaneval.py b/HumanEval_82/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8a5ee72cf4ced48e563ce4ba2ad9cc0ab93045f1 --- /dev/null +++ b/HumanEval_82/tests/test_humaneval.py @@ -0,0 +1,28 @@ +from solution import prime_length as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('Hello') == True + assert candidate('abcdcba') == True + assert candidate('kittens') == True + assert candidate('orange') == False + assert candidate('wow') == True + assert candidate('world') == True + assert candidate('MadaM') == True + assert candidate('Wow') == True + assert candidate('') == False + assert candidate('HI') == True + assert candidate('go') == True + assert candidate('gogo') == False + assert candidate('aaaaaaaaaaaaaaa') == False + + # Check some edge cases that are easy to work out by hand. + assert candidate('Madam') == True + assert candidate('M') == False + assert candidate('0') == False + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_83/instruction.md b/HumanEval_83/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..7c09091153d1777a5385c3c7934da29ef849b88e --- /dev/null +++ b/HumanEval_83/instruction.md @@ -0,0 +1,12 @@ +# HumanEval — HumanEval/83 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def starts_one_ends(n): + """ + Given a positive integer n, return the count of the numbers of n-digit + positive integers that start or end with 1. + """ +``` diff --git a/HumanEval_83/solution/__init__.py b/HumanEval_83/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1c690820fdbb1bb81a34a343d5c384790cadc5d0 --- /dev/null +++ b/HumanEval_83/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import starts_one_ends diff --git a/HumanEval_83/solution/solution.py b/HumanEval_83/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..03e255a468f2c8c3827d81b316d03e7710cb2c98 --- /dev/null +++ b/HumanEval_83/solution/solution.py @@ -0,0 +1,8 @@ + +def starts_one_ends(n): + """ + Given a positive integer n, return the count of the numbers of n-digit + positive integers that start or end with 1. + """ + if n == 1: return 1 + return 18 * (10 ** (n - 2)) diff --git a/HumanEval_83/task.toml b/HumanEval_83/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..866b50d0e5fa48a64244f6b31ecbc6c5de3f47fa --- /dev/null +++ b/HumanEval_83/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/83" +name = "HumanEval — HumanEval/83" + +[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/HumanEval_83/tests/__init__.py b/HumanEval_83/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_83/tests/conftest.py b/HumanEval_83/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_83/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/HumanEval_83/tests/test_humaneval.py b/HumanEval_83/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9f1105ed105b8cc78d5b18df70c0d0bc16091d72 --- /dev/null +++ b/HumanEval_83/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import starts_one_ends as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(1) == 1 + assert candidate(2) == 18 + assert candidate(3) == 180 + assert candidate(4) == 1800 + assert candidate(5) == 18000 + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_84/instruction.md b/HumanEval_84/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b6b1cf9fa84974432a6f4267190f44159ec87f1b --- /dev/null +++ b/HumanEval_84/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/84 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def solve(N): + """Given a positive integer N, return the total sum of its digits in binary. + + Example + For N = 1000, the sum of digits will be 1 the output should be "1". + For N = 150, the sum of digits will be 6 the output should be "110". + For N = 147, the sum of digits will be 12 the output should be "1100". + + Variables: + @N integer + Constraints: 0 ≤ N ≤ 10000. + Output: + a string of binary number + """ +``` diff --git a/HumanEval_84/solution/__init__.py b/HumanEval_84/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ba22072926328a428ebbf607075059dedb2221d0 --- /dev/null +++ b/HumanEval_84/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import solve diff --git a/HumanEval_84/solution/solution.py b/HumanEval_84/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..93dfb6532cf5ad4b61631501a3f2060a93a58d0f --- /dev/null +++ b/HumanEval_84/solution/solution.py @@ -0,0 +1,16 @@ + +def solve(N): + """Given a positive integer N, return the total sum of its digits in binary. + + Example + For N = 1000, the sum of digits will be 1 the output should be "1". + For N = 150, the sum of digits will be 6 the output should be "110". + For N = 147, the sum of digits will be 12 the output should be "1100". + + Variables: + @N integer + Constraints: 0 ≤ N ≤ 10000. + Output: + a string of binary number + """ + return bin(sum(int(i) for i in str(N)))[2:] diff --git a/HumanEval_84/task.toml b/HumanEval_84/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..1e01f9039c96f4d342a9ef094ad0cf78b7cd48f9 --- /dev/null +++ b/HumanEval_84/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/84" +name = "HumanEval — HumanEval/84" + +[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/HumanEval_84/tests/__init__.py b/HumanEval_84/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_84/tests/conftest.py b/HumanEval_84/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_84/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/HumanEval_84/tests/test_humaneval.py b/HumanEval_84/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..ecd09492c0289b887a9fccc51f454320492cb2c5 --- /dev/null +++ b/HumanEval_84/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import solve as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(1000) == "1", "Error" + assert candidate(150) == "110", "Error" + assert candidate(147) == "1100", "Error" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate(333) == "1001", "Error" + assert candidate(963) == "10010", "Error" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_85/instruction.md b/HumanEval_85/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..44663f055e6f56dcd3faf62d93965c74c3829f46 --- /dev/null +++ b/HumanEval_85/instruction.md @@ -0,0 +1,14 @@ +# HumanEval — HumanEval/85 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def add(lst): + """Given a non-empty list of integers lst. add the even elements that are at odd indices.. + + + Examples: + add([4, 2, 6, 7]) ==> 2 + """ +``` diff --git a/HumanEval_85/solution/__init__.py b/HumanEval_85/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f347031b33901848e2c9d8661560ceb67a9264a2 --- /dev/null +++ b/HumanEval_85/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import add diff --git a/HumanEval_85/solution/solution.py b/HumanEval_85/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..3ffd9ace1878644d8ed360c7e4de868edc47b07f --- /dev/null +++ b/HumanEval_85/solution/solution.py @@ -0,0 +1,9 @@ + +def add(lst): + """Given a non-empty list of integers lst. add the even elements that are at odd indices.. + + + Examples: + add([4, 2, 6, 7]) ==> 2 + """ + return sum([lst[i] for i in range(1, len(lst), 2) if lst[i]%2 == 0]) diff --git a/HumanEval_85/task.toml b/HumanEval_85/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..bc9b1f66625aca31f864385cbc248381bb2d4e36 --- /dev/null +++ b/HumanEval_85/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/85" +name = "HumanEval — HumanEval/85" + +[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/HumanEval_85/tests/__init__.py b/HumanEval_85/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_85/tests/conftest.py b/HumanEval_85/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_85/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/HumanEval_85/tests/test_humaneval.py b/HumanEval_85/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..9998af964d6bc00a47b6371caf7cc6b24c6de7d0 --- /dev/null +++ b/HumanEval_85/tests/test_humaneval.py @@ -0,0 +1,16 @@ +from solution import add as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([4, 88]) == 88 + assert candidate([4, 5, 6, 7, 2, 122]) == 122 + assert candidate([4, 0, 6, 7]) == 0 + assert candidate([4, 4, 6, 8]) == 12 + + # Check some edge cases that are easy to work out by hand. + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_86/instruction.md b/HumanEval_86/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..6b5133ea1ab1c3cd1dc90f11fac180487f80d3e8 --- /dev/null +++ b/HumanEval_86/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/86 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def anti_shuffle(s): + """ + Write a function that takes a string and returns an ordered version of it. + Ordered version of string, is a string where all words (separated by space) + are replaced by a new word where all the characters arranged in + ascending order based on ascii value. + Note: You should keep the order of words and blank spaces in the sentence. + + For example: + anti_shuffle('Hi') returns 'Hi' + anti_shuffle('hello') returns 'ehllo' + anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' + """ +``` diff --git a/HumanEval_86/solution/__init__.py b/HumanEval_86/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c8948607d530101afd280432328a64c47fa2e7e2 --- /dev/null +++ b/HumanEval_86/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import anti_shuffle diff --git a/HumanEval_86/solution/solution.py b/HumanEval_86/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..65fa031fd4f67f36bb02d2d794e76c547a38138a --- /dev/null +++ b/HumanEval_86/solution/solution.py @@ -0,0 +1,15 @@ + +def anti_shuffle(s): + """ + Write a function that takes a string and returns an ordered version of it. + Ordered version of string, is a string where all words (separated by space) + are replaced by a new word where all the characters arranged in + ascending order based on ascii value. + Note: You should keep the order of words and blank spaces in the sentence. + + For example: + anti_shuffle('Hi') returns 'Hi' + anti_shuffle('hello') returns 'ehllo' + anti_shuffle('Hello World!!!') returns 'Hello !!!Wdlor' + """ + return ' '.join([''.join(sorted(list(i))) for i in s.split(' ')]) diff --git a/HumanEval_86/task.toml b/HumanEval_86/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f95c0279a145b0328acbff3e7c0f9c6b2e8a4897 --- /dev/null +++ b/HumanEval_86/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/86" +name = "HumanEval — HumanEval/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/HumanEval_86/tests/__init__.py b/HumanEval_86/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_86/tests/conftest.py b/HumanEval_86/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_86/tests/test_humaneval.py b/HumanEval_86/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..8dbedef905290100d7ba457f0bd156235de14298 --- /dev/null +++ b/HumanEval_86/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import anti_shuffle as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('Hi') == 'Hi' + assert candidate('hello') == 'ehllo' + assert candidate('number') == 'bemnru' + assert candidate('abcd') == 'abcd' + assert candidate('Hello World!!!') == 'Hello !!!Wdlor' + assert candidate('') == '' + assert candidate('Hi. My name is Mister Robot. How are you?') == '.Hi My aemn is Meirst .Rboot How aer ?ouy' + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_87/instruction.md b/HumanEval_87/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..c9e95a36ea54a4e54c488ad52858c4472e1c707f --- /dev/null +++ b/HumanEval_87/instruction.md @@ -0,0 +1,27 @@ +# HumanEval — HumanEval/87 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def get_row(lst, x): + """ + You are given a 2 dimensional data, as a nested lists, + which is similar to matrix, however, unlike matrices, + each row may contain a different number of columns. + Given lst, and integer x, find integers x in the list, + and return list of tuples, [(x1, y1), (x2, y2) ...] such that + each tuple is a coordinate - (row, columns), starting with 0. + Sort coordinates initially by rows in ascending order. + Also, sort coordinates of the row by columns in descending order. + + Examples: + get_row([ + [1,2,3,4,5,6], + [1,2,3,4,1,6], + [1,2,3,4,5,1] + ], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)] + get_row([], 1) == [] + get_row([[], [1], [1, 2, 3]], 3) == [(2, 2)] + """ +``` diff --git a/HumanEval_87/solution/__init__.py b/HumanEval_87/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7d354331ae22e08be509ea0a9b9de5b6e3d54e96 --- /dev/null +++ b/HumanEval_87/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import get_row diff --git a/HumanEval_87/solution/solution.py b/HumanEval_87/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..3c56a70870b8b4e3c4e3ccc4ac0c8f0c41663381 --- /dev/null +++ b/HumanEval_87/solution/solution.py @@ -0,0 +1,23 @@ + +def get_row(lst, x): + """ + You are given a 2 dimensional data, as a nested lists, + which is similar to matrix, however, unlike matrices, + each row may contain a different number of columns. + Given lst, and integer x, find integers x in the list, + and return list of tuples, [(x1, y1), (x2, y2) ...] such that + each tuple is a coordinate - (row, columns), starting with 0. + Sort coordinates initially by rows in ascending order. + Also, sort coordinates of the row by columns in descending order. + + Examples: + get_row([ + [1,2,3,4,5,6], + [1,2,3,4,1,6], + [1,2,3,4,5,1] + ], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)] + get_row([], 1) == [] + get_row([[], [1], [1, 2, 3]], 3) == [(2, 2)] + """ + coords = [(i, j) for i in range(len(lst)) for j in range(len(lst[i])) if lst[i][j] == x] + return sorted(sorted(coords, key=lambda x: x[1], reverse=True), key=lambda x: x[0]) diff --git a/HumanEval_87/task.toml b/HumanEval_87/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..05541aa667d0ec295c84a7ac6bbff4961cd46929 --- /dev/null +++ b/HumanEval_87/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/87" +name = "HumanEval — HumanEval/87" + +[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/HumanEval_87/tests/__init__.py b/HumanEval_87/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_87/tests/conftest.py b/HumanEval_87/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_87/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/HumanEval_87/tests/test_humaneval.py b/HumanEval_87/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..3cb27a549d2eb9c8cf668916c198b20dc3ba4e97 --- /dev/null +++ b/HumanEval_87/tests/test_humaneval.py @@ -0,0 +1,38 @@ +from solution import get_row as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([ + [1,2,3,4,5,6], + [1,2,3,4,1,6], + [1,2,3,4,5,1] + ], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)] + assert candidate([ + [1,2,3,4,5,6], + [1,2,3,4,5,6], + [1,2,3,4,5,6], + [1,2,3,4,5,6], + [1,2,3,4,5,6], + [1,2,3,4,5,6] + ], 2) == [(0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1)] + assert candidate([ + [1,2,3,4,5,6], + [1,2,3,4,5,6], + [1,1,3,4,5,6], + [1,2,1,4,5,6], + [1,2,3,1,5,6], + [1,2,3,4,1,6], + [1,2,3,4,5,1] + ], 1) == [(0, 0), (1, 0), (2, 1), (2, 0), (3, 2), (3, 0), (4, 3), (4, 0), (5, 4), (5, 0), (6, 5), (6, 0)] + assert candidate([], 1) == [] + assert candidate([[1]], 2) == [] + assert candidate([[], [1], [1, 2, 3]], 3) == [(2, 2)] + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_88/instruction.md b/HumanEval_88/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..b9da1b110776a40ba979adfaa1030981cba2e86b --- /dev/null +++ b/HumanEval_88/instruction.md @@ -0,0 +1,22 @@ +# HumanEval — HumanEval/88 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def sort_array(array): + """ + Given an array of non-negative integers, return a copy of the given array after sorting, + you will sort the given array in ascending order if the sum( first index value, last index value) is odd, + or sort it in descending order if the sum( first index value, last index value) is even. + + Note: + * don't change the given array. + + Examples: + * sort_array([]) => [] + * sort_array([5]) => [5] + * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] + * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] + """ +``` diff --git a/HumanEval_88/solution/__init__.py b/HumanEval_88/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e76c8bd33e870760b00ac1256a65ba27831b9f30 --- /dev/null +++ b/HumanEval_88/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import sort_array diff --git a/HumanEval_88/solution/solution.py b/HumanEval_88/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..07a1178800462f67788ead4f7f23bafa6c6e93a6 --- /dev/null +++ b/HumanEval_88/solution/solution.py @@ -0,0 +1,17 @@ + +def sort_array(array): + """ + Given an array of non-negative integers, return a copy of the given array after sorting, + you will sort the given array in ascending order if the sum( first index value, last index value) is odd, + or sort it in descending order if the sum( first index value, last index value) is even. + + Note: + * don't change the given array. + + Examples: + * sort_array([]) => [] + * sort_array([5]) => [5] + * sort_array([2, 4, 3, 0, 1, 5]) => [0, 1, 2, 3, 4, 5] + * sort_array([2, 4, 3, 0, 1, 5, 6]) => [6, 5, 4, 3, 2, 1, 0] + """ + return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 == 0) diff --git a/HumanEval_88/task.toml b/HumanEval_88/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..09ddd7d487404622e186c03b964cef2fafed93a0 --- /dev/null +++ b/HumanEval_88/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/88" +name = "HumanEval — HumanEval/88" + +[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/HumanEval_88/tests/__init__.py b/HumanEval_88/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_88/tests/conftest.py b/HumanEval_88/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_88/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/HumanEval_88/tests/test_humaneval.py b/HumanEval_88/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..70bb3a0aa7e3a672a47106bbdfcafb990b76c848 --- /dev/null +++ b/HumanEval_88/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import sort_array as candidate + +def check(candidate): + + # Check some simple cases + assert True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate([]) == [], "Error" + assert candidate([5]) == [5], "Error" + assert candidate([2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5], "Error" + assert candidate([2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0], "Error" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + assert candidate([2, 1]) == [1, 2], "Error" + assert candidate([15, 42, 87, 32 ,11, 0]) == [0, 11, 15, 32, 42, 87], "Error" + assert candidate([21, 14, 23, 11]) == [23, 21, 14, 11], "Error" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_89/instruction.md b/HumanEval_89/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2c5e1c9eec2208036b45d4004578b6afd7cdbcbc --- /dev/null +++ b/HumanEval_89/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/89 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def encrypt(s): + """Create a function encrypt that takes a string as an argument and + returns a string encrypted with the alphabet being rotated. + The alphabet should be rotated in a manner such that the letters + shift down by two multiplied to two places. + For example: + encrypt('hi') returns 'lm' + encrypt('asdfghjkl') returns 'ewhjklnop' + encrypt('gf') returns 'kj' + encrypt('et') returns 'ix' + """ +``` diff --git a/HumanEval_89/solution/__init__.py b/HumanEval_89/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e3c954322b9e4530ed786be59c0ce32e361c6f98 --- /dev/null +++ b/HumanEval_89/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import encrypt diff --git a/HumanEval_89/solution/solution.py b/HumanEval_89/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..1f9212a97a2757c62f1683e5a3827b619a71e66d --- /dev/null +++ b/HumanEval_89/solution/solution.py @@ -0,0 +1,20 @@ + +def encrypt(s): + """Create a function encrypt that takes a string as an argument and + returns a string encrypted with the alphabet being rotated. + The alphabet should be rotated in a manner such that the letters + shift down by two multiplied to two places. + For example: + encrypt('hi') returns 'lm' + encrypt('asdfghjkl') returns 'ewhjklnop' + encrypt('gf') returns 'kj' + encrypt('et') returns 'ix' + """ + d = 'abcdefghijklmnopqrstuvwxyz' + out = '' + for c in s: + if c in d: + out += d[(d.index(c)+2*2) % 26] + else: + out += c + return out diff --git a/HumanEval_89/task.toml b/HumanEval_89/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e7a59d190f747de18370ba57aff98a10846b8c5a --- /dev/null +++ b/HumanEval_89/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/89" +name = "HumanEval — HumanEval/89" + +[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/HumanEval_89/tests/__init__.py b/HumanEval_89/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_89/tests/conftest.py b/HumanEval_89/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_89/tests/test_humaneval.py b/HumanEval_89/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..d5c0997dd8b6ad536e3a62cc44175008b69ad429 --- /dev/null +++ b/HumanEval_89/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import encrypt as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('hi') == 'lm', "This prints if this assert fails 1 (good for debugging!)" + assert candidate('asdfghjkl') == 'ewhjklnop', "This prints if this assert fails 1 (good for debugging!)" + assert candidate('gf') == 'kj', "This prints if this assert fails 1 (good for debugging!)" + assert candidate('et') == 'ix', "This prints if this assert fails 1 (good for debugging!)" + + assert candidate('faewfawefaewg')=='jeiajeaijeiak', "This prints if this assert fails 1 (good for debugging!)" + assert candidate('hellomyfriend')=='lippsqcjvmirh', "This prints if this assert fails 2 (good for debugging!)" + assert candidate('dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh')=='hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl', "This prints if this assert fails 3 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate('a')=='e', "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_9/instruction.md b/HumanEval_9/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..166685a7960cbf779c29557d13d2286d3c4c7839 --- /dev/null +++ b/HumanEval_9/instruction.md @@ -0,0 +1,15 @@ +# HumanEval — HumanEval/9 + +Complete the following Python function so that it satisfies its docstring. + +```python +from typing import List, Tuple + + +def rolling_max(numbers: List[int]) -> List[int]: + """ From a given list of integers, generate a list of rolling maximum element found until given moment + in the sequence. + >>> rolling_max([1, 2, 3, 2, 3, 4, 2]) + [1, 2, 3, 3, 3, 4, 4] + """ +``` diff --git a/HumanEval_9/solution/__init__.py b/HumanEval_9/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..26a3df2e67d71076c45871b2c1f3f7f7e18928f5 --- /dev/null +++ b/HumanEval_9/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import rolling_max diff --git a/HumanEval_9/solution/solution.py b/HumanEval_9/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..57658102e834145f34ffac1a580c064ac778513b --- /dev/null +++ b/HumanEval_9/solution/solution.py @@ -0,0 +1,21 @@ +from typing import List, Tuple + + +def rolling_max(numbers: List[int]) -> List[int]: + """ From a given list of integers, generate a list of rolling maximum element found until given moment + in the sequence. + >>> rolling_max([1, 2, 3, 2, 3, 4, 2]) + [1, 2, 3, 3, 3, 4, 4] + """ + running_max = None + result = [] + + for n in numbers: + if running_max is None: + running_max = n + else: + running_max = max(running_max, n) + + result.append(running_max) + + return result diff --git a/HumanEval_9/task.toml b/HumanEval_9/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..d2975eb2052070a5f420ce89bc7aaf9ab9af862a --- /dev/null +++ b/HumanEval_9/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/9" +name = "HumanEval — HumanEval/9" + +[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/HumanEval_9/tests/__init__.py b/HumanEval_9/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_9/tests/conftest.py b/HumanEval_9/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_9/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/HumanEval_9/tests/test_humaneval.py b/HumanEval_9/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..5be4c56ed5b81b7896b02b529e14cca3291ec5d6 --- /dev/null +++ b/HumanEval_9/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import rolling_max as candidate + + + +METADATA = { + 'author': 'jt', + 'dataset': 'test' +} + + +def check(candidate): + assert candidate([]) == [] + assert candidate([1, 2, 3, 4]) == [1, 2, 3, 4] + assert candidate([4, 3, 2, 1]) == [4, 4, 4, 4] + assert candidate([3, 2, 3, 100, 3]) == [3, 3, 3, 100, 100] + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_90/instruction.md b/HumanEval_90/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..09ee2bab7d8ab624f2580b483a09aeac6c57df96 --- /dev/null +++ b/HumanEval_90/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/90 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def next_smallest(lst): + """ + You are given a list of integers. + Write a function next_smallest() that returns the 2nd smallest element of the list. + Return None if there is no such element. + + next_smallest([1, 2, 3, 4, 5]) == 2 + next_smallest([5, 1, 4, 3, 2]) == 2 + next_smallest([]) == None + next_smallest([1, 1]) == None + """ +``` diff --git a/HumanEval_90/solution/__init__.py b/HumanEval_90/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..42b0d68d5a47f590279f2b582cef90c6e90b1dc3 --- /dev/null +++ b/HumanEval_90/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import next_smallest diff --git a/HumanEval_90/solution/solution.py b/HumanEval_90/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..ab7aadd6c0a1f4fc2aa404f0edd6c43b93b6de92 --- /dev/null +++ b/HumanEval_90/solution/solution.py @@ -0,0 +1,14 @@ + +def next_smallest(lst): + """ + You are given a list of integers. + Write a function next_smallest() that returns the 2nd smallest element of the list. + Return None if there is no such element. + + next_smallest([1, 2, 3, 4, 5]) == 2 + next_smallest([5, 1, 4, 3, 2]) == 2 + next_smallest([]) == None + next_smallest([1, 1]) == None + """ + lst = sorted(set(lst)) + return None if len(lst) < 2 else lst[1] diff --git a/HumanEval_90/task.toml b/HumanEval_90/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..951c0b79b016f7316a4cc5cd88ea948defa25333 --- /dev/null +++ b/HumanEval_90/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/90" +name = "HumanEval — HumanEval/90" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/HumanEval_90/tests/__init__.py b/HumanEval_90/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_90/tests/conftest.py b/HumanEval_90/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_90/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/HumanEval_90/tests/test_humaneval.py b/HumanEval_90/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..0fe48e7bf77cfd150f22af89508e7d7b3111dc54 --- /dev/null +++ b/HumanEval_90/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import next_smallest as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([1, 2, 3, 4, 5]) == 2 + assert candidate([5, 1, 4, 3, 2]) == 2 + assert candidate([]) == None + assert candidate([1, 1]) == None + assert candidate([1,1,1,1,0]) == 1 + assert candidate([1, 0**0]) == None + assert candidate([-35, 34, 12, -45]) == -35 + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_91/instruction.md b/HumanEval_91/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..a1df3c959a3454de7652578ccde57fc41a23e48e --- /dev/null +++ b/HumanEval_91/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/91 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def is_bored(S): + """ + You'll be given a string of words, and your task is to count the number + of boredoms. A boredom is a sentence that starts with the word "I". + Sentences are delimited by '.', '?' or '!'. + + For example: + >>> is_bored("Hello world") + 0 + >>> is_bored("The sky is blue. The sun is shining. I love this weather") + 1 + """ +``` diff --git a/HumanEval_91/solution/__init__.py b/HumanEval_91/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3fa3833e7e05f6c05fc7a263a7d3c1d7592dbb4c --- /dev/null +++ b/HumanEval_91/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import is_bored diff --git a/HumanEval_91/solution/solution.py b/HumanEval_91/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..17cb9d8a3560f4c37e48085665a0ce3a7a19fa5e --- /dev/null +++ b/HumanEval_91/solution/solution.py @@ -0,0 +1,16 @@ + +def is_bored(S): + """ + You'll be given a string of words, and your task is to count the number + of boredoms. A boredom is a sentence that starts with the word "I". + Sentences are delimited by '.', '?' or '!'. + + For example: + >>> is_bored("Hello world") + 0 + >>> is_bored("The sky is blue. The sun is shining. I love this weather") + 1 + """ + import re + sentences = re.split(r'[.?!]\s*', S) + return sum(sentence[0:2] == 'I ' for sentence in sentences) diff --git a/HumanEval_91/task.toml b/HumanEval_91/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..65631441e0e5c0172842df289242e3bd5c4533fc --- /dev/null +++ b/HumanEval_91/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/91" +name = "HumanEval — HumanEval/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/HumanEval_91/tests/__init__.py b/HumanEval_91/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_91/tests/conftest.py b/HumanEval_91/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_91/tests/test_humaneval.py b/HumanEval_91/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..6520d6944e84f8c03e2bfc4fc7a19f11bfc3d168 --- /dev/null +++ b/HumanEval_91/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import is_bored as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("Hello world") == 0, "Test 1" + assert candidate("Is the sky blue?") == 0, "Test 2" + assert candidate("I love It !") == 1, "Test 3" + assert candidate("bIt") == 0, "Test 4" + assert candidate("I feel good today. I will be productive. will kill It") == 2, "Test 5" + assert candidate("You and I are going for a walk") == 0, "Test 6" + + # Check some edge cases that are easy to work out by hand. + assert True, "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_92/instruction.md b/HumanEval_92/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..03db6a1023f59a545f3be73847d7b15674a2228d --- /dev/null +++ b/HumanEval_92/instruction.md @@ -0,0 +1,25 @@ +# HumanEval — HumanEval/92 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def any_int(x, y, z): + ''' + Create a function that takes 3 numbers. + Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers. + Returns false in any other cases. + + Examples + any_int(5, 2, 7) ➞ True + + any_int(3, 2, 2) ➞ False + + any_int(3, -2, 1) ➞ True + + any_int(3.6, -2.2, 2) ➞ False + + + + ''' +``` diff --git a/HumanEval_92/solution/__init__.py b/HumanEval_92/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4d2ab30c10ee1ea4e1c066525cdaedab2b8080b4 --- /dev/null +++ b/HumanEval_92/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import any_int diff --git a/HumanEval_92/solution/solution.py b/HumanEval_92/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..134fbb944394adbd79ee5f931963a4ccb3bcc3d6 --- /dev/null +++ b/HumanEval_92/solution/solution.py @@ -0,0 +1,25 @@ + +def any_int(x, y, z): + ''' + Create a function that takes 3 numbers. + Returns true if one of the numbers is equal to the sum of the other two, and all numbers are integers. + Returns false in any other cases. + + Examples + any_int(5, 2, 7) ➞ True + + any_int(3, 2, 2) ➞ False + + any_int(3, -2, 1) ➞ True + + any_int(3.6, -2.2, 2) ➞ False + + + + ''' + + if isinstance(x,int) and isinstance(y,int) and isinstance(z,int): + if (x+y==z) or (x+z==y) or (y+z==x): + return True + return False + return False diff --git a/HumanEval_92/task.toml b/HumanEval_92/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..b0dc4b0b15b17d7e5ab33f02edd3a4989ba7c3d1 --- /dev/null +++ b/HumanEval_92/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/92" +name = "HumanEval — HumanEval/92" + +[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/HumanEval_92/tests/__init__.py b/HumanEval_92/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_92/tests/conftest.py b/HumanEval_92/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_92/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/HumanEval_92/tests/test_humaneval.py b/HumanEval_92/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..0ceac69bb61638efb2b9965e65e0f08ba4ebae9f --- /dev/null +++ b/HumanEval_92/tests/test_humaneval.py @@ -0,0 +1,22 @@ +from solution import any_int as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(2, 3, 1)==True, "This prints if this assert fails 1 (good for debugging!)" + assert candidate(2.5, 2, 3)==False, "This prints if this assert fails 2 (good for debugging!)" + assert candidate(1.5, 5, 3.5)==False, "This prints if this assert fails 3 (good for debugging!)" + assert candidate(2, 6, 2)==False, "This prints if this assert fails 4 (good for debugging!)" + assert candidate(4, 2, 2)==True, "This prints if this assert fails 5 (good for debugging!)" + assert candidate(2.2, 2.2, 2.2)==False, "This prints if this assert fails 6 (good for debugging!)" + assert candidate(-4, 6, 2)==True, "This prints if this assert fails 7 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate(2,1,1)==True, "This prints if this assert fails 8 (also good for debugging!)" + assert candidate(3,4,7)==True, "This prints if this assert fails 9 (also good for debugging!)" + assert candidate(3.0,4,7)==False, "This prints if this assert fails 10 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_93/instruction.md b/HumanEval_93/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..5f496c79912b0ec4fc749041ea28b4c0551f2720 --- /dev/null +++ b/HumanEval_93/instruction.md @@ -0,0 +1,21 @@ +# HumanEval — HumanEval/93 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def encode(message): + """ + Write a function that takes a message, and encodes in such a + way that it swaps case of all letters, replaces all vowels in + the message with the letter that appears 2 places ahead of that + vowel in the english alphabet. + Assume only letters. + + Examples: + >>> encode('test') + 'TGST' + >>> encode('This is a message') + 'tHKS KS C MGSSCGG' + """ +``` diff --git a/HumanEval_93/solution/__init__.py b/HumanEval_93/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b70f5c8c219246bebd8dd49b70bc33488ee91de3 --- /dev/null +++ b/HumanEval_93/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import encode diff --git a/HumanEval_93/solution/solution.py b/HumanEval_93/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..b909b7089d5e320149ec02f8a6f9e6458dd6a1f0 --- /dev/null +++ b/HumanEval_93/solution/solution.py @@ -0,0 +1,19 @@ + +def encode(message): + """ + Write a function that takes a message, and encodes in such a + way that it swaps case of all letters, replaces all vowels in + the message with the letter that appears 2 places ahead of that + vowel in the english alphabet. + Assume only letters. + + Examples: + >>> encode('test') + 'TGST' + >>> encode('This is a message') + 'tHKS KS C MGSSCGG' + """ + vowels = "aeiouAEIOU" + vowels_replace = dict([(i, chr(ord(i) + 2)) for i in vowels]) + message = message.swapcase() + return ''.join([vowels_replace[i] if i in vowels else i for i in message]) diff --git a/HumanEval_93/task.toml b/HumanEval_93/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9e223656dc7c4fdad6399a10cdea0c75beb1acbe --- /dev/null +++ b/HumanEval_93/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/93" +name = "HumanEval — HumanEval/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/HumanEval_93/tests/__init__.py b/HumanEval_93/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_93/tests/conftest.py b/HumanEval_93/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_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/HumanEval_93/tests/test_humaneval.py b/HumanEval_93/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..490aa603400eb8456297439d538760d9128d8738 --- /dev/null +++ b/HumanEval_93/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import encode as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('TEST') == 'tgst', "This prints if this assert fails 1 (good for debugging!)" + assert candidate('Mudasir') == 'mWDCSKR', "This prints if this assert fails 2 (good for debugging!)" + assert candidate('YES') == 'ygs', "This prints if this assert fails 3 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate('This is a message') == 'tHKS KS C MGSSCGG', "This prints if this assert fails 2 (also good for debugging!)" + assert candidate("I DoNt KnOw WhAt tO WrItE") == 'k dQnT kNqW wHcT Tq wRkTg', "This prints if this assert fails 2 (also good for debugging!)" + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_94/instruction.md b/HumanEval_94/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..4b8ec105f72f7f5fa0c9fb89f1f853cff81786c1 --- /dev/null +++ b/HumanEval_94/instruction.md @@ -0,0 +1,20 @@ +# HumanEval — HumanEval/94 + +Complete the following Python function so that it satisfies its docstring. + +```python + + +def skjkasdkd(lst): + """You are given a list of integers. + You need to find the largest prime value and return the sum of its digits. + + Examples: + For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10 + For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output should be 25 + For lst = [1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3] the output should be 13 + For lst = [0,724,32,71,99,32,6,0,5,91,83,0,5,6] the output should be 11 + For lst = [0,81,12,3,1,21] the output should be 3 + For lst = [0,8,1,2,1,7] the output should be 7 + """ +``` diff --git a/HumanEval_94/solution/__init__.py b/HumanEval_94/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..dd3ec1a8ef3f4571b2e2fc0611ebafc0944dcf96 --- /dev/null +++ b/HumanEval_94/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import skjkasdkd diff --git a/HumanEval_94/solution/solution.py b/HumanEval_94/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..985c09f0849f013dd6047a9f1569bf9f506442f0 --- /dev/null +++ b/HumanEval_94/solution/solution.py @@ -0,0 +1,29 @@ + + +def skjkasdkd(lst): + """You are given a list of integers. + You need to find the largest prime value and return the sum of its digits. + + Examples: + For lst = [0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3] the output should be 10 + For lst = [1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1] the output should be 25 + For lst = [1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3] the output should be 13 + For lst = [0,724,32,71,99,32,6,0,5,91,83,0,5,6] the output should be 11 + For lst = [0,81,12,3,1,21] the output should be 3 + For lst = [0,8,1,2,1,7] the output should be 7 + """ + def isPrime(n): + for i in range(2,int(n**0.5)+1): + if n%i==0: + return False + + return True + maxx = 0 + i = 0 + while i < len(lst): + if(lst[i] > maxx and isPrime(lst[i])): + maxx = lst[i] + i+=1 + result = sum(int(digit) for digit in str(maxx)) + return result + diff --git a/HumanEval_94/task.toml b/HumanEval_94/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..9294d7a1cac2142616c369fc331b0608056a477f --- /dev/null +++ b/HumanEval_94/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/94" +name = "HumanEval — HumanEval/94" + +[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/HumanEval_94/tests/__init__.py b/HumanEval_94/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_94/tests/conftest.py b/HumanEval_94/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_94/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/HumanEval_94/tests/test_humaneval.py b/HumanEval_94/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..5e6627bff39da2c37863695fb8e5d8664474143b --- /dev/null +++ b/HumanEval_94/tests/test_humaneval.py @@ -0,0 +1,29 @@ +from solution import skjkasdkd as candidate + +def check(candidate): + + # Check some simple cases + assert candidate([0,3,2,1,3,5,7,4,5,5,5,2,181,32,4,32,3,2,32,324,4,3]) == 10, "This prints if this assert fails 1 (good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate([1,0,1,8,2,4597,2,1,3,40,1,2,1,2,4,2,5,1]) == 25, "This prints if this assert fails 2 (also good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate([1,3,1,32,5107,34,83278,109,163,23,2323,32,30,1,9,3]) == 13, "This prints if this assert fails 3 (also good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate([0,724,32,71,99,32,6,0,5,91,83,0,5,6]) == 11, "This prints if this assert fails 4 (also good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate([0,81,12,3,1,21]) == 3, "This prints if this assert fails 5 (also good for debugging!)" + + # Check some edge cases that are easy to work out by hand. + assert candidate([0,8,1,2,1,7]) == 7, "This prints if this assert fails 6 (also good for debugging!)" + + assert candidate([8191]) == 19, "This prints if this assert fails 7 (also good for debugging!)" + assert candidate([8191, 123456, 127, 7]) == 19, "This prints if this assert fails 8 (also good for debugging!)" + assert candidate([127, 97, 8192]) == 10, "This prints if this assert fails 9 (also good for debugging!)" + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_95/instruction.md b/HumanEval_95/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..817e9a1ce14caf354f8f3c0dc518b706137ff97c --- /dev/null +++ b/HumanEval_95/instruction.md @@ -0,0 +1,19 @@ +# HumanEval — HumanEval/95 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def check_dict_case(dict): + """ + Given a dictionary, return True if all keys are strings in lower + case or all keys are strings in upper case, else return False. + The function should return False is the given dictionary is empty. + Examples: + check_dict_case({"a":"apple", "b":"banana"}) should return True. + check_dict_case({"a":"apple", "A":"banana", "B":"banana"}) should return False. + check_dict_case({"a":"apple", 8:"banana", "a":"apple"}) should return False. + check_dict_case({"Name":"John", "Age":"36", "City":"Houston"}) should return False. + check_dict_case({"STATE":"NC", "ZIP":"12345" }) should return True. + """ +``` diff --git a/HumanEval_95/solution/__init__.py b/HumanEval_95/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..043404bcaa2cffc4813406d55a741c41afd13a26 --- /dev/null +++ b/HumanEval_95/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import check_dict_case diff --git a/HumanEval_95/solution/solution.py b/HumanEval_95/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..b652465cf778121b0f3b1f76039b42560e568f33 --- /dev/null +++ b/HumanEval_95/solution/solution.py @@ -0,0 +1,35 @@ + +def check_dict_case(dict): + """ + Given a dictionary, return True if all keys are strings in lower + case or all keys are strings in upper case, else return False. + The function should return False is the given dictionary is empty. + Examples: + check_dict_case({"a":"apple", "b":"banana"}) should return True. + check_dict_case({"a":"apple", "A":"banana", "B":"banana"}) should return False. + check_dict_case({"a":"apple", 8:"banana", "a":"apple"}) should return False. + check_dict_case({"Name":"John", "Age":"36", "City":"Houston"}) should return False. + check_dict_case({"STATE":"NC", "ZIP":"12345" }) should return True. + """ + if len(dict.keys()) == 0: + return False + else: + state = "start" + for key in dict.keys(): + + if isinstance(key, str) == False: + state = "mixed" + break + if state == "start": + if key.isupper(): + state = "upper" + elif key.islower(): + state = "lower" + else: + break + elif (state == "upper" and not key.isupper()) or (state == "lower" and not key.islower()): + state = "mixed" + break + else: + break + return state == "upper" or state == "lower" diff --git a/HumanEval_95/task.toml b/HumanEval_95/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..e981792b87e9c220ec63f407c5e5d0e04f2d1b2d --- /dev/null +++ b/HumanEval_95/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/95" +name = "HumanEval — HumanEval/95" + +[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/HumanEval_95/tests/__init__.py b/HumanEval_95/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_95/tests/conftest.py b/HumanEval_95/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_95/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/HumanEval_95/tests/test_humaneval.py b/HumanEval_95/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..f609123db348f83644bfa2cb132b1c364a25e187 --- /dev/null +++ b/HumanEval_95/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import check_dict_case as candidate + +def check(candidate): + + # Check some simple cases + assert candidate({"p":"pineapple", "b":"banana"}) == True, "First test error: " + str(candidate({"p":"pineapple", "b":"banana"})) + assert candidate({"p":"pineapple", "A":"banana", "B":"banana"}) == False, "Second test error: " + str(candidate({"p":"pineapple", "A":"banana", "B":"banana"})) + assert candidate({"p":"pineapple", 5:"banana", "a":"apple"}) == False, "Third test error: " + str(candidate({"p":"pineapple", 5:"banana", "a":"apple"})) + assert candidate({"Name":"John", "Age":"36", "City":"Houston"}) == False, "Fourth test error: " + str(candidate({"Name":"John", "Age":"36", "City":"Houston"})) + assert candidate({"STATE":"NC", "ZIP":"12345" }) == True, "Fifth test error: " + str(candidate({"STATE":"NC", "ZIP":"12345" })) + assert candidate({"fruit":"Orange", "taste":"Sweet" }) == True, "Fourth test error: " + str(candidate({"fruit":"Orange", "taste":"Sweet" })) + + + # Check some edge cases that are easy to work out by hand. + assert candidate({}) == False, "1st edge test error: " + str(candidate({})) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_96/instruction.md b/HumanEval_96/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..43b2dbb37165a639ebac49a0c2674861c9e45644 --- /dev/null +++ b/HumanEval_96/instruction.md @@ -0,0 +1,18 @@ +# HumanEval — HumanEval/96 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def count_up_to(n): + """Implement a function that takes an non-negative integer and returns an array of the first n + integers that are prime numbers and less than n. + for example: + count_up_to(5) => [2,3] + count_up_to(11) => [2,3,5,7] + count_up_to(0) => [] + count_up_to(20) => [2,3,5,7,11,13,17,19] + count_up_to(1) => [] + count_up_to(18) => [2,3,5,7,11,13,17] + """ +``` diff --git a/HumanEval_96/solution/__init__.py b/HumanEval_96/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bba921680779b74f8dfd28b862d7f8ab89b350a4 --- /dev/null +++ b/HumanEval_96/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import count_up_to diff --git a/HumanEval_96/solution/solution.py b/HumanEval_96/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..26864c1c2903bb447091061a53e198c131300595 --- /dev/null +++ b/HumanEval_96/solution/solution.py @@ -0,0 +1,23 @@ + +def count_up_to(n): + """Implement a function that takes an non-negative integer and returns an array of the first n + integers that are prime numbers and less than n. + for example: + count_up_to(5) => [2,3] + count_up_to(11) => [2,3,5,7] + count_up_to(0) => [] + count_up_to(20) => [2,3,5,7,11,13,17,19] + count_up_to(1) => [] + count_up_to(18) => [2,3,5,7,11,13,17] + """ + primes = [] + for i in range(2, n): + is_prime = True + for j in range(2, i): + if i % j == 0: + is_prime = False + break + if is_prime: + primes.append(i) + return primes + diff --git a/HumanEval_96/task.toml b/HumanEval_96/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..4b8f79a2f51019145d6ab1d633781eb786c94172 --- /dev/null +++ b/HumanEval_96/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/96" +name = "HumanEval — HumanEval/96" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/HumanEval_96/tests/__init__.py b/HumanEval_96/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_96/tests/conftest.py b/HumanEval_96/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_96/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/HumanEval_96/tests/test_humaneval.py b/HumanEval_96/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..f7b55206b95a82223497191f5a3b3a255adf3829 --- /dev/null +++ b/HumanEval_96/tests/test_humaneval.py @@ -0,0 +1,19 @@ +from solution import count_up_to as candidate + +def check(candidate): + + assert candidate(5) == [2,3] + assert candidate(6) == [2,3,5] + assert candidate(7) == [2,3,5] + assert candidate(10) == [2,3,5,7] + assert candidate(0) == [] + assert candidate(22) == [2,3,5,7,11,13,17,19] + assert candidate(1) == [] + assert candidate(18) == [2,3,5,7,11,13,17] + assert candidate(47) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43] + assert candidate(101) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_97/instruction.md b/HumanEval_97/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..41d2620a4e2d71138bfc39639af838cd90b17e6b --- /dev/null +++ b/HumanEval_97/instruction.md @@ -0,0 +1,17 @@ +# HumanEval — HumanEval/97 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def multiply(a, b): + """Complete the function that takes two integers and returns + the product of their unit digits. + Assume the input is always valid. + Examples: + multiply(148, 412) should return 16. + multiply(19, 28) should return 72. + multiply(2020, 1851) should return 0. + multiply(14,-15) should return 20. + """ +``` diff --git a/HumanEval_97/solution/__init__.py b/HumanEval_97/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bfd8ea2e00d2ce0dfc07dccfa7e7426436e4e36f --- /dev/null +++ b/HumanEval_97/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import multiply diff --git a/HumanEval_97/solution/solution.py b/HumanEval_97/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..8e75ce4b02bcc732b845564bc32edeaa5ac03b10 --- /dev/null +++ b/HumanEval_97/solution/solution.py @@ -0,0 +1,12 @@ + +def multiply(a, b): + """Complete the function that takes two integers and returns + the product of their unit digits. + Assume the input is always valid. + Examples: + multiply(148, 412) should return 16. + multiply(19, 28) should return 72. + multiply(2020, 1851) should return 0. + multiply(14,-15) should return 20. + """ + return abs(a % 10) * abs(b % 10) diff --git a/HumanEval_97/task.toml b/HumanEval_97/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..68ea1d045518a8e4cbb726ef22f1aafcb86d375f --- /dev/null +++ b/HumanEval_97/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/97" +name = "HumanEval — HumanEval/97" + +[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/HumanEval_97/tests/__init__.py b/HumanEval_97/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_97/tests/conftest.py b/HumanEval_97/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_97/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/HumanEval_97/tests/test_humaneval.py b/HumanEval_97/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..2cf6865340222b0fb1f8c7b9bf9bc70519f7917b --- /dev/null +++ b/HumanEval_97/tests/test_humaneval.py @@ -0,0 +1,21 @@ +from solution import multiply as candidate + +def check(candidate): + + # Check some simple cases + assert candidate(148, 412) == 16, "First test error: " + str(candidate(148, 412)) + assert candidate(19, 28) == 72, "Second test error: " + str(candidate(19, 28)) + assert candidate(2020, 1851) == 0, "Third test error: " + str(candidate(2020, 1851)) + assert candidate(14,-15) == 20, "Fourth test error: " + str(candidate(14,-15)) + assert candidate(76, 67) == 42, "Fifth test error: " + str(candidate(76, 67)) + assert candidate(17, 27) == 49, "Sixth test error: " + str(candidate(17, 27)) + + + # Check some edge cases that are easy to work out by hand. + assert candidate(0, 1) == 0, "1st edge test error: " + str(candidate(0, 1)) + assert candidate(0, 0) == 0, "2nd edge test error: " + str(candidate(0, 0)) + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_98/instruction.md b/HumanEval_98/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..bf33dfa23aa1945874fd409607c89842ce42a1ba --- /dev/null +++ b/HumanEval_98/instruction.md @@ -0,0 +1,16 @@ +# HumanEval — HumanEval/98 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def count_upper(s): + """ + Given a string s, count the number of uppercase vowels in even indices. + + For example: + count_upper('aBCdEf') returns 1 + count_upper('abcdefg') returns 0 + count_upper('dBBE') returns 0 + """ +``` diff --git a/HumanEval_98/solution/__init__.py b/HumanEval_98/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fa3fcdb5afaefa4a630ee039da2d3981d61e7590 --- /dev/null +++ b/HumanEval_98/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import count_upper diff --git a/HumanEval_98/solution/solution.py b/HumanEval_98/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..753baedd7aead013c023d86c297a24d474ec6312 --- /dev/null +++ b/HumanEval_98/solution/solution.py @@ -0,0 +1,15 @@ + +def count_upper(s): + """ + Given a string s, count the number of uppercase vowels in even indices. + + For example: + count_upper('aBCdEf') returns 1 + count_upper('abcdefg') returns 0 + count_upper('dBBE') returns 0 + """ + count = 0 + for i in range(0,len(s),2): + if s[i] in "AEIOU": + count += 1 + return count diff --git a/HumanEval_98/task.toml b/HumanEval_98/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..6e04dc103cffec97c430c9464640030f941d812f --- /dev/null +++ b/HumanEval_98/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/98" +name = "HumanEval — HumanEval/98" + +[environment] +os = "linux" +docker_image = "python:3.11-slim" + +[agent] +name = "oracle" + +[verifier] +name = "pytest" + +[[steps]] +name = "main" +artifacts = ["solution/solution.py"] diff --git a/HumanEval_98/tests/__init__.py b/HumanEval_98/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_98/tests/conftest.py b/HumanEval_98/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_98/tests/conftest.py @@ -0,0 +1,3 @@ +import sys +from pathlib import Path +sys.path.insert(0, str(Path(__file__).parent.parent)) diff --git a/HumanEval_98/tests/test_humaneval.py b/HumanEval_98/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..b3e4c6f19e73d94e9108db617dbd9746991d4ae6 --- /dev/null +++ b/HumanEval_98/tests/test_humaneval.py @@ -0,0 +1,20 @@ +from solution import count_upper as candidate + +def check(candidate): + + # Check some simple cases + assert candidate('aBCdEf') == 1 + assert candidate('abcdefg') == 0 + assert candidate('dBBE') == 0 + assert candidate('B') == 0 + assert candidate('U') == 1 + assert candidate('') == 0 + assert candidate('EEEE') == 2 + + # Check some edge cases that are easy to work out by hand. + assert True + + + +def test_check() -> None: + check(candidate) diff --git a/HumanEval_99/instruction.md b/HumanEval_99/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..2a61d8b596a53f53a76785bd6d7236e266e1ded2 --- /dev/null +++ b/HumanEval_99/instruction.md @@ -0,0 +1,25 @@ +# HumanEval — HumanEval/99 + +Complete the following Python function so that it satisfies its docstring. + +```python + +def closest_integer(value): + ''' + Create a function that takes a value (string) representing a number + and returns the closest integer to it. If the number is equidistant + from two integers, round it away from zero. + + Examples + >>> closest_integer("10") + 10 + >>> closest_integer("15.3") + 15 + + Note: + Rounding away from zero means that if the given number is equidistant + from two integers, the one you should return is the one that is the + farthest from zero. For example closest_integer("14.5") should + return 15 and closest_integer("-14.5") should return -15. + ''' +``` diff --git a/HumanEval_99/solution/__init__.py b/HumanEval_99/solution/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4f6a852171384399db9e673035a6f55a509e357b --- /dev/null +++ b/HumanEval_99/solution/__init__.py @@ -0,0 +1 @@ +from solution.solution import closest_integer diff --git a/HumanEval_99/solution/solution.py b/HumanEval_99/solution/solution.py new file mode 100644 index 0000000000000000000000000000000000000000..93f0d1f1dcf10b7172979e9dbd606b8407bbbe57 --- /dev/null +++ b/HumanEval_99/solution/solution.py @@ -0,0 +1,39 @@ + +def closest_integer(value): + ''' + Create a function that takes a value (string) representing a number + and returns the closest integer to it. If the number is equidistant + from two integers, round it away from zero. + + Examples + >>> closest_integer("10") + 10 + >>> closest_integer("15.3") + 15 + + Note: + Rounding away from zero means that if the given number is equidistant + from two integers, the one you should return is the one that is the + farthest from zero. For example closest_integer("14.5") should + return 15 and closest_integer("-14.5") should return -15. + ''' + from math import floor, ceil + + if value.count('.') == 1: + # remove trailing zeros + while (value[-1] == '0'): + value = value[:-1] + + num = float(value) + if value[-2:] == '.5': + if num > 0: + res = ceil(num) + else: + res = floor(num) + elif len(value) > 0: + res = int(round(num)) + else: + res = 0 + + return res + diff --git a/HumanEval_99/task.toml b/HumanEval_99/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..57d71bbefc6b5a78571002460b4037b8d973c7c8 --- /dev/null +++ b/HumanEval_99/task.toml @@ -0,0 +1,19 @@ +schema_version = "1" + +[task] +id = "humaneval/HumanEval/99" +name = "HumanEval — HumanEval/99" + +[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/HumanEval_99/tests/__init__.py b/HumanEval_99/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/HumanEval_99/tests/conftest.py b/HumanEval_99/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..15276a2c2c5ff47e715e1c78bfa99635064e69b4 --- /dev/null +++ b/HumanEval_99/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/HumanEval_99/tests/test_humaneval.py b/HumanEval_99/tests/test_humaneval.py new file mode 100644 index 0000000000000000000000000000000000000000..79fe39c8412a13ffe077168485ca74eaa5db9996 --- /dev/null +++ b/HumanEval_99/tests/test_humaneval.py @@ -0,0 +1,17 @@ +from solution import closest_integer as candidate + +def check(candidate): + + # Check some simple cases + assert candidate("10") == 10, "Test 1" + assert candidate("14.5") == 15, "Test 2" + assert candidate("-15.5") == -16, "Test 3" + assert candidate("15.3") == 15, "Test 3" + + # Check some edge cases that are easy to work out by hand. + assert candidate("0") == 0, "Test 0" + + + +def test_check() -> None: + check(candidate) diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..0cbb4c574424c57c761bd40a51727f758f0692c1 --- /dev/null +++ b/manifest.json @@ -0,0 +1,1330 @@ +{ + "benchmark_id": "humaneval", + "display_name": "HumanEval", + "license_spdx": "MIT", + "license_url": "https://github.com/openai/human-eval/blob/master/LICENSE", + "loom_adapter_version": null, + "published_at": "2026-06-12T16:55:53.424429+00:00", + "schema_version": 1, + "splits": [ + "test" + ], + "task_count": 164, + "tasks": [ + { + "checksum": "sha256:8c9656051ef108223efc7cb4b078565959ab0000bd413b69bfab5ae3a5e40d8e", + "hf_path": "HumanEval_0/", + "instance_id": "HumanEval/0", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/0" + }, + { + "checksum": "sha256:719aad7d1a28ad9dacaed303b3cf99959572a50aa0ea6f66ae9bbe6257514c6c", + "hf_path": "HumanEval_1/", + "instance_id": "HumanEval/1", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/1" + }, + { + "checksum": "sha256:667452152d283e7e8e262243ee0e7303329c0178cb2f69bbdba6c2e71b8a1ba7", + "hf_path": "HumanEval_2/", + "instance_id": "HumanEval/2", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/2" + }, + { + "checksum": "sha256:2ac4ef08e85c085d0ed35cc372b05f80e0c186ea8103c46c05a3d523dd3a0769", + "hf_path": "HumanEval_3/", + "instance_id": "HumanEval/3", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/3" + }, + { + "checksum": "sha256:a11fee13777db0a7608c15a0d785c7ca240a5fe9b88ebdf1fad5ec419bb7eb19", + "hf_path": "HumanEval_4/", + "instance_id": "HumanEval/4", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/4" + }, + { + "checksum": "sha256:cac5ea9d788493b616c828eb44a703332c42409f5819acd08047b8c56adb2615", + "hf_path": "HumanEval_5/", + "instance_id": "HumanEval/5", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/5" + }, + { + "checksum": "sha256:ccb6c166aad6cf9a7824b5b7daa02b84284dbeff2b6cab95a32a9b3f492fe4f2", + "hf_path": "HumanEval_6/", + "instance_id": "HumanEval/6", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/6" + }, + { + "checksum": "sha256:c4f1ce44a57c591683fa8fa0339ab835bf8927f1f980894fda5914c6803b2b9b", + "hf_path": "HumanEval_7/", + "instance_id": "HumanEval/7", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/7" + }, + { + "checksum": "sha256:d5a6aca8a42b29e1424143ea0be84de5ce6b07bcdcf6d689a31a62a0eedd69c5", + "hf_path": "HumanEval_8/", + "instance_id": "HumanEval/8", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/8" + }, + { + "checksum": "sha256:e18ef6ba81e053474a05df5df32c378c009610b11a40b7d0b24bf1a8d9be2904", + "hf_path": "HumanEval_9/", + "instance_id": "HumanEval/9", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/9" + }, + { + "checksum": "sha256:e9fb6322ab4a636957197908806d9bfc6a5588dc9176026d0b8fee9c1b2b9573", + "hf_path": "HumanEval_10/", + "instance_id": "HumanEval/10", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/10" + }, + { + "checksum": "sha256:5554831369d5f90ffbd5aff74dd1f74dbf829909217340c5eb86da16f2013912", + "hf_path": "HumanEval_11/", + "instance_id": "HumanEval/11", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/11" + }, + { + "checksum": "sha256:3908a12e7163fc58c63f3f393ef0d2a9d3779ac991714d760ecbea6321b3cb43", + "hf_path": "HumanEval_12/", + "instance_id": "HumanEval/12", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/12" + }, + { + "checksum": "sha256:d3d943cfcc0c166c61b32754bd6625c66c973668ffa30e431361490b634edfa5", + "hf_path": "HumanEval_13/", + "instance_id": "HumanEval/13", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/13" + }, + { + "checksum": "sha256:2e89e49f1c22b72953847cfbb544e5be94c269c1b0e35ea6d9d6d221126abafc", + "hf_path": "HumanEval_14/", + "instance_id": "HumanEval/14", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/14" + }, + { + "checksum": "sha256:3f8fe9c567348028237c26f654977b3ad90115d4dc0ff2ee7667e92f36d1bad4", + "hf_path": "HumanEval_15/", + "instance_id": "HumanEval/15", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/15" + }, + { + "checksum": "sha256:e432ffdba6e1f49afc16240b7d92f161967c79f81ea4e274268f1c31bc829826", + "hf_path": "HumanEval_16/", + "instance_id": "HumanEval/16", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/16" + }, + { + "checksum": "sha256:fd58d1f381a2f947c34aee8a55ed6648a2d184444815afdd7f29aaf89f6bb072", + "hf_path": "HumanEval_17/", + "instance_id": "HumanEval/17", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/17" + }, + { + "checksum": "sha256:8b5aca48556b793eb44393f93b8f4d278c62084b797b18c9865599415f96d38e", + "hf_path": "HumanEval_18/", + "instance_id": "HumanEval/18", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/18" + }, + { + "checksum": "sha256:050a4da03236dec4f990d88f4f4b121db46b07bd75eee9992b85eb3911aad4f4", + "hf_path": "HumanEval_19/", + "instance_id": "HumanEval/19", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/19" + }, + { + "checksum": "sha256:65cdce1d65a2f372aa6d3fc5569b7dee7124a2c37cdb957db67116336de3b94c", + "hf_path": "HumanEval_20/", + "instance_id": "HumanEval/20", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/20" + }, + { + "checksum": "sha256:8193123e739278133feb79144f194462b6239340efef1c5dae522e13650e48f1", + "hf_path": "HumanEval_21/", + "instance_id": "HumanEval/21", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/21" + }, + { + "checksum": "sha256:ca5cde5ab8bc6d65f9b08918953d74a206a698fc4747f9ae3de90d376b6dc54e", + "hf_path": "HumanEval_22/", + "instance_id": "HumanEval/22", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/22" + }, + { + "checksum": "sha256:d3fc06b9b823a565c5dd75b1dad2ac2e3ccf259da14f288756058fad9fc345aa", + "hf_path": "HumanEval_23/", + "instance_id": "HumanEval/23", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/23" + }, + { + "checksum": "sha256:b26b54e7edce23bc7e7e0b780dd56e314a6da517e8e99ea80b5f916b8d18e7bf", + "hf_path": "HumanEval_24/", + "instance_id": "HumanEval/24", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/24" + }, + { + "checksum": "sha256:05f1aebf9b88e8f665dd0e0aa1db8020e41fa5f4a940f4d8722443d5ad1e233d", + "hf_path": "HumanEval_25/", + "instance_id": "HumanEval/25", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/25" + }, + { + "checksum": "sha256:3038c2130a773e1f6e1dd12eb5f11924ac1dc0dfc539bd1d8dbee8b4fe60bdc1", + "hf_path": "HumanEval_26/", + "instance_id": "HumanEval/26", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/26" + }, + { + "checksum": "sha256:5137f8b0df9efae6788e8cc5a882a2a00f9abf735f451b12c0582384547cfa2e", + "hf_path": "HumanEval_27/", + "instance_id": "HumanEval/27", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/27" + }, + { + "checksum": "sha256:9f78f0477009b4ca84976e68732d83aeaf9fe5e26cde2cd9ae0a6ed8d4cc33a2", + "hf_path": "HumanEval_28/", + "instance_id": "HumanEval/28", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/28" + }, + { + "checksum": "sha256:375f7386ef46ce01d054585f2e22a0ecbfaa62521bb5a4c2de32c9753fd72e81", + "hf_path": "HumanEval_29/", + "instance_id": "HumanEval/29", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/29" + }, + { + "checksum": "sha256:ae17b3ba5650ac64f1c74e97c44957ff0c01e89e035d4ca96e2dd4dda3dc4166", + "hf_path": "HumanEval_30/", + "instance_id": "HumanEval/30", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/30" + }, + { + "checksum": "sha256:77089b20f7bff39327360022feaf9f0d6c4653c9c4aa6631c087dd0fb8865cc7", + "hf_path": "HumanEval_31/", + "instance_id": "HumanEval/31", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/31" + }, + { + "checksum": "sha256:a49f1c964bcf2cef30bfbc1bce9729b5b1496b2781871aaa0b4916820496c4d3", + "hf_path": "HumanEval_32/", + "instance_id": "HumanEval/32", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/32" + }, + { + "checksum": "sha256:e3793de3bedf372acad0c93f52ab8993157877622e56ead8eb035dddbf0d320e", + "hf_path": "HumanEval_33/", + "instance_id": "HumanEval/33", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/33" + }, + { + "checksum": "sha256:0343a104fc486af3ba6c9b847564bed7695d6417bc3aca55cb4505e222d0b1f3", + "hf_path": "HumanEval_34/", + "instance_id": "HumanEval/34", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/34" + }, + { + "checksum": "sha256:bbb9b5c33dd7e9eb08ee0c2158678c056c4ccf6e3cebbef0bd61e550ed1252b6", + "hf_path": "HumanEval_35/", + "instance_id": "HumanEval/35", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/35" + }, + { + "checksum": "sha256:4e08967461bf251799b633f47c3df4d2c1f8c3ab8199cbaa5a5f8ea3a4c8749c", + "hf_path": "HumanEval_36/", + "instance_id": "HumanEval/36", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/36" + }, + { + "checksum": "sha256:8963957d54155c6547d29acad469fadaa87698acb69c6bf8cd16f9afcf149cfa", + "hf_path": "HumanEval_37/", + "instance_id": "HumanEval/37", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/37" + }, + { + "checksum": "sha256:bb643e6df0ef3ab6081d1651b66d0fdfa3e2581b18b43a5e7889d2fd17e7ca06", + "hf_path": "HumanEval_38/", + "instance_id": "HumanEval/38", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/38" + }, + { + "checksum": "sha256:5e6427d417631f02a86d8a1170a46de90faa8a870f47e4cd1323344111638fb7", + "hf_path": "HumanEval_39/", + "instance_id": "HumanEval/39", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/39" + }, + { + "checksum": "sha256:6ab5df3d43ba73c0201dbafad570330c722287e8e1a3f5e06fc07f287021699a", + "hf_path": "HumanEval_40/", + "instance_id": "HumanEval/40", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/40" + }, + { + "checksum": "sha256:034f1beb8fbffe66987383cf5c85341ed260ecbd2d2f5c6f54e737a1523ddad1", + "hf_path": "HumanEval_41/", + "instance_id": "HumanEval/41", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/41" + }, + { + "checksum": "sha256:d0332cf84e521e8e5d771a61e742d554350f767d9ffa15c8819cad6e7bd43244", + "hf_path": "HumanEval_42/", + "instance_id": "HumanEval/42", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/42" + }, + { + "checksum": "sha256:89f355d31e692ee59961fddbc008f3fab7223371f1cf7caeead5832dbd8c65ac", + "hf_path": "HumanEval_43/", + "instance_id": "HumanEval/43", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/43" + }, + { + "checksum": "sha256:3f8ac727dbbf639835d037e72a63199d998d6842a8a0bf0041251450594bf38e", + "hf_path": "HumanEval_44/", + "instance_id": "HumanEval/44", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/44" + }, + { + "checksum": "sha256:56b40ab80465367ea516e9f5c846950efafa6aa454d260b7ee05f8ec4b19680c", + "hf_path": "HumanEval_45/", + "instance_id": "HumanEval/45", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/45" + }, + { + "checksum": "sha256:f77ceeb3f99490894137e8080df608fb7ec7c3696f2d7e0f967d462b7adfe117", + "hf_path": "HumanEval_46/", + "instance_id": "HumanEval/46", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/46" + }, + { + "checksum": "sha256:c3a254f5894c38027b369a64e794da37053c141cb6e74e7419e419f887fa5502", + "hf_path": "HumanEval_47/", + "instance_id": "HumanEval/47", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/47" + }, + { + "checksum": "sha256:0d49e1bcdf18f0cfe7366f7c6080d993209adfb8a6fbe4ac2b45724da3a40d8c", + "hf_path": "HumanEval_48/", + "instance_id": "HumanEval/48", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/48" + }, + { + "checksum": "sha256:cd039d28bcf44b316bc64578a50f4a29c380680b4b7498a378b079c1c878dd29", + "hf_path": "HumanEval_49/", + "instance_id": "HumanEval/49", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/49" + }, + { + "checksum": "sha256:04afcf1d4226a04636a309694dc6578e654592c853bbe7c1f4a6acc10a22888c", + "hf_path": "HumanEval_50/", + "instance_id": "HumanEval/50", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/50" + }, + { + "checksum": "sha256:63d86c30afdcabe377c54bf5c94c49fe4aa7454ceaaf65792b7d81bd7add01e0", + "hf_path": "HumanEval_51/", + "instance_id": "HumanEval/51", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/51" + }, + { + "checksum": "sha256:957e5b2dd1582a38a14b7ff962e73697768c12edee335e971325e243aaa2c9c8", + "hf_path": "HumanEval_52/", + "instance_id": "HumanEval/52", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/52" + }, + { + "checksum": "sha256:3dfbe5271282fd10db12f4192eaa2faa9a9e037799614fdbb6f1d72f1e002c5a", + "hf_path": "HumanEval_53/", + "instance_id": "HumanEval/53", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/53" + }, + { + "checksum": "sha256:406cb75021da62a438386d413904c02e19faa4487c35a0c098466b9437cac6db", + "hf_path": "HumanEval_54/", + "instance_id": "HumanEval/54", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/54" + }, + { + "checksum": "sha256:5432012a18d08eb68b4c99a5ebb75d20ac758e62aa0f8af0bffb600531dcf78f", + "hf_path": "HumanEval_55/", + "instance_id": "HumanEval/55", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/55" + }, + { + "checksum": "sha256:ef7e963ea185d61ce764b8ca690e6dee9ea68e19b9635058014c768ec4d574c3", + "hf_path": "HumanEval_56/", + "instance_id": "HumanEval/56", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/56" + }, + { + "checksum": "sha256:2573052f4a6ac107e57d672f00de230a2dfe082105518d39d74bbcc5a9652107", + "hf_path": "HumanEval_57/", + "instance_id": "HumanEval/57", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/57" + }, + { + "checksum": "sha256:b2a44eee86c7d99b99476bfeae5b48322310fe067261074a84180b63c73d7c2c", + "hf_path": "HumanEval_58/", + "instance_id": "HumanEval/58", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/58" + }, + { + "checksum": "sha256:f212d94731a345a5e19a3d3e7cef341c43a22fb02b4f534fe222048c23ea2304", + "hf_path": "HumanEval_59/", + "instance_id": "HumanEval/59", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/59" + }, + { + "checksum": "sha256:ca3c40651fe5bc6ed0e94cda7e3ae9de12e1d16a9e044a069ea0002bda58d1c8", + "hf_path": "HumanEval_60/", + "instance_id": "HumanEval/60", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/60" + }, + { + "checksum": "sha256:f5dd73c9d1c8334397208493dc94ca7931b0991c38da0f164e5b42e1e44b0970", + "hf_path": "HumanEval_61/", + "instance_id": "HumanEval/61", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/61" + }, + { + "checksum": "sha256:b397a32c21366e14bbde0c75054c366ae37fa74f57f6769051bba6a9bc601c53", + "hf_path": "HumanEval_62/", + "instance_id": "HumanEval/62", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/62" + }, + { + "checksum": "sha256:0e0f51be2f9f27bcd7884505de731b3246497623fb1d900d44e8d2209f9532bd", + "hf_path": "HumanEval_63/", + "instance_id": "HumanEval/63", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/63" + }, + { + "checksum": "sha256:0ce50be2f4402c5377c512290269620e51c28eba82ffd06907acc02b24dc1168", + "hf_path": "HumanEval_64/", + "instance_id": "HumanEval/64", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/64" + }, + { + "checksum": "sha256:cf0c03308b996d022b7e44483c9b133849dc3d59eccb261566fbbe3d35eb2560", + "hf_path": "HumanEval_65/", + "instance_id": "HumanEval/65", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/65" + }, + { + "checksum": "sha256:3a33b12d017222bbd3ecbc34dc1974b90778d8b37962f51961fb1285507b6cff", + "hf_path": "HumanEval_66/", + "instance_id": "HumanEval/66", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/66" + }, + { + "checksum": "sha256:e67250dfac2d34ca17634c500d2f8d08137d14140115549e59a4c542b416e77a", + "hf_path": "HumanEval_67/", + "instance_id": "HumanEval/67", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/67" + }, + { + "checksum": "sha256:47581e949026398ce9f693efe804ca49e9d90c92dd95f557571f83b493eeed24", + "hf_path": "HumanEval_68/", + "instance_id": "HumanEval/68", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/68" + }, + { + "checksum": "sha256:f4a4c4a01ce199cd51729b47d2b62d864032212e33100de0013b3966ec664418", + "hf_path": "HumanEval_69/", + "instance_id": "HumanEval/69", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/69" + }, + { + "checksum": "sha256:478124b90030e90e67c0d61680ebfa27ec0d4593c0fba013d3733f8a4f1b4e0d", + "hf_path": "HumanEval_70/", + "instance_id": "HumanEval/70", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/70" + }, + { + "checksum": "sha256:05035565487d29130e681713ad4be9ca823618aedb366a1f9052a8af700515b9", + "hf_path": "HumanEval_71/", + "instance_id": "HumanEval/71", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/71" + }, + { + "checksum": "sha256:24274574ac3c6234f4e58a5ecc45b82fb0b0075c0c66ba75676086095e7b2891", + "hf_path": "HumanEval_72/", + "instance_id": "HumanEval/72", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/72" + }, + { + "checksum": "sha256:f60c6686c1c0c4659dcdee776c5034d2d0f558b3b3b68559e30c3a3210f3f4b6", + "hf_path": "HumanEval_73/", + "instance_id": "HumanEval/73", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/73" + }, + { + "checksum": "sha256:98a9d7b34ba009de331cd44355f03702554484fa4ba203f62d473c7d264a4eab", + "hf_path": "HumanEval_74/", + "instance_id": "HumanEval/74", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/74" + }, + { + "checksum": "sha256:17a9d317cb798362b436300e50ad3a3cd14133face95d7559c2a21e2460d729a", + "hf_path": "HumanEval_75/", + "instance_id": "HumanEval/75", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/75" + }, + { + "checksum": "sha256:5e1fa6dfce61e3489fa53ccdaaadb6174ce5e59ab41362e89cee1e157f614336", + "hf_path": "HumanEval_76/", + "instance_id": "HumanEval/76", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/76" + }, + { + "checksum": "sha256:9d627afae800087d8c645fbf904eb818a2abb8636a3aeba0cbb702263c13c111", + "hf_path": "HumanEval_77/", + "instance_id": "HumanEval/77", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/77" + }, + { + "checksum": "sha256:b439e625ff6aa7f7f0402d95f6f8664113393101324a0228010b3a87fc119080", + "hf_path": "HumanEval_78/", + "instance_id": "HumanEval/78", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/78" + }, + { + "checksum": "sha256:60e0b9b900b788d64b2acee69de4feed92f54737dd32ddb36910fcc81297f8af", + "hf_path": "HumanEval_79/", + "instance_id": "HumanEval/79", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/79" + }, + { + "checksum": "sha256:6ce30851cfedd1c06355258c9157cd944e946a8b5a80d36eefd0ef34beaee39e", + "hf_path": "HumanEval_80/", + "instance_id": "HumanEval/80", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/80" + }, + { + "checksum": "sha256:09a6419ba418030e5c1ffa2a0b940489f30cabea97165581121abf19e937bb4d", + "hf_path": "HumanEval_81/", + "instance_id": "HumanEval/81", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/81" + }, + { + "checksum": "sha256:c7e8354392572c9aefa197abd56b2c9c53e2dcc9d71999e342702e7ed5404e37", + "hf_path": "HumanEval_82/", + "instance_id": "HumanEval/82", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/82" + }, + { + "checksum": "sha256:85793063045a2b5f55a2eb642070a78687f0fad3d554afe3d9cd77174d1fa0f0", + "hf_path": "HumanEval_83/", + "instance_id": "HumanEval/83", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/83" + }, + { + "checksum": "sha256:5afdc7c9bf2f32951193be746c906436f02cfb20311ea2e8adad5ca464f09642", + "hf_path": "HumanEval_84/", + "instance_id": "HumanEval/84", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/84" + }, + { + "checksum": "sha256:f7286d1053e8e2fe4c6844fec68be88db03bfb00389c02b2857cbc6c11c75b11", + "hf_path": "HumanEval_85/", + "instance_id": "HumanEval/85", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/85" + }, + { + "checksum": "sha256:e9cdbf7c86f2bd4a425671610f7d1c7c538391ebf4777ec3dc57e5acb76a21bc", + "hf_path": "HumanEval_86/", + "instance_id": "HumanEval/86", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/86" + }, + { + "checksum": "sha256:a9956745e14bb76253d71561aa0f2fd9d54963311c4c5390e984df2790f6ee14", + "hf_path": "HumanEval_87/", + "instance_id": "HumanEval/87", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/87" + }, + { + "checksum": "sha256:754e729ad8172bce240a745ed3bec5dba09763b9b46ff1c629b38f8bb2c00efc", + "hf_path": "HumanEval_88/", + "instance_id": "HumanEval/88", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/88" + }, + { + "checksum": "sha256:bce86042bfab4e018a421168552022c5483d2d6f68fc01d90d0beaae3ad40f9c", + "hf_path": "HumanEval_89/", + "instance_id": "HumanEval/89", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/89" + }, + { + "checksum": "sha256:d078362a5380cba717ac3e2d9ac66f79a984a4d5ae7c233543e704ae5ed127ff", + "hf_path": "HumanEval_90/", + "instance_id": "HumanEval/90", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/90" + }, + { + "checksum": "sha256:d8aba53b2c145108897b9b8de95875d085fc24b5f4c953f35d2ae3381a0ff921", + "hf_path": "HumanEval_91/", + "instance_id": "HumanEval/91", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/91" + }, + { + "checksum": "sha256:492518a9018e19cf2207f311fd0542c8317a4696175e9ae8ebffb3ba82784297", + "hf_path": "HumanEval_92/", + "instance_id": "HumanEval/92", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/92" + }, + { + "checksum": "sha256:74a93f23738cf08069f7f0a298e6cc2f826ac9d735c3bd1150bd28b3ddbd6e2c", + "hf_path": "HumanEval_93/", + "instance_id": "HumanEval/93", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/93" + }, + { + "checksum": "sha256:79487a530807068241ac175c751e2e95eb452f808c3397a208c9f2d10ccd300a", + "hf_path": "HumanEval_94/", + "instance_id": "HumanEval/94", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/94" + }, + { + "checksum": "sha256:25ae54bcf6ab678ed36fd55bae24a457458e8f945724a3452335ee6947e1aca7", + "hf_path": "HumanEval_95/", + "instance_id": "HumanEval/95", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/95" + }, + { + "checksum": "sha256:816e40a7cb8ea6ad49e99d76e21db75fb48980c03fb11d2c131eb042029664bc", + "hf_path": "HumanEval_96/", + "instance_id": "HumanEval/96", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/96" + }, + { + "checksum": "sha256:2588809dfdddc7df7e49616967d9f8498810bf438ad3e04a1737a1e36d6e2bb8", + "hf_path": "HumanEval_97/", + "instance_id": "HumanEval/97", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/97" + }, + { + "checksum": "sha256:d021a667e2e480eb513a34f9456b32c0fb6efb6b579ac9b5875ddc0b73580550", + "hf_path": "HumanEval_98/", + "instance_id": "HumanEval/98", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/98" + }, + { + "checksum": "sha256:e8e1bfdd592ff2ab7752e33433badfe5f7718f5ce2466d01d2afc9d921641d8d", + "hf_path": "HumanEval_99/", + "instance_id": "HumanEval/99", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/99" + }, + { + "checksum": "sha256:e196ba2ed2e7f29dc4fe87e10decbced2d40f7a6c01bd946266614ed5ecebcc7", + "hf_path": "HumanEval_100/", + "instance_id": "HumanEval/100", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/100" + }, + { + "checksum": "sha256:3186afd059cd88726d28617c011f6af674230ecde57693d82d4dee1bfdb18ad4", + "hf_path": "HumanEval_101/", + "instance_id": "HumanEval/101", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/101" + }, + { + "checksum": "sha256:113d89be0f5e3742654e3a135170bdf851a56cace6c98d6a3b70f4fc03225b55", + "hf_path": "HumanEval_102/", + "instance_id": "HumanEval/102", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/102" + }, + { + "checksum": "sha256:d8fe1a55a8096731c1ee9ef93882d44e8a09184ae3a58fae2e528e3a0837b1c6", + "hf_path": "HumanEval_103/", + "instance_id": "HumanEval/103", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/103" + }, + { + "checksum": "sha256:062443a078064d40f8b732d1b60681badb7913516c340aefa9c58cdd6a25403e", + "hf_path": "HumanEval_104/", + "instance_id": "HumanEval/104", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/104" + }, + { + "checksum": "sha256:e6455ef41c75552ba101eb695d0a64d029cf5f61a5ed09ae3a904ae7fb631306", + "hf_path": "HumanEval_105/", + "instance_id": "HumanEval/105", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/105" + }, + { + "checksum": "sha256:25197027cebcb2ce9331889cf5dbc57e8e31a9bdd7f9e921bcc074b85d63e77e", + "hf_path": "HumanEval_106/", + "instance_id": "HumanEval/106", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/106" + }, + { + "checksum": "sha256:ac4641eaa7b407761a5c42bf416dbf95ca1ed6decb451fa56eb7f88182749929", + "hf_path": "HumanEval_107/", + "instance_id": "HumanEval/107", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/107" + }, + { + "checksum": "sha256:3dd09b733fed7baca512ab08616cbb1996b1ae2504cdeada6bc7dbc03e9ec4f6", + "hf_path": "HumanEval_108/", + "instance_id": "HumanEval/108", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/108" + }, + { + "checksum": "sha256:d8c5c2f4691c0dc553c0df6cb480a952cdcd1d9f8e72b1e39ad0cc3a09330a96", + "hf_path": "HumanEval_109/", + "instance_id": "HumanEval/109", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/109" + }, + { + "checksum": "sha256:2e1002990a28110c7fc178017a6c67918369b31e2266ff5102e1e50c3c12521a", + "hf_path": "HumanEval_110/", + "instance_id": "HumanEval/110", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/110" + }, + { + "checksum": "sha256:3e7002cd6be846a80ec3e0aa6deef21060ecf5ab3cd74b47d7ba89de4e9ed44c", + "hf_path": "HumanEval_111/", + "instance_id": "HumanEval/111", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/111" + }, + { + "checksum": "sha256:7b15f8081c9fe446d415b8c4d9eb7fdbef7f08c1087345e2e7ba013f000f2f34", + "hf_path": "HumanEval_112/", + "instance_id": "HumanEval/112", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/112" + }, + { + "checksum": "sha256:13587eec8daef022b51a3cb4810a9033d5a7c2dea812997fc963e798da0abc6f", + "hf_path": "HumanEval_113/", + "instance_id": "HumanEval/113", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/113" + }, + { + "checksum": "sha256:54cc59b773a728033449846c2ade2d1bc751448b31a3280ce9ad36ec77950c90", + "hf_path": "HumanEval_114/", + "instance_id": "HumanEval/114", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/114" + }, + { + "checksum": "sha256:b6261c11a6ab73b6a86e8df200a5ed80e9f7260673ca00e4c848c4dd52d4879d", + "hf_path": "HumanEval_115/", + "instance_id": "HumanEval/115", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/115" + }, + { + "checksum": "sha256:8a6bf592308f9b08812c38ebb8acc80ae463b693aa86170ab2b19b201f0ec252", + "hf_path": "HumanEval_116/", + "instance_id": "HumanEval/116", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/116" + }, + { + "checksum": "sha256:958a7489869da658c6a88587268dae437bcb418a56c4e6f832c06587eb04b81d", + "hf_path": "HumanEval_117/", + "instance_id": "HumanEval/117", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/117" + }, + { + "checksum": "sha256:21ef2ba098e903a42f1c99a906e2a8b060b6e0790a95641266f68be4b3354900", + "hf_path": "HumanEval_118/", + "instance_id": "HumanEval/118", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/118" + }, + { + "checksum": "sha256:fdd224ce41a39866cfa7af31f0c47515f21a3f7a6944e6e45b249f188dd2ff23", + "hf_path": "HumanEval_119/", + "instance_id": "HumanEval/119", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/119" + }, + { + "checksum": "sha256:e01e14c2e5d83769f73cbb718ea439243ae160bf38086b8ad484e623c418b003", + "hf_path": "HumanEval_120/", + "instance_id": "HumanEval/120", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/120" + }, + { + "checksum": "sha256:ed69bd906d0c846c3a8263ee25ce2c0f6da7288d23b4cf8fc1db790dedbcc585", + "hf_path": "HumanEval_121/", + "instance_id": "HumanEval/121", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/121" + }, + { + "checksum": "sha256:3860cb2e99db431ae60019080c9a4edeffa5e99ebe9ac760d80c9d32cfd05319", + "hf_path": "HumanEval_122/", + "instance_id": "HumanEval/122", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/122" + }, + { + "checksum": "sha256:d292355bd4a7866117a40fe2bbfc736d1bcdc535e5795c928c4512fe545287b5", + "hf_path": "HumanEval_123/", + "instance_id": "HumanEval/123", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/123" + }, + { + "checksum": "sha256:18208c9a0bef84c317022b36706409a2af61d364e5df5bf1db58f00d6a87d679", + "hf_path": "HumanEval_124/", + "instance_id": "HumanEval/124", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/124" + }, + { + "checksum": "sha256:17fa6fb2179de3bd7ababc938cc10b89e63f63d5b7f9f4057eac104419796b10", + "hf_path": "HumanEval_125/", + "instance_id": "HumanEval/125", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/125" + }, + { + "checksum": "sha256:8b6071ec2fccd63bbc7c31c333b7a7d28e38fd41e8542bf001b4c0eedda816a0", + "hf_path": "HumanEval_126/", + "instance_id": "HumanEval/126", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/126" + }, + { + "checksum": "sha256:07306b2a11bf9abf9d6fc264eca38a374ba04d38c176dcd9677ef6e93bdad6f9", + "hf_path": "HumanEval_127/", + "instance_id": "HumanEval/127", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/127" + }, + { + "checksum": "sha256:7a851e62b2eba046cadc59df5381c868645a117d2db221ecd6426ae02df3c2dd", + "hf_path": "HumanEval_128/", + "instance_id": "HumanEval/128", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/128" + }, + { + "checksum": "sha256:5cb2acbd2902677dcbb984628fb2f9c869b41f4b8958204041dbbe32ac3b9cc7", + "hf_path": "HumanEval_129/", + "instance_id": "HumanEval/129", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/129" + }, + { + "checksum": "sha256:16ed41dc8c2746f216924fbd52d16fd3ff5fc7bd25e0140027c2c9a4780ae94c", + "hf_path": "HumanEval_130/", + "instance_id": "HumanEval/130", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/130" + }, + { + "checksum": "sha256:81cf28317e69a787d6aabab65eaa797dae3727aee1fba50f4388f2ebb24266e7", + "hf_path": "HumanEval_131/", + "instance_id": "HumanEval/131", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/131" + }, + { + "checksum": "sha256:16a85c0da411799c72a2708460236f760f59315eb1563117187f84304582e506", + "hf_path": "HumanEval_132/", + "instance_id": "HumanEval/132", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/132" + }, + { + "checksum": "sha256:b408681a46ebfc6fad73a16ce9ba38c82912e68b090299860295a603bc640504", + "hf_path": "HumanEval_133/", + "instance_id": "HumanEval/133", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/133" + }, + { + "checksum": "sha256:83fea0ec119396606f88900e13f4541a97a73f2a6e494bf9c0f19d96e23a2ff6", + "hf_path": "HumanEval_134/", + "instance_id": "HumanEval/134", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/134" + }, + { + "checksum": "sha256:e28e5ad892ff49922b52f3810aa89572f3876e03f7153313e0693e5ff3220de1", + "hf_path": "HumanEval_135/", + "instance_id": "HumanEval/135", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/135" + }, + { + "checksum": "sha256:544d705cd329b8cb9eb23be5d91e0b7c2de57ffa31e3ed4d03c961635fd3fff7", + "hf_path": "HumanEval_136/", + "instance_id": "HumanEval/136", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/136" + }, + { + "checksum": "sha256:0f05901fe3f1e138eabec29c88a331b1206339a9408c10ba2d81bac6226d48ed", + "hf_path": "HumanEval_137/", + "instance_id": "HumanEval/137", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/137" + }, + { + "checksum": "sha256:c31b09cf61663709f18f8411e10cb2b832f84aefa2dd5e6d5c883693f4e2cc2e", + "hf_path": "HumanEval_138/", + "instance_id": "HumanEval/138", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/138" + }, + { + "checksum": "sha256:3f1c4cd1afdee0abc5bedd1c184f1b7beded2914c1e34f7988fc683b1e054a1a", + "hf_path": "HumanEval_139/", + "instance_id": "HumanEval/139", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/139" + }, + { + "checksum": "sha256:adabfa7ad8133288d0c1ee9169d0c1a37a72e30e0be00a211f356afaf9721f2e", + "hf_path": "HumanEval_140/", + "instance_id": "HumanEval/140", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/140" + }, + { + "checksum": "sha256:54b5dfb265e4cafabef39f252d863e0776cc7fa55481f4f5a5333c6e5f014319", + "hf_path": "HumanEval_141/", + "instance_id": "HumanEval/141", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/141" + }, + { + "checksum": "sha256:2f57e4595f1ec875428640a1f2135a25d8d17511d6768167a4cbcb7c4d7e52b1", + "hf_path": "HumanEval_142/", + "instance_id": "HumanEval/142", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/142" + }, + { + "checksum": "sha256:5d73df155da1bc2029a5fc590dbf2fed37f47c7f5418589e1afb6e2f43a4d79b", + "hf_path": "HumanEval_143/", + "instance_id": "HumanEval/143", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/143" + }, + { + "checksum": "sha256:df525a080c59d470effbaccaef5e201d192e86bbf31859546b644caffba88e50", + "hf_path": "HumanEval_144/", + "instance_id": "HumanEval/144", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/144" + }, + { + "checksum": "sha256:059e6f4c5352ab7a2d0acd4e7d5bd32f5ced48ed97719ac6d4766de6663ec8e7", + "hf_path": "HumanEval_145/", + "instance_id": "HumanEval/145", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/145" + }, + { + "checksum": "sha256:b8c7394d487b2863a549d7e75ae273a3aef1008745102324d906f71f16804625", + "hf_path": "HumanEval_146/", + "instance_id": "HumanEval/146", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/146" + }, + { + "checksum": "sha256:12af56ffdb65d780020f2aa846db34bf81c99126cbc02b1105e92b941fc1e7ee", + "hf_path": "HumanEval_147/", + "instance_id": "HumanEval/147", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/147" + }, + { + "checksum": "sha256:893a52606063741e8102b061373b0101820da264728d1a46d924e7cf76fc78fd", + "hf_path": "HumanEval_148/", + "instance_id": "HumanEval/148", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/148" + }, + { + "checksum": "sha256:bc9e17b9f1f4b3c417c545c4779b527be65e311f42cada0d2a2b2a47766cec4a", + "hf_path": "HumanEval_149/", + "instance_id": "HumanEval/149", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/149" + }, + { + "checksum": "sha256:229992eaef94becc1295a3791311edc3b82f7508f31361147a9627122c34561b", + "hf_path": "HumanEval_150/", + "instance_id": "HumanEval/150", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/150" + }, + { + "checksum": "sha256:1483b1b21ed9867c7082fa45d85a34ecef9ae101667274c8f7f390589f859dea", + "hf_path": "HumanEval_151/", + "instance_id": "HumanEval/151", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/151" + }, + { + "checksum": "sha256:1fec0a1d3467e55240342be2148fd14bb764f3e70499be731394de76a407cc16", + "hf_path": "HumanEval_152/", + "instance_id": "HumanEval/152", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/152" + }, + { + "checksum": "sha256:f8c3452085717c78aa151623931efd6ec31f35381e951b69aa8660e6f8840f99", + "hf_path": "HumanEval_153/", + "instance_id": "HumanEval/153", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/153" + }, + { + "checksum": "sha256:fc2a8a4151ba7dd3a137e289b4c82374ef94477c7d108a14a0716afdcf7777ab", + "hf_path": "HumanEval_154/", + "instance_id": "HumanEval/154", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/154" + }, + { + "checksum": "sha256:2a90864e25a64f99a77168435e6c4cb5f85b959c9c98352d562c77965c20b64c", + "hf_path": "HumanEval_155/", + "instance_id": "HumanEval/155", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/155" + }, + { + "checksum": "sha256:a1dac01a86089674ed355d9b523944d316e86e8c67a67afc0c6c847c18f76b4b", + "hf_path": "HumanEval_156/", + "instance_id": "HumanEval/156", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/156" + }, + { + "checksum": "sha256:2248c45476011462a04484f3d963c835430f4c87a0971f438886d291e030acc1", + "hf_path": "HumanEval_157/", + "instance_id": "HumanEval/157", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/157" + }, + { + "checksum": "sha256:f7964260a8575c8fcd3f117f2eea8c6f205f1061db2f5eba7a00c0966000c2aa", + "hf_path": "HumanEval_158/", + "instance_id": "HumanEval/158", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/158" + }, + { + "checksum": "sha256:8048a062cc2b7de3099691a63b211e3ebd54ae0932e349b802ae6b0e4c5434a0", + "hf_path": "HumanEval_159/", + "instance_id": "HumanEval/159", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/159" + }, + { + "checksum": "sha256:c3ba744dd22a3340098c5abaa2d0a511ce21382cd2e76b502706cdc68f10c1af", + "hf_path": "HumanEval_160/", + "instance_id": "HumanEval/160", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/160" + }, + { + "checksum": "sha256:10c89cdd69cc84b4d3323f542bb98c8db93219312ff48a22bc6e1bf40985e9a6", + "hf_path": "HumanEval_161/", + "instance_id": "HumanEval/161", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/161" + }, + { + "checksum": "sha256:67eaf8b5436549cc7cb98ffeeded5c63569c5c3a06b54d33b0f892e0eb017704", + "hf_path": "HumanEval_162/", + "instance_id": "HumanEval/162", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/162" + }, + { + "checksum": "sha256:0aa51bef23af8dfe6fedcfb456a8100bb67531b01e50d9cc01cf46bac98a60eb", + "hf_path": "HumanEval_163/", + "instance_id": "HumanEval/163", + "license_spdx": "MIT", + "split": "test", + "task_id": "humaneval/HumanEval/163" + } + ], + "upstream_kind": "huggingface", + "upstream_locator": "openai/openai_humaneval", + "upstream_revision": "" +}