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" ]
README.md exists but content is empty.
Downloads last month
32