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/39/L7_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
n -= 1 if n == 0: return f[-1]
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
if n == 0: return f[-1]
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
return f[-1]
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L7_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0:
return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L8
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return True
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return True f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return True f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
return True f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
n -= 1 if n == 0: return f[-1]
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
if n == 0: return f[-1]
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
return f[-1]
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L8_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False
return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L9_L9
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
f = [0, 1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L9_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
f = [0, 1] while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L9_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
f = [0, 1] while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L9_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
n -= 1 if n == 0: return f[-1]
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L9_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
if n == 0: return f[-1]
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L9_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
return f[-1]
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L9_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True
f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L10_L10
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
while True:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L10_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
while True: f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L10_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
n -= 1 if n == 0: return f[-1]
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L10_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
if n == 0: return f[-1]
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L10_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
return f[-1]
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L10_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1]
while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L11_L11
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
f.append(f[-1] + f[-2])
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L11_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
n -= 1 if n == 0: return f[-1]
f.append(f[-1] + f[-2]) if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L11_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
if n == 0: return f[-1]
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L11_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
return f[-1]
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L11_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True:
f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L12_L12
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
n -= 1 if n == 0: return f[-1]
if is_prime(f[-1]):
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L12_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
if n == 0: return f[-1]
if is_prime(f[-1]): n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L12_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
return f[-1]
if is_prime(f[-1]): n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L12_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2])
if is_prime(f[-1]): n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L13_L13
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
if n == 0: return f[-1]
n -= 1
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L13_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
return f[-1]
n -= 1 if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L13_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]):
n -= 1 if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L14_L14
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
return f[-1]
if n == 0:
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L14_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1
if n == 0: return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/39/L15_L15
prime_fib
def prime_fib(n: int): """ prime_fib returns n-th number that is a Fibonacci number and it's also prime. >>> prime_fib(1) 2 >>> prime_fib(2) 3 >>> prime_fib(3) 5 >>> prime_fib(4) 13 >>> prime_fib(5) 89 """ import math def is_prime(p): if p < 2: return False for k in range(2, min(int(math.sqrt(p)) + 1, p - 1)): if p % k == 0: return False return True f = [0, 1] while True: f.append(f[-1] + f[-2]) if is_prime(f[-1]): n -= 1 if n == 0:
return f[-1]
METADATA = {} def check(candidate): assert candidate(1) == 2 assert candidate(2) == 3 assert candidate(3) == 5 assert candidate(4) == 13 assert candidate(5) == 89 assert candidate(6) == 233 assert candidate(7) == 1597 assert candidate(8) == 28657 assert candidate(9) == 514229 assert candidate(10) == 433494437
MultiLineInfilling/HumanEval/40/L0_L0
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """
for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True return False
for i in range(len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L0_L1
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """
for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True return False
for i in range(len(l)): for j in range(i + 1, len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L0_L2
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """
if l[i] + l[j] + l[k] == 0: return True return False
for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L0_L3
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """
return True return False
for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0:
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L0_L4
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """
return False
for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L0_L5
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """
for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L1_L1
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)):
for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True return False
for j in range(i + 1, len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L1_L2
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)):
if l[i] + l[j] + l[k] == 0: return True return False
for j in range(i + 1, len(l)): for k in range(j + 1, len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L1_L3
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)):
return True return False
for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0:
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L1_L4
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)):
return False
for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L1_L5
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)):
for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L2_L2
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)):
if l[i] + l[j] + l[k] == 0: return True return False
for k in range(j + 1, len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L2_L3
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)):
return True return False
for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0:
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L2_L4
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)):
return False
for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L2_L5
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)):
for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L3_L3
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)):
return True return False
if l[i] + l[j] + l[k] == 0:
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L3_L4
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)):
return False
if l[i] + l[j] + l[k] == 0: return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L3_L5
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)):
if l[i] + l[j] + l[k] == 0: return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L4_L4
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0:
return False
return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L4_L5
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0:
return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/40/L5_L5
triples_sum_to_zero
def triples_sum_to_zero(l: list): """ triples_sum_to_zero takes a list of integers as an input. it returns True if there are three distinct elements in the list that sum to zero, and False otherwise. >>> triples_sum_to_zero([1, 3, 5, 0]) False >>> triples_sum_to_zero([1, 3, -2, 1]) True >>> triples_sum_to_zero([1, 2, 3, 7]) False >>> triples_sum_to_zero([2, 4, -5, 3, 9, 7]) True >>> triples_sum_to_zero([1]) False """ for i in range(len(l)): for j in range(i + 1, len(l)): for k in range(j + 1, len(l)): if l[i] + l[j] + l[k] == 0: return True
return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, 5, -1]) == False assert candidate([1, 3, -2, 1]) == True assert candidate([1, 2, 3, 7]) == False assert candidate([1, 2, 5, 7]) == False assert candidate([2, 4, -5, 3, 9, 7]) == True assert candidate([1]) == False assert candidate([1, 3, 5, -100]) == False assert candidate([100, 3, 5, -100]) == False
MultiLineInfilling/HumanEval/41/L0_L0
car_race_collision
def car_race_collision(n: int): """ Imagine a road that's a perfectly straight infinitely long line. n cars are driving left to right; simultaneously, a different set of n cars are driving right to left. The two sets of cars start out being very far from each other. All cars move in the same speed. Two cars are said to collide when a car that's moving left to right hits a car that's moving right to left. However, the cars are infinitely sturdy and strong; as a result, they continue moving in their trajectory as if they did not collide. This function outputs the number of such collisions. """
return n**2
METADATA = {} def check(candidate): assert candidate(2) == 4 assert candidate(3) == 9 assert candidate(4) == 16 assert candidate(8) == 64 assert candidate(10) == 100
MultiLineInfilling/HumanEval/42/L0_L0
incr_list
def incr_list(l: list): """Return list with elements incremented by 1. >>> incr_list([1, 2, 3]) [2, 3, 4] >>> incr_list([5, 3, 5, 2, 3, 3, 9, 0, 123]) [6, 4, 6, 3, 4, 4, 10, 1, 124] """
return [(e + 1) for e in l]
METADATA = {} def check(candidate): assert candidate([]) == [] assert candidate([3, 2, 1]) == [4, 3, 2] assert candidate([5, 2, 5, 2, 3, 3, 9, 0, 123]) == [6, 3, 6, 3, 4, 4, 10, 1, 124]
MultiLineInfilling/HumanEval/43/L0_L0
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """
for j in range(i + 1, len(l)): if l1 + l[j] == 0: return True return False
for i, l1 in enumerate(l):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L0_L1
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """
if l1 + l[j] == 0: return True return False
for i, l1 in enumerate(l): for j in range(i + 1, len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L0_L2
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """
return True return False
for i, l1 in enumerate(l): for j in range(i + 1, len(l)): if l1 + l[j] == 0:
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L0_L3
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """
return False
for i, l1 in enumerate(l): for j in range(i + 1, len(l)): if l1 + l[j] == 0: return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L0_L4
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """
for i, l1 in enumerate(l): for j in range(i + 1, len(l)): if l1 + l[j] == 0: return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L1_L1
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l):
if l1 + l[j] == 0: return True return False
for j in range(i + 1, len(l)):
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L1_L2
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l):
return True return False
for j in range(i + 1, len(l)): if l1 + l[j] == 0:
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L1_L3
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l):
return False
for j in range(i + 1, len(l)): if l1 + l[j] == 0: return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L1_L4
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l):
for j in range(i + 1, len(l)): if l1 + l[j] == 0: return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L2_L2
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l): for j in range(i + 1, len(l)):
return True return False
if l1 + l[j] == 0:
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L2_L3
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l): for j in range(i + 1, len(l)):
return False
if l1 + l[j] == 0: return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L2_L4
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l): for j in range(i + 1, len(l)):
if l1 + l[j] == 0: return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L3_L3
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l): for j in range(i + 1, len(l)): if l1 + l[j] == 0:
return False
return True
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L3_L4
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l): for j in range(i + 1, len(l)): if l1 + l[j] == 0:
return True return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/43/L4_L4
pairs_sum_to_zero
def pairs_sum_to_zero(l): """ pairs_sum_to_zero takes a list of integers as an input. it returns True if there are two distinct elements in the list that sum to zero, and False otherwise. >>> pairs_sum_to_zero([1, 3, 5, 0]) False >>> pairs_sum_to_zero([1, 3, -2, 1]) False >>> pairs_sum_to_zero([1, 2, 3, 7]) False >>> pairs_sum_to_zero([2, 4, -5, 3, 5, 7]) True >>> pairs_sum_to_zero([1]) False """ for i, l1 in enumerate(l): for j in range(i + 1, len(l)): if l1 + l[j] == 0: return True
return False
METADATA = {} def check(candidate): assert candidate([1, 3, 5, 0]) == False assert candidate([1, 3, -2, 1]) == False assert candidate([1, 2, 3, 7]) == False assert candidate([2, 4, -5, 3, 5, 7]) == True assert candidate([1]) == False assert candidate([-3, 9, -1, 3, 2, 30]) == True assert candidate([-3, 9, -1, 3, 2, 31]) == True assert candidate([-3, 9, -1, 4, 2, 30]) == False assert candidate([-3, 9, -1, 4, 2, 31]) == False
MultiLineInfilling/HumanEval/44/L0_L0
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """
while x > 0: ret = str(x % base) + ret x //= base return ret
ret = ""
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L0_L1
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """
ret = str(x % base) + ret x //= base return ret
ret = "" while x > 0:
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L0_L2
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """
x //= base return ret
ret = "" while x > 0: ret = str(x % base) + ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L0_L3
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """
return ret
ret = "" while x > 0: ret = str(x % base) + ret x //= base
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L0_L4
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """
ret = "" while x > 0: ret = str(x % base) + ret x //= base return ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L1_L1
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = ""
ret = str(x % base) + ret x //= base return ret
while x > 0:
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L1_L2
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = ""
x //= base return ret
while x > 0: ret = str(x % base) + ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L1_L3
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = ""
return ret
while x > 0: ret = str(x % base) + ret x //= base
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L1_L4
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = ""
while x > 0: ret = str(x % base) + ret x //= base return ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L2_L2
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = "" while x > 0:
x //= base return ret
ret = str(x % base) + ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L2_L3
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = "" while x > 0:
return ret
ret = str(x % base) + ret x //= base
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L2_L4
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = "" while x > 0:
ret = str(x % base) + ret x //= base return ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L3_L3
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = "" while x > 0: ret = str(x % base) + ret
return ret
x //= base
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L3_L4
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = "" while x > 0: ret = str(x % base) + ret
x //= base return ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/44/L4_L4
change_base
def change_base(x: int, base: int): """Change numerical base of input number x to base. return string representation after the conversion. base numbers are less than 10. >>> change_base(8, 3) '22' >>> change_base(8, 2) '1000' >>> change_base(7, 2) '111' """ ret = "" while x > 0: ret = str(x % base) + ret x //= base
return ret
METADATA = {} def check(candidate): assert candidate(8, 3) == "22" assert candidate(9, 3) == "100" assert candidate(234, 2) == "11101010" assert candidate(16, 2) == "10000" assert candidate(8, 2) == "1000" assert candidate(7, 2) == "111" for x in range(2, 8): assert candidate(x, x + 1) == str(x)
MultiLineInfilling/HumanEval/45/L0_L0
triangle_area
def triangle_area(a, h): """Given length of a side and high return area for a triangle. >>> triangle_area(5, 3) 7.5 """
return a * h / 2.0
METADATA = {} def check(candidate): assert candidate(5, 3) == 7.5 assert candidate(2, 2) == 2.0 assert candidate(10, 8) == 40.0
MultiLineInfilling/HumanEval/46/L0_L0
fib4
def fib4(n: int): """The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: fib4(0) -> 0 fib4(1) -> 0 fib4(2) -> 2 fib4(3) -> 0 fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion. >>> fib4(5) 4 >>> fib4(6) 8 >>> fib4(7) 14 """
if n < 4: return results[n] for _ in range(4, n + 1): results.append(results[-1] + results[-2] + results[-3] + results[-4]) results.pop(0) return results[-1]
results = [0, 0, 2, 0]
METADATA = {} def check(candidate): assert candidate(5) == 4 assert candidate(8) == 28 assert candidate(10) == 104 assert candidate(12) == 386
MultiLineInfilling/HumanEval/46/L0_L1
fib4
def fib4(n: int): """The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows: fib4(0) -> 0 fib4(1) -> 0 fib4(2) -> 2 fib4(3) -> 0 fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4). Please write a function to efficiently compute the n-th element of the fib4 number sequence. Do not use recursion. >>> fib4(5) 4 >>> fib4(6) 8 >>> fib4(7) 14 """
return results[n] for _ in range(4, n + 1): results.append(results[-1] + results[-2] + results[-3] + results[-4]) results.pop(0) return results[-1]
results = [0, 0, 2, 0] if n < 4:
METADATA = {} def check(candidate): assert candidate(5) == 4 assert candidate(8) == 28 assert candidate(10) == 104 assert candidate(12) == 386