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
sequencelengths 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')
'lm'
>>> encrypt('asdfghjkl')
'ewhjklnop'
>>> encrypt('gf')
'kj'
>>> encrypt('et')
'ix'
"""
| 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 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')
'lm'
>>> encrypt('asdfghjkl')
'ewhjklnop'
>>> encrypt('gf')
'kj'
>>> encrypt('et')
'ix'
"""
```
| 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')
'lm'
>>> encrypt('asdfghjkl')
'ewhjklnop'
>>> encrypt('gf')
'kj'
>>> encrypt('et')
'ix'
"""
| 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('dxzdlmnilfuhmilufhlihufnmlimnufhlimnufhfucufh') == 'hbdhpqrmpjylqmpyjlpmlyjrqpmqryjlpmqryjljygyjl'
assert candidate('a') == 'e'
def test_check():
check(encrypt)
test_check()
| [
"\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_dict_case({ 'a': 'apple', 'b': 'banana' })
True
>>> check_dict_case({ 'a': 'apple', 'A': 'banana', 'B': 'banana' })
False
>>> check_dict_case({ 'a': 'apple', 8: 'banana', 'a': 'apple' })
False
>>> check_dict_case({ 'Name': 'John', 'Age': '36', 'City': 'Houston' })
False
>>> check_dict_case({ 'STATE': 'NC', 'ZIP': '12345' })
True
"""
| 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
case or all keys are strings in upper case, else return False.
The function should return False is the given dictionary is empty.
Examples:
>>> check_dict_case({ 'a': 'apple', 'b': 'banana' })
True
>>> check_dict_case({ 'a': 'apple', 'A': 'banana', 'B': 'banana' })
False
>>> check_dict_case({ 'a': 'apple', 8: 'banana', 'a': 'apple' })
False
>>> check_dict_case({ 'Name': 'John', 'Age': '36', 'City': 'Houston' })
False
>>> check_dict_case({ 'STATE': 'NC', 'ZIP': '12345' })
True
"""
```
| 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_dict_case({ 'a': 'apple', 'b': 'banana' })
True
>>> check_dict_case({ 'a': 'apple', 'A': 'banana', 'B': 'banana' })
False
>>> check_dict_case({ 'a': 'apple', 8: 'banana', 'a': 'apple' })
False
>>> check_dict_case({ 'Name': 'John', 'Age': '36', 'City': 'Houston' })
False
>>> check_dict_case({ 'STATE': 'NC', 'ZIP': '12345' })
True
"""
| 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' }) == False
assert candidate({ 'STATE': 'NC', 'ZIP': '12345' }) == True
assert candidate({ 'fruit': 'Orange', 'taste': 'Sweet' }) == True
assert candidate({ }) == False
def test_check():
check(check_dict_case)
test_check()
| [
"\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..
Examples:
>>> add([4, 2, 6, 7])
2
"""
```
| 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'
>>> fix_spaces(' Example 2')
'_Example_2'
>>> fix_spaces(' Example 3')
'_Example-3'
"""
| 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 spaces,
then replace all consecutive spaces with -
>>> fix_spaces(' Example')
'Example'
>>> fix_spaces(' Example 1')
'Example_1'
>>> fix_spaces(' Example 2')
'_Example_2'
>>> fix_spaces(' Example 3')
'_Example-3'
"""
```
| 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'
>>> fix_spaces(' Example 2')
'_Example_2'
>>> fix_spaces(' Example 3')
'_Example-3'
"""
| 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_mple'
def test_check():
check(fix_spaces)
test_check()
| [
"\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 of the fibfib number sequence.
>>> fibfib(1)
0
>>> fibfib(5)
4
>>> fibfib(8)
24
"""
| 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
fibfib(1) == 0
fibfib(2) == 1
fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
Please write a function to efficiently compute the n-th element of the fibfib number sequence.
>>> fibfib(1)
0
>>> fibfib(5)
4
>>> fibfib(8)
24
"""
```
| 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 of the fibfib number sequence.
>>> fibfib(1)
0
>>> fibfib(5)
4
>>> fibfib(8)
24
"""
| 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([-1, -2, 0])
0
>>> double_the_difference([9, -2])
81
>>> double_the_difference([0])
0
If the input list is empty, return 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 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([-1, -2, 0])
0
>>> double_the_difference([9, -2])
81
>>> double_the_difference([0])
0
If the input list is empty, return 0.
"""
```
| 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([-1, -2, 0])
0
>>> double_the_difference([9, -2])
81
>>> double_the_difference([0])
0
If the input list is empty, return 0.
"""
| 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.0, 1.0, 3.0, 5.0, 7.0, 9.0]) == 165
def test_check():
check(double_the_difference)
test_check()
| [
"\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
>>> filter_integers(['a', 3.14, 5])
[5]
>>> filter_integers([1, 2, 3, 'abc', { }, []])
[1, 2, 3]
"""
```
| 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 same speed. Two cars are said to collide
when a car that's moving left to right hits a car that's moving right to left.
However, the cars are infinitely sturdy and strong; as a result, they continue moving
in their trajectory as if they did not collide.
This function outputs the number of such collisions.
"""
| 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; simultaneously, a different set of n cars
are driving right to left. The two sets of cars start out being very far from
each other. All cars move in the same speed. Two cars are said to collide
when a car that's moving left to right hits a car that's moving right to left.
However, the cars are infinitely sturdy and strong; as a result, they continue moving
in their trajectory as if they did not collide.
This function outputs the number of such collisions.
"""
```
| 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 same speed. Two cars are said to collide
when a car that's moving left to right hits a car that's moving right to left.
However, the cars are infinitely sturdy and strong; as a result, they continue moving
in their trajectory as if they did not collide.
This function outputs the number of such collisions.
"""
| 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:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
>>> parse_music('o o| .| o| o| .| .| .| .| o o')
[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
"""
| 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 ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
>>> parse_music('o o| .| o| o| .| .| .| .| o o')
[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
"""
```
| 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:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
>>> parse_music('o o| .| o| o| .| .| .| .| o o')
[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]
"""
| 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():
check(parse_music)
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 couple of characters 'db' at the beginning and at the end of the string.
The extra characters are there to help with the format.
Examples:
>>> decimal_to_binary(15)
'db1111db'
>>> decimal_to_binary(32)
'db100000db'
"""
| 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 should return a string, with each character representing a binary
number. Each character in the string will be '0' or '1'.
There will be an extra couple of characters 'db' at the beginning and at the end of the string.
The extra characters are there to help with the format.
Examples:
>>> decimal_to_binary(15)
'db1111db'
>>> decimal_to_binary(32)
'db100000db'
"""
```
| 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 couple of characters 'db' at the beginning and at the end of the string.
The extra characters are there to help with the format.
Examples:
>>> decimal_to_binary(15)
'db1111db'
>>> decimal_to_binary(32)
'db100000db'
"""
| 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
>>> all_prefixes('abc')
['a', 'ab', 'abc']
"""
```
| 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 your meals,
the number of carrots left after your meals ]
if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
Example:
>>> eat(5, 6, 10)
[11, 4]
>>> eat(4, 8, 9)
[12, 1]
>>> eat(1, 10, 10)
[11, 0]
>>> eat(2, 11, 5)
[7, 0]
Variables:
@number : integer
the number of carrots that you have eaten.
@need : integer
the number of carrots that you need to eat.
@remaining : integer
the number of remaining carrots thet exist in stock
Constrain:
* 0 <= number <= 1000
* 0 <= need <= 1000
* 0 <= remaining <= 1000
Have fun :)
"""
| 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 number of carrots,
but now you need to eat more carrots to complete the day's meals.
you should return an array of [ total number of eaten carrots after your meals,
the number of carrots left after your meals ]
if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
Example:
>>> eat(5, 6, 10)
[11, 4]
>>> eat(4, 8, 9)
[12, 1]
>>> eat(1, 10, 10)
[11, 0]
>>> eat(2, 11, 5)
[7, 0]
Variables:
@number : integer
the number of carrots that you have eaten.
@need : integer
the number of carrots that you need to eat.
@remaining : integer
the number of remaining carrots thet exist in stock
Constrain:
* 0 <= number <= 1000
* 0 <= need <= 1000
* 0 <= remaining <= 1000
Have fun :)
"""
```
| 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 your meals,
the number of carrots left after your meals ]
if there are not enough remaining carrots, you will eat all remaining carrots, but will still be hungry.
Example:
>>> eat(5, 6, 10)
[11, 4]
>>> eat(4, 8, 9)
[12, 1]
>>> eat(1, 10, 10)
[11, 0]
>>> eat(2, 11, 5)
[7, 0]
Variables:
@number : integer
the number of carrots that you have eaten.
@need : integer
the number of carrots that you need to eat.
@remaining : integer
the number of remaining carrots thet exist in stock
Constrain:
* 0 <= number <= 1000
* 0 <= need <= 1000
* 0 <= remaining <= 1000
Have fun :)
"""
| 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,
and all buckets have the same capacity.
Your task is to use the buckets to empty the wells.
Output the number of times you need to lower the buckets.
Example 1:
>>> max_fill([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)
6
Example 2:
>>> max_fill([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)
5
Example 3:
>>> max_fill([[0, 0, 0], [0, 0, 0]], 5)
0
Constraints:
* all wells have the same length
* 1 <= grid.length <= 10^2
* 1 <= grid[:,1].length <= 10^2
* grid[i][j] -> 0 | 1
* 1 <= capacity <= 10
"""
| 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 a single well,
and each 1 in a row represents a single unit of water.
Each well has a corresponding bucket that can be used to extract water from it,
and all buckets have the same capacity.
Your task is to use the buckets to empty the wells.
Output the number of times you need to lower the buckets.
Example 1:
>>> max_fill([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)
6
Example 2:
>>> max_fill([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)
5
Example 3:
>>> max_fill([[0, 0, 0], [0, 0, 0]], 5)
0
Constraints:
* all wells have the same length
* 1 <= grid.length <= 10^2
* 1 <= grid[:,1].length <= 10^2
* grid[i][j] -> 0 | 1
* 1 <= capacity <= 10
"""
```
| 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,
and all buckets have the same capacity.
Your task is to use the buckets to empty the wells.
Output the number of times you need to lower the buckets.
Example 1:
>>> max_fill([[0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 1]], 1)
6
Example 2:
>>> max_fill([[0, 0, 1, 1], [0, 0, 0, 0], [1, 1, 1, 1], [0, 1, 1, 1]], 2)
5
Example 3:
>>> max_fill([[0, 0, 0], [0, 0, 0]], 5)
0
Constraints:
* all wells have the same length
* 1 <= grid.length <= 10^2
* 1 <= grid[:,1].length <= 10^2
* grid[i][j] -> 0 | 1
* 1 <= capacity <= 10
"""
| 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, 1, 1, 1], [1, 1, 1, 1]], 9) == 2
def test_check():
check(max_fill)
test_check()
| [
"\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 of this expression.
The basic algebra operations:
Addition ( + )
Subtraction ( - )
Multiplication ( * )
Floor division ( // )
Exponentiation ( ** )
Example:
operator['+', '*', '-']
array = [2, 3, 4, 5]
result = 2 + 3 * 4 - 5
=> result = 9
Note:
The length of operator list is equal to the length of operand list minus one.
Operand is a list of of non-negative integers.
Operator list has at least one operator, and operand list has at least two operands.
"""
| 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 basic algebra operations, and
the second list is a list of integers. Use the two given lists to build the algebric
expression and return the evaluation of this expression.
The basic algebra operations:
Addition ( + )
Subtraction ( - )
Multiplication ( * )
Floor division ( // )
Exponentiation ( ** )
Example:
operator['+', '*', '-']
array = [2, 3, 4, 5]
result = 2 + 3 * 4 - 5
=> result = 9
Note:
The length of operator list is equal to the length of operand list minus one.
Operand is a list of of non-negative integers.
Operator list has at least one operator, and operand list has at least two operands.
"""
```
| 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 of this expression.
The basic algebra operations:
Addition ( + )
Subtraction ( - )
Multiplication ( * )
Floor division ( // )
Exponentiation ( ** )
Example:
operator['+', '*', '-']
array = [2, 3, 4, 5]
result = 2 + 3 * 4 - 5
=> result = 9
Note:
The length of operator list is equal to the length of operand list minus one.
Operand is a list of of non-negative integers.
Operator list has at least one operator, and operand list has at least two operands.
"""
| 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')
'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", "Nine".
For example:
>>> by_length([2, 1, 1, 4, 5, 8, 2, 3])
['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']
If the array is empty, return an empty array:
>>> by_length([])
[]
If the array has any strange number ignore it:
>>> by_length([1, -1, 55])
['One']
"""
| 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 inclusive,
reverse the resulting array, and then replace each digit by its corresponding name from
"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine".
For example:
>>> by_length([2, 1, 1, 4, 5, 8, 2, 3])
['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']
If the array is empty, return an empty array:
>>> by_length([])
[]
If the array has any strange number ignore it:
>>> by_length([1, -1, 55])
['One']
"""
```
| 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", "Nine".
For example:
>>> by_length([2, 1, 1, 4, 5, 8, 2, 3])
['Eight', 'Five', 'Four', 'Three', 'Two', 'Two', 'One', 'One']
If the array is empty, return an empty array:
>>> by_length([])
[]
If the array has any strange number ignore it:
>>> by_length([1, -1, 55])
['One']
"""
| 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', 'Eight', 'Four']
def test_check():
check(by_length)
test_check()
| [
"\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 of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| 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.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
```
| 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 of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| 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 candidate(18) == [2, 3, 3]
def test_check():
check(factorize)
test_check()
| [
"\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_up_to(0)
[]
>>> count_up_to(20)
[2, 3, 5, 7, 11, 13, 17, 19]
>>> count_up_to(1)
[]
>>> count_up_to(18)
[2, 3, 5, 7, 11, 13, 17]
"""
| 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 n
integers that are prime numbers and less than n.
for example:
>>> count_up_to(5)
[2, 3]
>>> count_up_to(11)
[2, 3, 5, 7]
>>> count_up_to(0)
[]
>>> count_up_to(20)
[2, 3, 5, 7, 11, 13, 17, 19]
>>> count_up_to(1)
[]
>>> count_up_to(18)
[2, 3, 5, 7, 11, 13, 17]
"""
```
| 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_up_to(0)
[]
>>> count_up_to(20)
[2, 3, 5, 7, 11, 13, 17, 19]
>>> count_up_to(1)
[]
>>> count_up_to(18)
[2, 3, 5, 7, 11, 13, 17]
"""
| 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, 3, 5, 7, 11, 13, 17]
assert candidate(47) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43]
assert candidate(101) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
def test_check():
check(count_up_to)
test_check()
| [
"\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])
[0, 2, 3, 5, 9, 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, return the first list.
Examples
>>> total_match([], [])
[]
>>> total_match(['hi', 'admin'], ['hI', 'Hi'])
['hI', 'Hi']
>>> total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project'])
['hi', 'admin']
>>> total_match(['hi', 'admin'], ['hI', 'hi', 'hi'])
['hI', 'hi', 'hi']
>>> total_match(['4'], ['1', '2', '3', '4', '5'])
['4']
"""
| 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 returns the list that has
total number of chars in the all strings of the list less than the other list.
if the two lists have the same number of chars, return the first list.
Examples
>>> total_match([], [])
[]
>>> total_match(['hi', 'admin'], ['hI', 'Hi'])
['hI', 'Hi']
>>> total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project'])
['hi', 'admin']
>>> total_match(['hi', 'admin'], ['hI', 'hi', 'hi'])
['hI', 'hi', 'hi']
>>> total_match(['4'], ['1', '2', '3', '4', '5'])
['4']
"""
```
| 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, return the first list.
Examples
>>> total_match([], [])
[]
>>> total_match(['hi', 'admin'], ['hI', 'Hi'])
['hI', 'Hi']
>>> total_match(['hi', 'admin'], ['hi', 'hi', 'admin', 'project'])
['hi', 'admin']
>>> total_match(['hi', 'admin'], ['hI', 'hi', 'hi'])
['hI', 'hi', 'hi']
>>> total_match(['4'], ['1', '2', '3', '4', '5'])
['4']
"""
| 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'], ['hI', 'Hi']) == ['hI', 'Hi']
assert candidate(['hi', 'admin'], ['hI', 'hi', 'hi']) == ['hI', 'hi', 'hi']
assert candidate(['hi', 'admin'], ['hI', 'hi', 'hii']) == ['hi', 'admin']
assert candidate([], ['this']) == []
assert candidate(['this'], []) == []
def test_check():
check(total_match)
test_check()
| [
"\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_element([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
123
"""
```
| 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('[[]]')
True
>>> is_nested('[]]]]]]][[[[[]')
False
>>> is_nested('[][]')
False
>>> is_nested('[]')
False
>>> is_nested('[[][]]')
True
>>> is_nested('[[]][[')
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_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('[[]]')
True
>>> is_nested('[]]]]]]][[[[[]')
False
>>> is_nested('[][]')
False
>>> is_nested('[]')
False
>>> is_nested('[[][]]')
True
>>> is_nested('[[]][[')
True
"""
```
| 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('[[]]')
True
>>> is_nested('[]]]]]]][[[[[]')
False
>>> is_nested('[][]')
False
>>> is_nested('[]')
False
>>> is_nested('[[][]]')
True
>>> is_nested('[[]][[')
True
"""
| 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 candidate('[[]') == False
assert candidate('[]]') == False
assert candidate('[[]][[') == True
assert candidate('[[][]]') == True
assert candidate('') == False
assert candidate('[[[[[[[[') == False
assert candidate(']]]]]]]]') == False
def test_check():
check(is_nested)
test_check()
| [
"\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 than m, return -1.
Example:
>>> rounded_avg(1, 5)
'0b11'
>>> rounded_avg(7, 5)
-1
>>> rounded_avg(10, 20)
'0b1111'
>>> rounded_avg(20, 33)
'0b11010'
"""
| 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 the
average of the integers from n through m (including n and m).
Round the answer to the nearest integer and convert that to binary.
If n is greater than m, return -1.
Example:
>>> rounded_avg(1, 5)
'0b11'
>>> rounded_avg(7, 5)
-1
>>> rounded_avg(10, 20)
'0b1111'
>>> rounded_avg(20, 33)
'0b11010'
"""
```
| 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 than m, return -1.
Example:
>>> rounded_avg(1, 5)
'0b11'
>>> rounded_avg(7, 5)
-1
>>> rounded_avg(10, 20)
'0b1111'
>>> rounded_avg(20, 33)
'0b11010'
"""
| 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, 496) == '0b110101101'
assert candidate(350, 902) == '0b1001110010'
assert candidate(197, 233) == '0b11010111'
assert candidate(7, 5) == -1
assert candidate(5, 1) == -1
assert candidate(5, 5) == '0b101'
def test_check():
check(rounded_avg)
test_check()
| [
"\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
of odd digits in the i'th string of the input.
>>> odd_count(['1234567'])
['the number of odd elements 4n the str4ng 4 of the 4nput.']
>>> odd_count(['3', '11111111'])
['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 8n the str8ng 8 of the 8nput.']
"""
| 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.
Each element i of the output should be "the number of odd elements in the
string i of the input." where all the i's should be replaced by the number
of odd digits in the i'th string of the input.
>>> odd_count(['1234567'])
['the number of odd elements 4n the str4ng 4 of the 4nput.']
>>> odd_count(['3', '11111111'])
['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 8n the str8ng 8 of the 8nput.']
"""
```
| 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
of odd digits in the i'th string of the input.
>>> odd_count(['1234567'])
['the number of odd elements 4n the str4ng 4 of the 4nput.']
>>> odd_count(['3', '11111111'])
['the number of odd elements 1n the str1ng 1 of the 1nput.', 'the number of odd elements 8n the str8ng 8 of the 8nput.']
"""
| 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', '314']) == ['the number of odd elements 2n the str2ng 2 of the 2nput.', 'the number of odd elements 3n the str3ng 3 of the 3nput.', 'the number of odd elements 2n the str2ng 2 of the 2nput.']
def test_check():
check(odd_count)
test_check()
| [
"\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 following operation on the given array:
You are allowed to perform right shift operation any number of times.
One right shift operation means shifting all elements of the array by one
position in the right direction. The last element of the array will be moved to
the starting position in the array i.e. 0th index.
If it is possible to obtain the sorted array by performing the above operation
then return True else return False.
If the given array is empty then return True.
Note: The given list is guaranteed to have unique elements.
For Example:
>>> move_one_ball([3, 4, 5, 1, 2])
True
Explanation: By performin 2 right shift operations, non-decreasing order can
be achieved for the given array.
>>> move_one_ball([3, 5, 4, 1, 2])
False
Explanation:It is not possible to get non-decreasing order for the given
array by performing any number of right shift operations.
"""
| 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 the array will be randomly ordered. Your task is to determine if
it is possible to get an array sorted in non-decreasing order by performing
the following operation on the given array:
You are allowed to perform right shift operation any number of times.
One right shift operation means shifting all elements of the array by one
position in the right direction. The last element of the array will be moved to
the starting position in the array i.e. 0th index.
If it is possible to obtain the sorted array by performing the above operation
then return True else return False.
If the given array is empty then return True.
Note: The given list is guaranteed to have unique elements.
For Example:
>>> move_one_ball([3, 4, 5, 1, 2])
True
Explanation: By performin 2 right shift operations, non-decreasing order can
be achieved for the given array.
>>> move_one_ball([3, 5, 4, 1, 2])
False
Explanation:It is not possible to get non-decreasing order for the given
array by performing any number of right shift operations.
"""
```
| 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 following operation on the given array:
You are allowed to perform right shift operation any number of times.
One right shift operation means shifting all elements of the array by one
position in the right direction. The last element of the array will be moved to
the starting position in the array i.e. 0th index.
If it is possible to obtain the sorted array by performing the above operation
then return True else return False.
If the given array is empty then return True.
Note: The given list is guaranteed to have unique elements.
For Example:
>>> move_one_ball([3, 4, 5, 1, 2])
True
Explanation: By performin 2 right shift operations, non-decreasing order can
be achieved for the given array.
>>> move_one_ball([3, 5, 4, 1, 2])
False
Explanation:It is not possible to get non-decreasing order for the given
array by performing any number of right shift operations.
"""
| 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:
Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
Example 2:
>>> even_odd_palindrome(12)
(4, 6)
Explanation:
Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
Note:
1. 1 <= n <= 10^3
2. returned tuple has the number of even and odd integer palindromes respectively.
"""
| 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 even and odd
integer palindromes that fall within the range(1, n), inclusive.
Example 1:
>>> even_odd_palindrome(3)
(1, 2)
Explanation:
Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
Example 2:
>>> even_odd_palindrome(12)
(4, 6)
Explanation:
Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
Note:
1. 1 <= n <= 10^3
2. returned tuple has the number of even and odd integer palindromes respectively.
"""
```
| def 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:
Integer palindrome are 1, 2, 3. one of them is even, and two of them are odd.
Example 2:
>>> even_odd_palindrome(12)
(4, 6)
Explanation:
Integer palindrome are 1, 2, 3, 4, 5, 6, 7, 8, 9, 11. four of them are even, and 6 of them are odd.
Note:
1. 1 <= n <= 10^3
2. returned tuple has the number of even and odd integer palindromes respectively.
"""
| 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():
check(even_odd_palindrome)
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
>>> is_equal_to_sum_even(4)
False
>>> is_equal_to_sum_even(6)
False
>>> is_equal_to_sum_even(8)
True
"""
```
| 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_equal_to_sum_even)
test_check()
| [
"\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 + ....
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]
"""
```
| 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])
True
>>> is_sorted([1, 2, 3, 4, 5])
True
>>> is_sorted([1, 3, 2, 4, 5])
False
>>> is_sorted([1, 2, 3, 4, 5, 6])
True
>>> is_sorted([1, 2, 3, 4, 5, 6, 7])
True
>>> is_sorted([1, 3, 2, 4, 5, 6, 7])
False
>>> is_sorted([1, 2, 2, 3, 3, 4])
True
>>> is_sorted([1, 2, 2, 2, 3, 4])
False
"""
| 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 order. If list has more than 1 duplicate of the same
number, return False. Assume no negative numbers and only integers.
Examples
>>> is_sorted([5])
True
>>> is_sorted([1, 2, 3, 4, 5])
True
>>> is_sorted([1, 3, 2, 4, 5])
False
>>> is_sorted([1, 2, 3, 4, 5, 6])
True
>>> is_sorted([1, 2, 3, 4, 5, 6, 7])
True
>>> is_sorted([1, 3, 2, 4, 5, 6, 7])
False
>>> is_sorted([1, 2, 2, 3, 3, 4])
True
>>> is_sorted([1, 2, 2, 2, 3, 4])
False
"""
```
| 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])
True
>>> is_sorted([1, 2, 3, 4, 5])
True
>>> is_sorted([1, 3, 2, 4, 5])
False
>>> is_sorted([1, 2, 3, 4, 5, 6])
True
>>> is_sorted([1, 2, 3, 4, 5, 6, 7])
True
>>> is_sorted([1, 3, 2, 4, 5, 6, 7])
False
>>> is_sorted([1, 2, 2, 3, 3, 4])
True
>>> is_sorted([1, 2, 2, 2, 3, 4])
False
"""
| 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 candidate([]) == True
assert candidate([1]) == True
assert candidate([3, 2, 1]) == False
assert candidate([1, 2, 2, 2, 3, 4]) == False
assert candidate([1, 2, 3, 3, 3, 4]) == False
assert candidate([1, 2, 2, 3, 3, 4]) == True
assert candidate([1, 2, 3, 4]) == True
def test_check():
check(is_sorted)
test_check()
| [
"\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')
'4321'
>>> solve('ab')
'AB'
>>> solve('#a@C')
'#A@c'
"""
| 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 as it is.
If the string contains no letters, reverse the string.
The function should return the resulted string.
Examples
>>> solve('1234')
'4321'
>>> solve('ab')
'AB'
>>> solve('#a@C')
'#A@c'
"""
```
| 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')
'4321'
>>> solve('ab')
'AB'
>>> solve('#a@C')
'#A@c'
"""
| 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 candidate('#ccc') == '#CCC'
def test_check():
check(solve)
test_check()
| [
"\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, if n is even.
tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
For example:
tri(2) = 1 + (2 / 2) = 2
tri(4) = 3
tri(3) = tri(2) + tri(1) + tri(4)
= 2 + 3 + 3 = 8
You are given a non-negative integer number n, you have to a return a list of the
first n + 1 numbers of the Tribonacci sequence.
Examples:
>>> tri(3)
[1, 3, 2, 8]
"""
| 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 couple centuries. However, what people don't know is Tribonacci sequence.
Tribonacci sequence is defined by the recurrence:
tri(1) = 3
tri(n) = 1 + n / 2, if n is even.
tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
For example:
tri(2) = 1 + (2 / 2) = 2
tri(4) = 3
tri(3) = tri(2) + tri(1) + tri(4)
= 2 + 3 + 3 = 8
You are given a non-negative integer number n, you have to a return a list of the
first n + 1 numbers of the Tribonacci sequence.
Examples:
>>> tri(3)
[1, 3, 2, 8]
"""
```
| 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, if n is even.
tri(n) = tri(n - 1) + tri(n - 2) + tri(n + 1), if n is odd.
For example:
tri(2) = 1 + (2 / 2) = 2
tri(4) = 3
tri(3) = tri(2) + tri(1) + tri(4)
= 2 + 3 + 3 = 8
You are given a non-negative integer number n, you have to a return a list of the
first n + 1 numbers of the Tribonacci sequence.
Examples:
>>> tri(3)
[1, 3, 2, 8]
"""
| 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]
assert candidate(9) == [1, 3, 2, 8, 3, 15, 4, 24, 5, 35]
assert candidate(20) == [1, 3, 2, 8, 3, 15, 4, 24, 5, 35, 6, 48, 7, 63, 8, 80, 9, 99, 10, 120, 11]
assert candidate(0) == [1]
assert candidate(1) == [1, 3]
def test_check():
check(tri)
test_check()
| [
"\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(50)
0
>>> fizz_buzz(78)
2
>>> fizz_buzz(79)
3
"""
```
| 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)
test_check()
| [
"\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 with a given prefix.
>>> filter_by_prefix([], 'a')
[]
>>> filter_by_prefix(['abc', 'bcd', 'cde', 'array'], 'a')
['abc', 'array']
"""
```
| 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 of binary number
"""
| 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'
>>> solve(150)
'110'
>>> solve(147)
'1100'
Variables:
@N integer
Constraints: 0 ≤ N ≤ 10000.
Output:
a string of binary number
"""
```
| 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 of binary number
"""
| 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 have to find the minimum path of length k in the grid. You can start
from any cell, and in each step you can move to any of the neighbor cells,
in other words, you can go to cells which share an edge with you current
cell.
Please note that a path of length k means visiting exactly k cells (not
necessarily distinct).
You CANNOT go off the grid.
A path A (of length k) is considered less than a path B (of length k) if
after making the ordered lists of the values on the cells that A and B go
through (let's call them lst_A and lst_B), lst_A is lexicographically less
than lst_B, in other words, there exist an integer index i (1 <= i <= k)
such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
lst_A[j] = lst_B[j].
It is guaranteed that the answer is unique.
Return an ordered list of the values on the cells that the minimum path go through.
Examples:
>>> minPath([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3)
[1, 2, 1]
>>> minPath([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 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 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 have to find the minimum path of length k in the grid. You can start
from any cell, and in each step you can move to any of the neighbor cells,
in other words, you can go to cells which share an edge with you current
cell.
Please note that a path of length k means visiting exactly k cells (not
necessarily distinct).
You CANNOT go off the grid.
A path A (of length k) is considered less than a path B (of length k) if
after making the ordered lists of the values on the cells that A and B go
through (let's call them lst_A and lst_B), lst_A is lexicographically less
than lst_B, in other words, there exist an integer index i (1 <= i <= k)
such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
lst_A[j] = lst_B[j].
It is guaranteed that the answer is unique.
Return an ordered list of the values on the cells that the minimum path go through.
Examples:
>>> minPath([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3)
[1, 2, 1]
>>> minPath([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1)
[1]
"""
```
| 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 have to find the minimum path of length k in the grid. You can start
from any cell, and in each step you can move to any of the neighbor cells,
in other words, you can go to cells which share an edge with you current
cell.
Please note that a path of length k means visiting exactly k cells (not
necessarily distinct).
You CANNOT go off the grid.
A path A (of length k) is considered less than a path B (of length k) if
after making the ordered lists of the values on the cells that A and B go
through (let's call them lst_A and lst_B), lst_A is lexicographically less
than lst_B, in other words, there exist an integer index i (1 <= i <= k)
such that lst_A[i] < lst_B[i] and for any j (1 <= j < i) we have
lst_A[j] = lst_B[j].
It is guaranteed that the answer is unique.
Return an ordered list of the values on the cells that the minimum path go through.
Examples:
>>> minPath([[1, 2, 3], [4, 5, 6], [7, 8, 9]], 3)
[1, 2, 1]
>>> minPath([[5, 9, 3], [4, 1, 6], [7, 8, 2]], 1)
[1]
"""
| 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, 16, 11, 15], [8, 14, 9, 2]], 7) == [1, 10, 1, 10, 1, 10, 1]
assert candidate([[8, 14, 9, 2], [6, 4, 13, 15], [5, 7, 1, 12], [3, 10, 11, 16]], 5) == [1, 7, 1, 7, 1]
assert candidate([[11, 8, 7, 2], [5, 16, 14, 4], [9, 3, 15, 6], [12, 13, 10, 1]], 9) == [1, 6, 1, 6, 1, 6, 1, 6, 1]
assert candidate([[12, 13, 10, 1], [9, 3, 15, 6], [5, 16, 14, 4], [11, 8, 7, 2]], 12) == [1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6]
assert candidate([[2, 7, 4], [3, 1, 5], [6, 8, 9]], 8) == [1, 3, 1, 3, 1, 3, 1, 3]
assert candidate([[6, 1, 5], [3, 8, 9], [2, 7, 4]], 8) == [1, 5, 1, 5, 1, 5, 1, 5]
assert candidate([[1, 2], [3, 4]], 10) == [1, 2, 1, 2, 1, 2, 1, 2, 1, 2]
assert candidate([[1, 3], [3, 2]], 10) == [1, 3, 1, 3, 1, 3, 1, 3, 1, 3]
def test_check():
check(minPath)
test_check()
| [
"\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('aBCdEf')
1
>>> count_upper('abcdefg')
0
>>> count_upper('dBBE')
0
"""
```
| 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, -4, 4], 2)
[4, 4]
Example 3:
>>> maximum([-3, 2, 1, 2, -1, -2, 1], 1)
[2]
Note:
1. The length of the array will be in the range of [1, 1000].
2. The elements in the array will be in the range of [-1000, 1000].
3. 0 <= k <= len(arr)
"""
| 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 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, -4, 4], 2)
[4, 4]
Example 3:
>>> maximum([-3, 2, 1, 2, -1, -2, 1], 1)
[2]
Note:
1. The length of the array will be in the range of [1, 1000].
2. The elements in the array will be in the range of [-1000, 1000].
3. 0 <= k <= len(arr)
"""
```
| 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, -4, 4], 2)
[4, 4]
Example 3:
>>> maximum([-3, 2, 1, 2, -1, -2, 1], 1)
[2]
Note:
1. The length of the array will be in the range of [1, 1000].
2. The elements in the array will be in the range of [-1000, 1000].
3. 0 <= k <= len(arr)
"""
| 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]
assert candidate([5, 15, 0, 3, -13, -8, 0], 7) == [-13, -8, 0, 0, 3, 5, 15]
assert candidate([-1, 0, 2, 5, 3, -10], 2) == [3, 5]
assert candidate([1, 0, 5, -7], 1) == [5]
assert candidate([4, -4], 2) == [-4, 4]
assert candidate([-10, 10], 2) == [-10, 10]
assert candidate([1, 2, 3, -23, 243, -400, 0], 0) == []
def test_check():
check(maximum)
test_check()
| [
"\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)
5
"""
```
| 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 the sum( first index value, last index value) is even.
Note:
* don't change the given array.
Examples:
>>> sort_array([])
[]
>>> sort_array([5])
[5]
>>> sort_array([2, 4, 3, 0, 1, 5])
[0, 1, 2, 3, 4, 5]
>>> sort_array([2, 4, 3, 0, 1, 5, 6])
[6, 5, 4, 3, 2, 1, 0]
"""
| 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 after sorting,
you will sort the given array in ascending order if the sum( first index value, last index value) is odd,
or sort it in descending order if the sum( first index value, last index value) is even.
Note:
* don't change the given array.
Examples:
>>> sort_array([])
[]
>>> sort_array([5])
[5]
>>> sort_array([2, 4, 3, 0, 1, 5])
[0, 1, 2, 3, 4, 5]
>>> sort_array([2, 4, 3, 0, 1, 5, 6])
[6, 5, 4, 3, 2, 1, 0]
"""
```
| 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 the sum( first index value, last index value) is even.
Note:
* don't change the given array.
Examples:
>>> sort_array([])
[]
>>> sort_array([5])
[5]
>>> sort_array([2, 4, 3, 0, 1, 5])
[0, 1, 2, 3, 4, 5]
>>> sort_array([2, 4, 3, 0, 1, 5, 6])
[6, 5, 4, 3, 2, 1, 0]
"""
| 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, 42, 87]
assert candidate([21, 14, 23, 11]) == [23, 21, 14, 11]
def test_check():
check(sort_array)
test_check()
| [
"\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 i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
Example:
>>> f(5)
[1, 2, 6, 24, 15]
"""
| 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 the value of the element at index i is the factorial of i if i is even
or the sum of numbers from 1 to i otherwise.
i starts from 1.
the factorial of i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
Example:
>>> f(5)
[1, 2, 6, 24, 15]
"""
```
| 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 i is the multiplication of the numbers from 1 to i (1 * 2 * ... * i).
Example:
>>> f(5)
[1, 2, 6, 24, 15]
"""
| 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)
True
>>> iscube(0)
True
>>> iscube(180)
False
"""
| 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.
Note: you may assume the input is always valid.
Examples:
>>> iscube(1)
True
>>> iscube(2)
False
>>> iscube(-1)
True
>>> iscube(64)
True
>>> iscube(0)
True
>>> iscube(180)
False
"""
```
| 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)
True
>>> iscube(0)
True
>>> iscube(180)
False
"""
| 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(iscube)
test_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.
Examples:
>>> encode('test')
'TGST'
>>> encode('This is a message')
'tHKS KS C MGSSCGG'
"""
| 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 all vowels in
the message with the letter that appears 2 places ahead of that
vowel in the english alphabet.
Assume only letters.
Examples:
>>> encode('test')
'TGST'
>>> encode('This is a message')
'tHKS KS C MGSSCGG'
"""
```
| 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.
Examples:
>>> encode('test')
'TGST'
>>> encode('This is a message')
'tHKS KS C MGSSCGG'
"""
| 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(encode)
test_check()
| [
"\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 blue. The sun is shining. I love this weather')
1
"""
| 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 starts with the word "I".
Sentences are delimited by '.', '?' or '!'.
For example:
>>> is_bored('Hello world')
0
>>> is_bored('The sky is blue. The sun is shining. I love this weather')
1
"""
```
| 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 blue. The sun is shining. I love this weather')
1
"""
| 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') == 0
def test_check():
check(is_bored)
test_check()
| [
"\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_zero([1, 3, -2, 1])
False
>>> pairs_sum_to_zero([1, 2, 3, 7])
False
>>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])
True
>>> pairs_sum_to_zero([1])
False
"""
| 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 if there are two distinct elements in the list that
sum to zero, and False otherwise.
>>> pairs_sum_to_zero([1, 3, 5, 0])
False
>>> pairs_sum_to_zero([1, 3, -2, 1])
False
>>> pairs_sum_to_zero([1, 2, 3, 7])
False
>>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])
True
>>> pairs_sum_to_zero([1])
False
"""
```
| 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_zero([1, 3, -2, 1])
False
>>> pairs_sum_to_zero([1, 2, 3, 7])
False
>>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7])
True
>>> pairs_sum_to_zero([1])
False
"""
| 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, -1, 3, 2, 31]) == True
assert candidate([-3, 9, -1, 4, 2, 30]) == False
assert candidate([-3, 9, -1, 4, 2, 31]) == False
def test_check():
check(pairs_sum_to_zero)
test_check()
| [
"\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 greater
than the third side.
Example:
>>> triangle_area(3, 4, 5)
6.0
>>> triangle_area(1, 2, 10)
-1
"""
| 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 to 2 decimal points if the three sides form a valid triangle.
Otherwise return -1
Three sides make a valid triangle when the sum of any two sides is greater
than the third side.
Example:
>>> triangle_area(3, 4, 5)
6.0
>>> triangle_area(1, 2, 10)
-1
"""
```
| 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 greater
than the third side.
Example:
>>> triangle_area(3, 4, 5)
6.0
>>> triangle_area(1, 2, 10)
-1
"""
| 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.43
assert candidate(2, 2, 10) == -1
def test_check():
check(triangle_area)
test_check()
| [
"\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 planet1 and planet2.
The function should return a tuple containing all planets whose orbits are
located between the orbit of planet1 and the orbit of planet2, sorted by
the proximity to the sun.
The function should return an empty tuple if planet1 or planet2
are not correct planet names.
Examples
>>> bf('Jupiter', 'Neptune')
('Saturn', 'Uranus')
>>> bf('Earth', 'Mercury')
'Venus'
>>> bf('Mercury', 'Uranus')
('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')
"""
| 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 Sun
is Mercury, the next one is Venus, then Earth, Mars, Jupiter, Saturn,
Uranus, Neptune.
Write a function that takes two planet names as strings planet1 and planet2.
The function should return a tuple containing all planets whose orbits are
located between the orbit of planet1 and the orbit of planet2, sorted by
the proximity to the sun.
The function should return an empty tuple if planet1 or planet2
are not correct planet names.
Examples
>>> bf('Jupiter', 'Neptune')
('Saturn', 'Uranus')
>>> bf('Earth', 'Mercury')
'Venus'
>>> bf('Mercury', 'Uranus')
('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')
"""
```
| 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 planet1 and planet2.
The function should return a tuple containing all planets whose orbits are
located between the orbit of planet1 and the orbit of planet2, sorted by
the proximity to the sun.
The function should return an empty tuple if planet1 or planet2
are not correct planet names.
Examples
>>> bf('Jupiter', 'Neptune')
('Saturn', 'Uranus')
>>> bf('Earth', 'Mercury')
'Venus'
>>> bf('Mercury', 'Uranus')
('Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn')
"""
| 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', 'Uranus')
assert candidate('Earth', 'Earth') == ()
assert candidate('Mars', 'Earth') == ()
assert candidate('Jupiter', 'Makemake') == ()
def test_check():
check(bf)
test_check()
| [
"\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:
>>> digits(1)
1
>>> digits(4)
0
>>> digits(235)
15
"""
```
| 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', 'John']
>>> words_string('One, two, three, four, five, six')
['One', 'two', 'three', 'four', 'five', 'six']
"""
| 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
to split the string into words and return an array of the words.
For example:
>>> words_string('Hi, my name is John')
['Hi', 'my', 'name', 'is', 'John']
>>> words_string('One, two, three, four, five, six')
['One', 'two', 'three', 'four', 'five', 'six']
"""
```
| 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', 'John']
>>> words_string('One, two, three, four, five, six')
['One', 'two', 'three', 'four', 'five', 'six']
"""
| 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, five, six,') == ['One', 'two', 'three', 'four', 'five', 'six']
assert candidate('') == []
assert candidate('ahmed , gamal') == ['ahmed', 'gamal']
def test_check():
check(words_string)
test_check()
| [
"\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 cases.
>>> how_many_times('', 'a')
0
>>> how_many_times('aaa', 'a')
3
>>> how_many_times('aaaa', 'aa')
3
"""
```
| 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 are equal.
Note: If a real number is represented as a string, the floating point might be . or ,
>>> compare_one(1, 2.5)
2.5
>>> compare_one(1, '2,3')
'2,3'
>>> compare_one('5,1', '6')
'6'
>>> compare_one('1', 1)
None
"""
| 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 that takes integers, floats, or strings representing
real numbers, and returns the larger variable in its given variable type.
Return None if the values are equal.
Note: If a real number is represented as a string, the floating point might be . or ,
>>> compare_one(1, 2.5)
2.5
>>> compare_one(1, '2,3')
'2,3'
>>> compare_one('5,1', '6')
'6'
>>> compare_one('1', 1)
None
"""
```
| 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 are equal.
Note: If a real number is represented as a string, the floating point might be . or ,
>>> compare_one(1, 2.5)
2.5
>>> compare_one(1, '2,3')
'2,3'
>>> compare_one('5,1', '6')
'6'
>>> compare_one('1', 1)
None
"""
| 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_check():
check(compare_one)
test_check()
| [
"\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')
'zbcd'
"""
| 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('')
''
>>> remove_vowels('abcdef')
'bcdf'
>>> remove_vowels('aaaaa')
''
>>> remove_vowels('aaBAA')
'B'
>>> remove_vowels('zbcd')
'zbcd'
"""
```
| 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')
'zbcd'
"""
| 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():
check(remove_vowels)
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, 3, 4])
[1, 4, 2, 3]
>>> strange_sort_list([5, 5, 5, 5])
[5, 5, 5, 5]
>>> strange_sort_list([])
[]
"""
| 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 sorting, is when you start with the minimum value,
then maximum of the remaining integers, then minimum and so on.
Examples:
>>> strange_sort_list([1, 2, 3, 4])
[1, 4, 2, 3]
>>> strange_sort_list([5, 5, 5, 5])
[5, 5, 5, 5]
>>> strange_sort_list([])
[]
"""
```
| 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, 3, 4])
[1, 4, 2, 3]
>>> strange_sort_list([5, 5, 5, 5])
[5, 5, 5, 5]
>>> strange_sort_list([])
[]
"""
| 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 candidate([]) == []
assert candidate([1, 2, 3, 4, 5, 6, 7, 8]) == [1, 8, 2, 7, 3, 6, 4, 5]
assert candidate([0, 2, 2, 2, 5, 5, -5, -5]) == [-5, 5, -5, 5, 0, 2, 2, 2]
assert candidate([111111]) == [111111]
def test_check():
check(strange_sort_list)
test_check()
| [
"\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.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
| 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 least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
```
| 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.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
| 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, 4.1, 5.1]) == (2.2, 3.1)
def test_check():
check(find_closest_elements)
test_check()
| [
"\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_simple_power(8, 2)
True
>>> is_simple_power(3, 2)
False
>>> is_simple_power(3, 1)
False
>>> is_simple_power(5, 3)
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_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_simple_power(8, 2)
True
>>> is_simple_power(3, 2)
False
>>> is_simple_power(3, 1)
False
>>> is_simple_power(5, 3)
False
"""
```
| 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_simple_power(8, 2)
True
>>> is_simple_power(3, 2)
False
>>> is_simple_power(3, 1)
False
>>> is_simple_power(5, 3)
False
"""
| 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
assert candidate(1, 1) == True
assert candidate(1, 12) == True
def test_check():
check(is_simple_power)
test_check()
| [
"\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
>>> prime_fib(2)
3
>>> prime_fib(3)
5
>>> prime_fib(4)
13
>>> prime_fib(5)
89
"""
```
| 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(10) == 433494437
def test_check():
check(prime_fib)
test_check()
| [
"\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 original list.
For example:
>>> order_by_points([1, 11, -1, -11, -12])
[-1, -11, 1, -12, 11]
>>> order_by_points([])
[]
"""
| 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 ascending order according to the sum of their digits.
Note: if there are several items with similar sum of their digits,
order them based on their index in original list.
For example:
>>> order_by_points([1, 11, -1, -11, -12])
[-1, -11, 1, -12, 11]
>>> order_by_points([])
[]
"""
```
| def 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 original list.
For example:
>>> order_by_points([1, 11, -1, -11, -12])
[-1, -11, 1, -12, 11]
>>> order_by_points([])
[]
"""
| 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, -98, 2, -3]) == [-3, -32, -98, -11, 1, 2, 43, 54]
assert candidate([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]) == [1, 10, 2, 11, 3, 4, 5, 6, 7, 8, 9]
assert candidate([0, 6, 6, -76, -21, 23, 4]) == [-76, -21, 0, 4, 23, 6, 6]
def test_check():
check(order_by_points)
test_check()
| [
"\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.0], 0.3)
True
"""
| 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 closer to each other than
given threshold.
>>> has_close_elements([1.0, 2.0, 3.0], 0.5)
False
>>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3)
True
"""
```
| 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.0], 0.3)
True
"""
| 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, 5.0, 2.0], 0.1) == True
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 1.0) == True
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1], 0.5) == False
def test_check():
check(has_close_elements)
test_check()
| [
"\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 suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
| 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 longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
```
| 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 suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
| 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 result also as a string.
>>> string_xor('010', '110')
'100'
"""
```
| 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 integer.
"""
| 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 > 0
For example:
>>> special_factorial(4)
288
The function will receive an integer as input and should return the special
factorial of this integer.
"""
```
| 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 integer.
"""
| 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
Constraints:
1. 1 <= len(arr) <= 100
2. 1 <= k <= len(arr)
"""
| 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 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
Constraints:
1. 1 <= len(arr) <= 100
2. 1 <= k <= len(arr)
"""
```
| 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
Constraints:
1. 1 <= len(arr) <= 100
2. 1 <= k <= len(arr)
"""
| 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_check():
check(add_elements)
test_check()
| [
"\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-th element of the fib4 number sequence. Do not use recursion.
>>> fib4(5)
4
>>> fib4(6)
8
>>> fib4(7)
14
"""
| 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(1) -> 0
fib4(2) -> 2
fib4(3) -> 0
fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion.
>>> fib4(5)
4
>>> fib4(6)
8
>>> fib4(7)
14
"""
```
| 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-th element of the fib4 number sequence. Do not use recursion.
>>> fib4(5)
4
>>> fib4(6)
8
>>> fib4(7)
14
"""
| 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, 15, 33]
>>> unique_digits([152, 323, 1422, 10])
[]
"""
| 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 that hasn't any even digit.
Note: Returned list should be sorted in increasing order.
For example:
>>> unique_digits([15, 33, 1422, 1])
[1, 15, 33]
>>> unique_digits([152, 323, 1422, 10])
[]
"""
```
| 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, 15, 33]
>>> unique_digits([152, 323, 1422, 10])
[]
"""
| 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 s is empty then the function should return an empty list.
Note: you may assume the input string contains only letters and spaces.
Examples:
>>> select_words('Mary had a little lamb', 4)
['little']
>>> select_words('Mary had a little lamb', 3)
['Mary', 'lamb']
>>> select_words('simple white space', 2)
[]
>>> select_words('Hello world', 4)
['world']
>>> select_words('Uncle sam', 3)
['Uncle']
"""
| 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
a function that returns a list of all words from string s that contain exactly
n consonants, in order these words appear in the string s.
If the string s is empty then the function should return an empty list.
Note: you may assume the input string contains only letters and spaces.
Examples:
>>> select_words('Mary had a little lamb', 4)
['little']
>>> select_words('Mary had a little lamb', 3)
['Mary', 'lamb']
>>> select_words('simple white space', 2)
[]
>>> select_words('Hello world', 4)
['world']
>>> select_words('Uncle sam', 3)
['Uncle']
"""
```
| 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 s is empty then the function should return an empty list.
Note: you may assume the input string contains only letters and spaces.
Examples:
>>> select_words('Mary had a little lamb', 4)
['little']
>>> select_words('Mary had a little lamb', 3)
['Mary', 'lamb']
>>> select_words('simple white space', 2)
[]
>>> select_words('Hello world', 4)
['world']
>>> select_words('Uncle sam', 3)
['Uncle']
"""
| 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 candidate('', 4) == []
assert candidate('a b c d e f', 1) == ['b', 'c', 'd', 'f']
def test_check():
check(select_words)
test_check()
| [
"\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.
Example:
>>> will_it_fly([1, 2], 5)
False
# 1+2 is less than the maximum possible weight, but it's unbalanced.
>>> will_it_fly([3, 2, 3], 1)
False
# it's balanced, but 3+2+3 is more than the maximum possible weight.
>>> will_it_fly([3, 2, 3], 9)
True
# 3+2+3 is less than the maximum possible weight, and it's balanced.
>>> will_it_fly([3], 5)
True
# 3 is less than the maximum possible weight, and it's balanced.
"""
| 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 otherwise.
The object q will fly if it's balanced (it is a palindromic list) and the sum of its elements is less than or equal the maximum possible weight w.
Example:
>>> will_it_fly([1, 2], 5)
False
# 1+2 is less than the maximum possible weight, but it's unbalanced.
>>> will_it_fly([3, 2, 3], 1)
False
# it's balanced, but 3+2+3 is more than the maximum possible weight.
>>> will_it_fly([3, 2, 3], 9)
True
# 3+2+3 is less than the maximum possible weight, and it's balanced.
>>> will_it_fly([3], 5)
True
# 3 is less than the maximum possible weight, and it's balanced.
"""
```
| 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.
Example:
>>> will_it_fly([1, 2], 5)
False
# 1+2 is less than the maximum possible weight, but it's unbalanced.
>>> will_it_fly([3, 2, 3], 1)
False
# it's balanced, but 3+2+3 is more than the maximum possible weight.
>>> will_it_fly([3, 2, 3], 9)
True
# 3+2+3 is less than the maximum possible weight, and it's balanced.
>>> will_it_fly([3], 5)
True
# 3 is less than the maximum possible weight, and it's balanced.
"""
| 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_check()
| [
"\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 number of the uppercase
letters in the extension's name, and let SM be the number of lowercase letters
in the extension's name, the strength is given by the fraction CAP - SM.
You should find the strongest extension and return a string in this
format: ClassName.StrongestExtensionName.
If there are two or more extensions with the same strength, you should
choose the one that comes first in the list.
For example, if you are given "Slices" as the class and a list of the
extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension
(its strength is -1).
Example:
>>> Strongest_Extension('my_class', ['AA', 'Be', 'CC'])
'my_class.AA'
"""
| 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 list of extensions.
The extensions are to be used to load additional classes to the class. The
strength of the extension is as follows: Let CAP be the number of the uppercase
letters in the extension's name, and let SM be the number of lowercase letters
in the extension's name, the strength is given by the fraction CAP - SM.
You should find the strongest extension and return a string in this
format: ClassName.StrongestExtensionName.
If there are two or more extensions with the same strength, you should
choose the one that comes first in the list.
For example, if you are given "Slices" as the class and a list of the
extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension
(its strength is -1).
Example:
>>> Strongest_Extension('my_class', ['AA', 'Be', 'CC'])
'my_class.AA'
"""
```
| 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 number of the uppercase
letters in the extension's name, and let SM be the number of lowercase letters
in the extension's name, the strength is given by the fraction CAP - SM.
You should find the strongest extension and return a string in this
format: ClassName.StrongestExtensionName.
If there are two or more extensions with the same strength, you should
choose the one that comes first in the list.
For example, if you are given "Slices" as the class and a list of the
extensions: ['SErviNGSliCes', 'Cheese', 'StuFfed'] then you should
return 'Slices.SErviNGSliCes' since 'SErviNGSliCes' is the strongest extension
(its strength is -1).
Example:
>>> Strongest_Extension('my_class', ['AA', 'Be', 'CC'])
'my_class.AA'
"""
| 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']) == '__YESIMHERE.NuLl__'
assert candidate('K', ['Ta', 'TAR', 't234An', 'cosSo']) == 'K.TAR'
assert candidate('__HAHA', ['Tab', '123', '781345', '-_-']) == '__HAHA.123'
assert candidate('YameRore', ['HhAas', 'okIWILL123', 'WorkOut', 'Fails', '-_-']) == 'YameRore.okIWILL123'
assert candidate('finNNalLLly', ['Die', 'NowW', 'Wow', 'WoW']) == 'finNNalLLly.WoW'
assert candidate('_', ['Bb', '91245']) == '_.Bb'
assert candidate('Sp', ['671235', 'Bb']) == 'Sp.671235'
def test_check():
check(Strongest_Extension)
test_check()
| [
"\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 be good.
A string S is considered to be good if and only if all parentheses in S
are balanced. For example: the string '(())()' is good, while the string
'())' is not.
Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
Examples:
>>> match_parens(['()(', ')'])
'Yes'
>>> match_parens([')', ')'])
'No'
"""
| 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 '(' or close parentheses ')' only.
Your job is to check if it is possible to concatenate the two strings in
some order, that the resulting string will be good.
A string S is considered to be good if and only if all parentheses in S
are balanced. For example: the string '(())()' is good, while the string
'())' is not.
Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
Examples:
>>> match_parens(['()(', ')'])
'Yes'
>>> match_parens([')', ')'])
'No'
"""
```
| def 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 be good.
A string S is considered to be good if and only if all parentheses in S
are balanced. For example: the string '(())()' is good, while the string
'())' is not.
Return 'Yes' if there's a way to make a good string, and return 'No' otherwise.
Examples:
>>> match_parens(['()(', ')'])
'Yes'
>>> match_parens([')', ')'])
'No'
"""
| 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 candidate(['(()(', '()))()']) == 'Yes'
assert candidate(['((((', '((())']) == 'No'
assert candidate([')(()', '(()(']) == 'No'
assert candidate([')(', ')(']) == 'No'
assert candidate(['(', ')']) == 'Yes'
assert candidate([')', '(']) == 'Yes'
def test_check():
check(match_parens)
test_check()
| [
"\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
>>> next_smallest([5, 1, 4, 3, 2])
2
>>> next_smallest([])
None
>>> next_smallest([1, 1])
None
"""
| 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_smallest() that returns the 2nd smallest element of the list.
Return None if there is no such element.
>>> next_smallest([1, 2, 3, 4, 5])
2
>>> next_smallest([5, 1, 4, 3, 2])
2
>>> next_smallest([])
None
>>> next_smallest([1, 1])
None
"""
```
| 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
>>> next_smallest([5, 1, 4, 3, 2])
2
>>> next_smallest([])
None
>>> next_smallest([1, 1])
None
"""
| 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_check():
check(next_smallest)
test_check()
| [
"\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(3, 2, 2)
False
>>> any_int(3, -2, 1)
True
>>> any_int(3.6, -2.2, 2)
False
"""
| 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 sum of the other two, and all numbers are integers.
Returns false in any other cases.
Examples
>>> any_int(5, 2, 7)
True
>>> any_int(3, 2, 2)
False
>>> any_int(3, -2, 1)
True
>>> any_int(3.6, -2.2, 2)
False
"""
```
| 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(3, 2, 2)
False
>>> any_int(3, -2, 1)
True
>>> any_int(3.6, -2.2, 2)
False
"""
| 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 candidate(2, 1, 1) == True
assert candidate(3, 4, 7) == True
assert candidate(3.0, 4, 7) == False
def test_check():
check(any_int)
test_check()
| [
"\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 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
"""
```
| 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]
>>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123])
[6, 4, 6, 3, 4, 4, 10, 1, 124]
"""
```
| 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 of y otherwise.
Examples:
>>> x_or_y(7, 34, 12)
34
>>> x_or_y(15, 8, 5)
5
"""
```
| 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 candidate(6, 34, 1234) == 1234
assert candidate(1, 2, 0) == 0
assert candidate(2, 2, 0) == 2
def test_check():
check(x_or_y)
test_check()
| [
"\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)
1
>>> modp(3, 11)
8
>>> modp(100, 101)
1
"""
```
| 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 respectively.
Example:
>>> even_odd_count(-12)
(1, 1)
>>> even_odd_count(123)
(1, 2)
"""
```
| 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 test_check():
check(even_odd_count)
test_check()
| [
"\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')
True
>>> is_happy('aabb')
False
>>> is_happy('adb')
True
>>> is_happy('xyy')
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_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')
True
>>> is_happy('aabb')
False
>>> is_happy('adb')
True
>>> is_happy('xyy')
False
"""
```
| 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')
True
>>> is_happy('aabb')
False
>>> is_happy('adb')
True
>>> is_happy('xyy')
False
"""
| 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') == False
def test_check():
check(is_happy)
test_check()
| [
"\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)
29
>>> largest_prime_factor(2048)
2
"""
```
| 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('woArBld')
131
>>> digitSum('aAaaaXa')
153
"""
| 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.
Examples:
>>> digitSum('')
0
>>> digitSum('abAB')
131
>>> digitSum('abcCd')
67
>>> digitSum('helloE')
69
>>> digitSum('woArBld')
131
>>> digitSum('aAaaaXa')
153
"""
```
| 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('woArBld')
131
>>> digitSum('aAaaaXa')
153
"""
| 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 Smart') == 327
def test_check():
check(digitSum)
test_check()
| [
"\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.25, 0.5, 0.75, 1.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 transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
```
| 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.25, 0.5, 0.75, 1.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.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
def test_check():
check(rescale_to_unit)
test_check()
| [
"\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 even positions.
Examples
>>> solution([5, 8, 7, 1])
12
>>> solution([3, 3, 3, 3, 3])
9
>>> solution([30, 13, 24, 321])
0
"""
```
| 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_check():
check(solution)
test_check()
| [
"\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 same smallest even value are found return the node that has smallest index.
The plucked node should be returned in a list, [ smalest_value, its index ],
If there are no even values or the given array is empty, return [].
Example 1:
>>> pluck([4, 2, 3])
[2, 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 2:
>>> pluck([1, 2, 3])
[2, 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 3:
>>> pluck([])
[]
Example 4:
>>> pluck([5, 0, 3, 0, 4, 2])
[0, 1]
Explanation: 0 is the smallest value, but there are two zeros,
so we will choose the first zero, which has the smallest index.
Constraints:
* 1 <= nodes.length <= 10000
* 0 <= node.value
"""
| 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 nodes
your task is to pluck one of the nodes and return it.
The plucked node should be the node with the smallest even value.
If multiple nodes with the same smallest even value are found return the node that has smallest index.
The plucked node should be returned in a list, [ smalest_value, its index ],
If there are no even values or the given array is empty, return [].
Example 1:
>>> pluck([4, 2, 3])
[2, 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 2:
>>> pluck([1, 2, 3])
[2, 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 3:
>>> pluck([])
[]
Example 4:
>>> pluck([5, 0, 3, 0, 4, 2])
[0, 1]
Explanation: 0 is the smallest value, but there are two zeros,
so we will choose the first zero, which has the smallest index.
Constraints:
* 1 <= nodes.length <= 10000
* 0 <= node.value
"""
```
| 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 same smallest even value are found return the node that has smallest index.
The plucked node should be returned in a list, [ smalest_value, its index ],
If there are no even values or the given array is empty, return [].
Example 1:
>>> pluck([4, 2, 3])
[2, 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 2:
>>> pluck([1, 2, 3])
[2, 1]
Explanation: 2 has the smallest even value, and 2 has the smallest index.
Example 3:
>>> pluck([])
[]
Example 4:
>>> pluck([5, 0, 3, 0, 4, 2])
[0, 1]
Explanation: 0 is the smallest value, but there are two zeros,
so we will choose the first zero, which has the smallest index.
Constraints:
* 1 <= nodes.length <= 10000
* 0 <= node.value
"""
| 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]) == [6, 1]
assert candidate([7, 9, 7, 1]) == []
def test_check():
check(pluck)
test_check()
| [
"\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 multiple of 3.
Example :
>>> get_max_triples(5)
1
Explanation:
a = [1, 3, 7, 13, 21]
The only valid triple is (1, 7, 13).
"""
| 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 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
Return the number of triples (a[i], a[j], a[k]) of a where i < j < k,
and a[i] + a[j] + a[k] is a multiple of 3.
Example :
>>> get_max_triples(5)
1
Explanation:
a = [1, 3, 7, 13, 21]
The only valid triple is (1, 7, 13).
"""
```
| 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 multiple of 3.
Example :
>>> get_max_triples(5)
1
Explanation:
a = [1, 3, 7, 13, 21]
The only valid triple is (1, 7, 13).
"""
| 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 limit on the number of exchanged elements between lst1 and lst2.
If it is possible to exchange elements between the lst1 and lst2 to make
all the elements of lst1 to be even, return "YES".
Otherwise, return "NO".
For example:
>>> exchange([1, 2, 3, 4], [1, 2, 3, 4])
'YES'
>>> exchange([1, 2, 3, 4], [1, 5, 3, 4])
'NO'
It is assumed that the input lists will be non-empty.
"""
| 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 numbers,
and determines whether it is possible to perform an exchange of elements
between them to make lst1 a list of only even numbers.
There is no limit on the number of exchanged elements between lst1 and lst2.
If it is possible to exchange elements between the lst1 and lst2 to make
all the elements of lst1 to be even, return "YES".
Otherwise, return "NO".
For example:
>>> exchange([1, 2, 3, 4], [1, 2, 3, 4])
'YES'
>>> exchange([1, 2, 3, 4], [1, 5, 3, 4])
'NO'
It is assumed that the input lists will be non-empty.
"""
```
| 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 limit on the number of exchanged elements between lst1 and lst2.
If it is possible to exchange elements between the lst1 and lst2 to make
all the elements of lst1 to be even, return "YES".
Otherwise, return "NO".
For example:
>>> exchange([1, 2, 3, 4], [1, 2, 3, 4])
'YES'
>>> exchange([1, 2, 3, 4], [1, 5, 3, 4])
'NO'
It is assumed that the input lists will be non-empty.
"""
| 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([3, 2, 6, 1, 8, 9], [3, 5, 5, 1, 1, 1]) == 'NO'
assert candidate([100, 200], [200, 200]) == 'YES'
def test_check():
check(exchange)
test_check()
| [
"\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
>>> median([-10, 4, 6, 1000, 10, 20])
15.0
"""
```
| 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('orange')
False
"""
| 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 otherwise
Examples
>>> prime_length('Hello')
True
>>> prime_length('abcdcba')
True
>>> prime_length('kittens')
True
>>> prime_length('orange')
False
"""
```
| 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('orange')
False
"""
| 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') == True
assert candidate('') == False
assert candidate('HI') == True
assert candidate('go') == True
assert candidate('gogo') == False
assert candidate('aaaaaaaaaaaaaaa') == False
assert candidate('Madam') == True
assert candidate('M') == False
assert candidate('0') == False
def test_check():
check(prime_length)
test_check()
| [
"\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 one element to any other element.
For example:
>>> smallest_change([1, 2, 3, 5, 4, 7, 9, 6])
4
>>> smallest_change([1, 2, 3, 4, 3, 2, 2])
1
>>> smallest_change([1, 2, 3, 2, 1])
0
"""
| 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
need to be changed to make the array palindromic. A palindromic array is an array that
is read the same backwards and forwards. In one change, you can change one element to any other element.
For example:
>>> smallest_change([1, 2, 3, 5, 4, 7, 9, 6])
4
>>> smallest_change([1, 2, 3, 4, 3, 2, 2])
1
>>> smallest_change([1, 2, 3, 2, 1])
0
"""
```
| 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 one element to any other element.
For example:
>>> smallest_change([1, 2, 3, 5, 4, 7, 9, 6])
4
>>> smallest_change([1, 2, 3, 4, 3, 2, 2])
1
>>> smallest_change([1, 2, 3, 2, 1])
0
"""
| 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
assert candidate([0, 1]) == 1
def test_check():
check(smallest_change)
test_check()
| [
"\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])
98
>>> lst([1.0, 3.0, 5.0, 7.0])
84
>>> lst([1.4, 4.2, 0.0])
29
>>> lst([-2.4, 1.0, 1.0])
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 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])
98
>>> lst([1.0, 3.0, 5.0, 7.0])
84
>>> lst([1.4, 4.2, 0.0])
29
>>> lst([-2.4, 1.0, 1.0])
6
"""
```
| 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])
98
>>> lst([1.0, 3.0, 5.0, 7.0])
84
>>> lst([1.4, 4.2, 0.0])
29
>>> lst([-2.4, 1.0, 1.0])
6
"""
| 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 candidate([10000.0, 10000.0]) == 200000000
assert candidate([-1.4, 4.6, 6.3]) == 75
assert candidate([-1.4, 17.9, 18.9, 19.9]) == 1086
assert candidate([0.0]) == 0
assert candidate([-1.0]) == 1
assert candidate([-1.0, 1.0, 0.0]) == 2
def test_check():
check(sum_squares)
test_check()
| [
"\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 should not be more than three digits ('0'-'9') in the file's name.
- The file's name contains exactly one dot '.'
- The substring before the dot should not be empty, and it starts with a letter from
the latin alphapet ('a'-'z' and 'A'-'Z').
- The substring after the dot should be one of these: ['txt', 'exe', 'dll']
Examples:
>>> file_name_check('example.txt')
'Yes'
>>> file_name_check('1example.dll')
'No'
"""
| 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 name is valid, and returns 'No' otherwise.
A file's name is considered to be valid if and only if all the following conditions
are met:
- There should not be more than three digits ('0'-'9') in the file's name.
- The file's name contains exactly one dot '.'
- The substring before the dot should not be empty, and it starts with a letter from
the latin alphapet ('a'-'z' and 'A'-'Z').
- The substring after the dot should be one of these: ['txt', 'exe', 'dll']
Examples:
>>> file_name_check('example.txt')
'Yes'
>>> file_name_check('1example.dll')
'No'
"""
```
| 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 should not be more than three digits ('0'-'9') in the file's name.
- The file's name contains exactly one dot '.'
- The substring before the dot should not be empty, and it starts with a letter from
the latin alphapet ('a'-'z' and 'A'-'Z').
- The substring after the dot should be one of these: ['txt', 'exe', 'dll']
Examples:
>>> file_name_check('example.txt')
'Yes'
>>> file_name_check('1example.dll')
'No'
"""
| 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') == 'No'
assert candidate('?aREYA.exe') == 'No'
assert candidate('/this_is_valid.dll') == 'No'
assert candidate('this_is_valid.wow') == 'No'
assert candidate('this_is_valid.txt') == 'Yes'
assert candidate('this_is_valid.txtexe') == 'No'
assert candidate('#this2_i4s_5valid.ten') == 'No'
assert candidate('@this1_is6_valid.exe') == 'No'
assert candidate('this_is_12valid.6exe4.txt') == 'No'
assert candidate('all.exe.txt') == 'No'
assert candidate('I563_No.exe') == 'Yes'
assert candidate('Is3youfault.txt') == 'Yes'
assert candidate('no_one#knows.dll') == 'Yes'
assert candidate('1I563_Yes3.exe') == 'No'
assert candidate('I563_Yes3.txtt') == 'No'
assert candidate('final..txt') == 'No'
assert candidate('final132') == 'No'
assert candidate('_f4indsartal132.') == 'No'
assert candidate('.txt') == 'No'
assert candidate('s.') == 'No'
def test_check():
check(file_name_check)
test_check()
| [
"\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
>>> triples_sum_to_zero([1, 3, -2, 1])
True
>>> triples_sum_to_zero([1, 2, 3, 7])
False
>>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])
True
>>> triples_sum_to_zero([1])
False
"""
| 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 True if there are three distinct elements in the list that
sum to zero, and False otherwise.
>>> triples_sum_to_zero([1, 3, 5, 0])
False
>>> triples_sum_to_zero([1, 3, -2, 1])
True
>>> triples_sum_to_zero([1, 2, 3, 7])
False
>>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])
True
>>> triples_sum_to_zero([1])
False
"""
```
| 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
>>> triples_sum_to_zero([1, 3, -2, 1])
True
>>> triples_sum_to_zero([1, 2, 3, 7])
False
>>> triples_sum_to_zero([2, 4, -5, 3, 9, 7])
True
>>> triples_sum_to_zero([1])
False
"""
| 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]) == False
assert candidate([1, 3, 5, -100]) == False
assert candidate([100, 3, 5, -100]) == False
def test_check():
check(triples_sum_to_zero)
test_check()
| [
"\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)
includes both start and end.
For each given interval, it is assumed that its start is less or equal its end.
Your task is to determine whether the length of intersection of these two
intervals is a prime number.
Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
which its length is 1, which not a prime number.
If the length of the intersection is a prime number, return "YES",
otherwise, return "NO".
If the two intervals don't intersect, return "NO".
[input/output] samples:
>>> intersection((1, 2), (2, 3))
'NO'
>>> intersection((-1, 1), (0, 4))
'NO'
>>> intersection((-3, -1), (-5, 5))
'YES'
"""
| 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 interval is a pair of integers. For example, interval = (start, end) = (1, 2).
The given intervals are closed which means that the interval (start, end)
includes both start and end.
For each given interval, it is assumed that its start is less or equal its end.
Your task is to determine whether the length of intersection of these two
intervals is a prime number.
Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
which its length is 1, which not a prime number.
If the length of the intersection is a prime number, return "YES",
otherwise, return "NO".
If the two intervals don't intersect, return "NO".
[input/output] samples:
>>> intersection((1, 2), (2, 3))
'NO'
>>> intersection((-1, 1), (0, 4))
'NO'
>>> intersection((-3, -1), (-5, 5))
'YES'
"""
```
| def 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)
includes both start and end.
For each given interval, it is assumed that its start is less or equal its end.
Your task is to determine whether the length of intersection of these two
intervals is a prime number.
Example, the intersection of the intervals (1, 3), (2, 4) is (2, 3)
which its length is 1, which not a prime number.
If the length of the intersection is a prime number, return "YES",
otherwise, return "NO".
If the two intervals don't intersect, return "NO".
[input/output] samples:
>>> intersection((1, 2), (2, 3))
'NO'
>>> intersection((-1, 1), (0, 4))
'NO'
>>> intersection((-3, -1), (-5, 5))
'YES'
"""
| 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 candidate((1, 2), (1, 2)) == 'NO'
assert candidate((-2, -2), (-3, -2)) == 'NO'
def test_check():
check(intersection)
test_check()
| [
"\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 is properly closed) and not nested within each other
Ignore any spaces in the input string.
>>> separate_paren_groups('( ) (( )) (( )( ))')
['()', '(())', '(()())']
"""
| 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 nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
>>> separate_paren_groups('( ) (( )) (( )( ))')
['()', '(())', '(()())']
"""
```
| 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 is properly closed) and not nested within each other
Ignore any spaces in the input string.
>>> separate_paren_groups('( ) (( )) (( )( ))')
['()', '(())', '(()())']
"""
| 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('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
def test_check():
check(separate_paren_groups)
test_check()
| [
"\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 determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
>>> compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])
[0, 0, 0, 0, 3, 3]
>>> compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])
[4, 4, 1, 0, 0, 6]
"""
| 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-awaited
event is finally known. The feelings and thoughts you have at that moment are
definitely worth noting down and comparing.
Your task is to determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
>>> compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])
[0, 0, 0, 0, 3, 3]
>>> compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])
[4, 4, 1, 0, 0, 6]
"""
```
| 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 determine if a person correctly guessed the results of a number of matches.
You are given two arrays of scores and guesses of equal length, where each index shows a match.
Return an array of the same length denoting how far off each guess was. If they have guessed correctly,
the value is 0, and if not, the value is the absolute difference between the guess and the score.
example:
>>> compare([1, 2, 3, 4, 5, 1], [1, 2, 3, 4, 2, -2])
[0, 0, 0, 0, 3, 3]
>>> compare([0, 5, 0, 0, 0, 4], [4, 1, 1, 0, 0, -2])
[4, 4, 1, 0, 0, 6]
"""
| 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 test_check():
check(compare)
test_check()
| [
"\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 with 1.
"""
```
| 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_if_last_char_is_a_letter('apple pie')
False
>>> check_if_last_char_is_a_letter('apple pi e')
True
>>> check_if_last_char_is_a_letter('apple pi e ')
False
>>> check_if_last_char_is_a_letter('')
False
"""
| 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 alphabetical character and is not
a part of a word, and False otherwise.
Note: "word" is a group of characters separated by space.
Examples:
>>> check_if_last_char_is_a_letter('apple pie')
False
>>> check_if_last_char_is_a_letter('apple pi e')
True
>>> check_if_last_char_is_a_letter('apple pi e ')
False
>>> check_if_last_char_is_a_letter('')
False
"""
```
| 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_if_last_char_is_a_letter('apple pie')
False
>>> check_if_last_char_is_a_letter('apple pi e')
True
>>> check_if_last_char_is_a_letter('apple pi e ')
False
>>> check_if_last_char_is_a_letter('')
False
"""
| 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 candidate('eeeee e ') == False
assert candidate('apple pie') == False
assert candidate('apple pi e ') == False
def test_check():
check(check_if_last_char_is_a_letter)
test_check()
| [
"\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 higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
3. The months should not be less than 1 or higher than 12.
4. The date should be in the format: mm-dd-yyyy
>>> valid_date('03-11-2000')
True
>>> valid_date('15-01-2012')
False
>>> valid_date('04-0-2040')
False
>>> valid_date('06-04-2020')
True
>>> valid_date('06/04/2020')
False
"""
| 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 False.
The date is valid if all of the following rules are satisfied:
1. The date string is not empty.
2. The number of days is not less than 1 or higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
3. The months should not be less than 1 or higher than 12.
4. The date should be in the format: mm-dd-yyyy
>>> valid_date('03-11-2000')
True
>>> valid_date('15-01-2012')
False
>>> valid_date('04-0-2040')
False
>>> valid_date('06-04-2020')
True
>>> valid_date('06/04/2020')
False
"""
```
| 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 higher than 31 days for months 1,3,5,7,8,10,12. And the number of days is not less than 1 or higher than 30 days for months 4,6,9,11. And, the number of days is not less than 1 or higher than 29 for the month 2.
3. The months should not be less than 1 or higher than 12.
4. The date should be in the format: mm-dd-yyyy
>>> valid_date('03-11-2000')
True
>>> valid_date('15-01-2012')
False
>>> valid_date('04-0-2040')
False
>>> valid_date('06-04-2020')
True
>>> valid_date('06/04/2020')
False
"""
| 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
assert candidate('04-31-3000') == False
assert candidate('06-06-2005') == True
assert candidate('21-31-2000') == False
assert candidate('04-12-2003') == True
assert candidate('04122003') == False
assert candidate('20030412') == False
assert candidate('2003-04') == False
assert candidate('2003-04-12') == False
assert candidate('04-2003') == False
def test_check():
check(valid_date)
test_check()
| [
"\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, and 3.
>>> count_nums([])
0
>>> count_nums([-1, 11, -11])
1
>>> count_nums([1, 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
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, and 3.
>>> count_nums([])
0
>>> count_nums([-1, 11, -11])
1
>>> count_nums([1, 1, 2])
3
"""
```
| 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, and 3.
>>> count_nums([])
0
>>> count_nums([-1, 11, -11])
1
>>> count_nums([1, 1, 2])
3
"""
| 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, 1]) == 1
assert candidate([1]) == 1
def test_check():
check(count_nums)
test_check()
| [
"\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 should keep the order of words and blank spaces in the sentence.
For example:
>>> anti_shuffle('Hi')
'Hi'
>>> anti_shuffle('hello')
'ehllo'
>>> anti_shuffle('Hello World!!!')
'Hello !!!Wdlor'
"""
| 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 string where all words (separated by space)
are replaced by a new word where all the characters arranged in
ascending order based on ascii value.
Note: You should keep the order of words and blank spaces in the sentence.
For example:
>>> anti_shuffle('Hi')
'Hi'
>>> anti_shuffle('hello')
'ehllo'
>>> anti_shuffle('Hello World!!!')
'Hello !!!Wdlor'
"""
```
| 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: You should keep the order of words and blank spaces in the sentence.
For example:
>>> anti_shuffle('Hi')
'Hi'
>>> anti_shuffle('hello')
'ehllo'
>>> anti_shuffle('Hello World!!!')
'Hello !!!Wdlor'
"""
| 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. How are you?') == '.Hi My aemn is Meirst .Rboot How aer ?ouy'
def test_check():
check(anti_shuffle)
test_check()
| [
"\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')
True
>>> is_palindrome('aaaaa')
True
>>> is_palindrome('zbcd')
False
"""
```
| 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_palindrome)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |