import_str
sequencelengths 0
1
| doc_string
stringclasses 164
values | suffix
stringlengths 0
837
| compare_func
sequencelengths 0
0
| data_id
stringlengths 34
37
| task_name
stringclasses 1
value | solution
stringlengths 6
141
| demos
sequencelengths 0
8
| prefix
stringlengths 65
1.8k
| dataset_name
stringclasses 1
value | entry_func
stringclasses 158
values | tgt_lang
stringclasses 1
value | src_lang
stringclasses 1
value | test_cases
sequencelengths 0
100
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
[
"from typing import List"
] | Check if in given list of numbers, are any two numbers closer to each other than
given threshold. | for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False
| [] | SingleLineInfilling/HumanEval/0/L0 | code_infilling | for idx, elem in enumerate(numbers):
| [
[
"[1.0, 2.0, 3.0], 0.5",
"False"
],
[
"[1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3",
"True"
]
] | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
"""
| HumanEval_SingleLineInfillingLight | has_close_elements | python | python | [
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3",
"True"
],
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05",
"False"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.95",
"True"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.8",
"False"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 1.0",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 0.5",
"False"
]
] |
[
"from typing import List"
] | Check if in given list of numbers, are any two numbers closer to each other than
given threshold. | if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
return False
| [] | SingleLineInfilling/HumanEval/0/L1 | code_infilling | for idx2, elem2 in enumerate(numbers):
| [
[
"[1.0, 2.0, 3.0], 0.5",
"False"
],
[
"[1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3",
"True"
]
] | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
"""
for idx, elem in enumerate(numbers):
| HumanEval_SingleLineInfillingLight | has_close_elements | python | python | [
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3",
"True"
],
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05",
"False"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.95",
"True"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.8",
"False"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 1.0",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 0.5",
"False"
]
] |
[
"from typing import List"
] | Check if in given list of numbers, are any two numbers closer to each other than
given threshold. | distance = abs(elem - elem2)
if distance < threshold:
return True
return False
| [] | SingleLineInfilling/HumanEval/0/L2 | code_infilling | if idx != idx2:
| [
[
"[1.0, 2.0, 3.0], 0.5",
"False"
],
[
"[1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3",
"True"
]
] | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
"""
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
| HumanEval_SingleLineInfillingLight | has_close_elements | python | python | [
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3",
"True"
],
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05",
"False"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.95",
"True"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.8",
"False"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 1.0",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 0.5",
"False"
]
] |
[
"from typing import List"
] | Check if in given list of numbers, are any two numbers closer to each other than
given threshold. | if distance < threshold:
return True
return False
| [] | SingleLineInfilling/HumanEval/0/L3 | code_infilling | distance = abs(elem - elem2)
| [
[
"[1.0, 2.0, 3.0], 0.5",
"False"
],
[
"[1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3",
"True"
]
] | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
"""
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
| HumanEval_SingleLineInfillingLight | has_close_elements | python | python | [
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3",
"True"
],
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05",
"False"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.95",
"True"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.8",
"False"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 1.0",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 0.5",
"False"
]
] |
[
"from typing import List"
] | Check if in given list of numbers, are any two numbers closer to each other than
given threshold. | return True
return False
| [] | SingleLineInfilling/HumanEval/0/L4 | code_infilling | if distance < threshold:
| [
[
"[1.0, 2.0, 3.0], 0.5",
"False"
],
[
"[1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3",
"True"
]
] | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
"""
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
| HumanEval_SingleLineInfillingLight | has_close_elements | python | python | [
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3",
"True"
],
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05",
"False"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.95",
"True"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.8",
"False"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 1.0",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 0.5",
"False"
]
] |
[
"from typing import List"
] | Check if in given list of numbers, are any two numbers closer to each other than
given threshold. |
return False
| [] | SingleLineInfilling/HumanEval/0/L5 | code_infilling | return True
| [
[
"[1.0, 2.0, 3.0], 0.5",
"False"
],
[
"[1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3",
"True"
]
] | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
"""
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
| HumanEval_SingleLineInfillingLight | has_close_elements | python | python | [
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3",
"True"
],
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05",
"False"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.95",
"True"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.8",
"False"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 1.0",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 0.5",
"False"
]
] |
[
"from typing import List"
] | Check if in given list of numbers, are any two numbers closer to each other than
given threshold. | [] | SingleLineInfilling/HumanEval/0/L7 | code_infilling | return False
| [
[
"[1.0, 2.0, 3.0], 0.5",
"False"
],
[
"[1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3",
"True"
]
] | from typing import List
def has_close_elements(numbers: List[float], threshold: float) -> bool:
""" Check if in given list of numbers, are any two numbers closer to each other than
given threshold.
"""
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
distance = abs(elem - elem2)
if distance < threshold:
return True
| HumanEval_SingleLineInfillingLight | has_close_elements | python | python | [
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.3",
"True"
],
[
"[1.0, 2.0, 3.9, 4.0, 5.0, 2.2], 0.05",
"False"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.95",
"True"
],
[
"[1.0, 2.0, 5.9, 4.0, 5.0], 0.8",
"False"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0, 2.0], 0.1",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 1.0",
"True"
],
[
"[1.1, 2.2, 3.1, 4.1, 5.1], 0.5",
"False"
]
] |
|
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L0 | code_infilling | result = []
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L1 | code_infilling | current_string = []
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. |
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L2 | code_infilling | current_depth = 0
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L4 | code_infilling | for c in paren_string:
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L5 | code_infilling | if c == '(':
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L6 | code_infilling | current_depth += 1
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L7 | code_infilling | current_string.append(c)
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L8 | code_infilling | elif c == ')':
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L9 | code_infilling | current_depth -= 1
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. |
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L10 | code_infilling | current_string.append(c)
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | result.append(''.join(current_string))
current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L12 | code_infilling | if current_depth == 0:
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | current_string.clear()
return result
| [] | SingleLineInfilling/HumanEval/1/L13 | code_infilling | result.append(''.join(current_string))
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. |
return result
| [] | SingleLineInfilling/HumanEval/1/L14 | code_infilling | current_string.clear()
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
[
"from typing import List"
] | Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string. | [] | SingleLineInfilling/HumanEval/1/L16 | code_infilling | return result
| [
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] | from typing import List
def separate_paren_groups(paren_string: str) -> List[str]:
""" Input to this function is a string containing multiple groups of nested parentheses. Your goal is to
separate those group into separate strings and return the list of those.
Separate groups are balanced (each open brace is properly closed) and not nested within each other
Ignore any spaces in the input string.
"""
result = []
current_string = []
current_depth = 0
for c in paren_string:
if c == '(':
current_depth += 1
current_string.append(c)
elif c == ')':
current_depth -= 1
current_string.append(c)
if current_depth == 0:
result.append(''.join(current_string))
current_string.clear()
| HumanEval_SingleLineInfillingLight | separate_paren_groups | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[\n '(()())', '((()))', '()', '((())()())'\n ]"
],
[
"'() (()) ((())) (((())))'",
"[\n '()', '(())', '((()))', '(((())))'\n ]"
],
[
"'(()(())((())))'",
"[\n '(()(())((())))'\n ]"
],
[
"'( ) (( )) (( )( ))'",
"['()', '(())', '(()())']"
]
] |
|
[] | Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number. | [] | SingleLineInfilling/HumanEval/2/L0 | code_infilling | return number % 1.0
| [
[
"3.5",
"0.5"
],
[
"1.33",
"0.33"
],
[
"123.456",
"0.456"
]
] |
def truncate_number(number: float) -> float:
""" Given a positive floating point number, it can be decomposed into
and integer part (largest integer smaller than given number) and decimals
(leftover part always smaller than 1).
Return the decimal part of the number.
"""
| HumanEval_SingleLineInfillingLight | truncate_number | python | python | [
[
"3.5",
"0.5"
]
] |
|
[
"from typing import List"
] | 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. |
for op in operations:
balance += op
if balance < 0:
return True
return False
| [] | SingleLineInfilling/HumanEval/3/L0 | code_infilling | balance = 0
| [
[
"[1, 2, 3]",
"False"
],
[
"[1, 2, -4, 5]",
"True"
]
] | 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.
"""
| HumanEval_SingleLineInfillingLight | below_zero | python | python | [
[
"[]",
"False"
],
[
"[1, 2, -3, 1, 2, -3]",
"False"
],
[
"[1, 2, -4, 5, 6]",
"True"
],
[
"[1, -1, 2, -2, 5, -5, 4, -4]",
"False"
],
[
"[1, -1, 2, -2, 5, -5, 4, -5]",
"True"
],
[
"[1, -2, 2, -2, 5, -5, 4, -4]",
"True"
]
] |
[
"from typing import List"
] | 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. | balance += op
if balance < 0:
return True
return False
| [] | SingleLineInfilling/HumanEval/3/L2 | code_infilling | for op in operations:
| [
[
"[1, 2, 3]",
"False"
],
[
"[1, 2, -4, 5]",
"True"
]
] | 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.
"""
balance = 0
| HumanEval_SingleLineInfillingLight | below_zero | python | python | [
[
"[]",
"False"
],
[
"[1, 2, -3, 1, 2, -3]",
"False"
],
[
"[1, 2, -4, 5, 6]",
"True"
],
[
"[1, -1, 2, -2, 5, -5, 4, -4]",
"False"
],
[
"[1, -1, 2, -2, 5, -5, 4, -5]",
"True"
],
[
"[1, -2, 2, -2, 5, -5, 4, -4]",
"True"
]
] |
[
"from typing import List"
] | 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. | if balance < 0:
return True
return False
| [] | SingleLineInfilling/HumanEval/3/L3 | code_infilling | balance += op
| [
[
"[1, 2, 3]",
"False"
],
[
"[1, 2, -4, 5]",
"True"
]
] | 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.
"""
balance = 0
for op in operations:
| HumanEval_SingleLineInfillingLight | below_zero | python | python | [
[
"[]",
"False"
],
[
"[1, 2, -3, 1, 2, -3]",
"False"
],
[
"[1, 2, -4, 5, 6]",
"True"
],
[
"[1, -1, 2, -2, 5, -5, 4, -4]",
"False"
],
[
"[1, -1, 2, -2, 5, -5, 4, -5]",
"True"
],
[
"[1, -2, 2, -2, 5, -5, 4, -4]",
"True"
]
] |
[
"from typing import List"
] | 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. | return True
return False
| [] | SingleLineInfilling/HumanEval/3/L4 | code_infilling | if balance < 0:
| [
[
"[1, 2, 3]",
"False"
],
[
"[1, 2, -4, 5]",
"True"
]
] | 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.
"""
balance = 0
for op in operations:
balance += op
| HumanEval_SingleLineInfillingLight | below_zero | python | python | [
[
"[]",
"False"
],
[
"[1, 2, -3, 1, 2, -3]",
"False"
],
[
"[1, 2, -4, 5, 6]",
"True"
],
[
"[1, -1, 2, -2, 5, -5, 4, -4]",
"False"
],
[
"[1, -1, 2, -2, 5, -5, 4, -5]",
"True"
],
[
"[1, -2, 2, -2, 5, -5, 4, -4]",
"True"
]
] |
[
"from typing import List"
] | 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. |
return False
| [] | SingleLineInfilling/HumanEval/3/L5 | code_infilling | return True
| [
[
"[1, 2, 3]",
"False"
],
[
"[1, 2, -4, 5]",
"True"
]
] | 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.
"""
balance = 0
for op in operations:
balance += op
if balance < 0:
| HumanEval_SingleLineInfillingLight | below_zero | python | python | [
[
"[]",
"False"
],
[
"[1, 2, -3, 1, 2, -3]",
"False"
],
[
"[1, 2, -4, 5, 6]",
"True"
],
[
"[1, -1, 2, -2, 5, -5, 4, -4]",
"False"
],
[
"[1, -1, 2, -2, 5, -5, 4, -5]",
"True"
],
[
"[1, -2, 2, -2, 5, -5, 4, -4]",
"True"
]
] |
[
"from typing import List"
] | 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. | [] | SingleLineInfilling/HumanEval/3/L7 | code_infilling | return False
| [
[
"[1, 2, 3]",
"False"
],
[
"[1, 2, -4, 5]",
"True"
]
] | 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.
"""
balance = 0
for op in operations:
balance += op
if balance < 0:
return True
| HumanEval_SingleLineInfillingLight | below_zero | python | python | [
[
"[]",
"False"
],
[
"[1, 2, -3, 1, 2, -3]",
"False"
],
[
"[1, 2, -4, 5, 6]",
"True"
],
[
"[1, -1, 2, -2, 5, -5, 4, -4]",
"False"
],
[
"[1, -1, 2, -2, 5, -5, 4, -5]",
"True"
],
[
"[1, -2, 2, -2, 5, -5, 4, -4]",
"True"
]
] |
|
[
"from typing import List"
] | 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 | | return sum(abs(x - mean) for x in numbers) / len(numbers)
| [] | SingleLineInfilling/HumanEval/4/L0 | code_infilling | mean = sum(numbers) / len(numbers)
| [
[
"[1.0, 2.0, 3.0, 4.0]",
"1.0"
]
] | 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 |
"""
| HumanEval_SingleLineInfillingLight | mean_absolute_deviation | python | python | [
[
"[1.0, 2.0, 3.0]",
"2.0/3.0"
],
[
"[1.0, 2.0, 3.0, 4.0]",
"1.0"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0]",
"6.0/5.0"
]
] |
[
"from typing import List"
] | 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 | | [] | SingleLineInfilling/HumanEval/4/L1 | code_infilling | return sum(abs(x - mean) for x in numbers) / len(numbers)
| [
[
"[1.0, 2.0, 3.0, 4.0]",
"1.0"
]
] | 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 = sum(numbers) / len(numbers)
| HumanEval_SingleLineInfillingLight | mean_absolute_deviation | python | python | [
[
"[1.0, 2.0, 3.0]",
"2.0/3.0"
],
[
"[1.0, 2.0, 3.0, 4.0]",
"1.0"
],
[
"[1.0, 2.0, 3.0, 4.0, 5.0]",
"6.0/5.0"
]
] |
|
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' | return []
result = []
for n in numbers[:-1]:
result.append(n)
result.append(delimeter)
result.append(numbers[-1])
return result
| [] | SingleLineInfilling/HumanEval/5/L0 | code_infilling | if not numbers:
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' |
result = []
for n in numbers[:-1]:
result.append(n)
result.append(delimeter)
result.append(numbers[-1])
return result
| [] | SingleLineInfilling/HumanEval/5/L1 | code_infilling | return []
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
if not numbers:
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' |
for n in numbers[:-1]:
result.append(n)
result.append(delimeter)
result.append(numbers[-1])
return result
| [] | SingleLineInfilling/HumanEval/5/L3 | code_infilling | result = []
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
if not numbers:
return []
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' | result.append(n)
result.append(delimeter)
result.append(numbers[-1])
return result
| [] | SingleLineInfilling/HumanEval/5/L5 | code_infilling | for n in numbers[:-1]:
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
if not numbers:
return []
result = []
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' | result.append(delimeter)
result.append(numbers[-1])
return result
| [] | SingleLineInfilling/HumanEval/5/L6 | code_infilling | result.append(n)
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
if not numbers:
return []
result = []
for n in numbers[:-1]:
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' |
result.append(numbers[-1])
return result
| [] | SingleLineInfilling/HumanEval/5/L7 | code_infilling | result.append(delimeter)
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
if not numbers:
return []
result = []
for n in numbers[:-1]:
result.append(n)
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' |
return result
| [] | SingleLineInfilling/HumanEval/5/L9 | code_infilling | result.append(numbers[-1])
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
if not numbers:
return []
result = []
for n in numbers[:-1]:
result.append(n)
result.append(delimeter)
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
[
"from typing import List"
] | Insert a number 'delimeter' between every two consecutive elements of input list `numbers' | [] | SingleLineInfilling/HumanEval/5/L11 | code_infilling | return result
| [
[
"[], 4",
"[]"
],
[
"[1, 2, 3], 4",
"[1, 4, 2, 4, 3]"
]
] | 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'
"""
if not numbers:
return []
result = []
for n in numbers[:-1]:
result.append(n)
result.append(delimeter)
result.append(numbers[-1])
| HumanEval_SingleLineInfillingLight | intersperse | python | python | [
[
"[], 7",
"[]"
],
[
"[5, 6, 3, 2], 8",
"[5, 8, 6, 8, 3, 8, 2]"
],
[
"[2, 2, 2], 2",
"[2, 2, 2, 2, 2]"
]
] |
|
[
"from typing import List"
] | 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. | depth = 0
max_depth = 0
for c in s:
if c == '(':
depth += 1
max_depth = max(depth, max_depth)
else:
depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L0 | code_infilling | def parse_paren_group(s):
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | max_depth = 0
for c in s:
if c == '(':
depth += 1
max_depth = max(depth, max_depth)
else:
depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L1 | code_infilling | depth = 0
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | for c in s:
if c == '(':
depth += 1
max_depth = max(depth, max_depth)
else:
depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L2 | code_infilling | max_depth = 0
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | if c == '(':
depth += 1
max_depth = max(depth, max_depth)
else:
depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L3 | code_infilling | for c in s:
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | depth += 1
max_depth = max(depth, max_depth)
else:
depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L4 | code_infilling | if c == '(':
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
for c in s:
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | max_depth = max(depth, max_depth)
else:
depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L5 | code_infilling | depth += 1
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
for c in s:
if c == '(':
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | else:
depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L6 | code_infilling | max_depth = max(depth, max_depth)
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
for c in s:
if c == '(':
depth += 1
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | depth -= 1
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L7 | code_infilling | else:
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
for c in s:
if c == '(':
depth += 1
max_depth = max(depth, max_depth)
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. |
return max_depth
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L8 | code_infilling | depth -= 1
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
for c in s:
if c == '(':
depth += 1
max_depth = max(depth, max_depth)
else:
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. |
return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/6/L10 | code_infilling | return max_depth
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
for c in s:
if c == '(':
depth += 1
max_depth = max(depth, max_depth)
else:
depth -= 1
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
[
"from typing import List"
] | 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. | [] | SingleLineInfilling/HumanEval/6/L12 | code_infilling | return [parse_paren_group(x) for x in paren_string.split(' ') if x]
| [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
]
] | 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.
"""
def parse_paren_group(s):
depth = 0
max_depth = 0
for c in s:
if c == '(':
depth += 1
max_depth = max(depth, max_depth)
else:
depth -= 1
return max_depth
| HumanEval_SingleLineInfillingLight | parse_nested_parens | python | python | [
[
"'(()()) ((())) () ((())()())'",
"[2, 3, 1, 3]"
],
[
"'() (()) ((())) (((())))'",
"[1, 2, 3, 4]"
],
[
"'(()(())((())))'",
"[4]"
]
] |
|
[
"from typing import List"
] | Filter an input list of strings only for ones that contain given substring | [] | SingleLineInfilling/HumanEval/7/L0 | code_infilling | return [x for x in strings if substring in x]
| [
[
"[], 'a'",
"[]"
],
[
"['abc', 'bacd', 'cde', 'array'], 'a'",
"['abc', 'bacd', 'array']"
]
] | 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
"""
| HumanEval_SingleLineInfillingLight | filter_by_substring | python | python | [
[
"[], 'john'",
"[]"
],
[
"['xxx', 'asd', 'xxy', 'john doe', 'xxxAAA', 'xxx'], 'xxx'",
"['xxx', 'xxxAAA', 'xxx']"
],
[
"['xxx', 'asd', 'aaaxxy', 'john doe', 'xxxAAA', 'xxx'], 'xx'",
"['xxx', 'aaaxxy', 'xxxAAA', 'xxx']"
],
[
"['grunt', 'trumpet', 'prune', 'gruesome'], 'run'",
"['grunt', 'prune']"
]
] |
|
[
"from typing import List, Tuple"
] | 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) | prod_value = 1
for n in numbers:
sum_value += n
prod_value *= n
return sum_value, prod_value
| [] | SingleLineInfilling/HumanEval/8/L0 | code_infilling | sum_value = 0
| [
[
"[]",
"(0, 1)"
],
[
"[1, 2, 3, 4]",
"(10, 24)"
]
] | 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)
"""
| HumanEval_SingleLineInfillingLight | sum_product | python | python | [
[
"[]",
"(0, 1)"
],
[
"[1, 1, 1]",
"(3, 1)"
],
[
"[100, 0]",
"(100, 0)"
],
[
"[3, 5, 7]",
"(3 + 5 + 7, 3 * 5 * 7)"
],
[
"[10]",
"(10, 10)"
]
] |
[
"from typing import List, Tuple"
] | 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) |
for n in numbers:
sum_value += n
prod_value *= n
return sum_value, prod_value
| [] | SingleLineInfilling/HumanEval/8/L1 | code_infilling | prod_value = 1
| [
[
"[]",
"(0, 1)"
],
[
"[1, 2, 3, 4]",
"(10, 24)"
]
] | 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_value = 0
| HumanEval_SingleLineInfillingLight | sum_product | python | python | [
[
"[]",
"(0, 1)"
],
[
"[1, 1, 1]",
"(3, 1)"
],
[
"[100, 0]",
"(100, 0)"
],
[
"[3, 5, 7]",
"(3 + 5 + 7, 3 * 5 * 7)"
],
[
"[10]",
"(10, 10)"
]
] |
[
"from typing import List, Tuple"
] | 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_value += n
prod_value *= n
return sum_value, prod_value
| [] | SingleLineInfilling/HumanEval/8/L3 | code_infilling | for n in numbers:
| [
[
"[]",
"(0, 1)"
],
[
"[1, 2, 3, 4]",
"(10, 24)"
]
] | 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_value = 0
prod_value = 1
| HumanEval_SingleLineInfillingLight | sum_product | python | python | [
[
"[]",
"(0, 1)"
],
[
"[1, 1, 1]",
"(3, 1)"
],
[
"[100, 0]",
"(100, 0)"
],
[
"[3, 5, 7]",
"(3 + 5 + 7, 3 * 5 * 7)"
],
[
"[10]",
"(10, 10)"
]
] |
[
"from typing import List, Tuple"
] | 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) | prod_value *= n
return sum_value, prod_value
| [] | SingleLineInfilling/HumanEval/8/L4 | code_infilling | sum_value += n
| [
[
"[]",
"(0, 1)"
],
[
"[1, 2, 3, 4]",
"(10, 24)"
]
] | 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_value = 0
prod_value = 1
for n in numbers:
| HumanEval_SingleLineInfillingLight | sum_product | python | python | [
[
"[]",
"(0, 1)"
],
[
"[1, 1, 1]",
"(3, 1)"
],
[
"[100, 0]",
"(100, 0)"
],
[
"[3, 5, 7]",
"(3 + 5 + 7, 3 * 5 * 7)"
],
[
"[10]",
"(10, 10)"
]
] |
[
"from typing import List, Tuple"
] | 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) | return sum_value, prod_value
| [] | SingleLineInfilling/HumanEval/8/L5 | code_infilling | prod_value *= n
| [
[
"[]",
"(0, 1)"
],
[
"[1, 2, 3, 4]",
"(10, 24)"
]
] | 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_value = 0
prod_value = 1
for n in numbers:
sum_value += n
| HumanEval_SingleLineInfillingLight | sum_product | python | python | [
[
"[]",
"(0, 1)"
],
[
"[1, 1, 1]",
"(3, 1)"
],
[
"[100, 0]",
"(100, 0)"
],
[
"[3, 5, 7]",
"(3 + 5 + 7, 3 * 5 * 7)"
],
[
"[10]",
"(10, 10)"
]
] |
[
"from typing import List, Tuple"
] | 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) | [] | SingleLineInfilling/HumanEval/8/L6 | code_infilling | return sum_value, prod_value
| [
[
"[]",
"(0, 1)"
],
[
"[1, 2, 3, 4]",
"(10, 24)"
]
] | 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_value = 0
prod_value = 1
for n in numbers:
sum_value += n
prod_value *= n
| HumanEval_SingleLineInfillingLight | sum_product | python | python | [
[
"[]",
"(0, 1)"
],
[
"[1, 1, 1]",
"(3, 1)"
],
[
"[100, 0]",
"(100, 0)"
],
[
"[3, 5, 7]",
"(3 + 5 + 7, 3 * 5 * 7)"
],
[
"[10]",
"(10, 10)"
]
] |
|
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. | result = []
for n in numbers:
if running_max is None:
running_max = n
else:
running_max = max(running_max, n)
result.append(running_max)
return result
| [] | SingleLineInfilling/HumanEval/9/L0 | code_infilling | running_max = None
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. |
for n in numbers:
if running_max is None:
running_max = n
else:
running_max = max(running_max, n)
result.append(running_max)
return result
| [] | SingleLineInfilling/HumanEval/9/L1 | code_infilling | result = []
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. | if running_max is None:
running_max = n
else:
running_max = max(running_max, n)
result.append(running_max)
return result
| [] | SingleLineInfilling/HumanEval/9/L3 | code_infilling | for n in numbers:
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
result = []
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. | running_max = n
else:
running_max = max(running_max, n)
result.append(running_max)
return result
| [] | SingleLineInfilling/HumanEval/9/L4 | code_infilling | if running_max is None:
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
result = []
for n in numbers:
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. | else:
running_max = max(running_max, n)
result.append(running_max)
return result
| [] | SingleLineInfilling/HumanEval/9/L5 | code_infilling | running_max = n
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
result = []
for n in numbers:
if running_max is None:
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. | running_max = max(running_max, n)
result.append(running_max)
return result
| [] | SingleLineInfilling/HumanEval/9/L6 | code_infilling | else:
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
result = []
for n in numbers:
if running_max is None:
running_max = n
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. |
result.append(running_max)
return result
| [] | SingleLineInfilling/HumanEval/9/L7 | code_infilling | running_max = max(running_max, n)
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
result = []
for n in numbers:
if running_max is None:
running_max = n
else:
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. |
return result
| [] | SingleLineInfilling/HumanEval/9/L9 | code_infilling | result.append(running_max)
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
result = []
for n in numbers:
if running_max is None:
running_max = n
else:
running_max = max(running_max, n)
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
[
"from typing import List, Tuple"
] | From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence. | [] | SingleLineInfilling/HumanEval/9/L11 | code_infilling | return result
| [
[
"[1, 2, 3, 2, 3, 4, 2]",
"[1, 2, 3, 3, 3, 4, 4]"
]
] | from typing import List, Tuple
def rolling_max(numbers: List[int]) -> List[int]:
""" From a given list of integers, generate a list of rolling maximum element found until given moment
in the sequence.
"""
running_max = None
result = []
for n in numbers:
if running_max is None:
running_max = n
else:
running_max = max(running_max, n)
result.append(running_max)
| HumanEval_SingleLineInfillingLight | rolling_max | python | python | [
[
"[]",
"[]"
],
[
"[1, 2, 3, 4]",
"[1, 2, 3, 4]"
],
[
"[4, 3, 2, 1]",
"[4, 4, 4, 4]"
],
[
"[3, 2, 3, 100, 3]",
"[3, 3, 3, 100, 100]"
]
] |
|
[] | Test if given string is a palindrome | return ''
beginning_of_suffix = 0
while not is_palindrome(string[beginning_of_suffix:]):
beginning_of_suffix += 1
return string + string[:beginning_of_suffix][::-1]
| [] | SingleLineInfilling/HumanEval/10/L0 | code_infilling | if not string:
| [
[
"''",
"''"
],
[
"'cat'",
"'catac'"
],
[
"'cata'",
"'catac'"
]
] |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
| HumanEval_SingleLineInfillingLight | make_palindrome | python | python | [
[
"''",
"''"
],
[
"'x'",
"'x'"
],
[
"'xyz'",
"'xyzyx'"
],
[
"'xyx'",
"'xyx'"
],
[
"'jerry'",
"'jerryrrej'"
]
] |
[] | Test if given string is a palindrome |
beginning_of_suffix = 0
while not is_palindrome(string[beginning_of_suffix:]):
beginning_of_suffix += 1
return string + string[:beginning_of_suffix][::-1]
| [] | SingleLineInfilling/HumanEval/10/L1 | code_infilling | return ''
| [
[
"''",
"''"
],
[
"'cat'",
"'catac'"
],
[
"'cata'",
"'catac'"
]
] |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
if not string:
| HumanEval_SingleLineInfillingLight | make_palindrome | python | python | [
[
"''",
"''"
],
[
"'x'",
"'x'"
],
[
"'xyz'",
"'xyzyx'"
],
[
"'xyx'",
"'xyx'"
],
[
"'jerry'",
"'jerryrrej'"
]
] |
[] | Test if given string is a palindrome |
while not is_palindrome(string[beginning_of_suffix:]):
beginning_of_suffix += 1
return string + string[:beginning_of_suffix][::-1]
| [] | SingleLineInfilling/HumanEval/10/L3 | code_infilling | beginning_of_suffix = 0
| [
[
"''",
"''"
],
[
"'cat'",
"'catac'"
],
[
"'cata'",
"'catac'"
]
] |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
if not string:
return ''
| HumanEval_SingleLineInfillingLight | make_palindrome | python | python | [
[
"''",
"''"
],
[
"'x'",
"'x'"
],
[
"'xyz'",
"'xyzyx'"
],
[
"'xyx'",
"'xyx'"
],
[
"'jerry'",
"'jerryrrej'"
]
] |
[] | Test if given string is a palindrome | beginning_of_suffix += 1
return string + string[:beginning_of_suffix][::-1]
| [] | SingleLineInfilling/HumanEval/10/L5 | code_infilling | while not is_palindrome(string[beginning_of_suffix:]):
| [
[
"''",
"''"
],
[
"'cat'",
"'catac'"
],
[
"'cata'",
"'catac'"
]
] |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
if not string:
return ''
beginning_of_suffix = 0
| HumanEval_SingleLineInfillingLight | make_palindrome | python | python | [
[
"''",
"''"
],
[
"'x'",
"'x'"
],
[
"'xyz'",
"'xyzyx'"
],
[
"'xyx'",
"'xyx'"
],
[
"'jerry'",
"'jerryrrej'"
]
] |
[] | Test if given string is a palindrome |
return string + string[:beginning_of_suffix][::-1]
| [] | SingleLineInfilling/HumanEval/10/L6 | code_infilling | beginning_of_suffix += 1
| [
[
"''",
"''"
],
[
"'cat'",
"'catac'"
],
[
"'cata'",
"'catac'"
]
] |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
if not string:
return ''
beginning_of_suffix = 0
while not is_palindrome(string[beginning_of_suffix:]):
| HumanEval_SingleLineInfillingLight | make_palindrome | python | python | [
[
"''",
"''"
],
[
"'x'",
"'x'"
],
[
"'xyz'",
"'xyzyx'"
],
[
"'xyx'",
"'xyx'"
],
[
"'jerry'",
"'jerryrrej'"
]
] |
[] | Test if given string is a palindrome | [] | SingleLineInfilling/HumanEval/10/L8 | code_infilling | return string + string[:beginning_of_suffix][::-1]
| [
[
"''",
"''"
],
[
"'cat'",
"'catac'"
],
[
"'cata'",
"'catac'"
]
] |
def is_palindrome(string: str) -> bool:
""" Test if given string is a palindrome """
return string == string[::-1]
def make_palindrome(string: str) -> str:
""" Find the shortest palindrome that begins with a supplied string.
Algorithm idea is simple:
- Find the longest postfix of supplied string that is a palindrome.
- Append to the end of the string reverse of a string prefix that comes before the palindromic suffix.
>>> make_palindrome('')
''
>>> make_palindrome('cat')
'catac'
>>> make_palindrome('cata')
'catac'
"""
if not string:
return ''
beginning_of_suffix = 0
while not is_palindrome(string[beginning_of_suffix:]):
beginning_of_suffix += 1
| HumanEval_SingleLineInfillingLight | make_palindrome | python | python | [
[
"''",
"''"
],
[
"'x'",
"'x'"
],
[
"'xyz'",
"'xyzyx'"
],
[
"'xyx'",
"'xyx'"
],
[
"'jerry'",
"'jerryrrej'"
]
] |
|
[
"from typing import List"
] | Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string. | if i == j:
return '0'
else:
return '1'
return ''.join(xor(x, y) for x, y in zip(a, b))
| [] | SingleLineInfilling/HumanEval/11/L0 | code_infilling | def xor(i, j):
| [
[
"'010', '110'",
"'100'"
]
] | from typing import List
def string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
"""
| HumanEval_SingleLineInfillingLight | string_xor | python | python | [
[
"'111000', '101010'",
"'010010'"
],
[
"'1', '1'",
"'0'"
],
[
"'0101', '0000'",
"'0101'"
]
] |
[
"from typing import List"
] | Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string. | return '0'
else:
return '1'
return ''.join(xor(x, y) for x, y in zip(a, b))
| [] | SingleLineInfilling/HumanEval/11/L1 | code_infilling | if i == j:
| [
[
"'010', '110'",
"'100'"
]
] | from typing import List
def string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
"""
def xor(i, j):
| HumanEval_SingleLineInfillingLight | string_xor | python | python | [
[
"'111000', '101010'",
"'010010'"
],
[
"'1', '1'",
"'0'"
],
[
"'0101', '0000'",
"'0101'"
]
] |
[
"from typing import List"
] | Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string. | else:
return '1'
return ''.join(xor(x, y) for x, y in zip(a, b))
| [] | SingleLineInfilling/HumanEval/11/L2 | code_infilling | return '0'
| [
[
"'010', '110'",
"'100'"
]
] | from typing import List
def string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
"""
def xor(i, j):
if i == j:
| HumanEval_SingleLineInfillingLight | string_xor | python | python | [
[
"'111000', '101010'",
"'010010'"
],
[
"'1', '1'",
"'0'"
],
[
"'0101', '0000'",
"'0101'"
]
] |
[
"from typing import List"
] | Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string. | return '1'
return ''.join(xor(x, y) for x, y in zip(a, b))
| [] | SingleLineInfilling/HumanEval/11/L3 | code_infilling | else:
| [
[
"'010', '110'",
"'100'"
]
] | from typing import List
def string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
"""
def xor(i, j):
if i == j:
return '0'
| HumanEval_SingleLineInfillingLight | string_xor | python | python | [
[
"'111000', '101010'",
"'010010'"
],
[
"'1', '1'",
"'0'"
],
[
"'0101', '0000'",
"'0101'"
]
] |
[
"from typing import List"
] | Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string. |
return ''.join(xor(x, y) for x, y in zip(a, b))
| [] | SingleLineInfilling/HumanEval/11/L4 | code_infilling | return '1'
| [
[
"'010', '110'",
"'100'"
]
] | from typing import List
def string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
"""
def xor(i, j):
if i == j:
return '0'
else:
| HumanEval_SingleLineInfillingLight | string_xor | python | python | [
[
"'111000', '101010'",
"'010010'"
],
[
"'1', '1'",
"'0'"
],
[
"'0101', '0000'",
"'0101'"
]
] |
[
"from typing import List"
] | Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string. | [] | SingleLineInfilling/HumanEval/11/L6 | code_infilling | return ''.join(xor(x, y) for x, y in zip(a, b))
| [
[
"'010', '110'",
"'100'"
]
] | from typing import List
def string_xor(a: str, b: str) -> str:
""" Input are two strings a and b consisting only of 1s and 0s.
Perform binary XOR on these inputs and return result also as a string.
"""
def xor(i, j):
if i == j:
return '0'
else:
return '1'
| HumanEval_SingleLineInfillingLight | string_xor | python | python | [
[
"'111000', '101010'",
"'010010'"
],
[
"'1', '1'",
"'0'"
],
[
"'0101', '0000'",
"'0101'"
]
] |
|
[
"from typing import List, Optional"
] | 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. | return None
maxlen = max(len(x) for x in strings)
for s in strings:
if len(s) == maxlen:
return s
| [] | SingleLineInfilling/HumanEval/12/L0 | code_infilling | if not strings:
| [
[
"[]",
""
],
[
"['a', 'b', 'c']",
"'a'"
],
[
"['a', 'bb', 'ccc']",
"'ccc'"
]
] | 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.
"""
| HumanEval_SingleLineInfillingLight | longest | python | python | [
[
"[]",
"None"
],
[
"['x', 'y', 'z']",
"'x'"
],
[
"['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']",
"'zzzz'"
]
] |
[
"from typing import List, Optional"
] | 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. |
maxlen = max(len(x) for x in strings)
for s in strings:
if len(s) == maxlen:
return s
| [] | SingleLineInfilling/HumanEval/12/L1 | code_infilling | return None
| [
[
"[]",
""
],
[
"['a', 'b', 'c']",
"'a'"
],
[
"['a', 'bb', 'ccc']",
"'ccc'"
]
] | 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.
"""
if not strings:
| HumanEval_SingleLineInfillingLight | longest | python | python | [
[
"[]",
"None"
],
[
"['x', 'y', 'z']",
"'x'"
],
[
"['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']",
"'zzzz'"
]
] |
[
"from typing import List, Optional"
] | 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. | for s in strings:
if len(s) == maxlen:
return s
| [] | SingleLineInfilling/HumanEval/12/L3 | code_infilling | maxlen = max(len(x) for x in strings)
| [
[
"[]",
""
],
[
"['a', 'b', 'c']",
"'a'"
],
[
"['a', 'bb', 'ccc']",
"'ccc'"
]
] | 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.
"""
if not strings:
return None
| HumanEval_SingleLineInfillingLight | longest | python | python | [
[
"[]",
"None"
],
[
"['x', 'y', 'z']",
"'x'"
],
[
"['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']",
"'zzzz'"
]
] |
[
"from typing import List, Optional"
] | 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. | if len(s) == maxlen:
return s
| [] | SingleLineInfilling/HumanEval/12/L4 | code_infilling | for s in strings:
| [
[
"[]",
""
],
[
"['a', 'b', 'c']",
"'a'"
],
[
"['a', 'bb', 'ccc']",
"'ccc'"
]
] | 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.
"""
if not strings:
return None
maxlen = max(len(x) for x in strings)
| HumanEval_SingleLineInfillingLight | longest | python | python | [
[
"[]",
"None"
],
[
"['x', 'y', 'z']",
"'x'"
],
[
"['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']",
"'zzzz'"
]
] |
[
"from typing import List, Optional"
] | 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. | return s
| [] | SingleLineInfilling/HumanEval/12/L5 | code_infilling | if len(s) == maxlen:
| [
[
"[]",
""
],
[
"['a', 'b', 'c']",
"'a'"
],
[
"['a', 'bb', 'ccc']",
"'ccc'"
]
] | 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.
"""
if not strings:
return None
maxlen = max(len(x) for x in strings)
for s in strings:
| HumanEval_SingleLineInfillingLight | longest | python | python | [
[
"[]",
"None"
],
[
"['x', 'y', 'z']",
"'x'"
],
[
"['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']",
"'zzzz'"
]
] |
[
"from typing import List, Optional"
] | 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. | [] | SingleLineInfilling/HumanEval/12/L6 | code_infilling | return s
| [
[
"[]",
""
],
[
"['a', 'b', 'c']",
"'a'"
],
[
"['a', 'bb', 'ccc']",
"'ccc'"
]
] | 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.
"""
if not strings:
return None
maxlen = max(len(x) for x in strings)
for s in strings:
if len(s) == maxlen:
| HumanEval_SingleLineInfillingLight | longest | python | python | [
[
"[]",
"None"
],
[
"['x', 'y', 'z']",
"'x'"
],
[
"['x', 'yyy', 'zzzz', 'www', 'kkkk', 'abc']",
"'zzzz'"
]
] |
|
[] | Return a greatest common divisor of two integers a and b | a, b = b, a % b
return a
| [] | SingleLineInfilling/HumanEval/13/L0 | code_infilling | while b:
| [
[
"3, 5",
"1"
],
[
"25, 15",
"5"
]
] |
def greatest_common_divisor(a: int, b: int) -> int:
""" Return a greatest common divisor of two integers a and b
"""
| HumanEval_SingleLineInfillingLight | greatest_common_divisor | python | python | [
[
"3, 7",
"1"
],
[
"10, 15",
"5"
],
[
"49, 14",
"7"
],
[
"144, 60",
"12"
]
] |
[] | Return a greatest common divisor of two integers a and b | return a
| [] | SingleLineInfilling/HumanEval/13/L1 | code_infilling | a, b = b, a % b
| [
[
"3, 5",
"1"
],
[
"25, 15",
"5"
]
] |
def greatest_common_divisor(a: int, b: int) -> int:
""" Return a greatest common divisor of two integers a and b
"""
while b:
| HumanEval_SingleLineInfillingLight | greatest_common_divisor | python | python | [
[
"3, 7",
"1"
],
[
"10, 15",
"5"
],
[
"49, 14",
"7"
],
[
"144, 60",
"12"
]
] |
[] | Return a greatest common divisor of two integers a and b | [] | SingleLineInfilling/HumanEval/13/L2 | code_infilling | return a
| [
[
"3, 5",
"1"
],
[
"25, 15",
"5"
]
] |
def greatest_common_divisor(a: int, b: int) -> int:
""" Return a greatest common divisor of two integers a and b
"""
while b:
a, b = b, a % b
| HumanEval_SingleLineInfillingLight | greatest_common_divisor | python | python | [
[
"3, 7",
"1"
],
[
"10, 15",
"5"
],
[
"49, 14",
"7"
],
[
"144, 60",
"12"
]
] |
|
[
"from typing import List"
] | Return list of all prefixes from shortest to longest of the input string |
for i in range(len(string)):
result.append(string[:i+1])
return result
| [] | SingleLineInfilling/HumanEval/14/L0 | code_infilling | result = []
| [
[
"'abc'",
"['a', 'ab', 'abc']"
]
] | from typing import List
def all_prefixes(string: str) -> List[str]:
""" Return list of all prefixes from shortest to longest of the input string
"""
| HumanEval_SingleLineInfillingLight | all_prefixes | python | python | [
[
"''",
"[]"
],
[
"'asdfgh'",
"['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh']"
],
[
"'WWW'",
"['W', 'WW', 'WWW']"
]
] |
[
"from typing import List"
] | Return list of all prefixes from shortest to longest of the input string | result.append(string[:i+1])
return result
| [] | SingleLineInfilling/HumanEval/14/L2 | code_infilling | for i in range(len(string)):
| [
[
"'abc'",
"['a', 'ab', 'abc']"
]
] | from typing import List
def all_prefixes(string: str) -> List[str]:
""" Return list of all prefixes from shortest to longest of the input string
"""
result = []
| HumanEval_SingleLineInfillingLight | all_prefixes | python | python | [
[
"''",
"[]"
],
[
"'asdfgh'",
"['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh']"
],
[
"'WWW'",
"['W', 'WW', 'WWW']"
]
] |
[
"from typing import List"
] | Return list of all prefixes from shortest to longest of the input string | return result
| [] | SingleLineInfilling/HumanEval/14/L3 | code_infilling | result.append(string[:i+1])
| [
[
"'abc'",
"['a', 'ab', 'abc']"
]
] | from typing import List
def all_prefixes(string: str) -> List[str]:
""" Return list of all prefixes from shortest to longest of the input string
"""
result = []
for i in range(len(string)):
| HumanEval_SingleLineInfillingLight | all_prefixes | python | python | [
[
"''",
"[]"
],
[
"'asdfgh'",
"['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh']"
],
[
"'WWW'",
"['W', 'WW', 'WWW']"
]
] |
[
"from typing import List"
] | Return list of all prefixes from shortest to longest of the input string | [] | SingleLineInfilling/HumanEval/14/L4 | code_infilling | return result
| [
[
"'abc'",
"['a', 'ab', 'abc']"
]
] | from typing import List
def all_prefixes(string: str) -> List[str]:
""" Return list of all prefixes from shortest to longest of the input string
"""
result = []
for i in range(len(string)):
result.append(string[:i+1])
| HumanEval_SingleLineInfillingLight | all_prefixes | python | python | [
[
"''",
"[]"
],
[
"'asdfgh'",
"['a', 'as', 'asd', 'asdf', 'asdfg', 'asdfgh']"
],
[
"'WWW'",
"['W', 'WW', 'WWW']"
]
] |
|
[] | Return a string containing space-delimited numbers starting from 0 upto n inclusive. | [] | SingleLineInfilling/HumanEval/15/L0 | code_infilling | return ' '.join([str(x) for x in range(n + 1)])
| [
[
"0",
"'0'"
],
[
"5",
"'0 1 2 3 4 5'"
]
] |
def string_sequence(n: int) -> str:
""" Return a string containing space-delimited numbers starting from 0 upto n inclusive.
"""
| HumanEval_SingleLineInfillingLight | string_sequence | python | python | [
[
"0",
"'0'"
],
[
"3",
"'0 1 2 3'"
],
[
"10",
"'0 1 2 3 4 5 6 7 8 9 10'"
]
] |
|
[] | Given a string, find out how many distinct characters (regardless of case) does it consist of | [] | SingleLineInfilling/HumanEval/16/L0 | code_infilling | return len(set(string.lower()))
| [
[
"'xyzXYZ'",
"3"
],
[
"'Jerry'",
"4"
]
] |
def count_distinct_characters(string: str) -> int:
""" Given a string, find out how many distinct characters (regardless of case) does it consist of
"""
| HumanEval_SingleLineInfillingLight | count_distinct_characters | python | python | [
[
"''",
"0"
],
[
"'abcde'",
"5"
],
[
"'abcde' + 'cade' + 'CADE'",
"5"
],
[
"'aaaaAAAAaaaa'",
"1"
],
[
"'Jerry jERRY JeRRRY'",
"5"
]
] |
|
[
"from typing import List"
] | Input to this function is a string representing musical notes in a special ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat | return [note_map[x] for x in music_string.split(' ') if x]
| [] | SingleLineInfilling/HumanEval/17/L0 | code_infilling | note_map = {'o': 4, 'o|': 2, '.|': 1}
| [
[
"'o o| .| o| o| .| .| .| .| o o'",
"[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]"
]
] | from typing import List
def parse_music(music_string: str) -> List[int]:
""" Input to this function is a string representing musical notes in a special ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
"""
| HumanEval_SingleLineInfillingLight | parse_music | python | python | [
[
"''",
"[]"
],
[
"'o o o o'",
"[4, 4, 4, 4]"
],
[
"'.| .| .| .|'",
"[1, 1, 1, 1]"
],
[
"'o| o| .| .| o o o o'",
"[2, 2, 1, 1, 4, 4, 4, 4]"
],
[
"'o| .| o| .| o o| o o|'",
"[2, 1, 2, 1, 4, 2, 4, 2]"
]
] |
[
"from typing import List"
] | Input to this function is a string representing musical notes in a special ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat | [] | SingleLineInfilling/HumanEval/17/L1 | code_infilling | return [note_map[x] for x in music_string.split(' ') if x]
| [
[
"'o o| .| o| o| .| .| .| .| o o'",
"[4, 2, 1, 2, 2, 1, 1, 1, 1, 4, 4]"
]
] | from typing import List
def parse_music(music_string: str) -> List[int]:
""" Input to this function is a string representing musical notes in a special ASCII format.
Your task is to parse this string and return list of integers corresponding to how many beats does each
not last.
Here is a legend:
'o' - whole note, lasts four beats
'o|' - half note, lasts two beats
'.|' - quater note, lasts one beat
"""
note_map = {'o': 4, 'o|': 2, '.|': 1}
| HumanEval_SingleLineInfillingLight | parse_music | python | python | [
[
"''",
"[]"
],
[
"'o o o o'",
"[4, 4, 4, 4]"
],
[
"'.| .| .| .|'",
"[1, 1, 1, 1]"
],
[
"'o| o| .| .| o o o o'",
"[2, 2, 1, 1, 4, 4, 4, 4]"
],
[
"'o| .| o| .| o o| o o|'",
"[2, 1, 2, 1, 4, 2, 4, 2]"
]
] |
|
[] | Find how many times a given substring can be found in the original string. Count overlaping cases. |
for i in range(len(string) - len(substring) + 1):
if string[i:i+len(substring)] == substring:
times += 1
return times
| [] | SingleLineInfilling/HumanEval/18/L0 | code_infilling | times = 0
| [
[
"'', 'a'",
"0"
],
[
"'aaa', 'a'",
"3"
],
[
"'aaaa', 'aa'",
"3"
]
] |
def how_many_times(string: str, substring: str) -> int:
""" Find how many times a given substring can be found in the original string. Count overlaping cases.
"""
| HumanEval_SingleLineInfillingLight | how_many_times | python | python | [
[
"'', 'x'",
"0"
],
[
"'xyxyxyx', 'x'",
"4"
],
[
"'cacacacac', 'cac'",
"4"
],
[
"'john doe', 'john'",
"1"
]
] |
[] | Find how many times a given substring can be found in the original string. Count overlaping cases. | if string[i:i+len(substring)] == substring:
times += 1
return times
| [] | SingleLineInfilling/HumanEval/18/L2 | code_infilling | for i in range(len(string) - len(substring) + 1):
| [
[
"'', 'a'",
"0"
],
[
"'aaa', 'a'",
"3"
],
[
"'aaaa', 'aa'",
"3"
]
] |
def how_many_times(string: str, substring: str) -> int:
""" Find how many times a given substring can be found in the original string. Count overlaping cases.
"""
times = 0
| HumanEval_SingleLineInfillingLight | how_many_times | python | python | [
[
"'', 'x'",
"0"
],
[
"'xyxyxyx', 'x'",
"4"
],
[
"'cacacacac', 'cac'",
"4"
],
[
"'john doe', 'john'",
"1"
]
] |
[] | Find how many times a given substring can be found in the original string. Count overlaping cases. | times += 1
return times
| [] | SingleLineInfilling/HumanEval/18/L3 | code_infilling | if string[i:i+len(substring)] == substring:
| [
[
"'', 'a'",
"0"
],
[
"'aaa', 'a'",
"3"
],
[
"'aaaa', 'aa'",
"3"
]
] |
def how_many_times(string: str, substring: str) -> int:
""" Find how many times a given substring can be found in the original string. Count overlaping cases.
"""
times = 0
for i in range(len(string) - len(substring) + 1):
| HumanEval_SingleLineInfillingLight | how_many_times | python | python | [
[
"'', 'x'",
"0"
],
[
"'xyxyxyx', 'x'",
"4"
],
[
"'cacacacac', 'cac'",
"4"
],
[
"'john doe', 'john'",
"1"
]
] |
[] | Find how many times a given substring can be found in the original string. Count overlaping cases. |
return times
| [] | SingleLineInfilling/HumanEval/18/L4 | code_infilling | times += 1
| [
[
"'', 'a'",
"0"
],
[
"'aaa', 'a'",
"3"
],
[
"'aaaa', 'aa'",
"3"
]
] |
def how_many_times(string: str, substring: str) -> int:
""" Find how many times a given substring can be found in the original string. Count overlaping cases.
"""
times = 0
for i in range(len(string) - len(substring) + 1):
if string[i:i+len(substring)] == substring:
| HumanEval_SingleLineInfillingLight | how_many_times | python | python | [
[
"'', 'x'",
"0"
],
[
"'xyxyxyx', 'x'",
"4"
],
[
"'cacacacac', 'cac'",
"4"
],
[
"'john doe', 'john'",
"1"
]
] |
[] | Find how many times a given substring can be found in the original string. Count overlaping cases. | [] | SingleLineInfilling/HumanEval/18/L6 | code_infilling | return times
| [
[
"'', 'a'",
"0"
],
[
"'aaa', 'a'",
"3"
],
[
"'aaaa', 'aa'",
"3"
]
] |
def how_many_times(string: str, substring: str) -> int:
""" Find how many times a given substring can be found in the original string. Count overlaping cases.
"""
times = 0
for i in range(len(string) - len(substring) + 1):
if string[i:i+len(substring)] == substring:
times += 1
| HumanEval_SingleLineInfillingLight | how_many_times | python | python | [
[
"'', 'x'",
"0"
],
[
"'xyxyxyx', 'x'",
"4"
],
[
"'cacacacac', 'cac'",
"4"
],
[
"'john doe', 'john'",
"1"
]
] |
|
[
"from typing import List"
] | 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 | 'zero': 0,
'one': 1,
'two': 2,
'three': 3,
'four': 4,
'five': 5,
'six': 6,
'seven': 7,
'eight': 8,
'nine': 9
}
return ' '.join(sorted([x for x in numbers.split(' ') if x], key=lambda x: value_map[x]))
| [] | SingleLineInfilling/HumanEval/19/L0 | code_infilling | value_map = {
| [
[
"'three one five'",
"'one three five'"
]
] | from typing import List
def sort_numbers(numbers: str) -> str:
""" Input is a space-delimited string of numberals from 'zero' to 'nine'.
Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
Return the string with numbers sorted from smallest to largest
"""
| HumanEval_SingleLineInfillingLight | sort_numbers | python | python | [
[
"''",
"''"
],
[
"'three'",
"'three'"
],
[
"'three five nine'",
"'three five nine'"
],
[
"'five zero four seven nine eight'",
"'zero four five seven eight nine'"
],
[
"'six five four three two one zero'",
"'zero one two three four five six'"
]
] |
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 28