task_id
stringlengths
36
40
entry_point
stringlengths
1
30
prompt
stringlengths
116
1.98k
suffix
stringlengths
0
837
canonical_solution
stringlengths
6
859
test
stringlengths
117
1.8k
MultiLineInfilling/HumanEval/1/L7_L10
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1
if current_depth == 0: result.append(''.join(current_string)) current_string.clear() return result
current_string.append(c) elif c == ')': current_depth -= 1 current_string.append(c)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L7_L12
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1
result.append(''.join(current_string)) current_string.clear() return result
current_string.append(c) elif c == ')': current_depth -= 1 current_string.append(c) if current_depth == 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L7_L13
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1
current_string.clear() return result
current_string.append(c) elif c == ')': current_depth -= 1 current_string.append(c) if current_depth == 0: result.append(''.join(current_string))
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L7_L14
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1
return result
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()
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L7_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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() return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L8_L8
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c)
current_depth -= 1 current_string.append(c) if current_depth == 0: result.append(''.join(current_string)) current_string.clear() return result
elif c == ')':
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L8_L9
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c)
current_string.append(c) if current_depth == 0: result.append(''.join(current_string)) current_string.clear() return result
elif c == ')': current_depth -= 1
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L8_L10
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c)
if current_depth == 0: result.append(''.join(current_string)) current_string.clear() return result
elif c == ')': current_depth -= 1 current_string.append(c)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L8_L12
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c)
result.append(''.join(current_string)) current_string.clear() return result
elif c == ')': current_depth -= 1 current_string.append(c) if current_depth == 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L8_L13
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c)
current_string.clear() return result
elif c == ')': current_depth -= 1 current_string.append(c) if current_depth == 0: result.append(''.join(current_string))
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L8_L14
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c)
return result
elif c == ')': current_depth -= 1 current_string.append(c) if current_depth == 0: result.append(''.join(current_string)) current_string.clear()
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L8_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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() return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L9_L9
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c) elif c == ')':
current_string.append(c) if current_depth == 0: result.append(''.join(current_string)) current_string.clear() return result
current_depth -= 1
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L9_L10
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c) elif c == ')':
if current_depth == 0: result.append(''.join(current_string)) current_string.clear() return result
current_depth -= 1 current_string.append(c)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L9_L12
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c) elif c == ')':
result.append(''.join(current_string)) current_string.clear() return result
current_depth -= 1 current_string.append(c) if current_depth == 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L9_L13
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c) elif c == ')':
current_string.clear() return result
current_depth -= 1 current_string.append(c) if current_depth == 0: result.append(''.join(current_string))
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L9_L14
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ result = [] current_string = [] current_depth = 0 for c in paren_string: if c == '(': current_depth += 1 current_string.append(c) elif c == ')':
return result
current_depth -= 1 current_string.append(c) if current_depth == 0: result.append(''.join(current_string)) current_string.clear()
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L9_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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() return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L10_L10
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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
if current_depth == 0: result.append(''.join(current_string)) current_string.clear() return result
current_string.append(c)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L10_L12
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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
result.append(''.join(current_string)) current_string.clear() return result
current_string.append(c) if current_depth == 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L10_L13
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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.clear() return result
current_string.append(c) if current_depth == 0: result.append(''.join(current_string))
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L10_L14
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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
return result
current_string.append(c) if current_depth == 0: result.append(''.join(current_string)) current_string.clear()
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L10_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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() return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L12_L12
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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)
result.append(''.join(current_string)) current_string.clear() return result
if current_depth == 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L12_L13
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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)
current_string.clear() return result
if current_depth == 0: result.append(''.join(current_string))
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L12_L14
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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)
return result
if current_depth == 0: result.append(''.join(current_string)) current_string.clear()
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L12_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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() return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L13_L13
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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:
current_string.clear() return result
result.append(''.join(current_string))
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L13_L14
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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:
return result
result.append(''.join(current_string)) current_string.clear()
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L13_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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() return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L14_L14
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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))
return result
current_string.clear()
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L14_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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() return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/1/L16_L16
separate_paren_groups
from typing import List def separate_paren_groups(paren_string: str) -> List[str]: """ Input to this function is a string containing multiple groups of nested parentheses. Your goal is to separate those group into separate strings and return the list of those. Separate groups are balanced (each open brace is properly closed) and not nested within each other Ignore any spaces in the input string. >>> separate_paren_groups('( ) (( )) (( )( ))') ['()', '(())', '(()())'] """ 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()
return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [ '(()())', '((()))', '()', '((())()())' ] assert candidate('() (()) ((())) (((())))') == [ '()', '(())', '((()))', '(((())))' ] assert candidate('(()(())((())))') == [ '(()(())((())))' ] assert candidate('( ) (( )) (( )( ))') == ['()', '(())', '(()())']
MultiLineInfilling/HumanEval/2/L0_L0
truncate_number
def truncate_number(number: float) -> float: """ Given a positive floating point number, it can be decomposed into and integer part (largest integer smaller than given number) and decimals (leftover part always smaller than 1). Return the decimal part of the number. >>> truncate_number(3.5) 0.5 """
return number % 1.0
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate(3.5) == 0.5 assert abs(candidate(1.33) - 0.33) < 1e-6 assert abs(candidate(123.456) - 0.456) < 1e-6
MultiLineInfilling/HumanEval/3/L0_L0
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """
for op in operations: balance += op if balance < 0: return True return False
balance = 0
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L0_L2
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """
balance += op if balance < 0: return True return False
balance = 0 for op in operations:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L0_L3
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """
if balance < 0: return True return False
balance = 0 for op in operations: balance += op
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L0_L4
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """
return True return False
balance = 0 for op in operations: balance += op if balance < 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L0_L5
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """
return False
balance = 0 for op in operations: balance += op if balance < 0: return True
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L0_L7
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """
balance = 0 for op in operations: balance += op if balance < 0: return True return False
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L2_L2
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0
balance += op if balance < 0: return True return False
for op in operations:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L2_L3
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0
if balance < 0: return True return False
for op in operations: balance += op
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L2_L4
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0
return True return False
for op in operations: balance += op if balance < 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L2_L5
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0
return False
for op in operations: balance += op if balance < 0: return True
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L2_L7
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0
for op in operations: balance += op if balance < 0: return True return False
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L3_L3
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations:
if balance < 0: return True return False
balance += op
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L3_L4
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations:
return True return False
balance += op if balance < 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L3_L5
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations:
return False
balance += op if balance < 0: return True
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L3_L7
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations:
balance += op if balance < 0: return True return False
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L4_L4
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations: balance += op
return True return False
if balance < 0:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L4_L5
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations: balance += op
return False
if balance < 0: return True
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L4_L7
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations: balance += op
if balance < 0: return True return False
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L5_L5
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations: balance += op if balance < 0:
return False
return True
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L5_L7
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations: balance += op if balance < 0:
return True return False
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/3/L7_L7
below_zero
from typing import List def below_zero(operations: List[int]) -> bool: """ You're given a list of deposit and withdrawal operations on a bank account that starts with zero balance. Your task is to detect if at any point the balance of account fallls below zero, and at that point function should return True. Otherwise it should return False. >>> below_zero([1, 2, 3]) False >>> below_zero([1, 2, -4, 5]) True """ balance = 0 for op in operations: balance += op if balance < 0: return True
return False
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([]) == False assert candidate([1, 2, -3, 1, 2, -3]) == False assert candidate([1, 2, -4, 5, 6]) == True assert candidate([1, -1, 2, -2, 5, -5, 4, -4]) == False assert candidate([1, -1, 2, -2, 5, -5, 4, -5]) == True assert candidate([1, -2, 2, -2, 5, -5, 4, -4]) == True
MultiLineInfilling/HumanEval/4/L0_L0
mean_absolute_deviation
from typing import List def mean_absolute_deviation(numbers: List[float]) -> float: """ For a given list of input numbers, calculate Mean Absolute Deviation around the mean of this dataset. Mean Absolute Deviation is the average absolute difference between each element and a centerpoint (mean in this case): MAD = average | x - x_mean | >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) 1.0 """
return sum(abs(x - mean) for x in numbers) / len(numbers)
mean = sum(numbers) / len(numbers)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert abs(candidate([1.0, 2.0, 3.0]) - 2.0/3.0) < 1e-6 assert abs(candidate([1.0, 2.0, 3.0, 4.0]) - 1.0) < 1e-6 assert abs(candidate([1.0, 2.0, 3.0, 4.0, 5.0]) - 6.0/5.0) < 1e-6
MultiLineInfilling/HumanEval/4/L0_L1
mean_absolute_deviation
from typing import List def mean_absolute_deviation(numbers: List[float]) -> float: """ For a given list of input numbers, calculate Mean Absolute Deviation around the mean of this dataset. Mean Absolute Deviation is the average absolute difference between each element and a centerpoint (mean in this case): MAD = average | x - x_mean | >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) 1.0 """
mean = sum(numbers) / len(numbers) return sum(abs(x - mean) for x in numbers) / len(numbers)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert abs(candidate([1.0, 2.0, 3.0]) - 2.0/3.0) < 1e-6 assert abs(candidate([1.0, 2.0, 3.0, 4.0]) - 1.0) < 1e-6 assert abs(candidate([1.0, 2.0, 3.0, 4.0, 5.0]) - 6.0/5.0) < 1e-6
MultiLineInfilling/HumanEval/4/L1_L1
mean_absolute_deviation
from typing import List def mean_absolute_deviation(numbers: List[float]) -> float: """ For a given list of input numbers, calculate Mean Absolute Deviation around the mean of this dataset. Mean Absolute Deviation is the average absolute difference between each element and a centerpoint (mean in this case): MAD = average | x - x_mean | >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) 1.0 """ mean = sum(numbers) / len(numbers)
return sum(abs(x - mean) for x in numbers) / len(numbers)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert abs(candidate([1.0, 2.0, 3.0]) - 2.0/3.0) < 1e-6 assert abs(candidate([1.0, 2.0, 3.0, 4.0]) - 1.0) < 1e-6 assert abs(candidate([1.0, 2.0, 3.0, 4.0, 5.0]) - 6.0/5.0) < 1e-6
MultiLineInfilling/HumanEval/5/L0_L0
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
if not numbers:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L0_L1
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
if not numbers: return []
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L0_L3
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
if not numbers: return [] result = []
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L0_L5
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
if not numbers: return [] result = [] for n in numbers[:-1]:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L0_L6
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
result.append(delimeter) result.append(numbers[-1]) return result
if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L0_L7
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
result.append(numbers[-1]) return result
if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L0_L9
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
return result
if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1])
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L0_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """
if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L1_L1
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers:
result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
return []
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L1_L3
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers:
for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
return [] result = []
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L1_L5
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers:
result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
return [] result = [] for n in numbers[:-1]:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L1_L6
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers:
result.append(delimeter) result.append(numbers[-1]) return result
return [] result = [] for n in numbers[:-1]: result.append(n)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L1_L7
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers:
result.append(numbers[-1]) return result
return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L1_L9
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers:
return result
return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1])
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L1_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers:
return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L3_L3
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return []
for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
result = []
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L3_L5
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return []
result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
result = [] for n in numbers[:-1]:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L3_L6
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return []
result.append(delimeter) result.append(numbers[-1]) return result
result = [] for n in numbers[:-1]: result.append(n)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L3_L7
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return []
result.append(numbers[-1]) return result
result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L3_L9
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return []
return result
result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1])
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L3_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return []
result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L5_L5
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = []
result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
for n in numbers[:-1]:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L5_L6
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = []
result.append(delimeter) result.append(numbers[-1]) return result
for n in numbers[:-1]: result.append(n)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L5_L7
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = []
result.append(numbers[-1]) return result
for n in numbers[:-1]: result.append(n) result.append(delimeter)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L5_L9
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = []
return result
for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1])
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L5_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = []
for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L6_L6
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]:
result.append(delimeter) result.append(numbers[-1]) return result
result.append(n)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L6_L7
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]:
result.append(numbers[-1]) return result
result.append(n) result.append(delimeter)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L6_L9
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]:
return result
result.append(n) result.append(delimeter) result.append(numbers[-1])
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L6_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]:
result.append(n) result.append(delimeter) result.append(numbers[-1]) return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L7_L7
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n)
result.append(numbers[-1]) return result
result.append(delimeter)
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L7_L9
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n)
return result
result.append(delimeter) result.append(numbers[-1])
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L7_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n)
result.append(delimeter) result.append(numbers[-1]) return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L9_L9
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter)
return result
result.append(numbers[-1])
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L9_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter)
result.append(numbers[-1]) return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/5/L11_L11
intersperse
from typing import List def intersperse(numbers: List[int], delimeter: int) -> List[int]: """ Insert a number 'delimeter' between every two consecutive elements of input list `numbers' >>> intersperse([], 4) [] >>> intersperse([1, 2, 3], 4) [1, 4, 2, 4, 3] """ if not numbers: return [] result = [] for n in numbers[:-1]: result.append(n) result.append(delimeter) result.append(numbers[-1])
return result
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate([], 7) == [] assert candidate([5, 6, 3, 2], 8) == [5, 8, 6, 8, 3, 8, 2] assert candidate([2, 2, 2], 2) == [2, 2, 2, 2, 2]
MultiLineInfilling/HumanEval/6/L0_L0
parse_nested_parens
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each of the group, output the deepest level of nesting of parentheses. E.g. (()()) has maximum two levels of nesting while ((())) has three. >>> parse_nested_parens('(()()) ((())) () ((())()())') [2, 3, 1, 3] """
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]
def parse_paren_group(s):
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3] assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4] assert candidate('(()(())((())))') == [4]
MultiLineInfilling/HumanEval/6/L0_L1
parse_nested_parens
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each of the group, output the deepest level of nesting of parentheses. E.g. (()()) has maximum two levels of nesting while ((())) has three. >>> parse_nested_parens('(()()) ((())) () ((())()())') [2, 3, 1, 3] """
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]
def parse_paren_group(s): depth = 0
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3] assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4] assert candidate('(()(())((())))') == [4]
MultiLineInfilling/HumanEval/6/L0_L2
parse_nested_parens
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each of the group, output the deepest level of nesting of parentheses. E.g. (()()) has maximum two levels of nesting while ((())) has three. >>> parse_nested_parens('(()()) ((())) () ((())()())') [2, 3, 1, 3] """
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]
def parse_paren_group(s): depth = 0 max_depth = 0
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3] assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4] assert candidate('(()(())((())))') == [4]
MultiLineInfilling/HumanEval/6/L0_L3
parse_nested_parens
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each of the group, output the deepest level of nesting of parentheses. E.g. (()()) has maximum two levels of nesting while ((())) has three. >>> parse_nested_parens('(()()) ((())) () ((())()())') [2, 3, 1, 3] """
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]
def parse_paren_group(s): depth = 0 max_depth = 0 for c in s:
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3] assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4] assert candidate('(()(())((())))') == [4]
MultiLineInfilling/HumanEval/6/L0_L4
parse_nested_parens
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each of the group, output the deepest level of nesting of parentheses. E.g. (()()) has maximum two levels of nesting while ((())) has three. >>> parse_nested_parens('(()()) ((())) () ((())()())') [2, 3, 1, 3] """
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]
def parse_paren_group(s): depth = 0 max_depth = 0 for c in s: if c == '(':
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3] assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4] assert candidate('(()(())((())))') == [4]
MultiLineInfilling/HumanEval/6/L0_L5
parse_nested_parens
from typing import List def parse_nested_parens(paren_string: str) -> List[int]: """ Input to this function is a string represented multiple groups for nested parentheses separated by spaces. For each of the group, output the deepest level of nesting of parentheses. E.g. (()()) has maximum two levels of nesting while ((())) has three. >>> parse_nested_parens('(()()) ((())) () ((())()())') [2, 3, 1, 3] """
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]
def parse_paren_group(s): depth = 0 max_depth = 0 for c in s: if c == '(': depth += 1
METADATA = { 'author': 'jt', 'dataset': 'test' } def check(candidate): assert candidate('(()()) ((())) () ((())()())') == [2, 3, 1, 3] assert candidate('() (()) ((())) (((())))') == [1, 2, 3, 4] assert candidate('(()(())((())))') == [4]