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/20/L8_L15 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
| closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
|
MultiLineInfilling/HumanEval/20/L9_L9 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
| new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L9_L10 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
| if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| else:
new_distance = abs(elem - elem2)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L9_L11 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
| distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| else:
new_distance = abs(elem - elem2)
if new_distance < distance:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L9_L12 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
| closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| else:
new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L9_L13 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
|
return closest_pair
| else:
new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L9_L15 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
| else:
new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
|
MultiLineInfilling/HumanEval/20/L10_L10 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
| if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| new_distance = abs(elem - elem2)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L10_L11 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
| distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| new_distance = abs(elem - elem2)
if new_distance < distance:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L10_L12 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
| closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L10_L13 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
|
return closest_pair
| new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L10_L15 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
| new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
|
MultiLineInfilling/HumanEval/20/L11_L11 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
| distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| if new_distance < distance:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L11_L12 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
| closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| if new_distance < distance:
distance = new_distance
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L11_L13 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
|
return closest_pair
| if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L11_L15 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
| if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
|
MultiLineInfilling/HumanEval/20/L12_L12 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
if new_distance < distance:
| closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
| distance = new_distance
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L12_L13 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
if new_distance < distance:
|
return closest_pair
| distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L12_L15 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
if new_distance < distance:
| distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
|
MultiLineInfilling/HumanEval/20/L13_L13 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
|
return closest_pair
| closest_pair = tuple(sorted([elem, elem2]))
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
MultiLineInfilling/HumanEval/20/L13_L15 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
| closest_pair = tuple(sorted([elem, elem2]))
return closest_pair
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
|
MultiLineInfilling/HumanEval/20/L15_L15 | find_closest_elements | from typing import List, Tuple
def find_closest_elements(numbers: List[float]) -> Tuple[float, float]:
""" From a supplied list of numbers (of length at least two) select and return two that are the closest to each
other and return them in order (smaller number, larger number).
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.2])
(2.0, 2.2)
>>> find_closest_elements([1.0, 2.0, 3.0, 4.0, 5.0, 2.0])
(2.0, 2.0)
"""
closest_pair = None
distance = None
for idx, elem in enumerate(numbers):
for idx2, elem2 in enumerate(numbers):
if idx != idx2:
if distance is None:
distance = abs(elem - elem2)
closest_pair = tuple(sorted([elem, elem2]))
else:
new_distance = abs(elem - elem2)
if new_distance < distance:
distance = new_distance
closest_pair = tuple(sorted([elem, elem2]))
| return closest_pair
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([1.0, 2.0, 3.9, 4.0, 5.0, 2.2]) == (3.9, 4.0)
assert candidate([1.0, 2.0, 5.9, 4.0, 5.0]) == (5.0, 5.9)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.2]) == (2.0, 2.2)
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0, 2.0]) == (2.0, 2.0)
assert candidate([1.1, 2.2, 3.1, 4.1, 5.1]) == (2.2, 3.1)
|
|
MultiLineInfilling/HumanEval/21/L0_L0 | rescale_to_unit | from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
| max_number = max(numbers)
return [(x - min_number) / (max_number - min_number) for x in numbers]
| min_number = min(numbers)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([2.0, 49.9]) == [0.0, 1.0]
assert candidate([100.0, 49.9]) == [1.0, 0.0]
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
|
MultiLineInfilling/HumanEval/21/L0_L1 | rescale_to_unit | from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
| return [(x - min_number) / (max_number - min_number) for x in numbers]
| min_number = min(numbers)
max_number = max(numbers)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([2.0, 49.9]) == [0.0, 1.0]
assert candidate([100.0, 49.9]) == [1.0, 0.0]
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
|
MultiLineInfilling/HumanEval/21/L0_L2 | rescale_to_unit | from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
| min_number = min(numbers)
max_number = max(numbers)
return [(x - min_number) / (max_number - min_number) for x in numbers]
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([2.0, 49.9]) == [0.0, 1.0]
assert candidate([100.0, 49.9]) == [1.0, 0.0]
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
|
|
MultiLineInfilling/HumanEval/21/L1_L1 | rescale_to_unit | from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_number = min(numbers)
| return [(x - min_number) / (max_number - min_number) for x in numbers]
| max_number = max(numbers)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([2.0, 49.9]) == [0.0, 1.0]
assert candidate([100.0, 49.9]) == [1.0, 0.0]
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
|
MultiLineInfilling/HumanEval/21/L1_L2 | rescale_to_unit | from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_number = min(numbers)
| max_number = max(numbers)
return [(x - min_number) / (max_number - min_number) for x in numbers]
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([2.0, 49.9]) == [0.0, 1.0]
assert candidate([100.0, 49.9]) == [1.0, 0.0]
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
|
|
MultiLineInfilling/HumanEval/21/L2_L2 | rescale_to_unit | from typing import List
def rescale_to_unit(numbers: List[float]) -> List[float]:
""" Given list of numbers (of at least two elements), apply a linear transform to that list,
such that the smallest number will become 0 and the largest will become 1
>>> rescale_to_unit([1.0, 2.0, 3.0, 4.0, 5.0])
[0.0, 0.25, 0.5, 0.75, 1.0]
"""
min_number = min(numbers)
max_number = max(numbers)
| return [(x - min_number) / (max_number - min_number) for x in numbers]
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([2.0, 49.9]) == [0.0, 1.0]
assert candidate([100.0, 49.9]) == [1.0, 0.0]
assert candidate([1.0, 2.0, 3.0, 4.0, 5.0]) == [0.0, 0.25, 0.5, 0.75, 1.0]
assert candidate([2.0, 1.0, 5.0, 3.0, 4.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
assert candidate([12.0, 11.0, 15.0, 13.0, 14.0]) == [0.25, 0.0, 1.0, 0.5, 0.75]
|
|
MultiLineInfilling/HumanEval/22/L0_L0 | filter_integers | from typing import List, Any
def filter_integers(values: List[Any]) -> List[int]:
""" Filter given list of any python values only for integers
>>> filter_integers(['a', 3.14, 5])
[5]
>>> filter_integers([1, 2, 3, 'abc', {}, []])
[1, 2, 3]
"""
| return [x for x in values if isinstance(x, int)]
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate([]) == []
assert candidate([4, {}, [], 23.2, 9, 'adasd']) == [4, 9]
assert candidate([3, 'c', 3, 3, 'a', 'b']) == [3, 3, 3]
|
|
MultiLineInfilling/HumanEval/23/L0_L0 | strlen |
def strlen(string: str) -> int:
""" Return length of given string
>>> strlen('')
0
>>> strlen('abc')
3
"""
| return len(string)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate('') == 0
assert candidate('x') == 1
assert candidate('asdasnakj') == 9
|
|
MultiLineInfilling/HumanEval/24/L0_L0 | largest_divisor |
def largest_divisor(n: int) -> int:
""" For a given number n, find the largest number that divides n evenly, smaller than n
>>> largest_divisor(15)
5
"""
| if n % i == 0:
return i
| for i in reversed(range(n)):
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(3) == 1
assert candidate(7) == 1
assert candidate(10) == 5
assert candidate(100) == 50
assert candidate(49) == 7
|
MultiLineInfilling/HumanEval/24/L0_L1 | largest_divisor |
def largest_divisor(n: int) -> int:
""" For a given number n, find the largest number that divides n evenly, smaller than n
>>> largest_divisor(15)
5
"""
| return i
| for i in reversed(range(n)):
if n % i == 0:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(3) == 1
assert candidate(7) == 1
assert candidate(10) == 5
assert candidate(100) == 50
assert candidate(49) == 7
|
MultiLineInfilling/HumanEval/24/L0_L2 | largest_divisor |
def largest_divisor(n: int) -> int:
""" For a given number n, find the largest number that divides n evenly, smaller than n
>>> largest_divisor(15)
5
"""
| for i in reversed(range(n)):
if n % i == 0:
return i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(3) == 1
assert candidate(7) == 1
assert candidate(10) == 5
assert candidate(100) == 50
assert candidate(49) == 7
|
|
MultiLineInfilling/HumanEval/24/L1_L1 | largest_divisor |
def largest_divisor(n: int) -> int:
""" For a given number n, find the largest number that divides n evenly, smaller than n
>>> largest_divisor(15)
5
"""
for i in reversed(range(n)):
| return i
| if n % i == 0:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(3) == 1
assert candidate(7) == 1
assert candidate(10) == 5
assert candidate(100) == 50
assert candidate(49) == 7
|
MultiLineInfilling/HumanEval/24/L1_L2 | largest_divisor |
def largest_divisor(n: int) -> int:
""" For a given number n, find the largest number that divides n evenly, smaller than n
>>> largest_divisor(15)
5
"""
for i in reversed(range(n)):
| if n % i == 0:
return i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(3) == 1
assert candidate(7) == 1
assert candidate(10) == 5
assert candidate(100) == 50
assert candidate(49) == 7
|
|
MultiLineInfilling/HumanEval/24/L2_L2 | largest_divisor |
def largest_divisor(n: int) -> int:
""" For a given number n, find the largest number that divides n evenly, smaller than n
>>> largest_divisor(15)
5
"""
for i in reversed(range(n)):
if n % i == 0:
| return i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(3) == 1
assert candidate(7) == 1
assert candidate(10) == 5
assert candidate(100) == 50
assert candidate(49) == 7
|
|
MultiLineInfilling/HumanEval/25/L0_L0 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| import math
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L1 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| import math
fact = []
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L2 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| import math
fact = []
i = 2
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L3 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L4 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L5 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L6 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| else:
i += 1
if n > 1:
fact.append(n)
return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| i += 1
if n > 1:
fact.append(n)
return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L8 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
|
if n > 1:
fact.append(n)
return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L10 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| fact.append(n)
return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L11 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| return fact
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L0_L12 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
| import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
|
MultiLineInfilling/HumanEval/25/L1_L1 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact = []
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L2 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact = []
i = 2
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L3 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L4 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L5 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L6 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| i += 1
if n > 1:
fact.append(n)
return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L8 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
|
if n > 1:
fact.append(n)
return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L10 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| fact.append(n)
return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L11 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| return fact
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L1_L12 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
| fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
|
MultiLineInfilling/HumanEval/25/L2_L2 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| i = 2
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L3 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L4 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L5 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L6 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| else:
i += 1
if n > 1:
fact.append(n)
return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| i += 1
if n > 1:
fact.append(n)
return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L8 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
|
if n > 1:
fact.append(n)
return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L10 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| fact.append(n)
return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L11 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| return fact
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L2_L12 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
| i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
|
MultiLineInfilling/HumanEval/25/L3_L3 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| while i <= int(math.sqrt(n) + 1):
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L4 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L5 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L6 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| else:
i += 1
if n > 1:
fact.append(n)
return fact
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| i += 1
if n > 1:
fact.append(n)
return fact
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L8 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
|
if n > 1:
fact.append(n)
return fact
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L10 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| fact.append(n)
return fact
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L11 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| return fact
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L3_L12 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
| while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
|
MultiLineInfilling/HumanEval/25/L4_L4 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| if n % i == 0:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L4_L5 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| if n % i == 0:
fact.append(i)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L4_L6 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
| else:
i += 1
if n > 1:
fact.append(n)
return fact
| if n % i == 0:
fact.append(i)
n //= i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L4_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
| i += 1
if n > 1:
fact.append(n)
return fact
| if n % i == 0:
fact.append(i)
n //= i
else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L4_L8 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
|
if n > 1:
fact.append(n)
return fact
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L4_L10 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
| fact.append(n)
return fact
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L4_L11 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
| return fact
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L4_L12 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
| if n % i == 0:
fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
|
MultiLineInfilling/HumanEval/25/L5_L5 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact.append(i)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L5_L6 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
| else:
i += 1
if n > 1:
fact.append(n)
return fact
| fact.append(i)
n //= i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L5_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
| i += 1
if n > 1:
fact.append(n)
return fact
| fact.append(i)
n //= i
else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L5_L8 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
|
if n > 1:
fact.append(n)
return fact
| fact.append(i)
n //= i
else:
i += 1
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L5_L10 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
| fact.append(n)
return fact
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L5_L11 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
| return fact
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L5_L12 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
| fact.append(i)
n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
|
MultiLineInfilling/HumanEval/25/L6_L6 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
| else:
i += 1
if n > 1:
fact.append(n)
return fact
| n //= i
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L6_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
| i += 1
if n > 1:
fact.append(n)
return fact
| n //= i
else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L6_L8 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
|
if n > 1:
fact.append(n)
return fact
| n //= i
else:
i += 1
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L6_L10 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
| fact.append(n)
return fact
| n //= i
else:
i += 1
if n > 1:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L6_L11 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
| return fact
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
MultiLineInfilling/HumanEval/25/L6_L12 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
| n //= i
else:
i += 1
if n > 1:
fact.append(n)
return fact
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|
|
MultiLineInfilling/HumanEval/25/L7_L7 | factorize | from typing import List
def factorize(n: int) -> List[int]:
""" Return list of prime factors of given integer in the order from smallest to largest.
Each of the factors should be listed number of times corresponding to how many times it appeares in factorization.
Input number should be equal to the product of all factors
>>> factorize(8)
[2, 2, 2]
>>> factorize(25)
[5, 5]
>>> factorize(70)
[2, 5, 7]
"""
import math
fact = []
i = 2
while i <= int(math.sqrt(n) + 1):
if n % i == 0:
fact.append(i)
n //= i
| i += 1
if n > 1:
fact.append(n)
return fact
| else:
|
METADATA = {
'author': 'jt',
'dataset': 'test'
}
def check(candidate):
assert candidate(2) == [2]
assert candidate(4) == [2, 2]
assert candidate(8) == [2, 2, 2]
assert candidate(3 * 19) == [3, 19]
assert candidate(3 * 19 * 3 * 19) == [3, 3, 19, 19]
assert candidate(3 * 19 * 3 * 19 * 3 * 19) == [3, 3, 3, 19, 19, 19]
assert candidate(3 * 19 * 19 * 19) == [3, 19, 19, 19]
assert candidate(3 * 2 * 3) == [2, 3, 3]
|