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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
100 | HumanEval_118_get_closest_vowel | def get_closest_vowel(word: str) -> str:
"""You are given a word. Your task is to find the closest vowel that stands between
two consonants from the right side of the word (case sensitive).
Vowels in the beginning and ending doesn't count. Return empty string if you didn't
find any vowel met the above condition.
You may assume that the given string contains English letter only.
Example:
>>> get_closest_vowel('yogurt')
'u'
>>> get_closest_vowel('FULL')
'U'
>>> get_closest_vowel('quick')
''
>>> get_closest_vowel('ab')
''
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def get_closest_vowel(word: str) -> str:
"""You are given a word. Your task is to find the closest vowel that stands between
two consonants from the right side of the word (case sensitive).
Vowels in the beginning and ending doesn't count. Return empty string if you didn't
find any vowel met the above condition.
You may assume that the given string contains English letter only.
Example:
>>> get_closest_vowel('yogurt')
'u'
>>> get_closest_vowel('FULL')
'U'
>>> get_closest_vowel('quick')
''
>>> get_closest_vowel('ab')
''
"""
```
| def get_closest_vowel(word: str) -> str: | HumanEval_118_get_closest_vowel | py | def get_closest_vowel(word: str) -> str:
"""You are given a word. Your task is to find the closest vowel that stands between
two consonants from the right side of the word (case sensitive).
Vowels in the beginning and ending doesn't count. Return empty string if you didn't
find any vowel met the above condition.
You may assume that the given string contains English letter only.
Example:
>>> get_closest_vowel('yogurt')
'u'
>>> get_closest_vowel('FULL')
'U'
>>> get_closest_vowel('quick')
''
>>> get_closest_vowel('ab')
''
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_118_get_closest_vowel.py | reworded | def check(candidate):
assert candidate('yogurt') == 'u'
assert candidate('full') == 'u'
assert candidate('easy') == ''
assert candidate('eAsy') == ''
assert candidate('ali') == ''
assert candidate('bad') == 'a'
assert candidate('most') == 'o'
assert candidate('ab') == ''
assert candidate('ba') == ''
assert candidate('quick') == ''
assert candidate('anime') == 'i'
assert candidate('Asia') == ''
assert candidate('Above') == 'o'
def test_check():
check(get_closest_vowel)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
101 | HumanEval_31_is_prime | def is_prime(n: int) -> bool:
"""Return true if a given number is prime, and false otherwise.
>>> is_prime(6)
False
>>> is_prime(101)
True
>>> is_prime(11)
True
>>> is_prime(13441)
True
>>> is_prime(61)
True
>>> is_prime(4)
False
>>> is_prime(1)
False
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_prime(n: int) -> bool:
"""Return true if a given number is prime, and false otherwise.
>>> is_prime(6)
False
>>> is_prime(101)
True
>>> is_prime(11)
True
>>> is_prime(13441)
True
>>> is_prime(61)
True
>>> is_prime(4)
False
>>> is_prime(1)
False
"""
```
| def is_prime(n: int) -> bool: | HumanEval_31_is_prime | py | def is_prime(n: int) -> bool:
"""Return true if a given number is prime, and false otherwise.
>>> is_prime(6)
False
>>> is_prime(101)
True
>>> is_prime(11)
True
>>> is_prime(13441)
True
>>> is_prime(61)
True
>>> is_prime(4)
False
>>> is_prime(1)
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_31_is_prime.py | reworded | def check(candidate):
assert candidate(6) == False
assert candidate(101) == True
assert candidate(11) == True
assert candidate(13441) == True
assert candidate(61) == True
assert candidate(4) == False
assert candidate(1) == False
assert candidate(5) == True
assert candidate(11) == True
assert candidate(17) == True
assert candidate(85) == False
assert candidate(77) == False
assert candidate(255379) == False
def test_check():
check(is_prime)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
102 | HumanEval_144_simplify | def simplify(x: str, n: str) -> bool:
"""Your task is to implement a function that will simplify the expression
x * n. The function returns True if x * n evaluates to a whole number and False
otherwise. Both x and n, are string representation of a fraction, and have the following format,
<numerator>/<denominator> where both numerator and denominator are positive whole numbers.
You can assume that x, and n are valid fractions, and do not have zero as denominator.
>>> simplify('1/5', '5/1')
True
>>> simplify('1/6', '2/1')
False
>>> simplify('7/10', '10/2')
False
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def simplify(x: str, n: str) -> bool:
"""Your task is to implement a function that will simplify the expression
x * n. The function returns True if x * n evaluates to a whole number and False
otherwise. Both x and n, are string representation of a fraction, and have the following format,
<numerator>/<denominator> where both numerator and denominator are positive whole numbers.
You can assume that x, and n are valid fractions, and do not have zero as denominator.
>>> simplify('1/5', '5/1')
True
>>> simplify('1/6', '2/1')
False
>>> simplify('7/10', '10/2')
False
"""
```
| def simplify(x: str, n: str) -> bool: | HumanEval_144_simplify | py | def simplify(x: str, n: str) -> bool:
"""Your task is to implement a function that will simplify the expression
x * n. The function returns True if x * n evaluates to a whole number and False
otherwise. Both x and n, are string representation of a fraction, and have the following format,
<numerator>/<denominator> where both numerator and denominator are positive whole numbers.
You can assume that x, and n are valid fractions, and do not have zero as denominator.
>>> simplify('1/5', '5/1')
True
>>> simplify('1/6', '2/1')
False
>>> simplify('7/10', '10/2')
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_144_simplify.py | reworded | def check(candidate):
assert candidate('1/5', '5/1') == True
assert candidate('1/6', '2/1') == False
assert candidate('5/1', '3/1') == True
assert candidate('7/10', '10/2') == False
assert candidate('2/10', '50/10') == True
assert candidate('7/2', '4/2') == True
assert candidate('11/6', '6/1') == True
assert candidate('2/3', '5/2') == False
assert candidate('5/2', '3/5') == False
assert candidate('2/4', '8/4') == True
assert candidate('2/4', '4/2') == True
assert candidate('1/5', '5/1') == True
assert candidate('1/5', '1/5') == False
def test_check():
check(simplify)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
103 | HumanEval_78_hex_key | def hex_key(num: str) -> int:
"""You have been tasked to write a function that receives
a hexadecimal number as a string and counts the number of hexadecimal
digits that are primes (prime number, or a prime, is a natural number
greater than 1 that is not a product of two smaller natural numbers).
Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
So you have to determine a number of the following digits: 2, 3, 5, 7,
B (=decimal 11), D (=decimal 13).
Note: you may assume the input is always correct or empty string,
and symbols A,B,C,D,E,F are always uppercase.
Examples:
>>> hex_key('AB')
1
>>> hex_key('1077E')
2
>>> hex_key('ABED1A33')
4
>>> hex_key('123456789ABCDEF0')
6
>>> hex_key('2020')
2
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def hex_key(num: str) -> int:
"""You have been tasked to write a function that receives
a hexadecimal number as a string and counts the number of hexadecimal
digits that are primes (prime number, or a prime, is a natural number
greater than 1 that is not a product of two smaller natural numbers).
Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
So you have to determine a number of the following digits: 2, 3, 5, 7,
B (=decimal 11), D (=decimal 13).
Note: you may assume the input is always correct or empty string,
and symbols A,B,C,D,E,F are always uppercase.
Examples:
>>> hex_key('AB')
1
>>> hex_key('1077E')
2
>>> hex_key('ABED1A33')
4
>>> hex_key('123456789ABCDEF0')
6
>>> hex_key('2020')
2
"""
```
| def hex_key(num: str) -> int: | HumanEval_78_hex_key | py | def hex_key(num: str) -> int:
"""You have been tasked to write a function that receives
a hexadecimal number as a string and counts the number of hexadecimal
digits that are primes (prime number, or a prime, is a natural number
greater than 1 that is not a product of two smaller natural numbers).
Hexadecimal digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
Prime numbers are 2, 3, 5, 7, 11, 13, 17,...
So you have to determine a number of the following digits: 2, 3, 5, 7,
B (=decimal 11), D (=decimal 13).
Note: you may assume the input is always correct or empty string,
and symbols A,B,C,D,E,F are always uppercase.
Examples:
>>> hex_key('AB')
1
>>> hex_key('1077E')
2
>>> hex_key('ABED1A33')
4
>>> hex_key('123456789ABCDEF0')
6
>>> hex_key('2020')
2
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_78_hex_key.py | reworded | def check(candidate):
assert candidate('AB') == 1
assert candidate('1077E') == 2
assert candidate('ABED1A33') == 4
assert candidate('2020') == 2
assert candidate('123456789ABCDEF0') == 6
assert candidate('112233445566778899AABBCCDDEEFF00') == 12
def test_check():
check(hex_key)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
104 | HumanEval_143_words_in_sentence | def words_in_sentence(sentence: str) -> str:
"""
You are given a string representing a sentence,
the sentence contains some words separated by a space,
and you have to return a string that contains the words from the original sentence,
whose lengths are prime numbers,
the order of the words in the new string should be the same as the original one.
Example 1:
>>> words_in_sentence('This is a test')
'is'
Example 2:
>>> words_in_sentence('lets go for swimming')
'go for'
Constraints:
* 1 <= len(sentence) <= 100
* sentence contains only letters
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def words_in_sentence(sentence: str) -> str:
"""
You are given a string representing a sentence,
the sentence contains some words separated by a space,
and you have to return a string that contains the words from the original sentence,
whose lengths are prime numbers,
the order of the words in the new string should be the same as the original one.
Example 1:
>>> words_in_sentence('This is a test')
'is'
Example 2:
>>> words_in_sentence('lets go for swimming')
'go for'
Constraints:
* 1 <= len(sentence) <= 100
* sentence contains only letters
"""
```
| def words_in_sentence(sentence: str) -> str: | HumanEval_143_words_in_sentence | py | def words_in_sentence(sentence: str) -> str:
"""
You are given a string representing a sentence,
the sentence contains some words separated by a space,
and you have to return a string that contains the words from the original sentence,
whose lengths are prime numbers,
the order of the words in the new string should be the same as the original one.
Example 1:
>>> words_in_sentence('This is a test')
'is'
Example 2:
>>> words_in_sentence('lets go for swimming')
'go for'
Constraints:
* 1 <= len(sentence) <= 100
* sentence contains only letters
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_143_words_in_sentence.py | reworded | def check(candidate):
assert candidate('This is a test') == 'is'
assert candidate('lets go for swimming') == 'go for'
assert candidate('there is no place available here') == 'there is no place'
assert candidate('Hi I am Hussein') == 'Hi am Hussein'
assert candidate('go for it') == 'go for it'
assert candidate('here') == ''
assert candidate('here is') == 'is'
def test_check():
check(words_in_sentence)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
105 | HumanEval_111_histogram | from typing import Dict
def histogram(test: str) -> Dict[str, int]:
"""Given a string representing a space separated lowercase letters, return a dictionary
of the letter with the most repetition and containing the corresponding count.
If several letters have the same occurrence, return all of them.
Example:
>>> histogram('a b c')
{ 'a': 1, 'b': 1, 'c': 1 }
>>> histogram('a b b a')
{ 'a': 2, 'b': 2 }
>>> histogram('a b c a b')
{ 'a': 2, 'b': 2 }
>>> histogram('b b b b a')
{ 'b': 4 }
>>> histogram('')
{ }
"""
| 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 histogram(test: str) -> Dict[str, int]:
"""Given a string representing a space separated lowercase letters, return a dictionary
of the letter with the most repetition and containing the corresponding count.
If several letters have the same occurrence, return all of them.
Example:
>>> histogram('a b c')
{ 'a': 1, 'b': 1, 'c': 1 }
>>> histogram('a b b a')
{ 'a': 2, 'b': 2 }
>>> histogram('a b c a b')
{ 'a': 2, 'b': 2 }
>>> histogram('b b b b a')
{ 'b': 4 }
>>> histogram('')
{ }
"""
```
| def histogram(test: str) -> Dict[str, int]: | HumanEval_111_histogram | py | from typing import Dict
def histogram(test: str) -> Dict[str, int]:
"""Given a string representing a space separated lowercase letters, return a dictionary
of the letter with the most repetition and containing the corresponding count.
If several letters have the same occurrence, return all of them.
Example:
>>> histogram('a b c')
{ 'a': 1, 'b': 1, 'c': 1 }
>>> histogram('a b b a')
{ 'a': 2, 'b': 2 }
>>> histogram('a b c a b')
{ 'a': 2, 'b': 2 }
>>> histogram('b b b b a')
{ 'b': 4 }
>>> histogram('')
{ }
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_111_histogram.py | reworded | def check(candidate):
assert candidate('a b b a') == { 'a': 2, 'b': 2 }
assert candidate('a b c a b') == { 'a': 2, 'b': 2 }
assert candidate('a b c d g') == { 'a': 1, 'b': 1, 'c': 1, 'd': 1, 'g': 1 }
assert candidate('r t g') == { 'r': 1, 't': 1, 'g': 1 }
assert candidate('b b b b a') == { 'b': 4 }
assert candidate('r t g') == { 'r': 1, 't': 1, 'g': 1 }
assert candidate('') == { }
assert candidate('a') == { 'a': 1 }
def test_check():
check(histogram)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
106 | HumanEval_87_get_row | from typing import List, Tuple
def get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]:
"""
You are given a 2 dimensional data, as a nested lists,
which is similar to matrix, however, unlike matrices,
each row may contain a different number of columns.
Given lst, and integer x, find integers x in the list,
and return list of tuples, [(x1, y1), (x2, y2) ...] such that
each tuple is a coordinate - (row, columns), starting with 0.
Sort coordinates initially by rows in ascending order.
Also, sort coordinates of the row by columns in descending order.
Examples:
>>> get_row([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)
[(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
>>> get_row([], 1)
[]
>>> get_row([[], [1], [1, 2, 3]], 3)
[(2, 2)]
"""
| 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 get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]:
"""
You are given a 2 dimensional data, as a nested lists,
which is similar to matrix, however, unlike matrices,
each row may contain a different number of columns.
Given lst, and integer x, find integers x in the list,
and return list of tuples, [(x1, y1), (x2, y2) ...] such that
each tuple is a coordinate - (row, columns), starting with 0.
Sort coordinates initially by rows in ascending order.
Also, sort coordinates of the row by columns in descending order.
Examples:
>>> get_row([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)
[(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
>>> get_row([], 1)
[]
>>> get_row([[], [1], [1, 2, 3]], 3)
[(2, 2)]
"""
```
| def get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]: | HumanEval_87_get_row | py | from typing import List, Tuple
def get_row(lst: List[List[int]], x: int) -> List[Tuple[int, int]]:
"""
You are given a 2 dimensional data, as a nested lists,
which is similar to matrix, however, unlike matrices,
each row may contain a different number of columns.
Given lst, and integer x, find integers x in the list,
and return list of tuples, [(x1, y1), (x2, y2) ...] such that
each tuple is a coordinate - (row, columns), starting with 0.
Sort coordinates initially by rows in ascending order.
Also, sort coordinates of the row by columns in descending order.
Examples:
>>> get_row([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1)
[(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
>>> get_row([], 1)
[]
>>> get_row([[], [1], [1, 2, 3]], 3)
[(2, 2)]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_87_get_row.py | reworded | def check(candidate):
assert candidate([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1) == [(0, 0), (1, 4), (1, 0), (2, 5), (2, 0)]
assert candidate([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]], 2) == [(0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (5, 1)]
assert candidate([[1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6], [1, 1, 3, 4, 5, 6], [1, 2, 1, 4, 5, 6], [1, 2, 3, 1, 5, 6], [1, 2, 3, 4, 1, 6], [1, 2, 3, 4, 5, 1]], 1) == [(0, 0), (1, 0), (2, 1), (2, 0), (3, 2), (3, 0), (4, 3), (4, 0), (5, 4), (5, 0), (6, 5), (6, 0)]
assert candidate([], 1) == []
assert candidate([[1]], 2) == []
assert candidate([[], [1], [1, 2, 3]], 3) == [(2, 2)]
def test_check():
check(get_row)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
107 | HumanEval_123_get_odd_collatz | from typing import List
def get_odd_collatz(n: int) -> List[int]:
"""
Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.
The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
as follows: start with any positive integer n. Then each term is obtained from the
previous term as follows: if the previous term is even, the next term is one half of
the previous term. If the previous term is odd, the next term is 3 times the previous
term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
Note:
1. Collatz(1) is [1].
2. returned list sorted in increasing order.
For example:
get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
>>> get_odd_collatz(5)
[1, 5]
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def get_odd_collatz(n: int) -> List[int]:
"""
Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.
The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
as follows: start with any positive integer n. Then each term is obtained from the
previous term as follows: if the previous term is even, the next term is one half of
the previous term. If the previous term is odd, the next term is 3 times the previous
term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
Note:
1. Collatz(1) is [1].
2. returned list sorted in increasing order.
For example:
get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
>>> get_odd_collatz(5)
[1, 5]
"""
```
| def get_odd_collatz(n: int) -> List[int]: | HumanEval_123_get_odd_collatz | py | from typing import List
def get_odd_collatz(n: int) -> List[int]:
"""
Given a positive integer n, return a sorted list that has the odd numbers in collatz sequence.
The Collatz conjecture is a conjecture in mathematics that concerns a sequence defined
as follows: start with any positive integer n. Then each term is obtained from the
previous term as follows: if the previous term is even, the next term is one half of
the previous term. If the previous term is odd, the next term is 3 times the previous
term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1.
Note:
1. Collatz(1) is [1].
2. returned list sorted in increasing order.
For example:
get_odd_collatz(5) returns [1, 5] # The collatz sequence for 5 is [5, 16, 8, 4, 2, 1], so the odd numbers are only 1, and 5.
>>> get_odd_collatz(5)
[1, 5]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_123_get_odd_collatz.py | reworded | def check(candidate):
assert candidate(14) == [1, 5, 7, 11, 13, 17]
assert candidate(5) == [1, 5]
assert candidate(12) == [1, 3, 5]
assert candidate(1) == [1]
def test_check():
check(get_odd_collatz)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
108 | HumanEval_135_can_arrange | from typing import List
def can_arrange(arr: List[int]) -> int:
"""Create a function which returns the largest index of an element which
is not greater than or equal to the element immediately preceding it. If
no such element exists then return -1. The given array will not contain
duplicate values.
Examples:
>>> can_arrange([1, 2, 4, 3, 5])
3
>>> can_arrange([1, 2, 3])
-1
"""
| 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 can_arrange(arr: List[int]) -> int:
"""Create a function which returns the largest index of an element which
is not greater than or equal to the element immediately preceding it. If
no such element exists then return -1. The given array will not contain
duplicate values.
Examples:
>>> can_arrange([1, 2, 4, 3, 5])
3
>>> can_arrange([1, 2, 3])
-1
"""
```
| def can_arrange(arr: List[int]) -> int: | HumanEval_135_can_arrange | py | from typing import List
def can_arrange(arr: List[int]) -> int:
"""Create a function which returns the largest index of an element which
is not greater than or equal to the element immediately preceding it. If
no such element exists then return -1. The given array will not contain
duplicate values.
Examples:
>>> can_arrange([1, 2, 4, 3, 5])
3
>>> can_arrange([1, 2, 3])
-1
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_135_can_arrange.py | reworded | def check(candidate):
assert candidate([1, 2, 4, 3, 5]) == 3
assert candidate([1, 2, 4, 5]) == -1
assert candidate([1, 4, 2, 5, 6, 7, 8, 9, 10]) == 2
assert candidate([4, 8, 5, 7, 3]) == 4
assert candidate([]) == -1
def test_check():
check(can_arrange)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
109 | HumanEval_19_sort_numbers | def sort_numbers(numbers: str) -> str:
""" Input is a space-delimited string of numberals from 'zero' to 'nine'.
Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
Return the string with numbers sorted from smallest to largest
>>> sort_numbers('three one five')
'one three five'
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def sort_numbers(numbers: str) -> str:
""" Input is a space-delimited string of numberals from 'zero' to 'nine'.
Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
Return the string with numbers sorted from smallest to largest
>>> sort_numbers('three one five')
'one three five'
"""
```
| def sort_numbers(numbers: str) -> str: | HumanEval_19_sort_numbers | py | def sort_numbers(numbers: str) -> str:
""" Input is a space-delimited string of numberals from 'zero' to 'nine'.
Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
Return the string with numbers sorted from smallest to largest
>>> sort_numbers('three one five')
'one three five'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_19_sort_numbers.py | reworded | def check(candidate):
assert candidate('') == ''
assert candidate('three') == 'three'
assert candidate('three five nine') == 'three five nine'
assert candidate('five zero four seven nine eight') == 'zero four five seven eight nine'
assert candidate('six five four three two one zero') == 'zero one two three four five six'
def test_check():
check(sort_numbers)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
110 | HumanEval_65_circular_shift | def circular_shift(x: int, shift: int) -> str:
"""Circular shift the digits of the integer x, shift the digits right by shift
and return the result as a string.
If shift > number of digits, return digits reversed.
>>> circular_shift(12, 1)
'21'
>>> circular_shift(12, 2)
'12'
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def circular_shift(x: int, shift: int) -> str:
"""Circular shift the digits of the integer x, shift the digits right by shift
and return the result as a string.
If shift > number of digits, return digits reversed.
>>> circular_shift(12, 1)
'21'
>>> circular_shift(12, 2)
'12'
"""
```
| def circular_shift(x: int, shift: int) -> str: | HumanEval_65_circular_shift | py | def circular_shift(x: int, shift: int) -> str:
"""Circular shift the digits of the integer x, shift the digits right by shift
and return the result as a string.
If shift > number of digits, return digits reversed.
>>> circular_shift(12, 1)
'21'
>>> circular_shift(12, 2)
'12'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_65_circular_shift.py | reworded | def check(candidate):
assert candidate(100, 2) == '001'
assert candidate(12, 2) == '12'
assert candidate(97, 8) == '79'
assert candidate(12, 1) == '21'
assert candidate(11, 101) == '11'
def test_check():
check(circular_shift)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
111 | HumanEval_142_sum_squares | from typing import List
def sum_squares(lst: List[int]) -> int:
""""
This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a
multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not
change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.
Examples:
>>> lst
[1, 2, 3]
>>> lst
[]
>>> lst
[-1, -5, 2, -1, -5]
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
from typing import List
def sum_squares(lst: List[int]) -> int:
""""
This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a
multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not
change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.
Examples:
>>> lst
[1, 2, 3]
>>> lst
[]
>>> lst
[-1, -5, 2, -1, -5]
"""
```
| def sum_squares(lst: List[int]) -> int: | HumanEval_142_sum_squares | py | from typing import List
def sum_squares(lst: List[int]) -> int:
""""
This function will take a list of integers. For all entries in the list, the function shall square the integer entry if its index is a
multiple of 3 and will cube the integer entry if its index is a multiple of 4 and not a multiple of 3. The function will not
change the entries in the list whose indexes are not a multiple of 3 or 4. The function shall then return the sum of all entries.
Examples:
>>> lst
[1, 2, 3]
>>> lst
[]
>>> lst
[-1, -5, 2, -1, -5]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_142_sum_squares.py | reworded | def check(candidate):
assert candidate([1, 2, 3]) == 6
assert candidate([1, 4, 9]) == 14
assert candidate([]) == 0
assert candidate([1, 1, 1, 1, 1, 1, 1, 1, 1]) == 9
assert candidate([-1, -1, -1, -1, -1, -1, -1, -1, -1]) == -3
assert candidate([0]) == 0
assert candidate([-1, -5, 2, -1, -5]) == -126
assert candidate([-56, -99, 1, 0, -2]) == 3030
assert candidate([-1, 0, 0, 0, 0, 0, 0, 0, -1]) == 0
assert candidate([-16, -9, -2, 36, 36, 26, -20, 25, -40, 20, -4, 12, -26, 35, 37]) == -14196
assert candidate([-1, -3, 17, -1, -15, 13, -1, 14, -14, -12, -5, 14, -14, 6, 13, 11, 16, 16, 4, 10]) == -1448
def test_check():
check(sum_squares)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
112 | HumanEval_94_skjkasdkd | from typing import List
def skjkasdkd(lst: List[int]) -> int:
"""You are given a list of integers.
You need to find the largest prime value and return the sum of its digits.
Examples:
>>> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
10
>>> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
25
>>> skjkasdkd([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])
13
>>> skjkasdkd([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])
11
>>> skjkasdkd([0, 81, 12, 3, 1, 21])
3
>>> skjkasdkd([0, 8, 1, 2, 1, 7])
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 skjkasdkd(lst: List[int]) -> int:
"""You are given a list of integers.
You need to find the largest prime value and return the sum of its digits.
Examples:
>>> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
10
>>> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
25
>>> skjkasdkd([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])
13
>>> skjkasdkd([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])
11
>>> skjkasdkd([0, 81, 12, 3, 1, 21])
3
>>> skjkasdkd([0, 8, 1, 2, 1, 7])
7
"""
```
| def skjkasdkd(lst: List[int]) -> int: | HumanEval_94_skjkasdkd | py | from typing import List
def skjkasdkd(lst: List[int]) -> int:
"""You are given a list of integers.
You need to find the largest prime value and return the sum of its digits.
Examples:
>>> skjkasdkd([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3])
10
>>> skjkasdkd([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1])
25
>>> skjkasdkd([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3])
13
>>> skjkasdkd([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6])
11
>>> skjkasdkd([0, 81, 12, 3, 1, 21])
3
>>> skjkasdkd([0, 8, 1, 2, 1, 7])
7
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_94_skjkasdkd.py | reworded | def check(candidate):
assert candidate([0, 3, 2, 1, 3, 5, 7, 4, 5, 5, 5, 2, 181, 32, 4, 32, 3, 2, 32, 324, 4, 3]) == 10
assert candidate([1, 0, 1, 8, 2, 4597, 2, 1, 3, 40, 1, 2, 1, 2, 4, 2, 5, 1]) == 25
assert candidate([1, 3, 1, 32, 5107, 34, 83278, 109, 163, 23, 2323, 32, 30, 1, 9, 3]) == 13
assert candidate([0, 724, 32, 71, 99, 32, 6, 0, 5, 91, 83, 0, 5, 6]) == 11
assert candidate([0, 81, 12, 3, 1, 21]) == 3
assert candidate([0, 8, 1, 2, 1, 7]) == 7
assert candidate([8191]) == 19
assert candidate([8191, 123456, 127, 7]) == 19
assert candidate([127, 97, 8192]) == 10
def test_check():
check(skjkasdkd)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
113 | HumanEval_8_sum_product | from typing import List, Tuple
def sum_product(numbers: List[int]) -> Tuple[int, int]:
""" For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
Empty sum should be equal to 0 and empty product should be equal to 1.
>>> sum_product([])
(0, 1)
>>> sum_product([1, 2, 3, 4])
(10, 24)
"""
| 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 sum_product(numbers: List[int]) -> Tuple[int, int]:
""" For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
Empty sum should be equal to 0 and empty product should be equal to 1.
>>> sum_product([])
(0, 1)
>>> sum_product([1, 2, 3, 4])
(10, 24)
"""
```
| def sum_product(numbers: List[int]) -> Tuple[int, int]: | HumanEval_8_sum_product | py | from typing import List, Tuple
def sum_product(numbers: List[int]) -> Tuple[int, int]:
""" For a given list of integers, return a tuple consisting of a sum and a product of all the integers in a list.
Empty sum should be equal to 0 and empty product should be equal to 1.
>>> sum_product([])
(0, 1)
>>> sum_product([1, 2, 3, 4])
(10, 24)
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_8_sum_product.py | reworded | def check(candidate):
assert candidate([]) == (0, 1)
assert candidate([1, 1, 1]) == (3, 1)
assert candidate([100, 0]) == (100, 0)
assert candidate([3, 5, 7]) == (15, 105)
assert candidate([10]) == (10, 10)
def test_check():
check(sum_product)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
114 | HumanEval_102_choose_num | def choose_num(x: int, y: int) -> int:
"""This function takes two positive numbers x and y and returns the
biggest even integer number that is in the range [x, y] inclusive. If
there's no such number, then the function should return -1.
For example:
>>> choose_num(12, 15)
14
>>> choose_num(13, 12)
-1
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def choose_num(x: int, y: int) -> int:
"""This function takes two positive numbers x and y and returns the
biggest even integer number that is in the range [x, y] inclusive. If
there's no such number, then the function should return -1.
For example:
>>> choose_num(12, 15)
14
>>> choose_num(13, 12)
-1
"""
```
| def choose_num(x: int, y: int) -> int: | HumanEval_102_choose_num | py | def choose_num(x: int, y: int) -> int:
"""This function takes two positive numbers x and y and returns the
biggest even integer number that is in the range [x, y] inclusive. If
there's no such number, then the function should return -1.
For example:
>>> choose_num(12, 15)
14
>>> choose_num(13, 12)
-1
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_102_choose_num.py | reworded | def check(candidate):
assert candidate(12, 15) == 14
assert candidate(13, 12) == -1
assert candidate(33, 12354) == 12354
assert candidate(5234, 5233) == -1
assert candidate(6, 29) == 28
assert candidate(27, 10) == -1
assert candidate(7, 7) == -1
assert candidate(546, 546) == 546
def test_check():
check(choose_num)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
115 | HumanEval_136_largest_smallest_integers | from typing import List, Tuple, Optional
def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]:
"""
Create a function that returns a tuple (a, b), where 'a' is
the largest of negative integers, and 'b' is the smallest
of positive integers in a list.
If there is no negative or positive integers, return them as None.
Examples:
>>> largest_smallest_integers([2, 4, 1, 3, 5, 7])
(None, 1)
>>> largest_smallest_integers([])
(None, None)
>>> largest_smallest_integers([0])
(None, None)
"""
| 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, Optional
def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]:
"""
Create a function that returns a tuple (a, b), where 'a' is
the largest of negative integers, and 'b' is the smallest
of positive integers in a list.
If there is no negative or positive integers, return them as None.
Examples:
>>> largest_smallest_integers([2, 4, 1, 3, 5, 7])
(None, 1)
>>> largest_smallest_integers([])
(None, None)
>>> largest_smallest_integers([0])
(None, None)
"""
```
| def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]: | HumanEval_136_largest_smallest_integers | py | from typing import List, Tuple, Optional
def largest_smallest_integers(lst: List[int]) -> Tuple[Optional[int], Optional[int]]:
"""
Create a function that returns a tuple (a, b), where 'a' is
the largest of negative integers, and 'b' is the smallest
of positive integers in a list.
If there is no negative or positive integers, return them as None.
Examples:
>>> largest_smallest_integers([2, 4, 1, 3, 5, 7])
(None, 1)
>>> largest_smallest_integers([])
(None, None)
>>> largest_smallest_integers([0])
(None, None)
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_136_largest_smallest_integers.py | reworded | def check(candidate):
assert candidate([2, 4, 1, 3, 5, 7]) == (None, 1)
assert candidate([2, 4, 1, 3, 5, 7, 0]) == (None, 1)
assert candidate([1, 3, 2, 4, 5, 6, -2]) == (-2, 1)
assert candidate([4, 5, 3, 6, 2, 7, -7]) == (-7, 2)
assert candidate([7, 3, 8, 4, 9, 2, 5, -9]) == (-9, 2)
assert candidate([]) == (None, None)
assert candidate([0]) == (None, None)
assert candidate([-1, -3, -5, -6]) == (-1, None)
assert candidate([-1, -3, -5, -6, 0]) == (-1, None)
assert candidate([-6, -4, -4, -3, 1]) == (-3, 1)
assert candidate([-6, -4, -4, -3, -100, 1]) == (-3, 1)
def test_check():
check(largest_smallest_integers)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
116 | HumanEval_16_count_distinct_characters | def count_distinct_characters(string: str) -> int:
""" Given a string, find out how many distinct characters (regardless of case) does it consist of
>>> count_distinct_characters('xyzXYZ')
3
>>> count_distinct_characters('Jerry')
4
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def count_distinct_characters(string: str) -> int:
""" Given a string, find out how many distinct characters (regardless of case) does it consist of
>>> count_distinct_characters('xyzXYZ')
3
>>> count_distinct_characters('Jerry')
4
"""
```
| def count_distinct_characters(string: str) -> int: | HumanEval_16_count_distinct_characters | py | def count_distinct_characters(string: str) -> int:
""" Given a string, find out how many distinct characters (regardless of case) does it consist of
>>> count_distinct_characters('xyzXYZ')
3
>>> count_distinct_characters('Jerry')
4
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_16_count_distinct_characters.py | reworded | def check(candidate):
assert candidate('') == 0
assert candidate('abcde') == 5
assert candidate('abcdecadeCADE') == 5
assert candidate('aaaaAAAAaaaa') == 1
assert candidate('Jerry jERRY JeRRRY') == 5
def test_check():
check(count_distinct_characters)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
117 | HumanEval_100_make_a_pile | from typing import List
def make_a_pile(n: int) -> List[int]:
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
| 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 make_a_pile(n: int) -> List[int]:
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
```
| def make_a_pile(n: int) -> List[int]: | HumanEval_100_make_a_pile | py | from typing import List
def make_a_pile(n: int) -> List[int]:
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
Examples:
>>> make_a_pile(3)
[3, 5, 7]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_100_make_a_pile.py | reworded | def check(candidate):
assert candidate(3) == [3, 5, 7]
assert candidate(4) == [4, 6, 8, 10]
assert candidate(5) == [5, 7, 9, 11, 13]
assert candidate(6) == [6, 8, 10, 12, 14, 16]
assert candidate(8) == [8, 10, 12, 14, 16, 18, 20, 22]
def test_check():
check(make_a_pile)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
118 | HumanEval_128_prod_signs | from typing import List, Optional
def prod_signs(arr: List[int]) -> Optional[int]:
"""
You are given an array arr of integers and you need to return
sum of magnitudes of integers multiplied by product of all signs
of each number in the array, represented by 1, -1 or 0.
Note: return None for empty arr.
Example:
>>> prod_signs([1, 2, 2, -4])
9
>>> prod_signs([0, 1])
0
>>> prod_signs([])
None
"""
| 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 prod_signs(arr: List[int]) -> Optional[int]:
"""
You are given an array arr of integers and you need to return
sum of magnitudes of integers multiplied by product of all signs
of each number in the array, represented by 1, -1 or 0.
Note: return None for empty arr.
Example:
>>> prod_signs([1, 2, 2, -4])
9
>>> prod_signs([0, 1])
0
>>> prod_signs([])
None
"""
```
| def prod_signs(arr: List[int]) -> Optional[int]: | HumanEval_128_prod_signs | py | from typing import List, Optional
def prod_signs(arr: List[int]) -> Optional[int]:
"""
You are given an array arr of integers and you need to return
sum of magnitudes of integers multiplied by product of all signs
of each number in the array, represented by 1, -1 or 0.
Note: return None for empty arr.
Example:
>>> prod_signs([1, 2, 2, -4])
9
>>> prod_signs([0, 1])
0
>>> prod_signs([])
None
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_128_prod_signs.py | reworded | def check(candidate):
assert candidate([1, 2, 2, -4]) == -9
assert candidate([0, 1]) == 0
assert candidate([1, 1, 1, 2, 3, -1, 1]) == -10
assert candidate([]) == None
assert candidate([2, 4, 1, 2, -1, -1, 9]) == 20
assert candidate([-1, 1, -1, 1]) == 4
assert candidate([-1, 1, 1, 1]) == -4
assert candidate([-1, 1, 1, 0]) == 0
def test_check():
check(prod_signs)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
119 | HumanEval_114_minSubArraySum | from typing import List
def minSubArraySum(nums: List[int]) -> int:
"""
Given an array of integers nums, find the minimum sum of any non-empty sub-array
of nums.
Example
>>> minSubArraySum([2, 3, 4, 1, 2, 4])
1
>>> minSubArraySum([-1, -2, -3])
-6
"""
| 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 minSubArraySum(nums: List[int]) -> int:
"""
Given an array of integers nums, find the minimum sum of any non-empty sub-array
of nums.
Example
>>> minSubArraySum([2, 3, 4, 1, 2, 4])
1
>>> minSubArraySum([-1, -2, -3])
-6
"""
```
| def minSubArraySum(nums: List[int]) -> int: | HumanEval_114_minSubArraySum | py | from typing import List
def minSubArraySum(nums: List[int]) -> int:
"""
Given an array of integers nums, find the minimum sum of any non-empty sub-array
of nums.
Example
>>> minSubArraySum([2, 3, 4, 1, 2, 4])
1
>>> minSubArraySum([-1, -2, -3])
-6
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_114_minSubArraySum.py | reworded | def check(candidate):
assert candidate([2, 3, 4, 1, 2, 4]) == 1
assert candidate([-1, -2, -3]) == -6
assert candidate([-1, -2, -3, 2, -10]) == -14
assert candidate([-9999999999999999]) == -9999999999999999
assert candidate([0, 10, 20, 1000000]) == 0
assert candidate([-1, -2, -3, 10, -5]) == -6
assert candidate([100, -1, -2, -3, 10, -5]) == -6
assert candidate([10, 11, 13, 8, 3, 4]) == 3
assert candidate([100, -33, 32, -1, 0, -2]) == -33
assert candidate([-10]) == -10
assert candidate([7]) == 7
assert candidate([1, -1]) == -1
def test_check():
check(minSubArraySum)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
120 | HumanEval_15_string_sequence | def string_sequence(n: int) -> str:
""" Return a string containing space-delimited numbers starting from 0 upto n inclusive.
>>> string_sequence(0)
'0'
>>> string_sequence(5)
'0 1 2 3 4 5'
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def string_sequence(n: int) -> str:
""" Return a string containing space-delimited numbers starting from 0 upto n inclusive.
>>> string_sequence(0)
'0'
>>> string_sequence(5)
'0 1 2 3 4 5'
"""
```
| def string_sequence(n: int) -> str: | HumanEval_15_string_sequence | py | def string_sequence(n: int) -> str:
""" Return a string containing space-delimited numbers starting from 0 upto n inclusive.
>>> string_sequence(0)
'0'
>>> string_sequence(5)
'0 1 2 3 4 5'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_15_string_sequence.py | reworded | def check(candidate):
assert candidate(0) == '0'
assert candidate(3) == '0 1 2 3'
assert candidate(10) == '0 1 2 3 4 5 6 7 8 9 10'
def test_check():
check(string_sequence)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
121 | HumanEval_154_cycpattern_check | def cycpattern_check(a: str, b: str) -> bool:
"""You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word
>>> cycpattern_check('abcd', 'abd')
False
>>> cycpattern_check('hello', 'ell')
True
>>> cycpattern_check('whassup', 'psus')
False
>>> cycpattern_check('abab', 'baa')
True
>>> cycpattern_check('efef', 'eeff')
False
>>> cycpattern_check('himenss', 'simen')
True
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def cycpattern_check(a: str, b: str) -> bool:
"""You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word
>>> cycpattern_check('abcd', 'abd')
False
>>> cycpattern_check('hello', 'ell')
True
>>> cycpattern_check('whassup', 'psus')
False
>>> cycpattern_check('abab', 'baa')
True
>>> cycpattern_check('efef', 'eeff')
False
>>> cycpattern_check('himenss', 'simen')
True
"""
```
| def cycpattern_check(a: str, b: str) -> bool: | HumanEval_154_cycpattern_check | py | def cycpattern_check(a: str, b: str) -> bool:
"""You are given 2 words. You need to return True if the second word or any of its rotations is a substring in the first word
>>> cycpattern_check('abcd', 'abd')
False
>>> cycpattern_check('hello', 'ell')
True
>>> cycpattern_check('whassup', 'psus')
False
>>> cycpattern_check('abab', 'baa')
True
>>> cycpattern_check('efef', 'eeff')
False
>>> cycpattern_check('himenss', 'simen')
True
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_154_cycpattern_check.py | reworded | def check(candidate):
assert candidate('xyzw', 'xyw') == False
assert candidate('yello', 'ell') == True
assert candidate('whattup', 'ptut') == False
assert candidate('efef', 'fee') == True
assert candidate('abab', 'aabb') == False
assert candidate('winemtt', 'tinem') == True
def test_check():
check(cycpattern_check)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
122 | HumanEval_57_monotonic | from typing import List
def monotonic(l: List[int]) -> bool:
"""Return True is list elements are monotonically increasing or decreasing.
>>> monotonic([1, 2, 4, 20])
True
>>> monotonic([1, 20, 4, 10])
False
>>> monotonic([4, 1, 0, -10])
True
"""
| 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 monotonic(l: List[int]) -> bool:
"""Return True is list elements are monotonically increasing or decreasing.
>>> monotonic([1, 2, 4, 20])
True
>>> monotonic([1, 20, 4, 10])
False
>>> monotonic([4, 1, 0, -10])
True
"""
```
| def monotonic(l: List[int]) -> bool: | HumanEval_57_monotonic | py | from typing import List
def monotonic(l: List[int]) -> bool:
"""Return True is list elements are monotonically increasing or decreasing.
>>> monotonic([1, 2, 4, 20])
True
>>> monotonic([1, 20, 4, 10])
False
>>> monotonic([4, 1, 0, -10])
True
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_57_monotonic.py | reworded | def check(candidate):
assert candidate([1, 2, 4, 10]) == True
assert candidate([1, 2, 4, 20]) == True
assert candidate([1, 20, 4, 10]) == False
assert candidate([4, 1, 0, -10]) == True
assert candidate([4, 1, 1, 0]) == True
assert candidate([1, 2, 3, 2, 5, 60]) == False
assert candidate([1, 2, 3, 4, 5, 60]) == True
assert candidate([9, 9, 9, 9]) == True
def test_check():
check(monotonic)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
123 | HumanEval_12_longest | from typing import List, Optional
def longest(strings: List[str]) -> Optional[str]:
""" Out of list of strings, return the longest one. Return the first one in case of multiple
strings of the same length. Return None in case the input list is empty.
>>> longest([])
None
>>> longest(['a', 'b', 'c'])
'a'
>>> longest(['a', 'bb', 'ccc'])
'ccc'
"""
| 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 longest(strings: List[str]) -> Optional[str]:
""" Out of list of strings, return the longest one. Return the first one in case of multiple
strings of the same length. Return None in case the input list is empty.
>>> longest([])
None
>>> longest(['a', 'b', 'c'])
'a'
>>> longest(['a', 'bb', 'ccc'])
'ccc'
"""
```
| def longest(strings: List[str]) -> Optional[str]: | HumanEval_12_longest | py | from typing import List, Optional
def longest(strings: List[str]) -> Optional[str]:
""" Out of list of strings, return the longest one. Return the first one in case of multiple
strings of the same length. Return None in case the input list is empty.
>>> longest([])
None
>>> longest(['a', 'b', 'c'])
'a'
>>> longest(['a', 'bb', 'ccc'])
'ccc'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_12_longest.py | reworded | def check(candidate):
assert candidate([]) == None
assert candidate(['x', 'y', 'z']) == 'x'
assert candidate(['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']) == 'zzzz'
def test_check():
check(longest)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
124 | HumanEval_52_below_threshold | from typing import List
def below_threshold(l: List[int], t: int) -> bool:
"""Return True if all numbers in the list l are below threshold t.
>>> below_threshold([1, 2, 4, 10], 100)
True
>>> below_threshold([1, 20, 4, 10], 5)
False
"""
| 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 below_threshold(l: List[int], t: int) -> bool:
"""Return True if all numbers in the list l are below threshold t.
>>> below_threshold([1, 2, 4, 10], 100)
True
>>> below_threshold([1, 20, 4, 10], 5)
False
"""
```
| def below_threshold(l: List[int], t: int) -> bool: | HumanEval_52_below_threshold | py | from typing import List
def below_threshold(l: List[int], t: int) -> bool:
"""Return True if all numbers in the list l are below threshold t.
>>> below_threshold([1, 2, 4, 10], 100)
True
>>> below_threshold([1, 20, 4, 10], 5)
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_52_below_threshold.py | reworded | def check(candidate):
assert candidate([1, 2, 4, 10], 100) == True
assert candidate([1, 20, 4, 10], 5) == False
assert candidate([1, 20, 4, 10], 21) == True
assert candidate([1, 20, 4, 10], 22) == True
assert candidate([1, 8, 4, 10], 11) == True
assert candidate([1, 8, 4, 10], 10) == False
def test_check():
check(below_threshold)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
125 | HumanEval_75_is_multiply_prime | def is_multiply_prime(a: int) -> bool:
"""Write a function that returns true if the given number is the multiplication of 3 prime numbers
and false otherwise.
Knowing that (a) is less then 100.
Example:
>>> is_multiply_prime(30)
True
30 = 2 * 3 * 5
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def is_multiply_prime(a: int) -> bool:
"""Write a function that returns true if the given number is the multiplication of 3 prime numbers
and false otherwise.
Knowing that (a) is less then 100.
Example:
>>> is_multiply_prime(30)
True
30 = 2 * 3 * 5
"""
```
| def is_multiply_prime(a: int) -> bool: | HumanEval_75_is_multiply_prime | py | def is_multiply_prime(a: int) -> bool:
"""Write a function that returns true if the given number is the multiplication of 3 prime numbers
and false otherwise.
Knowing that (a) is less then 100.
Example:
>>> is_multiply_prime(30)
True
30 = 2 * 3 * 5
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_75_is_multiply_prime.py | reworded | def check(candidate):
assert candidate(5) == False
assert candidate(30) == True
assert candidate(8) == True
assert candidate(10) == False
assert candidate(125) == True
assert candidate(105) == True
assert candidate(126) == False
assert candidate(729) == False
assert candidate(891) == False
assert candidate(1001) == True
def test_check():
check(is_multiply_prime)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
126 | HumanEval_30_get_positive | from typing import List
def get_positive(l: List[int]) -> List[int]:
"""Return only positive numbers in the list.
>>> get_positive([-1, 2, -4, 5, 6])
[2, 5, 6]
>>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
[5, 3, 2, 3, 9, 123, 1]
"""
| 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 get_positive(l: List[int]) -> List[int]:
"""Return only positive numbers in the list.
>>> get_positive([-1, 2, -4, 5, 6])
[2, 5, 6]
>>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
[5, 3, 2, 3, 9, 123, 1]
"""
```
| def get_positive(l: List[int]) -> List[int]: | HumanEval_30_get_positive | py | from typing import List
def get_positive(l: List[int]) -> List[int]:
"""Return only positive numbers in the list.
>>> get_positive([-1, 2, -4, 5, 6])
[2, 5, 6]
>>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])
[5, 3, 2, 3, 9, 123, 1]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_30_get_positive.py | reworded | def check(candidate):
assert candidate([-1, -2, 4, 5, 6]) == [4, 5, 6]
assert candidate([5, 3, -5, 2, 3, 3, 9, 0, 123, 1, -10]) == [5, 3, 2, 3, 3, 9, 123, 1]
assert candidate([-1, -2]) == []
assert candidate([]) == []
def test_check():
check(get_positive)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
127 | HumanEval_33_sort_third | from typing import List
def sort_third(l: List[int]) -> List[int]:
"""This function takes a list l and returns a list l' such that
l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
to the values of the corresponding indicies of l, but sorted.
>>> sort_third([1, 2, 3])
[1, 2, 3]
>>> sort_third([5, 6, 3, 4, 8, 9, 2])
[2, 6, 3, 4, 8, 9, 5]
"""
| 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_third(l: List[int]) -> List[int]:
"""This function takes a list l and returns a list l' such that
l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
to the values of the corresponding indicies of l, but sorted.
>>> sort_third([1, 2, 3])
[1, 2, 3]
>>> sort_third([5, 6, 3, 4, 8, 9, 2])
[2, 6, 3, 4, 8, 9, 5]
"""
```
| def sort_third(l: List[int]) -> List[int]: | HumanEval_33_sort_third | py | from typing import List
def sort_third(l: List[int]) -> List[int]:
"""This function takes a list l and returns a list l' such that
l' is identical to l in the indicies that are not divisible by three, while its values at the indicies that are divisible by three are equal
to the values of the corresponding indicies of l, but sorted.
>>> sort_third([1, 2, 3])
[1, 2, 3]
>>> sort_third([5, 6, 3, 4, 8, 9, 2])
[2, 6, 3, 4, 8, 9, 5]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_33_sort_third.py | reworded | def check(candidate):
assert candidate([5, 6, 3, 4, 8, 9, 2]) == [2, 6, 3, 4, 8, 9, 5]
assert candidate([5, 8, 3, 4, 6, 9, 2]) == [2, 8, 3, 4, 6, 9, 5]
assert candidate([5, 6, 9, 4, 8, 3, 2]) == [2, 6, 9, 4, 8, 3, 5]
assert candidate([5, 6, 3, 4, 8, 9, 2, 1]) == [2, 6, 3, 4, 8, 9, 5, 1]
def test_check():
check(sort_third)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
128 | HumanEval_6_parse_nested_parens | from typing import List
def parse_nested_parens(paren_string: str) -> List[int]:
""" Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
For each of the group, output the deepest level of nesting of parentheses.
E.g. (()()) has maximum two levels of nesting while ((())) has three.
>>> parse_nested_parens('(()()) ((())) () ((())()())')
[2, 3, 1, 3]
"""
| 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_nested_parens(paren_string: str) -> List[int]:
""" Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
For each of the group, output the deepest level of nesting of parentheses.
E.g. (()()) has maximum two levels of nesting while ((())) has three.
>>> parse_nested_parens('(()()) ((())) () ((())()())')
[2, 3, 1, 3]
"""
```
| def parse_nested_parens(paren_string: str) -> List[int]: | HumanEval_6_parse_nested_parens | py | from typing import List
def parse_nested_parens(paren_string: str) -> List[int]:
""" Input to this function is a string represented multiple groups for nested parentheses separated by spaces.
For each of the group, output the deepest level of nesting of parentheses.
E.g. (()()) has maximum two levels of nesting while ((())) has three.
>>> parse_nested_parens('(()()) ((())) () ((())()())')
[2, 3, 1, 3]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_6_parse_nested_parens.py | reworded | def check(candidate):
assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3]
assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4]
assert candidate('(()(())((())))') == [4]
def test_check():
check(parse_nested_parens)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
129 | HumanEval_45_triangle_area | def triangle_area(a: int, h: int) -> float:
"""Given length of a side and high return area for a triangle.
>>> triangle_area(5, 3)
7.5
"""
| 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, h: int) -> float:
"""Given length of a side and high return area for a triangle.
>>> triangle_area(5, 3)
7.5
"""
```
| def triangle_area(a: int, h: int) -> float: | HumanEval_45_triangle_area | py | def triangle_area(a: int, h: int) -> float:
"""Given length of a side and high return area for a triangle.
>>> triangle_area(5, 3)
7.5
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_45_triangle_area.py | reworded | def check(candidate):
assert candidate(5, 3) == 7.5
assert candidate(2, 2) == 2.0
assert candidate(10, 8) == 40.0
def test_check():
check(triangle_area)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
130 | HumanEval_97_multiply | def multiply(a: int, b: int) -> int:
"""Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
>>> multiply(148, 412)
16
>>> multiply(19, 28)
72
>>> multiply(2020, 1851)
0
>>> multiply(14, -15)
20
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def multiply(a: int, b: int) -> int:
"""Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
>>> multiply(148, 412)
16
>>> multiply(19, 28)
72
>>> multiply(2020, 1851)
0
>>> multiply(14, -15)
20
"""
```
| def multiply(a: int, b: int) -> int: | HumanEval_97_multiply | py | def multiply(a: int, b: int) -> int:
"""Complete the function that takes two integers and returns
the product of their unit digits.
Assume the input is always valid.
Examples:
>>> multiply(148, 412)
16
>>> multiply(19, 28)
72
>>> multiply(2020, 1851)
0
>>> multiply(14, -15)
20
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_97_multiply.py | reworded | def check(candidate):
assert candidate(148, 412) == 16
assert candidate(19, 28) == 72
assert candidate(2020, 1851) == 0
assert candidate(14, -15) == 20
assert candidate(76, 67) == 42
assert candidate(17, 27) == 49
assert candidate(0, 1) == 0
assert candidate(0, 0) == 0
def test_check():
check(multiply)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
131 | HumanEval_4_mean_absolute_deviation | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
""" For a given list of input numbers, calculate Mean Absolute Deviation
around the mean of this dataset.
Mean Absolute Deviation is the average absolute difference between each
element and a centerpoint (mean in this case):
MAD = average | x - x_mean |
>>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])
1.0
"""
| 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 mean_absolute_deviation(numbers: List[float]) -> float:
""" For a given list of input numbers, calculate Mean Absolute Deviation
around the mean of this dataset.
Mean Absolute Deviation is the average absolute difference between each
element and a centerpoint (mean in this case):
MAD = average | x - x_mean |
>>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])
1.0
"""
```
| def mean_absolute_deviation(numbers: List[float]) -> float: | HumanEval_4_mean_absolute_deviation | py | from typing import List
def mean_absolute_deviation(numbers: List[float]) -> float:
""" For a given list of input numbers, calculate Mean Absolute Deviation
around the mean of this dataset.
Mean Absolute Deviation is the average absolute difference between each
element and a centerpoint (mean in this case):
MAD = average | x - x_mean |
>>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0])
1.0
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_4_mean_absolute_deviation.py | reworded | def check(candidate):
assert candidate([1.0, 2.0]) == 0.5
assert candidate([1.0, 2.0, 3.0, 4.0]) == 1.0
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == 1.2
def test_check():
check(mean_absolute_deviation)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
132 | HumanEval_58_common | from typing import List
def common(l1: List[int], l2: List[int]) -> List[int]:
"""Return sorted unique common elements for two lists.
>>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
[1, 5, 653]
>>> common([5, 3, 2, 8], [3, 2])
[2, 3]
"""
| 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 common(l1: List[int], l2: List[int]) -> List[int]:
"""Return sorted unique common elements for two lists.
>>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
[1, 5, 653]
>>> common([5, 3, 2, 8], [3, 2])
[2, 3]
"""
```
| def common(l1: List[int], l2: List[int]) -> List[int]: | HumanEval_58_common | py | from typing import List
def common(l1: List[int], l2: List[int]) -> List[int]:
"""Return sorted unique common elements for two lists.
>>> common([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121])
[1, 5, 653]
>>> common([5, 3, 2, 8], [3, 2])
[2, 3]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_58_common.py | reworded | def check(candidate):
assert candidate([1, 4, 3, 34, 653, 2, 5], [5, 7, 1, 5, 9, 653, 121]) == [1, 5, 653]
assert candidate([5, 3, 2, 8], [3, 2]) == [2, 3]
assert candidate([4, 3, 2, 8], [3, 2, 4]) == [2, 3, 4]
assert candidate([4, 3, 2, 8], []) == []
def test_check():
check(common)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
133 | HumanEval_156_int_to_mini_roman | def int_to_mini_roman(number: int) -> str:
"""
Given a positive integer, obtain its roman numeral equivalent as a string,
and return it in lowercase.
Restrictions: 1 <= num <= 1000
Examples:
>>> int_to_mini_roman(19)
'xix'
>>> int_to_mini_roman(152)
'clii'
>>> int_to_mini_roman(426)
'cdxxvi'
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def int_to_mini_roman(number: int) -> str:
"""
Given a positive integer, obtain its roman numeral equivalent as a string,
and return it in lowercase.
Restrictions: 1 <= num <= 1000
Examples:
>>> int_to_mini_roman(19)
'xix'
>>> int_to_mini_roman(152)
'clii'
>>> int_to_mini_roman(426)
'cdxxvi'
"""
```
| def int_to_mini_roman(number: int) -> str: | HumanEval_156_int_to_mini_roman | py | def int_to_mini_roman(number: int) -> str:
"""
Given a positive integer, obtain its roman numeral equivalent as a string,
and return it in lowercase.
Restrictions: 1 <= num <= 1000
Examples:
>>> int_to_mini_roman(19)
'xix'
>>> int_to_mini_roman(152)
'clii'
>>> int_to_mini_roman(426)
'cdxxvi'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_156_int_to_mini_roman.py | reworded | def check(candidate):
assert candidate(19) == 'xix'
assert candidate(152) == 'clii'
assert candidate(251) == 'ccli'
assert candidate(426) == 'cdxxvi'
assert candidate(500) == 'd'
assert candidate(1) == 'i'
assert candidate(4) == 'iv'
assert candidate(43) == 'xliii'
assert candidate(90) == 'xc'
assert candidate(94) == 'xciv'
assert candidate(532) == 'dxxxii'
assert candidate(900) == 'cm'
assert candidate(994) == 'cmxciv'
assert candidate(1000) == 'm'
def test_check():
check(int_to_mini_roman)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
134 | HumanEval_67_fruit_distribution | def fruit_distribution(s: str, n: int) -> int:
"""
In this task, you will be given a string that represents a number of apples and oranges
that are distributed in a basket of fruit this basket contains
apples, oranges, and mango fruits. Given the string that represents the total number of
the oranges and apples and an integer that represent the total number of the fruits
in the basket return the number of the mango fruits in the basket.
for examble:
>>> fruit_distribution('5 apples and 6 oranges', 19)
8
>>> fruit_distribution('0 apples and 1 oranges', 3)
2
>>> fruit_distribution('2 apples and 3 oranges', 100)
95
>>> fruit_distribution('100 apples and 1 oranges', 120)
19
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def fruit_distribution(s: str, n: int) -> int:
"""
In this task, you will be given a string that represents a number of apples and oranges
that are distributed in a basket of fruit this basket contains
apples, oranges, and mango fruits. Given the string that represents the total number of
the oranges and apples and an integer that represent the total number of the fruits
in the basket return the number of the mango fruits in the basket.
for examble:
>>> fruit_distribution('5 apples and 6 oranges', 19)
8
>>> fruit_distribution('0 apples and 1 oranges', 3)
2
>>> fruit_distribution('2 apples and 3 oranges', 100)
95
>>> fruit_distribution('100 apples and 1 oranges', 120)
19
"""
```
| def fruit_distribution(s: str, n: int) -> int: | HumanEval_67_fruit_distribution | py | def fruit_distribution(s: str, n: int) -> int:
"""
In this task, you will be given a string that represents a number of apples and oranges
that are distributed in a basket of fruit this basket contains
apples, oranges, and mango fruits. Given the string that represents the total number of
the oranges and apples and an integer that represent the total number of the fruits
in the basket return the number of the mango fruits in the basket.
for examble:
>>> fruit_distribution('5 apples and 6 oranges', 19)
8
>>> fruit_distribution('0 apples and 1 oranges', 3)
2
>>> fruit_distribution('2 apples and 3 oranges', 100)
95
>>> fruit_distribution('100 apples and 1 oranges', 120)
19
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_67_fruit_distribution.py | reworded | def check(candidate):
assert candidate('5 apples and 6 oranges', 19) == 8
assert candidate('5 apples and 6 oranges', 21) == 10
assert candidate('0 apples and 1 oranges', 3) == 2
assert candidate('1 apples and 0 oranges', 3) == 2
assert candidate('2 apples and 3 oranges', 100) == 95
assert candidate('2 apples and 3 oranges', 5) == 0
assert candidate('1 apples and 100 oranges', 120) == 19
def test_check():
check(fruit_distribution)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
135 | HumanEval_112_reverse_delete | from typing import Tuple
def reverse_delete(s: str, c: str) -> Tuple[str, bool]:
"""Task
We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
then check if the result string is palindrome.
A string is called palindrome if it reads the same backward as forward.
You should return a tuple containing the result string and True/False for the check.
Example
>>> reverse_delete('abcde', 'ae')
('bcd', False)
>>> reverse_delete('abcdef', 'b')
('acdef', False)
>>> reverse_delete('abcdedcba', 'ab')
('cdedc', 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 Tuple
def reverse_delete(s: str, c: str) -> Tuple[str, bool]:
"""Task
We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
then check if the result string is palindrome.
A string is called palindrome if it reads the same backward as forward.
You should return a tuple containing the result string and True/False for the check.
Example
>>> reverse_delete('abcde', 'ae')
('bcd', False)
>>> reverse_delete('abcdef', 'b')
('acdef', False)
>>> reverse_delete('abcdedcba', 'ab')
('cdedc', True)
"""
```
| def reverse_delete(s: str, c: str) -> Tuple[str, bool]: | HumanEval_112_reverse_delete | py | from typing import Tuple
def reverse_delete(s: str, c: str) -> Tuple[str, bool]:
"""Task
We are given two strings s and c, you have to deleted all the characters in s that are equal to any character in c
then check if the result string is palindrome.
A string is called palindrome if it reads the same backward as forward.
You should return a tuple containing the result string and True/False for the check.
Example
>>> reverse_delete('abcde', 'ae')
('bcd', False)
>>> reverse_delete('abcdef', 'b')
('acdef', False)
>>> reverse_delete('abcdedcba', 'ab')
('cdedc', True)
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_112_reverse_delete.py | reworded | def check(candidate):
assert candidate('abcde', 'ae') == ('bcd', False)
assert candidate('abcdef', 'b') == ('acdef', False)
assert candidate('abcdedcba', 'ab') == ('cdedc', True)
assert candidate('dwik', 'w') == ('dik', False)
assert candidate('a', 'a') == ('', True)
assert candidate('abcdedcba', '') == ('abcdedcba', True)
assert candidate('abcdedcba', 'v') == ('abcdedcba', True)
assert candidate('vabba', 'v') == ('abba', True)
assert candidate('mamma', 'mia') == ('', True)
def test_check():
check(reverse_delete)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
136 | HumanEval_13_greatest_common_divisor | def greatest_common_divisor(a: int, b: int) -> int:
""" Return a greatest common divisor of two integers a and b
>>> greatest_common_divisor(3, 5)
1
>>> greatest_common_divisor(25, 15)
5
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def greatest_common_divisor(a: int, b: int) -> int:
""" Return a greatest common divisor of two integers a and b
>>> greatest_common_divisor(3, 5)
1
>>> greatest_common_divisor(25, 15)
5
"""
```
| def greatest_common_divisor(a: int, b: int) -> int: | HumanEval_13_greatest_common_divisor | py | def greatest_common_divisor(a: int, b: int) -> int:
""" Return a greatest common divisor of two integers a and b
>>> greatest_common_divisor(3, 5)
1
>>> greatest_common_divisor(25, 15)
5
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_13_greatest_common_divisor.py | reworded | def check(candidate):
assert candidate(3, 7) == 1
assert candidate(10, 15) == 5
assert candidate(49, 14) == 7
assert candidate(144, 60) == 12
def test_check():
check(greatest_common_divisor)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
137 | HumanEval_125_split_words | from typing import Union, List
def split_words(txt: str) -> Union[List[str], int]:
"""
Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you
should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
Examples
>>> split_words('Hello world!')
['Hello', 'world!']
>>> split_words('Hello,world!')
['Hello', 'world!']
>>> split_words('abcdef')
3
"""
| 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, List
def split_words(txt: str) -> Union[List[str], int]:
"""
Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you
should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
Examples
>>> split_words('Hello world!')
['Hello', 'world!']
>>> split_words('Hello,world!')
['Hello', 'world!']
>>> split_words('abcdef')
3
"""
```
| def split_words(txt: str) -> Union[List[str], int]: | HumanEval_125_split_words | py | from typing import Union, List
def split_words(txt: str) -> Union[List[str], int]:
"""
Given a string of words, return a list of words split on whitespace, if no whitespaces exists in the text you
should split on commas ',' if no commas exists you should return the number of lower-case letters with odd order in the
alphabet, ord('a') = 0, ord('b') = 1, ... ord('z') = 25
Examples
>>> split_words('Hello world!')
['Hello', 'world!']
>>> split_words('Hello,world!')
['Hello', 'world!']
>>> split_words('abcdef')
3
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_125_split_words.py | reworded | def check(candidate):
assert candidate('Hello world!') == ['Hello', 'world!']
assert candidate('Hello,world!') == ['Hello', 'world!']
assert candidate('Hello world,!') == ['Hello', 'world,!']
assert candidate('Hello,Hello,world !') == ['Hello,Hello,world', '!']
assert candidate('abcdef') == 3
assert candidate('aaabb') == 2
assert candidate('aaaBb') == 1
assert candidate('') == 0
def test_check():
check(split_words)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
138 | HumanEval_116_sort_array | from typing import List
def sort_array(arr: List[int]) -> List[int]:
"""
In this Kata, you have to sort an array of non-negative integers according to
number of ones in their binary representation in ascending order.
For similar number of ones, sort based on decimal value.
It must be implemented like this:
>>> sort_array([1, 5, 2, 3, 4])
[1, 2, 3, 4, 5]
>>> sort_array([-2, -3, -4, -5, -6])
[-6, -5, -4, -3, -2]
>>> sort_array([1, 0, 2, 3, 4])
[0, 1, 2, 3, 4]
"""
| 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(arr: List[int]) -> List[int]:
"""
In this Kata, you have to sort an array of non-negative integers according to
number of ones in their binary representation in ascending order.
For similar number of ones, sort based on decimal value.
It must be implemented like this:
>>> sort_array([1, 5, 2, 3, 4])
[1, 2, 3, 4, 5]
>>> sort_array([-2, -3, -4, -5, -6])
[-6, -5, -4, -3, -2]
>>> sort_array([1, 0, 2, 3, 4])
[0, 1, 2, 3, 4]
"""
```
| def sort_array(arr: List[int]) -> List[int]: | HumanEval_116_sort_array | py | from typing import List
def sort_array(arr: List[int]) -> List[int]:
"""
In this Kata, you have to sort an array of non-negative integers according to
number of ones in their binary representation in ascending order.
For similar number of ones, sort based on decimal value.
It must be implemented like this:
>>> sort_array([1, 5, 2, 3, 4])
[1, 2, 3, 4, 5]
>>> sort_array([-2, -3, -4, -5, -6])
[-6, -5, -4, -3, -2]
>>> sort_array([1, 0, 2, 3, 4])
[0, 1, 2, 3, 4]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_116_sort_array.py | reworded | def check(candidate):
assert candidate([1, 5, 2, 3, 4]) == [1, 2, 4, 3, 5]
assert candidate([-2, -3, -4, -5, -6]) == [-4, -2, -6, -5, -3]
assert candidate([1, 0, 2, 3, 4]) == [0, 1, 2, 4, 3]
assert candidate([]) == []
assert candidate([2, 5, 77, 4, 5, 3, 5, 7, 2, 3, 4]) == [2, 2, 4, 4, 3, 3, 5, 5, 5, 7, 77]
assert candidate([3, 6, 44, 12, 32, 5]) == [32, 3, 5, 6, 12, 44]
assert candidate([2, 4, 8, 16, 32]) == [2, 4, 8, 16, 32]
assert candidate([2, 4, 8, 16, 32]) == [2, 4, 8, 16, 32]
def test_check():
check(sort_array)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
139 | HumanEval_28_concatenate | from typing import List
def concatenate(strings: List[str]) -> str:
""" Concatenate list of strings into a single string
>>> concatenate([])
''
>>> concatenate(['a', 'b', 'c'])
'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 concatenate(strings: List[str]) -> str:
""" Concatenate list of strings into a single string
>>> concatenate([])
''
>>> concatenate(['a', 'b', 'c'])
'abc'
"""
```
| def concatenate(strings: List[str]) -> str: | HumanEval_28_concatenate | py | from typing import List
def concatenate(strings: List[str]) -> str:
""" Concatenate list of strings into a single string
>>> concatenate([])
''
>>> concatenate(['a', 'b', 'c'])
'abc'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_28_concatenate.py | reworded | def check(candidate):
assert candidate([]) == ''
assert candidate(['x', 'y', 'z']) == 'xyz'
assert candidate(['x', 'y', 'z', 'w', 'k']) == 'xyzwk'
def test_check():
check(concatenate)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
140 | HumanEval_149_sorted_list_sum | from typing import List
def sorted_list_sum(lst: List[str]) -> List[str]:
"""Write a function that accepts a list of strings as a parameter,
deletes the strings that have odd lengths from it,
and returns the resulted list with a sorted order,
The list is always a list of strings and never an array of numbers,
and it may contain duplicates.
The order of the list should be ascending by length of each word, and you
should return the list sorted by that rule.
If two words have the same length, sort the list alphabetically.
The function should return a list of strings in sorted order.
You may assume that all words will have the same length.
For example:
>>> list_sort(['aa', 'a', 'aaa'])
['aa']
>>> list_sort(['ab', 'a', 'aaa', 'cd'])
['ab', 'cd']
"""
| 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 sorted_list_sum(lst: List[str]) -> List[str]:
"""Write a function that accepts a list of strings as a parameter,
deletes the strings that have odd lengths from it,
and returns the resulted list with a sorted order,
The list is always a list of strings and never an array of numbers,
and it may contain duplicates.
The order of the list should be ascending by length of each word, and you
should return the list sorted by that rule.
If two words have the same length, sort the list alphabetically.
The function should return a list of strings in sorted order.
You may assume that all words will have the same length.
For example:
>>> list_sort(['aa', 'a', 'aaa'])
['aa']
>>> list_sort(['ab', 'a', 'aaa', 'cd'])
['ab', 'cd']
"""
```
| def sorted_list_sum(lst: List[str]) -> List[str]: | HumanEval_149_sorted_list_sum | py | from typing import List
def sorted_list_sum(lst: List[str]) -> List[str]:
"""Write a function that accepts a list of strings as a parameter,
deletes the strings that have odd lengths from it,
and returns the resulted list with a sorted order,
The list is always a list of strings and never an array of numbers,
and it may contain duplicates.
The order of the list should be ascending by length of each word, and you
should return the list sorted by that rule.
If two words have the same length, sort the list alphabetically.
The function should return a list of strings in sorted order.
You may assume that all words will have the same length.
For example:
>>> list_sort(['aa', 'a', 'aaa'])
['aa']
>>> list_sort(['ab', 'a', 'aaa', 'cd'])
['ab', 'cd']
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_149_sorted_list_sum.py | reworded | def check(candidate):
assert candidate(['aa', 'a', 'aaa']) == ['aa']
assert candidate(['school', 'AI', 'asdf', 'b']) == ['AI', 'asdf', 'school']
assert candidate(['d', 'b', 'c', 'a']) == []
assert candidate(['d', 'dcba', 'abcd', 'a']) == ['abcd', 'dcba']
assert candidate(['AI', 'ai', 'au']) == ['AI', 'ai', 'au']
assert candidate(['a', 'b', 'b', 'c', 'c', 'a']) == []
assert candidate(['aaaa', 'bbbb', 'dd', 'cc']) == ['cc', 'dd', 'aaaa', 'bbbb']
def test_check():
check(sorted_list_sum)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
141 | HumanEval_7_filter_by_substring | from typing import List
def filter_by_substring(strings: List[str], substring: str) -> List[str]:
""" Filter an input list of strings only for ones that contain given substring
>>> filter_by_substring([], 'a')
[]
>>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')
['abc', 'bacd', 'array']
"""
| 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_substring(strings: List[str], substring: str) -> List[str]:
""" Filter an input list of strings only for ones that contain given substring
>>> filter_by_substring([], 'a')
[]
>>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')
['abc', 'bacd', 'array']
"""
```
| def filter_by_substring(strings: List[str], substring: str) -> List[str]: | HumanEval_7_filter_by_substring | py | from typing import List
def filter_by_substring(strings: List[str], substring: str) -> List[str]:
""" Filter an input list of strings only for ones that contain given substring
>>> filter_by_substring([], 'a')
[]
>>> filter_by_substring(['abc', 'bacd', 'cde', 'array'], 'a')
['abc', 'bacd', 'array']
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_7_filter_by_substring.py | reworded | def check(candidate):
assert candidate([], 'john') == []
assert candidate(['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx') == ['xxx', 'xxxAAA', 'xxx']
assert candidate(['xxx', 'asd', 'aaaxxy', 'john doe', 'xxxAAA', 'xxx'], 'xx') == ['xxx', 'aaaxxy', 'xxxAAA', 'xxx']
assert candidate(['grunt', 'trumpet', 'prune', 'gruesome'], 'run') == ['grunt', 'prune']
def test_check():
check(filter_by_substring)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
142 | HumanEval_99_closest_integer | def closest_integer(value: str) -> int:
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
Examples
>>> closest_integer('10')
10
>>> closest_integer('15.3')
15
Note:
Rounding away from zero means that if the given number is equidistant
from two integers, the one you should return is the one that is the
farthest from zero. For example closest_integer("14.5") should
return 15 and closest_integer("-14.5") should return -15.
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def closest_integer(value: str) -> int:
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
Examples
>>> closest_integer('10')
10
>>> closest_integer('15.3')
15
Note:
Rounding away from zero means that if the given number is equidistant
from two integers, the one you should return is the one that is the
farthest from zero. For example closest_integer("14.5") should
return 15 and closest_integer("-14.5") should return -15.
"""
```
| def closest_integer(value: str) -> int: | HumanEval_99_closest_integer | py | def closest_integer(value: str) -> int:
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
Examples
>>> closest_integer('10')
10
>>> closest_integer('15.3')
15
Note:
Rounding away from zero means that if the given number is equidistant
from two integers, the one you should return is the one that is the
farthest from zero. For example closest_integer("14.5") should
return 15 and closest_integer("-14.5") should return -15.
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_99_closest_integer.py | reworded | def check(candidate):
assert candidate('10') == 10
assert candidate('14.5') == 15
assert candidate('-15.5') == -16
assert candidate('15.3') == 15
assert candidate('0') == 0
def test_check():
check(closest_integer)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
143 | HumanEval_64_vowels_count | def vowels_count(s: str) -> int:
"""Write a function vowels_count which takes a string representing
a word as input and returns the number of vowels in the string.
Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
vowel, but only when it is at the end of the given word.
Example:
>>> vowels_count('abcde')
2
>>> vowels_count('ACEDY')
3
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def vowels_count(s: str) -> int:
"""Write a function vowels_count which takes a string representing
a word as input and returns the number of vowels in the string.
Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
vowel, but only when it is at the end of the given word.
Example:
>>> vowels_count('abcde')
2
>>> vowels_count('ACEDY')
3
"""
```
| def vowels_count(s: str) -> int: | HumanEval_64_vowels_count | py | def vowels_count(s: str) -> int:
"""Write a function vowels_count which takes a string representing
a word as input and returns the number of vowels in the string.
Vowels in this case are 'a', 'e', 'i', 'o', 'u'. Here, 'y' is also a
vowel, but only when it is at the end of the given word.
Example:
>>> vowels_count('abcde')
2
>>> vowels_count('ACEDY')
3
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_64_vowels_count.py | reworded | def check(candidate):
assert candidate('abcde') == 2
assert candidate('Alone') == 3
assert candidate('key') == 2
assert candidate('bye') == 1
assert candidate('keY') == 2
assert candidate('bYe') == 1
assert candidate('ACEDY') == 3
def test_check():
check(vowels_count)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
144 | HumanEval_158_find_max | from typing import List
def find_max(words: List[str]) -> str:
"""Write a function that accepts a list of strings.
The list contains different words. Return the word with maximum number
of unique characters. If multiple strings have maximum number of unique
characters, return the one which comes first in lexicographical order.
>>> find_max(['name', 'of', 'string'])
'string'
>>> find_max(['name', 'enam', 'game'])
'enam'
>>> find_max(['aaaaaaa', 'bb', 'cc'])
'aaaaaaa'
"""
| 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 find_max(words: List[str]) -> str:
"""Write a function that accepts a list of strings.
The list contains different words. Return the word with maximum number
of unique characters. If multiple strings have maximum number of unique
characters, return the one which comes first in lexicographical order.
>>> find_max(['name', 'of', 'string'])
'string'
>>> find_max(['name', 'enam', 'game'])
'enam'
>>> find_max(['aaaaaaa', 'bb', 'cc'])
'aaaaaaa'
"""
```
| def find_max(words: List[str]) -> str: | HumanEval_158_find_max | py | from typing import List
def find_max(words: List[str]) -> str:
"""Write a function that accepts a list of strings.
The list contains different words. Return the word with maximum number
of unique characters. If multiple strings have maximum number of unique
characters, return the one which comes first in lexicographical order.
>>> find_max(['name', 'of', 'string'])
'string'
>>> find_max(['name', 'enam', 'game'])
'enam'
>>> find_max(['aaaaaaa', 'bb', 'cc'])
'aaaaaaa'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_158_find_max.py | reworded | def check(candidate):
assert candidate(['name', 'of', 'string']) == 'string'
assert candidate(['name', 'enam', 'game']) == 'enam'
assert candidate(['aaaaaaa', 'bb', 'cc']) == 'aaaaaaa'
assert candidate(['abc', 'cba']) == 'abc'
assert candidate(['play', 'this', 'game', 'of', 'footbott']) == 'footbott'
assert candidate(['we', 'are', 'gonna', 'rock']) == 'gonna'
assert candidate(['we', 'are', 'a', 'mad', 'nation']) == 'nation'
assert candidate(['this', 'is', 'a', 'prrk']) == 'this'
assert candidate(['b']) == 'b'
assert candidate(['play', 'play', 'play']) == 'play'
def test_check():
check(find_max)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
145 | HumanEval_162_string_to_md5 | from typing import Optional
def string_to_md5(text: str) -> Optional[str]:
"""
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
>>> string_to_md5('Hello world')
'3e25960a79dbc69b674cd4ec67a72c62'
"""
| 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 Optional
def string_to_md5(text: str) -> Optional[str]:
"""
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
>>> string_to_md5('Hello world')
'3e25960a79dbc69b674cd4ec67a72c62'
"""
```
| def string_to_md5(text: str) -> Optional[str]: | HumanEval_162_string_to_md5 | py | from typing import Optional
def string_to_md5(text: str) -> Optional[str]:
"""
Given a string 'text', return its md5 hash equivalent string.
If 'text' is an empty string, return None.
>>> string_to_md5('Hello world')
'3e25960a79dbc69b674cd4ec67a72c62'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_162_string_to_md5.py | reworded | def check(candidate):
assert candidate('Hello world') == '3e25960a79dbc69b674cd4ec67a72c62'
assert candidate('') == None
assert candidate('A B C') == '0ef78513b0cb8cef12743f5aeb35f888'
assert candidate('password') == '5f4dcc3b5aa765d61d8327deb882cf99'
def test_check():
check(string_to_md5)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
146 | HumanEval_44_change_base | def change_base(x: int, base: int) -> str:
"""Change numerical base of input number x to base.
return string representation after the conversion.
base numbers are less than 10.
>>> change_base(8, 3)
'22'
>>> change_base(8, 2)
'1000'
>>> change_base(7, 2)
'111'
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def change_base(x: int, base: int) -> str:
"""Change numerical base of input number x to base.
return string representation after the conversion.
base numbers are less than 10.
>>> change_base(8, 3)
'22'
>>> change_base(8, 2)
'1000'
>>> change_base(7, 2)
'111'
"""
```
| def change_base(x: int, base: int) -> str: | HumanEval_44_change_base | py | def change_base(x: int, base: int) -> str:
"""Change numerical base of input number x to base.
return string representation after the conversion.
base numbers are less than 10.
>>> change_base(8, 3)
'22'
>>> change_base(8, 2)
'1000'
>>> change_base(7, 2)
'111'
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_44_change_base.py | reworded | def check(candidate):
assert candidate(8, 3) == '22'
assert candidate(9, 3) == '100'
assert candidate(234, 2) == '11101010'
assert candidate(16, 2) == '10000'
assert candidate(8, 2) == '1000'
assert candidate(7, 2) == '111'
assert candidate(2, 3) == '2'
assert candidate(3, 4) == '3'
assert candidate(4, 5) == '4'
assert candidate(5, 6) == '5'
assert candidate(6, 7) == '6'
assert candidate(7, 8) == '7'
def test_check():
check(change_base)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
147 | HumanEval_157_right_angle_triangle | def right_angle_triangle(a: int, b: int, c: int) -> bool:
"""
Given the lengths of the three sides of a triangle. Return True if the three
sides form a right-angled triangle, False otherwise.
A right-angled triangle is a triangle in which one angle is right angle or
90 degree.
Example:
>>> right_angle_triangle(3, 4, 5)
True
>>> right_angle_triangle(1, 2, 3)
False
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def right_angle_triangle(a: int, b: int, c: int) -> bool:
"""
Given the lengths of the three sides of a triangle. Return True if the three
sides form a right-angled triangle, False otherwise.
A right-angled triangle is a triangle in which one angle is right angle or
90 degree.
Example:
>>> right_angle_triangle(3, 4, 5)
True
>>> right_angle_triangle(1, 2, 3)
False
"""
```
| def right_angle_triangle(a: int, b: int, c: int) -> bool: | HumanEval_157_right_angle_triangle | py | def right_angle_triangle(a: int, b: int, c: int) -> bool:
"""
Given the lengths of the three sides of a triangle. Return True if the three
sides form a right-angled triangle, False otherwise.
A right-angled triangle is a triangle in which one angle is right angle or
90 degree.
Example:
>>> right_angle_triangle(3, 4, 5)
True
>>> right_angle_triangle(1, 2, 3)
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_157_right_angle_triangle.py | reworded | def check(candidate):
assert candidate(3, 4, 5) == True
assert candidate(1, 2, 3) == False
assert candidate(10, 6, 8) == True
assert candidate(2, 2, 2) == False
assert candidate(7, 24, 25) == True
assert candidate(10, 5, 7) == False
assert candidate(5, 12, 13) == True
assert candidate(15, 8, 17) == True
assert candidate(48, 55, 73) == True
assert candidate(1, 1, 1) == False
assert candidate(2, 2, 10) == False
def test_check():
check(right_angle_triangle)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
148 | HumanEval_81_numerical_letter_grade | from typing import List
def numerical_letter_grade(grades: List[float]) -> List[str]:
"""It is the last week of the semester and the teacher has to give the grades
to students. The teacher has been making her own algorithm for grading.
The only problem is, she has lost the code she used for grading.
She has given you a list of GPAs for some students and you have to write
a function that can output a list of letter grades using the following table:
GPA | Letter grade
4.0 A+
> 3.7 A
> 3.3 A-
> 3.0 B+
> 2.7 B
> 2.3 B-
> 2.0 C+
> 1.7 C
> 1.3 C-
> 1.0 D+
> 0.7 D
> 0.0 D-
0.0 E
Example:
>>> grade_equation([4.0, 3, 1.7, 2, 3.5])
['A+', 'B', 'C-', 'C', 'A-']
"""
| 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 numerical_letter_grade(grades: List[float]) -> List[str]:
"""It is the last week of the semester and the teacher has to give the grades
to students. The teacher has been making her own algorithm for grading.
The only problem is, she has lost the code she used for grading.
She has given you a list of GPAs for some students and you have to write
a function that can output a list of letter grades using the following table:
GPA | Letter grade
4.0 A+
> 3.7 A
> 3.3 A-
> 3.0 B+
> 2.7 B
> 2.3 B-
> 2.0 C+
> 1.7 C
> 1.3 C-
> 1.0 D+
> 0.7 D
> 0.0 D-
0.0 E
Example:
>>> grade_equation([4.0, 3, 1.7, 2, 3.5])
['A+', 'B', 'C-', 'C', 'A-']
"""
```
| def numerical_letter_grade(grades: List[float]) -> List[str]: | HumanEval_81_numerical_letter_grade | py | from typing import List
def numerical_letter_grade(grades: List[float]) -> List[str]:
"""It is the last week of the semester and the teacher has to give the grades
to students. The teacher has been making her own algorithm for grading.
The only problem is, she has lost the code she used for grading.
She has given you a list of GPAs for some students and you have to write
a function that can output a list of letter grades using the following table:
GPA | Letter grade
4.0 A+
> 3.7 A
> 3.3 A-
> 3.0 B+
> 2.7 B
> 2.3 B-
> 2.0 C+
> 1.7 C
> 1.3 C-
> 1.0 D+
> 0.7 D
> 0.0 D-
0.0 E
Example:
>>> grade_equation([4.0, 3, 1.7, 2, 3.5])
['A+', 'B', 'C-', 'C', 'A-']
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_81_numerical_letter_grade.py | reworded | def check(candidate):
assert candidate([4.0, 3, 1.7, 2, 3.5]) == ['A+', 'B', 'C-', 'C', 'A-']
assert candidate([1.2]) == ['D+']
assert candidate([0.5]) == ['D-']
assert candidate([0.0]) == ['E']
assert candidate([1.0, 0.3, 1.5, 2.8, 3.3]) == ['D', 'D-', 'C-', 'B', 'B+']
assert candidate([0.0, 0.7]) == ['E', 'D-']
def test_check():
check(numerical_letter_grade)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
149 | HumanEval_5_intersperse | from typing import List
def intersperse(numbers: List[int], delimeter: int) -> List[int]:
""" Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
>>> intersperse([], 4)
[]
>>> intersperse([1, 2, 3], 4)
[1, 4, 2, 4, 3]
"""
| 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 intersperse(numbers: List[int], delimeter: int) -> List[int]:
""" Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
>>> intersperse([], 4)
[]
>>> intersperse([1, 2, 3], 4)
[1, 4, 2, 4, 3]
"""
```
| def intersperse(numbers: List[int], delimeter: int) -> List[int]: | HumanEval_5_intersperse | py | from typing import List
def intersperse(numbers: List[int], delimeter: int) -> List[int]:
""" Insert a number 'delimeter' between every two consecutive elements of input list `numbers'
>>> intersperse([], 4)
[]
>>> intersperse([1, 2, 3], 4)
[1, 4, 2, 4, 3]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_5_intersperse.py | reworded | def check(candidate):
assert candidate([], 7) == []
assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2]
assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
def test_check():
check(intersperse)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
150 | HumanEval_146_specialFilter | from typing import List
def specialFilter(nums: List[int]) -> int:
"""Write a function that takes an array of numbers as input and returns
the number of elements in the array that are greater than 10 and both
first and last digits of a number are odd (1, 3, 5, 7, 9).
For example:
>>> specialFilter([15, -73, 14, -15])
1
>>> specialFilter([33, -2, -3, 45, 21, 109])
2
"""
| 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 specialFilter(nums: List[int]) -> int:
"""Write a function that takes an array of numbers as input and returns
the number of elements in the array that are greater than 10 and both
first and last digits of a number are odd (1, 3, 5, 7, 9).
For example:
>>> specialFilter([15, -73, 14, -15])
1
>>> specialFilter([33, -2, -3, 45, 21, 109])
2
"""
```
| def specialFilter(nums: List[int]) -> int: | HumanEval_146_specialFilter | py | from typing import List
def specialFilter(nums: List[int]) -> int:
"""Write a function that takes an array of numbers as input and returns
the number of elements in the array that are greater than 10 and both
first and last digits of a number are odd (1, 3, 5, 7, 9).
For example:
>>> specialFilter([15, -73, 14, -15])
1
>>> specialFilter([33, -2, -3, 45, 21, 109])
2
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_146_specialFilter.py | reworded | def check(candidate):
assert candidate([5, -2, 1, -5]) == 0
assert candidate([15, -73, 14, -15]) == 1
assert candidate([33, -2, -3, 45, 21, 109]) == 2
assert candidate([43, -12, 93, 125, 121, 109]) == 4
assert candidate([71, -2, -33, 75, 21, 19]) == 3
assert candidate([1]) == 0
assert candidate([]) == 0
def test_check():
check(specialFilter)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
151 | HumanEval_60_sum_to_n | def sum_to_n(n: int) -> int:
"""sum_to_n is a function that sums numbers from 1 to n.
>>> sum_to_n(30)
465
>>> sum_to_n(100)
5050
>>> sum_to_n(5)
15
>>> sum_to_n(10)
55
>>> sum_to_n(1)
1
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def sum_to_n(n: int) -> int:
"""sum_to_n is a function that sums numbers from 1 to n.
>>> sum_to_n(30)
465
>>> sum_to_n(100)
5050
>>> sum_to_n(5)
15
>>> sum_to_n(10)
55
>>> sum_to_n(1)
1
"""
```
| def sum_to_n(n: int) -> int: | HumanEval_60_sum_to_n | py | def sum_to_n(n: int) -> int:
"""sum_to_n is a function that sums numbers from 1 to n.
>>> sum_to_n(30)
465
>>> sum_to_n(100)
5050
>>> sum_to_n(5)
15
>>> sum_to_n(10)
55
>>> sum_to_n(1)
1
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_60_sum_to_n.py | reworded | def check(candidate):
assert candidate(1) == 1
assert candidate(6) == 21
assert candidate(11) == 66
assert candidate(30) == 465
assert candidate(100) == 5050
def test_check():
check(sum_to_n)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
152 | HumanEval_26_remove_duplicates | from typing import List
def remove_duplicates(numbers: List[int]) -> List[int]:
""" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
"""
| 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 remove_duplicates(numbers: List[int]) -> List[int]:
""" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
"""
```
| def remove_duplicates(numbers: List[int]) -> List[int]: | HumanEval_26_remove_duplicates | py | from typing import List
def remove_duplicates(numbers: List[int]) -> List[int]:
""" From a list of integers, remove all elements that occur more than once.
Keep order of elements left the same as in the input.
>>> remove_duplicates([1, 2, 3, 2, 4])
[1, 3, 4]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_26_remove_duplicates.py | reworded | def check(candidate):
assert candidate([]) == []
assert candidate([1, 2, 3, 4]) == [1, 2, 3, 4]
assert candidate([1, 2, 3, 2, 4, 3, 5]) == [1, 4, 5]
def test_check():
check(remove_duplicates)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
153 | HumanEval_163_generate_integers | from typing import List
def generate_integers(a: int, b: int) -> List[int]:
"""
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
For example:
>>> generate_integers(2, 8)
[2, 4, 6, 8]
>>> generate_integers(8, 2)
[2, 4, 6, 8]
>>> generate_integers(10, 14)
[]
"""
| 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 generate_integers(a: int, b: int) -> List[int]:
"""
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
For example:
>>> generate_integers(2, 8)
[2, 4, 6, 8]
>>> generate_integers(8, 2)
[2, 4, 6, 8]
>>> generate_integers(10, 14)
[]
"""
```
| def generate_integers(a: int, b: int) -> List[int]: | HumanEval_163_generate_integers | py | from typing import List
def generate_integers(a: int, b: int) -> List[int]:
"""
Given two positive integers a and b, return the even digits between a
and b, in ascending order.
For example:
>>> generate_integers(2, 8)
[2, 4, 6, 8]
>>> generate_integers(8, 2)
[2, 4, 6, 8]
>>> generate_integers(10, 14)
[]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_163_generate_integers.py | reworded | def check(candidate):
assert candidate(2, 10) == [2, 4, 6, 8]
assert candidate(10, 2) == [2, 4, 6, 8]
assert candidate(132, 2) == [2, 4, 6, 8]
assert candidate(17, 89) == []
def test_check():
check(generate_integers)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
154 | HumanEval_9_rolling_max | from typing import List
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
>>> rolling_max([1, 2, 3, 2, 3, 4, 2])
[1, 2, 3, 3, 3, 4, 4]
"""
| 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 rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
>>> rolling_max([1, 2, 3, 2, 3, 4, 2])
[1, 2, 3, 3, 3, 4, 4]
"""
```
| def rolling_max(numbers: List[int]) -> List[int]: | HumanEval_9_rolling_max | py | from typing import List
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
>>> rolling_max([1, 2, 3, 2, 3, 4, 2])
[1, 2, 3, 3, 3, 4, 4]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_9_rolling_max.py | reworded | def check(candidate):
assert candidate([]) == []
assert candidate([1, 2, 3, 4]) == [1, 2, 3, 4]
assert candidate([4, 3, 2, 1]) == [4, 4, 4, 4]
assert candidate([3, 2, 3, 100, 3]) == [3, 3, 3, 100, 100]
def test_check():
check(rolling_max)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
155 | HumanEval_3_below_zero | from typing import List
def below_zero(operations: List[int]) -> bool:
""" You're given a list of deposit and withdrawal operations on a bank account that starts with
zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
at that point function should return True. Otherwise it should return False.
>>> below_zero([1, 2, 3])
False
>>> below_zero([1, 2, -4, 5])
True
"""
| 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 below_zero(operations: List[int]) -> bool:
""" You're given a list of deposit and withdrawal operations on a bank account that starts with
zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
at that point function should return True. Otherwise it should return False.
>>> below_zero([1, 2, 3])
False
>>> below_zero([1, 2, -4, 5])
True
"""
```
| def below_zero(operations: List[int]) -> bool: | HumanEval_3_below_zero | py | from typing import List
def below_zero(operations: List[int]) -> bool:
""" You're given a list of deposit and withdrawal operations on a bank account that starts with
zero balance. Your task is to detect if at any point the balance of account fallls below zero, and
at that point function should return True. Otherwise it should return False.
>>> below_zero([1, 2, 3])
False
>>> below_zero([1, 2, -4, 5])
True
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_3_below_zero.py | reworded | def check(candidate):
assert candidate([]) == False
assert candidate([1, 2, -3, 1, 2, -3]) == False
assert candidate([1, 2, -4, 5, 6]) == True
assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False
assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True
assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
def test_check():
check(below_zero)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
156 | HumanEval_69_search | from typing import List
def search(lst: List[int]) -> int:
"""
You are given a non-empty list of positive integers. Return the greatest integer that is greater than
zero, and has a frequency greater than or equal to the value of the integer itself.
The frequency of an integer is the number of times it appears in the list.
If no such a value exist, return -1.
Examples:
>>> search([4, 1, 2, 2, 3, 1])
2
>>> search([1, 2, 2, 3, 3, 3, 4, 4, 4])
3
>>> search([5, 5, 4, 4, 4])
-1
"""
| 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 search(lst: List[int]) -> int:
"""
You are given a non-empty list of positive integers. Return the greatest integer that is greater than
zero, and has a frequency greater than or equal to the value of the integer itself.
The frequency of an integer is the number of times it appears in the list.
If no such a value exist, return -1.
Examples:
>>> search([4, 1, 2, 2, 3, 1])
2
>>> search([1, 2, 2, 3, 3, 3, 4, 4, 4])
3
>>> search([5, 5, 4, 4, 4])
-1
"""
```
| def search(lst: List[int]) -> int: | HumanEval_69_search | py | from typing import List
def search(lst: List[int]) -> int:
"""
You are given a non-empty list of positive integers. Return the greatest integer that is greater than
zero, and has a frequency greater than or equal to the value of the integer itself.
The frequency of an integer is the number of times it appears in the list.
If no such a value exist, return -1.
Examples:
>>> search([4, 1, 2, 2, 3, 1])
2
>>> search([1, 2, 2, 3, 3, 3, 4, 4, 4])
3
>>> search([5, 5, 4, 4, 4])
-1
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_69_search.py | reworded | def check(candidate):
assert candidate([5, 5, 5, 5, 1]) == 1
assert candidate([4, 1, 4, 1, 4, 4]) == 4
assert candidate([3, 3]) == -1
assert candidate([8, 8, 8, 8, 8, 8, 8, 8]) == 8
assert candidate([2, 3, 3, 2, 2]) == 2
assert candidate([2, 7, 8, 8, 4, 8, 7, 3, 9, 6, 5, 10, 4, 3, 6, 7, 1, 7, 4, 10, 8, 1]) == 1
assert candidate([3, 2, 8, 2]) == 2
assert candidate([6, 7, 1, 8, 8, 10, 5, 8, 5, 3, 10]) == 1
assert candidate([8, 8, 3, 6, 5, 6, 4]) == -1
assert candidate([6, 9, 6, 7, 1, 4, 7, 1, 8, 8, 9, 8, 10, 10, 8, 4, 10, 4, 10, 1, 2, 9, 5, 7, 9]) == 1
assert candidate([1, 9, 10, 1, 3]) == 1
assert candidate([6, 9, 7, 5, 8, 7, 5, 3, 7, 5, 10, 10, 3, 6, 10, 2, 8, 6, 5, 4, 9, 5, 3, 10]) == 5
assert candidate([1]) == 1
assert candidate([8, 8, 10, 6, 4, 3, 5, 8, 2, 4, 2, 8, 4, 6, 10, 4, 2, 1, 10, 2, 1, 1, 5]) == 4
assert candidate([2, 10, 4, 8, 2, 10, 5, 1, 2, 9, 5, 5, 6, 3, 8, 6, 4, 10]) == 2
assert candidate([1, 6, 10, 1, 6, 9, 10, 8, 6, 8, 7, 3]) == 1
assert candidate([9, 2, 4, 1, 5, 1, 5, 2, 5, 7, 7, 7, 3, 10, 1, 5, 4, 2, 8, 4, 1, 9, 10, 7, 10, 2, 8, 10, 9, 4]) == 4
assert candidate([2, 6, 4, 2, 8, 7, 5, 6, 4, 10, 4, 6, 3, 7, 8, 8, 3, 1, 4, 2, 2, 10, 7]) == 4
assert candidate([9, 8, 6, 10, 2, 6, 10, 2, 7, 8, 10, 3, 8, 2, 6, 2, 3, 1]) == 2
assert candidate([5, 5, 3, 9, 5, 6, 3, 2, 8, 5, 6, 10, 10, 6, 8, 4, 10, 7, 7, 10, 8]) == -1
assert candidate([10]) == -1
assert candidate([9, 7, 7, 2, 4, 7, 2, 10, 9, 7, 5, 7, 2]) == 2
assert candidate([5, 4, 10, 2, 1, 1, 10, 3, 6, 1, 8]) == 1
assert candidate([7, 9, 9, 9, 3, 4, 1, 5, 9, 1, 2, 1, 1, 10, 7, 5, 6, 7, 6, 7, 7, 6]) == 1
assert candidate([3, 10, 10, 9, 2]) == -1
def test_check():
check(search)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
157 | HumanEval_61_correct_bracketing | def correct_bracketing(brackets: str) -> bool:
""" brackets is a string of "(" and ")".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing('(')
False
>>> correct_bracketing('()')
True
>>> correct_bracketing('(()())')
True
>>> correct_bracketing(')(()')
False
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def correct_bracketing(brackets: str) -> bool:
""" brackets is a string of "(" and ")".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing('(')
False
>>> correct_bracketing('()')
True
>>> correct_bracketing('(()())')
True
>>> correct_bracketing(')(()')
False
"""
```
| def correct_bracketing(brackets: str) -> bool: | HumanEval_61_correct_bracketing | py | def correct_bracketing(brackets: str) -> bool:
""" brackets is a string of "(" and ")".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing('(')
False
>>> correct_bracketing('()')
True
>>> correct_bracketing('(()())')
True
>>> correct_bracketing(')(()')
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_61_correct_bracketing.py | reworded | def check(candidate):
assert candidate('()') == True
assert candidate('(()())') == True
assert candidate('()()(()())()') == True
assert candidate('()()((()()())())(()()(()))') == True
assert candidate('((()())))') == False
assert candidate(')(()') == False
assert candidate('(') == False
assert candidate('((((') == False
assert candidate(')') == False
assert candidate('(()') == False
assert candidate('()()(()())())(()') == False
assert candidate('()()(()())()))()') == False
def test_check():
check(correct_bracketing)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
158 | HumanEval_37_sort_even | from typing import List
def sort_even(l: List[int]) -> List[int]:
"""This function takes a list l and returns a list l' such that
l' is identical to l in the odd indicies, while its values at the even indicies are equal
to the values of the even indicies of l, but sorted.
>>> sort_even([1, 2, 3])
[1, 2, 3]
>>> sort_even([5, 6, 3, 4])
[3, 6, 5, 4]
"""
| 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_even(l: List[int]) -> List[int]:
"""This function takes a list l and returns a list l' such that
l' is identical to l in the odd indicies, while its values at the even indicies are equal
to the values of the even indicies of l, but sorted.
>>> sort_even([1, 2, 3])
[1, 2, 3]
>>> sort_even([5, 6, 3, 4])
[3, 6, 5, 4]
"""
```
| def sort_even(l: List[int]) -> List[int]: | HumanEval_37_sort_even | py | from typing import List
def sort_even(l: List[int]) -> List[int]:
"""This function takes a list l and returns a list l' such that
l' is identical to l in the odd indicies, while its values at the even indicies are equal
to the values of the even indicies of l, but sorted.
>>> sort_even([1, 2, 3])
[1, 2, 3]
>>> sort_even([5, 6, 3, 4])
[3, 6, 5, 4]
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_37_sort_even.py | reworded | def check(candidate):
assert candidate([1, 2, 3]) == [1, 2, 3]
assert candidate([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10]) == [-10, 3, -5, 2, -3, 3, 5, 0, 9, 1, 123]
assert candidate([5, 8, -12, 4, 23, 2, 3, 11, 12, -10]) == [-12, 8, 3, 4, 5, 2, 12, 11, 23, -10]
def test_check():
check(sort_even)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
159 | HumanEval_54_same_chars | def same_chars(s0: str, s1: str) -> bool:
"""
Check if two words have the same characters.
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')
True
>>> same_chars('abcd', 'dddddddabc')
True
>>> same_chars('dddddddabc', 'abcd')
True
>>> same_chars('eabcd', 'dddddddabc')
False
>>> same_chars('abcd', 'dddddddabce')
False
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc')
False
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def same_chars(s0: str, s1: str) -> bool:
"""
Check if two words have the same characters.
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')
True
>>> same_chars('abcd', 'dddddddabc')
True
>>> same_chars('dddddddabc', 'abcd')
True
>>> same_chars('eabcd', 'dddddddabc')
False
>>> same_chars('abcd', 'dddddddabce')
False
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc')
False
"""
```
| def same_chars(s0: str, s1: str) -> bool: | HumanEval_54_same_chars | py | def same_chars(s0: str, s1: str) -> bool:
"""
Check if two words have the same characters.
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddeddabc')
True
>>> same_chars('abcd', 'dddddddabc')
True
>>> same_chars('dddddddabc', 'abcd')
True
>>> same_chars('eabcd', 'dddddddabc')
False
>>> same_chars('abcd', 'dddddddabce')
False
>>> same_chars('eabcdzzzz', 'dddzzzzzzzddddabc')
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_54_same_chars.py | reworded | def check(candidate):
assert candidate('eabcdzzzz', 'dddzzzzzzzddeddabc') == True
assert candidate('abcd', 'dddddddabc') == True
assert candidate('dddddddabc', 'abcd') == True
assert candidate('eabcd', 'dddddddabc') == False
assert candidate('abcd', 'dddddddabcf') == False
assert candidate('eabcdzzzz', 'dddzzzzzzzddddabc') == False
assert candidate('aabb', 'aaccc') == False
def test_check():
check(same_chars)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |
160 | HumanEval_56_correct_bracketing | def correct_bracketing(brackets: str) -> bool:
""" brackets is a string of "<" and ">".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing('<')
False
>>> correct_bracketing('<>')
True
>>> correct_bracketing('<<><>>')
True
>>> correct_bracketing('><<>')
False
"""
| You are a professional Python programmer, please create a Python function based on the following function signature and natural language annotations.
```python
def correct_bracketing(brackets: str) -> bool:
""" brackets is a string of "<" and ">".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing('<')
False
>>> correct_bracketing('<>')
True
>>> correct_bracketing('<<><>>')
True
>>> correct_bracketing('><<>')
False
"""
```
| def correct_bracketing(brackets: str) -> bool: | HumanEval_56_correct_bracketing | py | def correct_bracketing(brackets: str) -> bool:
""" brackets is a string of "<" and ">".
return True if every opening bracket has a corresponding closing bracket.
>>> correct_bracketing('<')
False
>>> correct_bracketing('<>')
True
>>> correct_bracketing('<<><>>')
True
>>> correct_bracketing('><<>')
False
"""
| transform | /home/arjun/repos/nuprl/MultiPL-E/datasets/../datasets/originals-with-cleaned-doctests/HumanEval_56_correct_bracketing.py | reworded | def check(candidate):
assert candidate('<>') == True
assert candidate('<<><>>') == True
assert candidate('<><><<><>><>') == True
assert candidate('<><><<<><><>><>><<><><<>>>') == True
assert candidate('<<<><>>>>') == False
assert candidate('><<>') == False
assert candidate('<') == False
assert candidate('<<<<') == False
assert candidate('>') == False
assert candidate('<<>') == False
assert candidate('<><><<><>><>><<>') == False
assert candidate('<><><<><>><>>><>') == False
def test_check():
check(correct_bracketing)
test_check()
| [
"\ndef",
"\n#",
"\nif",
"\nclass"
] |