idx int64 0 160 | task_id stringlengths 15 44 | prompt_complete stringlengths 120 1.39k | prompt_chat stringlengths 286 1.56k | function_signature stringlengths 23 102 | name stringlengths 15 44 | language stringclasses 1
value | prompt stringlengths 120 1.39k | doctests stringclasses 1
value | original stringlengths 105 134 | prompt_terminology stringclasses 1
value | tests stringlengths 149 1.79k | stop_tokens listlengths 4 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | HumanEval_23_strlen | def strlen(string: str) -> int:
""" Return length of given string
>>> strlen('')
0
>>> strlen('abc')
3
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def strlen(string: str) -> int:
""" Return length of given string
>>> strlen('')
0
>>> strlen('abc')
3
"""
```
| def strlen(string: str) -> int: | HumanEval_23_strlen | py | def strlen(string: str) -> int:
""" Return length of given string
>>> strlen('')
0
>>> strlen('abc')
3
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_23_strlen.py | reworded | def check(candidate):
assert candidate('') == 0
assert candidate('x') == 1
assert candidate('asdasnakj') == 9
def test_check():
check(strlen)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
1 | HumanEval_89_encrypt | def encrypt(s: str) -> str:
"""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'... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def encrypt(s: str) -> str:
"""Create a function encrypt that takes a string as an argument and
returns a string encrypted with the alphabet being rota... | def encrypt(s: str) -> str: | HumanEval_89_encrypt | py | def encrypt(s: str) -> str:
"""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'... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_89_encrypt.py | reworded | def check(candidate):
assert candidate('hi') == 'lm'
assert candidate('asdfghjkl') == 'ewhjklnop'
assert candidate('gf') == 'kj'
assert candidate('et') == 'ix'
assert candidate('faewfawefaewg') == 'jeiajeaijeiak'
assert candidate('hellomyfriend') == 'lippsqcjvmirh'
assert candidate('dxzdlmni... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
2 | HumanEval_95_check_dict_case | from typing import Dict
def check_dict_case(dict: Dict[str, str]) -> bool:
"""
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_... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import Dict
def check_dict_case(dict: Dict[str, str]) -> bool:
"""
Given a dictionary, return True if all keys are strings in lower
c... | def check_dict_case(dict: Dict[str, str]) -> bool: | HumanEval_95_check_dict_case | py | from typing import Dict
def check_dict_case(dict: Dict[str, str]) -> bool:
"""
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_... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_95_check_dict_case.py | reworded | def check(candidate):
assert candidate({ 'p': 'pineapple', 'b': 'banana' }) == True
assert candidate({ 'p': 'pineapple', 'A': 'banana', 'B': 'banana' }) == False
assert candidate({ 'p': 'pineapple', '5': 'banana', 'a': 'apple' }) == False
assert candidate({ 'Name': 'John', 'Age': '36', 'City': 'Houston'... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
3 | HumanEval_85_add | from typing import List
def add(lst: List[int]) -> int:
"""Given a non-empty list of integers lst. add the even elements that are at odd indices..
Examples:
>>> add([4, 2, 6, 7])
2
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def add(lst: List[int]) -> int:
"""Given a non-empty list of integers lst. add the even elements that are at odd indices..
E... | def add(lst: List[int]) -> int: | HumanEval_85_add | py | from typing import List
def add(lst: List[int]) -> int:
"""Given a non-empty list of integers lst. add the even elements that are at odd indices..
Examples:
>>> add([4, 2, 6, 7])
2
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_85_add.py | reworded | def check(candidate):
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
def test_check():
check(add)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
4 | HumanEval_140_fix_spaces | def fix_spaces(text: str) -> str:
"""
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'
>... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def fix_spaces(text: str) -> str:
"""
Given a string text, replace all spaces in it with underscores,
and if a string has more than 2 consecutive ... | def fix_spaces(text: str) -> str: | HumanEval_140_fix_spaces | py | def fix_spaces(text: str) -> str:
"""
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'
>... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_140_fix_spaces.py | reworded | def check(candidate):
assert candidate('Example') == 'Example'
assert candidate('Mudasir Hanif ') == 'Mudasir_Hanif_'
assert candidate('Yellow Yellow Dirty Fellow') == 'Yellow_Yellow__Dirty__Fellow'
assert candidate('Exa mple') == 'Exa-mple'
assert candidate(' Exa 1 2 2 mple') == '-Exa_1_2_2_m... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
5 | HumanEval_63_fibfib | def fibfib(n: int) -> 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 ... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def fibfib(n: int) -> int:
"""The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
fibfib(0) == 0
... | def fibfib(n: int) -> int: | HumanEval_63_fibfib | py | def fibfib(n: int) -> 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 ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_63_fibfib.py | reworded | 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():
check(fibfib)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
6 | HumanEval_151_double_the_difference | from typing import List
def double_the_difference(lst: List[float]) -> int:
"""
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])
10
>>> double_the_difference... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def double_the_difference(lst: List[float]) -> int:
"""
Given a list of numbers, return the sum of squares of the numbers
... | def double_the_difference(lst: List[float]) -> int: | HumanEval_151_double_the_difference | py | from typing import List
def double_the_difference(lst: List[float]) -> int:
"""
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])
10
>>> double_the_difference... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_151_double_the_difference.py | reworded | def check(candidate):
assert candidate([]) == 0
assert candidate([5.0, 4.0]) == 25
assert candidate([0.1, 0.2, 0.3]) == 0
assert candidate([-10.0, -20.0, -30.0]) == 0
assert candidate([-1.0, -2.0, 8.0]) == 0
assert candidate([0.2, 3.0, 5.0]) == 34
assert candidate([-9.0, -7.0, -5.0, -3.0, -1... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
7 | HumanEval_22_filter_integers | 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]
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List, Any
def filter_integers(values: List[Any]) -> List[int]:
""" Filter given list of any python values only for integers
>>> fil... | def filter_integers(values: List[Any]) -> List[int]: | HumanEval_22_filter_integers | py | 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]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_22_filter_integers.py | reworded | 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():
check(filter_integers)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
8 | HumanEval_41_car_race_collision | def car_race_collision(n: int) -> 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 s... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def car_race_collision(n: int) -> int:
"""
Imagine a road that's a perfectly straight infinitely long line.
n cars are driving left to right; simu... | def car_race_collision(n: int) -> int: | HumanEval_41_car_race_collision | py | def car_race_collision(n: int) -> 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 s... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_41_car_race_collision.py | reworded | 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():
check(car_race_collision)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
9 | HumanEval_17_parse_music | 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:
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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 AS... | def parse_music(music_string: str) -> List[int]: | HumanEval_17_parse_music | py | 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:
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_17_parse_music.py | reworded | 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():
... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
10 | HumanEval_79_decimal_to_binary | def decimal_to_binary(decimal: int) -> str:
"""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 coupl... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def decimal_to_binary(decimal: int) -> str:
"""You will be given a number in decimal form and your task is to convert it to
binary format. The function... | def decimal_to_binary(decimal: int) -> str: | HumanEval_79_decimal_to_binary | py | def decimal_to_binary(decimal: int) -> str:
"""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 coupl... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_79_decimal_to_binary.py | reworded | def check(candidate):
assert candidate(0) == 'db0db'
assert candidate(32) == 'db100000db'
assert candidate(103) == 'db1100111db'
assert candidate(15) == 'db1111db'
def test_check():
check(decimal_to_binary)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
11 | HumanEval_14_all_prefixes | 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']
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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
>>> a... | def all_prefixes(string: str) -> List[str]: | HumanEval_14_all_prefixes | py | 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']
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_14_all_prefixes.py | reworded | def check(candidate):
assert candidate('') == []
assert candidate('asdfgh') == ['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh']
assert candidate('WWW') == ['W', 'WW', 'WWW']
def test_check():
check(all_prefixes)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
12 | HumanEval_53_add | def add(x: int, y: int) -> int:
"""Add two numbers x and y
>>> add(2, 3)
5
>>> add(5, 7)
12
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def add(x: int, y: int) -> int:
"""Add two numbers x and y
>>> add(2, 3)
5
>>> add(5, 7)
12
"""
```
| def add(x: int, y: int) -> int: | HumanEval_53_add | py | def add(x: int, y: int) -> int:
"""Add two numbers x and y
>>> add(2, 3)
5
>>> add(5, 7)
12
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_53_add.py | reworded | def check(candidate):
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
def test_check():
check(add)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
13 | HumanEval_159_eat | from typing import List
def eat(number: int, need: int, remaining: int) -> List[int]:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def eat(number: int, need: int, remaining: int) -> List[int]:
"""
You're a hungry rabbit, and you already have eaten a certain... | def eat(number: int, need: int, remaining: int) -> List[int]: | HumanEval_159_eat | py | from typing import List
def eat(number: int, need: int, remaining: int) -> List[int]:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_159_eat.py | reworded | def check(candidate):
assert candidate(5, 6, 10) == [11, 4]
assert candidate(4, 8, 9) == [12, 1]
assert candidate(1, 10, 10) == [11, 0]
assert candidate(2, 11, 5) == [7, 0]
assert candidate(4, 5, 7) == [9, 2]
assert candidate(4, 5, 1) == [5, 0]
def test_check():
check(eat)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
14 | HumanEval_115_max_fill | from typing import List
def max_fill(grid: List[List[int]], capacity: int) -> int:
"""
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,
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def max_fill(grid: List[List[int]], capacity: int) -> int:
"""
You are given a rectangular grid of wells. Each row represents ... | def max_fill(grid: List[List[int]], capacity: int) -> int: | HumanEval_115_max_fill | py | from typing import List
def max_fill(grid: List[List[int]], capacity: int) -> int:
"""
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,
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_115_max_fill.py | reworded | def check(candidate):
assert candidate([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1) == 6
assert candidate([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2) == 5
assert candidate([[0, 0, 0], [0, 0, 0]], 5) == 0
assert candidate([[1, 1, 1, 1], [1, 1, 1, 1]], 2) == 4
assert candidate([[1, ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
15 | HumanEval_160_do_algebra | from typing import List
def do_algebra(operator: List[str], operand: List[int]) -> int:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def do_algebra(operator: List[str], operand: List[int]) -> int:
"""
Given two lists operator, and operand. The first list has ... | def do_algebra(operator: List[str], operand: List[int]) -> int: | HumanEval_160_do_algebra | py | from typing import List
def do_algebra(operator: List[str], operand: List[int]) -> int:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_160_do_algebra.py | reworded | def check(candidate):
assert candidate(['**', '*', '+'], [2, 3, 4, 5]) == 37
assert candidate(['+', '*', '-'], [2, 3, 4, 5]) == 9
assert candidate(['//', '*'], [7, 3, 4]) == 8
def test_check():
check(do_algebra)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
16 | HumanEval_27_flip_case | def flip_case(string: str) -> str:
""" For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> flip_case('Hello')
'hELLO'
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def flip_case(string: str) -> str:
""" For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> flip_case('Hello')
... | def flip_case(string: str) -> str: | HumanEval_27_flip_case | py | def flip_case(string: str) -> str:
""" For a given string, flip lowercase characters to uppercase and uppercase to lowercase.
>>> flip_case('Hello')
'hELLO'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_27_flip_case.py | reworded | 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():
check(flip_case)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
17 | HumanEval_105_by_length | from typing import List
def by_length(arr: List[int]) -> List[str]:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def by_length(arr: List[int]) -> List[str]:
"""
Given an array of integers, sort the integers that are between 1 and 9 inclusi... | def by_length(arr: List[int]) -> List[str]: | HumanEval_105_by_length | py | from typing import List
def by_length(arr: List[int]) -> List[str]:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_105_by_length.py | reworded | def check(candidate):
assert candidate([2, 1, 1, 4, 5, 8, 2, 3]) == ['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']
assert candidate([]) == []
assert candidate([1, -1, 55]) == ['One']
assert candidate([1, -1, 3, 2]) == ['Three', 'Two', 'One']
assert candidate([9, 4, 8]) == ['Nine', 'E... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
18 | HumanEval_25_factorize | 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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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.
E... | def factorize(n: int) -> List[int]: | HumanEval_25_factorize | py | 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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_25_factorize.py | reworded | def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(57) == [3, 19]
assert candidate(3249) == [3, 3, 19, 19]
assert candidate(185193) == [3, 3, 3, 19, 19, 19]
assert candidate(20577) == [3, 19, 19, 19]
assert can... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
19 | HumanEval_96_count_up_to | from typing import List
def count_up_to(n: int) -> List[int]:
"""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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def count_up_to(n: int) -> List[int]:
"""Implement a function that takes an non-negative integer and returns an array of the first... | def count_up_to(n: int) -> List[int]: | HumanEval_96_count_up_to | py | from typing import List
def count_up_to(n: int) -> List[int]:
"""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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_96_count_up_to.py | reworded | 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, ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
20 | HumanEval_34_unique | from typing import List
def unique(l: List[int]) -> List[int]:
"""Return sorted unique elements in a list
>>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])
[0, 2, 3, 5, 9, 123]
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def unique(l: List[int]) -> List[int]:
"""Return sorted unique elements in a list
>>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])
... | def unique(l: List[int]) -> List[int]: | HumanEval_34_unique | py | from typing import List
def unique(l: List[int]) -> List[int]:
"""Return sorted unique elements in a list
>>> unique([5, 3, 5, 2, 3, 3, 9, 0, 123])
[0, 2, 3, 5, 9, 123]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_34_unique.py | reworded | def check(candidate):
assert candidate([5, 3, 5, 2, 3, 3, 9, 0, 123]) == [0, 2, 3, 5, 9, 123]
def test_check():
check(unique)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
21 | HumanEval_74_total_match | from typing import List
def total_match(lst1: List[str], lst2: List[str]) -> List[str]:
"""
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, r... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def total_match(lst1: List[str], lst2: List[str]) -> List[str]:
"""
Write a function that accepts two lists of strings and ret... | def total_match(lst1: List[str], lst2: List[str]) -> List[str]: | HumanEval_74_total_match | py | from typing import List
def total_match(lst1: List[str], lst2: List[str]) -> List[str]:
"""
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, r... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_74_total_match.py | reworded | def check(candidate):
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'], ['... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
22 | HumanEval_35_max_element | from typing import List
def max_element(l: List[int]) -> int:
"""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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def max_element(l: List[int]) -> int:
"""Return maximum element in the list.
>>> max_element([1, 2, 3])
3
>>> max_elem... | def max_element(l: List[int]) -> int: | HumanEval_35_max_element | py | from typing import List
def max_element(l: List[int]) -> int:
"""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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_35_max_element.py | reworded | 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():
check(max_element)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
23 | HumanEval_132_is_nested | def is_nested(string: str) -> bool:
"""
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('[[]]')
Tru... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_nested(string: str) -> bool:
"""
Create a function that takes a string as input which contains only square brackets.
The function should ret... | def is_nested(string: str) -> bool: | HumanEval_132_is_nested | py | def is_nested(string: str) -> bool:
"""
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('[[]]')
Tru... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_132_is_nested.py | reworded | def check(candidate):
assert candidate('[[]]') == True
assert candidate('[]]]]]]][[[[[]') == False
assert candidate('[][]') == False
assert candidate('[]') == False
assert candidate('[[[[]]]]') == True
assert candidate('[]]]]]]]]]]') == False
assert candidate('[][][[]]') == True
assert c... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
24 | HumanEval_103_rounded_avg | from typing import Union
def rounded_avg(n: int, m: int) -> Union[str, int]:
"""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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import Union
def rounded_avg(n: int, m: int) -> Union[str, int]:
"""You are given two positive integers n and m, and your task is to compute t... | def rounded_avg(n: int, m: int) -> Union[str, int]: | HumanEval_103_rounded_avg | py | from typing import Union
def rounded_avg(n: int, m: int) -> Union[str, int]:
"""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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_103_rounded_avg.py | reworded | def check(candidate):
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, ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
25 | HumanEval_113_odd_count | from typing import List
def odd_count(lst: List[str]) -> List[str]:
"""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
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def odd_count(lst: List[str]) -> List[str]:
"""Given a list of strings, where each string consists of only digits, return a list.
... | def odd_count(lst: List[str]) -> List[str]: | HumanEval_113_odd_count | py | from typing import List
def odd_count(lst: List[str]) -> List[str]:
"""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
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_113_odd_count.py | reworded | def check(candidate):
assert candidate(['1234567']) == ['the number of odd elements 4n the str4ng 4 of the 4nput.']
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.']
assert candidate(['271', '137', ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
26 | HumanEval_109_move_one_ball | from typing import List
def move_one_ball(arr: List[int]) -> bool:
"""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 followi... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def move_one_ball(arr: List[int]) -> bool:
"""We have an array 'arr' of N integers arr[1], arr[2], ..., arr[N].The
numbers in ... | def move_one_ball(arr: List[int]) -> bool: | HumanEval_109_move_one_ball | py | from typing import List
def move_one_ball(arr: List[int]) -> bool:
"""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 followi... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_109_move_one_ball.py | reworded | def check(candidate):
assert candidate([3, 4, 5, 1, 2]) == True
assert candidate([3, 5, 10, 1, 2]) == True
assert candidate([4, 3, 1, 2]) == False
assert candidate([3, 5, 4, 1, 2]) == False
assert candidate([]) == True
def test_check():
check(move_one_ball)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
27 | HumanEval_107_even_odd_palindrome | from typing import Tuple
def even_odd_palindrome(n: int) -> Tuple[int, int]:
"""
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:
>>> even_odd_palindrome(3)
(1, 2)
Explanation:
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import Tuple
def even_odd_palindrome(n: int) -> Tuple[int, int]:
"""
Given a positive integer n, return a tuple that has the number of eve... | def even_odd_palindrome(n: int) -> Tuple[int, int]: | HumanEval_107_even_odd_palindrome | py | from typing import Tuple
def even_odd_palindrome(n: int) -> Tuple[int, int]:
"""
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:
>>> even_odd_palindrome(3)
(1, 2)
Explanation:
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_107_even_odd_palindrome.py | reworded | def check(candidate):
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)
assert candidate(1) == (0, 1)
def test_check():
... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
28 | HumanEval_138_is_equal_to_sum_even | def is_equal_to_sum_even(n: int) -> bool:
"""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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_equal_to_sum_even(n: int) -> bool:
"""Evaluate whether the given number n can be written as the sum of exactly 4 positive even numbers
Example
... | def is_equal_to_sum_even(n: int) -> bool: | HumanEval_138_is_equal_to_sum_even | py | def is_equal_to_sum_even(n: int) -> bool:
"""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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_138_is_equal_to_sum_even.py | reworded | 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():
check(is_e... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
29 | HumanEval_62_derivative | from typing import List
def derivative(xs: List[int]) -> List[int]:
""" 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]
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def derivative(xs: List[int]) -> List[int]:
""" xs represent coefficients of a polynomial.
xs[0] + xs[1] * x + xs[2] * x^2 + .... | def derivative(xs: List[int]) -> List[int]: | HumanEval_62_derivative | py | from typing import List
def derivative(xs: List[int]) -> List[int]:
""" 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]
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_62_derivative.py | reworded | 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():
check(derivative)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
30 | HumanEval_126_is_sorted | from typing import List
def is_sorted(lst: List[int]) -> bool:
"""
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])
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def is_sorted(lst: List[int]) -> bool:
"""
Given a list of numbers, return whether or not they are sorted
in ascending ord... | def is_sorted(lst: List[int]) -> bool: | HumanEval_126_is_sorted | py | from typing import List
def is_sorted(lst: List[int]) -> bool:
"""
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])
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_126_is_sorted.py | reworded | def check(candidate):
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
assert candid... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
31 | HumanEval_161_solve | def solve(s: str) -> str:
"""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')
'... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def solve(s: str) -> str:
"""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 ... | def solve(s: str) -> str: | HumanEval_161_solve | py | def solve(s: str) -> str:
"""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')
'... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_161_solve.py | reworded | def check(candidate):
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#'
assert candidate('#$a^D') == '#$A^d'
assert candid... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
32 | HumanEval_130_tri | from typing import List
def tri(n: int) -> List[int]:
"""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,... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def tri(n: int) -> List[int]:
"""Everyone knows Fibonacci sequence, it was studied deeply by mathematicians in
the last coupl... | def tri(n: int) -> List[int]: | HumanEval_130_tri | py | from typing import List
def tri(n: int) -> List[int]:
"""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,... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_130_tri.py | reworded | def check(candidate):
assert candidate(3) == [1, 3, 2, 8]
assert candidate(4) == [1, 3, 2, 8, 3]
assert candidate(5) == [1, 3, 2, 8, 3, 15]
assert candidate(6) == [1, 3, 2, 8, 3, 15, 4]
assert candidate(7) == [1, 3, 2, 8, 3, 15, 4, 24]
assert candidate(8) == [1, 3, 2, 8, 3, 15, 4, 24, 5]
ass... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
33 | HumanEval_36_fizz_buzz | def fizz_buzz(n: int) -> 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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def fizz_buzz(n: int) -> int:
"""Return the number of times the digit 7 appears in integers less than n which are divisible by 11 or 13.
>>> fizz_buzz(... | def fizz_buzz(n: int) -> int: | HumanEval_36_fizz_buzz | py | def fizz_buzz(n: int) -> 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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_36_fizz_buzz.py | reworded | 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():
check(fizz_buzz)
... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
34 | HumanEval_29_filter_by_prefix | 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']
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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 w... | def filter_by_prefix(strings: List[str], prefix: str) -> List[str]: | HumanEval_29_filter_by_prefix | py | 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']
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_29_filter_by_prefix.py | reworded | def check(candidate):
assert candidate([], 'john') == []
assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']
def test_check():
check(filter_by_prefix)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
35 | HumanEval_84_solve | def solve(N: int) -> str:
"""Given a positive integer N, return the total sum of its digits in binary.
Example
>>> solve(1000)
'1'
>>> solve(150)
'110'
>>> solve(147)
'1100'
Variables:
@N integer
Constraints: 0 ≤ N ≤ 10000.
Output:
a string... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def solve(N: int) -> str:
"""Given a positive integer N, return the total sum of its digits in binary.
Example
>>> solve(1000)
'1'
>>>... | def solve(N: int) -> str: | HumanEval_84_solve | py | def solve(N: int) -> str:
"""Given a positive integer N, return the total sum of its digits in binary.
Example
>>> solve(1000)
'1'
>>> solve(150)
'110'
>>> solve(147)
'1100'
Variables:
@N integer
Constraints: 0 ≤ N ≤ 10000.
Output:
a string... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_84_solve.py | reworded | def check(candidate):
assert candidate(1000) == '1'
assert candidate(150) == '110'
assert candidate(147) == '1100'
assert candidate(333) == '1001'
assert candidate(963) == '10010'
def test_check():
check(solve)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
36 | HumanEval_129_minPath | from typing import List
def minPath(grid: List[List[int]], k: int) -> List[int]:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def minPath(grid: List[List[int]], k: int) -> List[int]:
"""
Given a grid with N rows and N columns (N >= 2) and a positive in... | def minPath(grid: List[List[int]], k: int) -> List[int]: | HumanEval_129_minPath | py | from typing import List
def minPath(grid: List[List[int]], k: int) -> List[int]:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_129_minPath.py | reworded | def check(candidate):
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... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
37 | HumanEval_98_count_upper | def count_upper(s: str) -> int:
"""
Given a string s, count the number of uppercase vowels in even indices.
For example:
>>> count_upper('aBCdEf')
1
>>> count_upper('abcdefg')
0
>>> count_upper('dBBE')
0
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def count_upper(s: str) -> int:
"""
Given a string s, count the number of uppercase vowels in even indices.
For example:
>>> count_upper('... | def count_upper(s: str) -> int: | HumanEval_98_count_upper | py | def count_upper(s: str) -> int:
"""
Given a string s, count the number of uppercase vowels in even indices.
For example:
>>> count_upper('aBCdEf')
1
>>> count_upper('abcdefg')
0
>>> count_upper('dBBE')
0
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_98_count_upper.py | reworded | def check(candidate):
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
def test_check():
check(count_upper)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
38 | HumanEval_120_maximum | from typing import List
def maximum(arr: List[int], k: int) -> List[int]:
"""
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:
>>> maximum([-3, -4, 5], 3)
[-4, -3, 5]
Example 2:
>>> maximum([4, -... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def maximum(arr: List[int], k: int) -> List[int]:
"""
Given an array arr of integers and a positive integer k, return a sorted... | def maximum(arr: List[int], k: int) -> List[int]: | HumanEval_120_maximum | py | from typing import List
def maximum(arr: List[int], k: int) -> List[int]:
"""
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:
>>> maximum([-3, -4, 5], 3)
[-4, -3, 5]
Example 2:
>>> maximum([4, -... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_120_maximum.py | reworded | def check(candidate):
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]
ass... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
39 | HumanEval_24_largest_divisor | 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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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)
... | def largest_divisor(n: int) -> int: | HumanEval_24_largest_divisor | py | 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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_24_largest_divisor.py | reworded | 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():
check(largest_divisor)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
40 | HumanEval_88_sort_array | from typing import List
def sort_array(array: List[int]) -> List[int]:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def sort_array(array: List[int]) -> List[int]:
"""
Given an array of non-negative integers, return a copy of the given array a... | def sort_array(array: List[int]) -> List[int]: | HumanEval_88_sort_array | py | from typing import List
def sort_array(array: List[int]) -> List[int]:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_88_sort_array.py | reworded | def check(candidate):
assert candidate([]) == []
assert candidate([5]) == [5]
assert candidate([2, 4, 3, 0, 1, 5]) == [0, 1, 2, 3, 4, 5]
assert candidate([2, 4, 3, 0, 1, 5, 6]) == [6, 5, 4, 3, 2, 1, 0]
assert candidate([2, 1]) == [1, 2]
assert candidate([15, 42, 87, 32, 11, 0]) == [0, 11, 15, 32... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
41 | HumanEval_106_f | from typing import List
def f(n: int) -> List[int]:
""" 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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def f(n: int) -> List[int]:
""" Implement the function f that takes n as a parameter,
and returns a list of size n, such that ... | def f(n: int) -> List[int]: | HumanEval_106_f | py | from typing import List
def f(n: int) -> List[int]:
""" 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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_106_f.py | reworded | 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():
check(f)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
42 | HumanEval_77_iscube | def iscube(a: int) -> bool:
"""
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)... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def iscube(a: int) -> bool:
"""
Write a function that takes an integer a and returns True
if this ingeger is a cube of some integer number.
No... | def iscube(a: int) -> bool: | HumanEval_77_iscube | py | def iscube(a: int) -> bool:
"""
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)... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_77_iscube.py | reworded | def check(candidate):
assert candidate(1) == True
assert candidate(2) == False
assert candidate(-1) == True
assert candidate(64) == True
assert candidate(180) == False
assert candidate(1000) == True
assert candidate(0) == True
assert candidate(1729) == False
def test_check():
check(... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
43 | HumanEval_93_encode | def encode(message: str) -> str:
"""
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.
Exampl... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def encode(message: str) -> str:
"""
Write a function that takes a message, and encodes in such a
way that it swaps case of all letters, replaces ... | def encode(message: str) -> str: | HumanEval_93_encode | py | def encode(message: str) -> str:
"""
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.
Exampl... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_93_encode.py | reworded | def check(candidate):
assert candidate('TEST') == 'tgst'
assert candidate('Mudasir') == 'mWDCSKR'
assert candidate('YES') == 'ygs'
assert candidate('This is a message') == 'tHKS KS C MGSSCGG'
assert candidate('I DoNt KnOw WhAt tO WrItE') == 'k dQnT kNqW wHcT Tq wRkTg'
def test_check():
check(en... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
44 | HumanEval_91_is_bored | def is_bored(S: str) -> int:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_bored(S: str) -> int:
"""
You'll be given a string of words, and your task is to count the number
of boredoms. A boredom is a sentence that ... | def is_bored(S: str) -> int: | HumanEval_91_is_bored | py | def is_bored(S: str) -> int:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_91_is_bored.py | reworded | def check(candidate):
assert candidate('Hello world') == 0
assert candidate('Is the sky blue?') == 0
assert candidate('I love It !') == 1
assert candidate('bIt') == 0
assert candidate('I feel good today. I will be productive. will kill It') == 2
assert candidate('You and I are going for a walk')... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
45 | HumanEval_43_pairs_sum_to_zero | from typing import List
def pairs_sum_to_zero(l: List[int]) -> bool:
"""
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_z... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def pairs_sum_to_zero(l: List[int]) -> bool:
"""
pairs_sum_to_zero takes a list of integers as an input.
it returns True i... | def pairs_sum_to_zero(l: List[int]) -> bool: | HumanEval_43_pairs_sum_to_zero | py | from typing import List
def pairs_sum_to_zero(l: List[int]) -> bool:
"""
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_z... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_43_pairs_sum_to_zero.py | reworded | 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,... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
46 | HumanEval_71_triangle_area | def triangle_area(a: int, b: int, c: int) -> float:
"""
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 gr... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def triangle_area(a: int, b: int, c: int) -> float:
"""
Given the lengths of the three sides of a triangle. Return the area of
the triangle rounded... | def triangle_area(a: int, b: int, c: int) -> float: | HumanEval_71_triangle_area | py | def triangle_area(a: int, b: int, c: int) -> float:
"""
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 gr... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_71_triangle_area.py | reworded | def check(candidate):
assert candidate(3, 4, 5) == 6.0
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
assert candidate(1, 1, 1) == 0.4... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
47 | HumanEval_148_bf | from typing import Tuple
def bf(planet1: str, planet2: str) -> Tuple[str, ...]:
"""
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 p... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import Tuple
def bf(planet1: str, planet2: str) -> Tuple[str, ...]:
"""
There are eight planets in our solar system: the closerst to the S... | def bf(planet1: str, planet2: str) -> Tuple[str, ...]: | HumanEval_148_bf | py | from typing import Tuple
def bf(planet1: str, planet2: str) -> Tuple[str, ...]:
"""
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 p... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_148_bf.py | reworded | def check(candidate):
assert candidate('Jupiter', 'Neptune') == ('Saturn', 'Uranus')
assert candidate('Earth', 'Mercury') == ('Venus',)
assert candidate('Mercury', 'Uranus') == ('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')
assert candidate('Neptune', 'Venus') == ('Earth', 'Mars', 'Jupiter', 'Saturn', ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
48 | HumanEval_131_digits | def digits(n: int) -> int:
"""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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def digits(n: int) -> int:
"""Given a positive integer n, return the product of the odd digits.
Return 0 if all digits are even.
For example:
>... | def digits(n: int) -> int: | HumanEval_131_digits | py | def digits(n: int) -> int:
"""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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_131_digits.py | reworded | def check(candidate):
assert candidate(5) == 5
assert candidate(54) == 5
assert candidate(120) == 1
assert candidate(5014) == 5
assert candidate(98765) == 315
assert candidate(5576543) == 2625
assert candidate(2468) == 0
def test_check():
check(digits)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
49 | HumanEval_101_words_string | from typing import List
def words_string(s: str) -> List[str]:
"""
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'... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def words_string(s: str) -> List[str]:
"""
You will be given a string of words separated by commas or spaces. Your task is
... | def words_string(s: str) -> List[str]: | HumanEval_101_words_string | py | from typing import List
def words_string(s: str) -> List[str]:
"""
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'... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_101_words_string.py | reworded | def check(candidate):
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, fiv... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
50 | HumanEval_18_how_many_times | 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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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 cas... | def how_many_times(string: str, substring: str) -> int: | HumanEval_18_how_many_times | py | 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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_18_how_many_times.py | reworded | 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():
check(how_many_times)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
51 | HumanEval_137_compare_one | from typing import Union
def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]:
"""
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 ... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import Union
def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]:
"""
Create a function ... | def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]: | HumanEval_137_compare_one | py | from typing import Union
def compare_one(a: Union[int, float, str], b: Union[int, float, str]) -> Union[int, float, str, None]:
"""
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 ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_137_compare_one.py | reworded | def check(candidate):
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
def test_c... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
52 | HumanEval_51_remove_vowels | def remove_vowels(text: str) -> str:
"""
remove_vowels is a function that takes string and returns string without vowels.
>>> remove_vowels('')
''
>>> remove_vowels('abcdef')
'bcdf'
>>> remove_vowels('aaaaa')
''
>>> remove_vowels('aaBAA')
'B'
>>> remove_vowels('zbcd')
'zb... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def remove_vowels(text: str) -> str:
"""
remove_vowels is a function that takes string and returns string without vowels.
>>> remove_vowels('')
... | def remove_vowels(text: str) -> str: | HumanEval_51_remove_vowels | py | def remove_vowels(text: str) -> str:
"""
remove_vowels is a function that takes string and returns string without vowels.
>>> remove_vowels('')
''
>>> remove_vowels('abcdef')
'bcdf'
>>> remove_vowels('aaaaa')
''
>>> remove_vowels('aaBAA')
'B'
>>> remove_vowels('zbcd')
'zb... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_51_remove_vowels.py | reworded | 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()... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
53 | HumanEval_70_strange_sort_list | from typing import List
def strange_sort_list(lst: List[int]) -> List[int]:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def strange_sort_list(lst: List[int]) -> List[int]:
"""
Given list of integers, return list in strange order.
Strange sort... | def strange_sort_list(lst: List[int]) -> List[int]: | HumanEval_70_strange_sort_list | py | from typing import List
def strange_sort_list(lst: List[int]) -> List[int]:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_70_strange_sort_list.py | reworded | def check(candidate):
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 candidat... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
54 | HumanEval_20_find_closest_elements | 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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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 l... | def find_closest_elements(numbers: List[float]) -> Tuple[float, float]: | HumanEval_20_find_closest_elements | py | 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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_20_find_closest_elements.py | reworded | 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... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
55 | HumanEval_76_is_simple_power | def is_simple_power(x: int, n: int) -> bool:
"""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_sim... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_simple_power(x: int, n: int) -> bool:
"""Your task is to write a function that returns true if a number x is a simple
power of n and false in ot... | def is_simple_power(x: int, n: int) -> bool: | HumanEval_76_is_simple_power | py | def is_simple_power(x: int, n: int) -> bool:
"""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_sim... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_76_is_simple_power.py | reworded | def check(candidate):
assert candidate(16, 2) == True
assert candidate(143214, 16) == False
assert candidate(4, 2) == True
assert candidate(9, 3) == True
assert candidate(16, 4) == True
assert candidate(24, 2) == False
assert candidate(128, 4) == False
assert candidate(12, 6) == False
... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
56 | HumanEval_39_prime_fib | def prime_fib(n: int) -> 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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def prime_fib(n: int) -> int:
"""
prime_fib returns n-th number that is a Fibonacci number and it's also prime.
>>> prime_fib(1)
2
>>> prim... | def prime_fib(n: int) -> int: | HumanEval_39_prime_fib | py | def prime_fib(n: int) -> 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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_39_prime_fib.py | reworded | 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(... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
57 | HumanEval_145_order_by_points | from typing import List
def order_by_points(nums: List[int]) -> List[int]:
"""
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 origi... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def order_by_points(nums: List[int]) -> List[int]:
"""
Write a function which sorts the given list of integers
in ascendin... | def order_by_points(nums: List[int]) -> List[int]: | HumanEval_145_order_by_points | py | from typing import List
def order_by_points(nums: List[int]) -> List[int]:
"""
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 origi... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_145_order_by_points.py | reworded | def check(candidate):
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... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
58 | HumanEval_0_has_close_elements | 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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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... | def has_close_elements(numbers: List[float], threshold: float) -> bool: | HumanEval_0_has_close_elements | py | 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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_0_has_close_elements.py | reworded | 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... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
59 | HumanEval_10_make_palindrome | 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 suffi... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the ... | def make_palindrome(string: str) -> str: | HumanEval_10_make_palindrome | py | 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 suffi... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_10_make_palindrome.py | reworded | def check(candidate):
assert candidate('') == ''
assert candidate('x') == 'x'
assert candidate('xyz') == 'xyzyx'
assert candidate('xyx') == 'xyx'
assert candidate('jerry') == 'jerryrrej'
def test_check():
check(make_palindrome)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
60 | HumanEval_11_string_xor | 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'
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
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 re... | def string_xor(a: str, b: str) -> str: | HumanEval_11_string_xor | py | 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'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_11_string_xor.py | reworded | def check(candidate):
assert candidate('111000', '101010') == '010010'
assert candidate('1', '1') == '0'
assert candidate('0101', '0000') == '0101'
def test_check():
check(string_xor)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
61 | HumanEval_139_special_factorial | def special_factorial(n: int) -> int:
"""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 i... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def special_factorial(n: int) -> int:
"""The Brazilian factorial is defined as:
brazilian_factorial(n) = n! * (n-1)! * (n-2)! * ... * 1!
where n > ... | def special_factorial(n: int) -> int: | HumanEval_139_special_factorial | py | def special_factorial(n: int) -> int:
"""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 i... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_139_special_factorial.py | reworded | def check(candidate):
assert candidate(4) == 288
assert candidate(5) == 34560
assert candidate(7) == 125411328000
assert candidate(1) == 1
def test_check():
check(special_factorial)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
62 | HumanEval_122_add_elements | from typing import List
def add_elements(arr: List[int], k: int) -> int:
"""
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:
>>> add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4)
24
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def add_elements(arr: List[int], k: int) -> int:
"""
Given a non-empty array of integers arr and an integer k, return
the ... | def add_elements(arr: List[int], k: int) -> int: | HumanEval_122_add_elements | py | from typing import List
def add_elements(arr: List[int], k: int) -> int:
"""
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:
>>> add_elements([111, 21, 3, 4000, 5, 6, 7, 8, 9], 4)
24
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_122_add_elements.py | reworded | def check(candidate):
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
assert candidate([1], 1) == 1
def test_che... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
63 | HumanEval_46_fib4 | def fib4(n: int) -> 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-... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def fib4(n: int) -> int:
"""The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
fib4(0) -> 0
fib4(... | def fib4(n: int) -> int: | HumanEval_46_fib4 | py | def fib4(n: int) -> 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-... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_46_fib4.py | reworded | def check(candidate):
assert candidate(5) == 4
assert candidate(8) == 28
assert candidate(10) == 104
assert candidate(12) == 386
def test_check():
check(fib4)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
64 | HumanEval_104_unique_digits | from typing import List
def unique_digits(x: List[int]) -> List[int]:
"""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, 1... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def unique_digits(x: List[int]) -> List[int]:
"""Given a list of positive integers x. return a sorted list of all
elements th... | def unique_digits(x: List[int]) -> List[int]: | HumanEval_104_unique_digits | py | from typing import List
def unique_digits(x: List[int]) -> List[int]:
"""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, 1... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_104_unique_digits.py | reworded | def check(candidate):
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]
def test_check():
check(unique_digits)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
65 | HumanEval_117_select_words | from typing import List
def select_words(s: str, n: int) -> List[str]:
"""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 ... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def select_words(s: str, n: int) -> List[str]:
"""Given a string s and a natural number n, you have been tasked to implement
... | def select_words(s: str, n: int) -> List[str]: | HumanEval_117_select_words | py | from typing import List
def select_words(s: str, n: int) -> List[str]:
"""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 ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_117_select_words.py | reworded | def check(candidate):
assert candidate('Mary had a little lamb', 4) == ['little']
assert candidate('Mary had a little lamb', 3) == ['Mary', 'lamb']
assert candidate('simple white space', 2) == []
assert candidate('Hello world', 4) == ['world']
assert candidate('Uncle sam', 3) == ['Uncle']
assert... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
66 | HumanEval_72_will_it_fly | from typing import List
def will_it_fly(q: List[int], w: int) -> bool:
"""
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.
... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def will_it_fly(q: List[int], w: int) -> bool:
"""
Write a function that returns True if the object q will fly, and False othe... | def will_it_fly(q: List[int], w: int) -> bool: | HumanEval_72_will_it_fly | py | from typing import List
def will_it_fly(q: List[int], w: int) -> bool:
"""
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.
... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_72_will_it_fly.py | reworded | def check(candidate):
assert candidate([3, 2, 3], 9) == True
assert candidate([1, 2], 5) == False
assert candidate([3], 5) == True
assert candidate([3, 2, 3], 1) == False
assert candidate([1, 2, 3], 6) == False
assert candidate([5], 5) == True
def test_check():
check(will_it_fly)
test_chec... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
67 | HumanEval_55_fib | def fib(n: int) -> int:
"""Return n-th Fibonacci number.
>>> fib(10)
55
>>> fib(1)
1
>>> fib(8)
21
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def fib(n: int) -> int:
"""Return n-th Fibonacci number.
>>> fib(10)
55
>>> fib(1)
1
>>> fib(8)
21
"""
```
| def fib(n: int) -> int: | HumanEval_55_fib | py | def fib(n: int) -> int:
"""Return n-th Fibonacci number.
>>> fib(10)
55
>>> fib(1)
1
>>> fib(8)
21
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_55_fib.py | reworded | 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():
check(fib)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
68 | HumanEval_153_Strongest_Extension | from typing import List
def Strongest_Extension(class_name: str, extensions: List[str]) -> str:
"""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 nu... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def Strongest_Extension(class_name: str, extensions: List[str]) -> str:
"""You will be given the name of a class (a string) and a ... | def Strongest_Extension(class_name: str, extensions: List[str]) -> str: | HumanEval_153_Strongest_Extension | py | from typing import List
def Strongest_Extension(class_name: str, extensions: List[str]) -> str:
"""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 nu... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_153_Strongest_Extension.py | reworded | def check(candidate):
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']) == '__YESIM... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
69 | HumanEval_119_match_parens | from typing import List
def match_parens(lst: List[str]) -> str:
"""
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 b... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def match_parens(lst: List[str]) -> str:
"""
You are given a list of two strings, both strings consist of open
parentheses... | def match_parens(lst: List[str]) -> str: | HumanEval_119_match_parens | py | from typing import List
def match_parens(lst: List[str]) -> str:
"""
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 b... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_119_match_parens.py | reworded | def check(candidate):
assert candidate(['()(', ')']) == 'Yes'
assert candidate([')', ')']) == 'No'
assert candidate(['(()(())', '())())']) == 'No'
assert candidate([')())', '(()()(']) == 'Yes'
assert candidate(['(())))', '(()())((']) == 'Yes'
assert candidate(['()', '())']) == 'No'
assert ca... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
70 | HumanEval_90_next_smallest | from typing import List, Optional
def next_smallest(lst: List[int]) -> Optional[int]:
"""
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
>>> n... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List, Optional
def next_smallest(lst: List[int]) -> Optional[int]:
"""
You are given a list of integers.
Write a function next_... | def next_smallest(lst: List[int]) -> Optional[int]: | HumanEval_90_next_smallest | py | from typing import List, Optional
def next_smallest(lst: List[int]) -> Optional[int]:
"""
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
>>> n... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_90_next_smallest.py | reworded | def check(candidate):
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, 1]) == None
assert candidate([-35, 34, 12, -45]) == -35
def test_chec... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
71 | HumanEval_92_any_int | def any_int(x: float, y: float, z: float) -> bool:
"""
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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def any_int(x: float, y: float, z: float) -> bool:
"""
Create a function that takes 3 numbers.
Returns true if one of the numbers is equal to the s... | def any_int(x: float, y: float, z: float) -> bool: | HumanEval_92_any_int | py | def any_int(x: float, y: float, z: float) -> bool:
"""
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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_92_any_int.py | reworded | def check(candidate):
assert candidate(2, 3, 1) == True
assert candidate(2.5, 2, 3) == False
assert candidate(1.5, 5, 3.5) == False
assert candidate(2, 6, 2) == False
assert candidate(4, 2, 2) == True
assert candidate(2.2, 2.2, 2.2) == False
assert candidate(-4, 6, 2) == True
assert cand... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
72 | HumanEval_2_truncate_number | 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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer sm... | def truncate_number(number: float) -> float: | HumanEval_2_truncate_number | py | 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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_2_truncate_number.py | reworded | def check(candidate):
assert candidate(3.5) == 0.5
assert candidate(1.25) == 0.25
assert candidate(123.0) == 0.0
def test_check():
check(truncate_number)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
73 | HumanEval_42_incr_list | from typing import List
def incr_list(l: List[int]) -> List[int]:
"""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]
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def incr_list(l: List[int]) -> List[int]:
"""Return list with elements incremented by 1.
>>> incr_list([1, 2, 3])
[2, 3, 4... | def incr_list(l: List[int]) -> List[int]: | HumanEval_42_incr_list | py | from typing import List
def incr_list(l: List[int]) -> List[int]:
"""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]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_42_incr_list.py | reworded | 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():
check(incr_list)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
74 | HumanEval_150_x_or_y | def x_or_y(n: int, x: int, y: int) -> int:
"""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:
>>> x_or_y(7, 34, 12)
34
>>> x_or_y(15, 8, 5)
5
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def x_or_y(n: int, x: int, y: int) -> int:
"""A simple program which should return the value of x if n is
a prime number and should return the value o... | def x_or_y(n: int, x: int, y: int) -> int: | HumanEval_150_x_or_y | py | def x_or_y(n: int, x: int, y: int) -> int:
"""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:
>>> x_or_y(7, 34, 12)
34
>>> x_or_y(15, 8, 5)
5
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_150_x_or_y.py | reworded | def check(candidate):
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 candida... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
75 | HumanEval_49_modp | def modp(n: int, p: int) -> 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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def modp(n: int, p: int) -> int:
"""Return 2^n modulo p (be aware of numerics).
>>> modp(3, 5)
3
>>> modp(1101, 101)
2
>>> modp(0, 101)... | def modp(n: int, p: int) -> int: | HumanEval_49_modp | py | def modp(n: int, p: int) -> 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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_49_modp.py | reworded | 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():
check(modp)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
76 | HumanEval_155_even_odd_count | from typing import Tuple
def even_odd_count(num: int) -> Tuple[int, int]:
"""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)
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import Tuple
def even_odd_count(num: int) -> Tuple[int, int]:
"""Given an integer. return a tuple that has the number of even and odd digits r... | def even_odd_count(num: int) -> Tuple[int, int]: | HumanEval_155_even_odd_count | py | from typing import Tuple
def even_odd_count(num: int) -> Tuple[int, int]:
"""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)
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_155_even_odd_count.py | reworded | def check(candidate):
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)
def... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
77 | HumanEval_80_is_happy | def is_happy(s: str) -> bool:
"""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'... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_happy(s: str) -> bool:
"""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 ... | def is_happy(s: str) -> bool: | HumanEval_80_is_happy | py | def is_happy(s: str) -> bool:
"""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'... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_80_is_happy.py | reworded | def check(candidate):
assert candidate('a') == False
assert candidate('aa') == False
assert candidate('abcd') == True
assert candidate('aabb') == False
assert candidate('adb') == True
assert candidate('xyy') == False
assert candidate('iopaxpoi') == True
assert candidate('iopaxioi') == Fa... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
78 | HumanEval_59_largest_prime_factor | def largest_prime_factor(n: int) -> 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
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def largest_prime_factor(n: int) -> int:
"""Return the largest prime factor of n. Assume n > 1 and is not a prime.
>>> largest_prime_factor(13195)
... | def largest_prime_factor(n: int) -> int: | HumanEval_59_largest_prime_factor | py | def largest_prime_factor(n: int) -> 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
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_59_largest_prime_factor.py | reworded | 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():
check(largest_prime_factor)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
79 | HumanEval_66_digitSum | def digitSum(s: str) -> int:
"""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('wo... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def digitSum(s: str) -> int:
"""Task
Write a function that takes a string as input and returns the sum of the upper characters only'
ASCII codes.
... | def digitSum(s: str) -> int: | HumanEval_66_digitSum | py | def digitSum(s: str) -> int:
"""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('wo... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_66_digitSum.py | reworded | def check(candidate):
assert candidate('') == 0
assert candidate('abAB') == 131
assert candidate('abcCd') == 67
assert candidate('helloE') == 69
assert candidate('woArBld') == 131
assert candidate('aAaaaXa') == 153
assert candidate(' How are yOu?') == 151
assert candidate('You arE Very S... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
80 | HumanEval_21_rescale_to_unit | 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... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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 tra... | def rescale_to_unit(numbers: List[float]) -> List[float]: | HumanEval_21_rescale_to_unit | py | 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... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_21_rescale_to_unit.py | reworded | 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... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
81 | HumanEval_121_solution | from typing import List
def solution(lst: List[int]) -> int:
"""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
""... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def solution(lst: List[int]) -> int:
"""Given a non-empty list of integers, return the sum of all of the odd elements that are in ... | def solution(lst: List[int]) -> int: | HumanEval_121_solution | py | from typing import List
def solution(lst: List[int]) -> int:
"""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
""... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_121_solution.py | reworded | def check(candidate):
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
def test_ch... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
82 | HumanEval_68_pluck | from typing import List
def pluck(arr: List[int]) -> List[int]:
"""
"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 ... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def pluck(arr: List[int]) -> List[int]:
"""
"Given an array representing a branch of a tree that has non-negative integer node... | def pluck(arr: List[int]) -> List[int]: | HumanEval_68_pluck | py | from typing import List
def pluck(arr: List[int]) -> List[int]:
"""
"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 ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_68_pluck.py | reworded | def check(candidate):
assert candidate([4, 2, 3]) == [2, 1]
assert candidate([1, 2, 3]) == [2, 1]
assert candidate([]) == []
assert candidate([5, 0, 3, 0, 4, 2]) == [0, 1]
assert candidate([1, 2, 3, 0, 5, 3]) == [0, 3]
assert candidate([5, 4, 8, 4, 8]) == [4, 1]
assert candidate([7, 6, 7, 1]... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
83 | HumanEval_147_get_max_triples | def get_max_triples(n: int) -> int:
"""
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 multipl... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def get_max_triples(n: int) -> int:
"""
You are given a positive integer n. You have to create an integer array a of length n.
For each i (1 ≤ ... | def get_max_triples(n: int) -> int: | HumanEval_147_get_max_triples | py | def get_max_triples(n: int) -> int:
"""
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 multipl... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_147_get_max_triples.py | reworded | def check(candidate):
assert candidate(5) == 1
assert candidate(6) == 4
assert candidate(10) == 36
assert candidate(100) == 53361
def test_check():
check(get_max_triples)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
84 | HumanEval_110_exchange | from typing import List
def exchange(lst1: List[int], lst2: List[int]) -> str:
"""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 l... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def exchange(lst1: List[int], lst2: List[int]) -> str:
"""In this problem, you will implement a function that takes two lists of n... | def exchange(lst1: List[int], lst2: List[int]) -> str: | HumanEval_110_exchange | py | from typing import List
def exchange(lst1: List[int], lst2: List[int]) -> str:
"""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 l... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_110_exchange.py | reworded | def check(candidate):
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([... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
85 | HumanEval_47_median | from typing import List
def median(l: List[int]) -> float:
"""Return median of elements in the list l.
>>> median([3, 1, 2, 4, 5])
3
>>> median([-10, 4, 6, 1000, 10, 20])
15.0
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def median(l: List[int]) -> float:
"""Return median of elements in the list l.
>>> median([3, 1, 2, 4, 5])
3
>>> media... | def median(l: List[int]) -> float: | HumanEval_47_median | py | from typing import List
def median(l: List[int]) -> float:
"""Return median of elements in the list l.
>>> median([3, 1, 2, 4, 5])
3
>>> median([-10, 4, 6, 1000, 10, 20])
15.0
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_47_median.py | reworded | 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():
check(median)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
86 | HumanEval_82_prime_length | def prime_length(string: str) -> bool:
"""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('or... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def prime_length(string: str) -> bool:
"""Write a function that takes a string and returns True if the string
length is a prime number or False otherwi... | def prime_length(string: str) -> bool: | HumanEval_82_prime_length | py | def prime_length(string: str) -> bool:
"""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('or... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_82_prime_length.py | reworded | def check(candidate):
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') ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
87 | HumanEval_73_smallest_change | from typing import List
def smallest_change(arr: List[int]) -> int:
"""
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 ... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def smallest_change(arr: List[int]) -> int:
"""
Given an array arr of integers, find the minimum number of elements that
n... | def smallest_change(arr: List[int]) -> int: | HumanEval_73_smallest_change | py | from typing import List
def smallest_change(arr: List[int]) -> int:
"""
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 ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_73_smallest_change.py | reworded | def check(candidate):
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
assert candidate([1, 2, 3, 2, 1]) == 0
assert candidate([3, 1, 1, 3]) == 0
assert candidate([1]) == 0
as... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
88 | HumanEval_133_sum_squares | from typing import List
def sum_squares(lst: List[float]) -> int:
"""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:
>>> lst([1.0, 2.0, 3.0])
14
>>> lst([1.0, 4.0, 9.0... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def sum_squares(lst: List[float]) -> int:
"""You are given a list of numbers.
You need to return the sum of squared numbers in... | def sum_squares(lst: List[float]) -> int: | HumanEval_133_sum_squares | py | from typing import List
def sum_squares(lst: List[float]) -> int:
"""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:
>>> lst([1.0, 2.0, 3.0])
14
>>> lst([1.0, 4.0, 9.0... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_133_sum_squares.py | reworded | def check(candidate):
assert candidate([1.0, 2.0, 3.0]) == 14
assert candidate([1.0, 2.0, 3.0]) == 14
assert candidate([1.0, 3.0, 5.0, 7.0]) == 84
assert candidate([1.4, 4.2, 0.0]) == 29
assert candidate([-2.4, 1.0, 1.0]) == 6
assert candidate([100.0, 1.0, 15.0, 2.0]) == 10230
assert candida... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
89 | HumanEval_141_file_name_check | def file_name_check(file_name: str) -> str:
"""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 shoul... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def file_name_check(file_name: str) -> str:
"""Create a function which takes a string representing a file's name, and returns
'Yes' if the the file's n... | def file_name_check(file_name: str) -> str: | HumanEval_141_file_name_check | py | def file_name_check(file_name: str) -> str:
"""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 shoul... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_141_file_name_check.py | reworded | def check(candidate):
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') ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
90 | HumanEval_40_triples_sum_to_zero | from typing import List
def triples_sum_to_zero(l: List[int]) -> bool:
"""
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
>>> tripl... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def triples_sum_to_zero(l: List[int]) -> bool:
"""
triples_sum_to_zero takes a list of integers as an input.
it returns Tr... | def triples_sum_to_zero(l: List[int]) -> bool: | HumanEval_40_triples_sum_to_zero | py | from typing import List
def triples_sum_to_zero(l: List[int]) -> bool:
"""
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
>>> tripl... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_40_triples_sum_to_zero.py | reworded | 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]) =... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
91 | HumanEval_127_intersection | from typing import Tuple
def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str:
"""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)
i... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import Tuple
def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str:
"""You are given two intervals,
where each i... | def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str: | HumanEval_127_intersection | py | from typing import Tuple
def intersection(interval1: Tuple[int, int], interval2: Tuple[int, int]) -> str:
"""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)
i... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_127_intersection.py | reworded | def check(candidate):
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'
assert candidate((-11, 2), (-1, -1)) == 'NO'
assert candidate((1, 2), (3, 5)) == 'NO'
assert candi... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
92 | HumanEval_1_separate_paren_groups | 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 ... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```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 ne... | def separate_paren_groups(paren_string: str) -> List[str]: | HumanEval_1_separate_paren_groups | py | 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 ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_1_separate_paren_groups.py | reworded | def check(candidate):
assert candidate('(()()) ((())) () ((())()())') == ['(()())', '((()))', '()', '((())()())']
assert candidate('() (()) ((())) (((())))') == ['()', '(())', '((()))', '(((())))']
assert candidate('(()(())((())))') == ['(()(())((())))']
assert candidate('( ) (( )) (( )( ))') == ['()', ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
93 | HumanEval_152_compare | from typing import List
def compare(game: List[int], guess: List[int]) -> List[int]:
"""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 det... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def compare(game: List[int], guess: List[int]) -> List[int]:
"""I think we all remember that feeling when the result of some long-... | def compare(game: List[int], guess: List[int]) -> List[int]: | HumanEval_152_compare | py | from typing import List
def compare(game: List[int], guess: List[int]) -> List[int]:
"""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 det... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_152_compare.py | reworded | def check(candidate):
assert candidate([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2]) == [0, 0, 0, 0, 3, 3]
assert candidate([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]) == [0, 0, 0, 0, 0, 0]
assert candidate([1, 2, 3], [-1, -2, -3]) == [2, 4, 6]
assert candidate([1, 2, 3, 5], [-1, 2, 3, 4]) == [2, 0, 0, 1]
def t... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
94 | HumanEval_83_starts_one_ends | def starts_one_ends(n: int) -> int:
"""
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1.
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def starts_one_ends(n: int) -> int:
"""
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end ... | def starts_one_ends(n: int) -> int: | HumanEval_83_starts_one_ends | py | def starts_one_ends(n: int) -> int:
"""
Given a positive integer n, return the count of the numbers of n-digit
positive integers that start or end with 1.
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_83_starts_one_ends.py | reworded | def check(candidate):
assert candidate(1) == 1
assert candidate(2) == 18
assert candidate(3) == 180
assert candidate(4) == 1800
assert candidate(5) == 18000
def test_check():
check(starts_one_ends)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
95 | HumanEval_134_check_if_last_char_is_a_letter | def check_if_last_char_is_a_letter(txt: str) -> bool:
"""
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_... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def check_if_last_char_is_a_letter(txt: str) -> bool:
"""
Create a function that returns True if the last character
of a given string is an alphabe... | def check_if_last_char_is_a_letter(txt: str) -> bool: | HumanEval_134_check_if_last_char_is_a_letter | py | def check_if_last_char_is_a_letter(txt: str) -> bool:
"""
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_... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_134_check_if_last_char_is_a_letter.py | reworded | def check(candidate):
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 candi... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
96 | HumanEval_124_valid_date | def valid_date(date: str) -> bool:
"""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 hi... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def valid_date(date: str) -> bool:
"""You have to write a function which validates a given date string and
returns True if the date is valid otherwise ... | def valid_date(date: str) -> bool: | HumanEval_124_valid_date | py | def valid_date(date: str) -> bool:
"""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 hi... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_124_valid_date.py | reworded | def check(candidate):
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
... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
97 | HumanEval_108_count_nums | from typing import List
def count_nums(arr: List[int]) -> int:
"""
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,... | You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def count_nums(arr: List[int]) -> int:
"""
Write a function count_nums which takes an array of integers and returns
the nu... | def count_nums(arr: List[int]) -> int: | HumanEval_108_count_nums | py | from typing import List
def count_nums(arr: List[int]) -> int:
"""
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,... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_108_count_nums.py | reworded | def check(candidate):
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, ... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
98 | HumanEval_86_anti_shuffle | def anti_shuffle(s: str) -> str:
"""
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 are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def anti_shuffle(s: str) -> str:
"""
Write a function that takes a string and returns an ordered version of it.
Ordered version of string, is a str... | def anti_shuffle(s: str) -> str: | HumanEval_86_anti_shuffle | py | def anti_shuffle(s: str) -> str:
"""
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: ... | transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_86_anti_shuffle.py | reworded | def check(candidate):
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.... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
99 | HumanEval_48_is_palindrome | def is_palindrome(text: str) -> bool:
"""
Checks if given string is a palindrome
>>> is_palindrome('')
True
>>> is_palindrome('aba')
True
>>> is_palindrome('aaaaa')
True
>>> is_palindrome('zbcd')
False
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_palindrome(text: str) -> bool:
"""
Checks if given string is a palindrome
>>> is_palindrome('')
True
>>> is_palindrome('aba')
Tr... | def is_palindrome(text: str) -> bool: | HumanEval_48_is_palindrome | py | def is_palindrome(text: str) -> bool:
"""
Checks if given string is a palindrome
>>> is_palindrome('')
True
>>> is_palindrome('aba')
True
>>> is_palindrome('aaaaa')
True
>>> is_palindrome('zbcd')
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_48_is_palindrome.py | reworded | 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():
check(is_palin... | [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.