prefix
stringlengths 65
1.8k
| suffix
stringclasses 839
values | solution
stringlengths 6
859
| test_cases
listlengths 0
100
| import_str
listlengths 0
1
| demos
listlengths 0
8
| entry_func
stringclasses 158
values | data_id
stringlengths 36
40
| doc_string
stringclasses 164
values | dataset_name
stringclasses 1
value | task_name
stringclasses 1
value | compare_func
listlengths 0
0
| src_lang
stringclasses 1
value | tgt_lang
stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
|
res = int(round(num))
else:
res = 0
return res
|
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L3_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
|
else:
res = 0
return res
|
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L3_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
|
res = 0
return res
|
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L3_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
|
return res
|
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L3_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
|
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L3_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L4
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L5
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L7
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L8
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L9
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L10
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L11
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
res = int(round(num))
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
else:
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
res = 0
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
return res
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
|
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L4_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L5
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L7
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L8
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L9
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L10
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L11
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
res = int(round(num))
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
else:
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
res = 0
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
return res
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
|
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L5_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
num = float(value)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L7
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L8
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L9
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L10
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L11
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
res = int(round(num))
else:
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
else:
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
res = 0
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
return res
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
|
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L7_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if value[-2:] == '.5':
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L8
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if value[-2:] == '.5':
if num > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L9
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L10
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L11
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
res = int(round(num))
else:
res = 0
return res
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
else:
res = 0
return res
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
res = 0
return res
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
return res
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
|
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L8_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if num > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L9
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if num > 0:
res = ceil(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L10
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if num > 0:
res = ceil(num)
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L11
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
res = int(round(num))
else:
res = 0
return res
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
else:
res = 0
return res
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
res = 0
return res
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
return res
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
|
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L9_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
res = ceil(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L10
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
res = ceil(num)
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L11
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
res = ceil(num)
else:
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
res = int(round(num))
else:
res = 0
return res
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
else:
res = 0
return res
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
res = 0
return res
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
return res
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
|
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L10_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L11_L11
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
else:
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L11_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
res = int(round(num))
else:
res = 0
return res
|
else:
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L11_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
else:
res = 0
return res
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L11_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
res = 0
return res
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L11_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
return res
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L11_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
|
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L11_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
res = floor(num)
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L12_L12
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
res = int(round(num))
else:
res = 0
return res
|
res = floor(num)
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L12_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
else:
res = 0
return res
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L12_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
res = 0
return res
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L12_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
return res
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L12_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
|
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L12_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
res = int(round(num))
else:
res = 0
return res
|
elif len(value) > 0:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L13_L13
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
else:
res = 0
return res
|
elif len(value) > 0:
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L13_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
res = 0
return res
|
elif len(value) > 0:
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L13_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
return res
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L13_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
|
elif len(value) > 0:
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L13_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
else:
res = 0
return res
|
res = int(round(num))
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L14_L14
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
res = 0
return res
|
res = int(round(num))
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L14_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
return res
|
res = int(round(num))
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L14_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
|
res = int(round(num))
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L14_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
res = 0
return res
|
else:
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L15_L15
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
return res
|
else:
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L15_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
|
else:
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L15_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
return res
|
res = 0
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L16_L16
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
|
res = 0
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L16_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def closest_integer(value):
"""
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
"""
from math import floor, ceil
if value.count('.') == 1:
# remove trailing zeros
while (value[-1] == '0'):
value = value[:-1]
num = float(value)
if value[-2:] == '.5':
if num > 0:
res = ceil(num)
else:
res = floor(num)
elif len(value) > 0:
res = int(round(num))
else:
res = 0
|
return res
|
[
[
"\"10\"",
"10"
],
[
"\"14.5\"",
"15"
],
[
"\"-15.5\"",
"-16"
],
[
"\"15.3\"",
"15"
],
[
"\"0\"",
"0"
]
] |
[] |
[
[
"\"10\"",
"10"
],
[
"\"15.3\"",
"15"
]
] |
closest_integer
|
MultiLineInfilling/HumanEval/99/L18_L18
|
Create a function that takes a value (string) representing a number
and returns the closest integer to it. If the number is equidistant
from two integers, round it away from zero.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def make_a_pile(n):
"""
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
"""
|
return [n + 2*i for i in range(n)]
|
[
[
"3",
"[3, 5, 7]"
],
[
"4",
"[4,6,8,10]"
],
[
"5",
"[5, 7, 9, 11, 13]"
],
[
"6",
"[6, 8, 10, 12, 14, 16]"
],
[
"8",
"[8, 10, 12, 14, 16, 18, 20, 22]"
]
] |
[] |
[
[
"3",
"[3, 5, 7]"
]
] |
make_a_pile
|
MultiLineInfilling/HumanEval/100/L0_L0
|
Given a positive integer n, you have to make a pile of n levels of stones.
The first level has n stones.
The number of stones in the next level is:
- the next odd number if n is odd.
- the next even number if n is even.
Return the number of stones in each level in a list, where element at index
i represents the number of stones in the level (i+1).
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
|
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
"""
|
return []
s_list = []
for letter in s:
if letter == ',':
s_list.append(' ')
else:
s_list.append(letter)
s_list = "".join(s_list)
return s_list.split()
|
if not s:
|
[
[
"\"Hi, my name is John\"",
"[\"Hi\", \"my\", \"name\", \"is\", \"John\"]"
],
[
"\"One, two, three, four, five, six\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
],
[
"\"Hi, my name\"",
"[\"Hi\", \"my\", \"name\"]"
],
[
"\"One,, two, three, four, five, six,\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
],
[
"\"\"",
"[]"
],
[
"\"ahmed , gamal\"",
"[\"ahmed\", \"gamal\"]"
]
] |
[] |
[
[
"\"Hi, my name is John\"",
"[\"Hi\", \"my\", \"name\", \"is\", \"John\"]"
],
[
"\"One, two, three, four, five, six\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
]
] |
words_string
|
MultiLineInfilling/HumanEval/101/L0_L0
|
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
"""
|
s_list = []
for letter in s:
if letter == ',':
s_list.append(' ')
else:
s_list.append(letter)
s_list = "".join(s_list)
return s_list.split()
|
if not s:
return []
|
[
[
"\"Hi, my name is John\"",
"[\"Hi\", \"my\", \"name\", \"is\", \"John\"]"
],
[
"\"One, two, three, four, five, six\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
],
[
"\"Hi, my name\"",
"[\"Hi\", \"my\", \"name\"]"
],
[
"\"One,, two, three, four, five, six,\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
],
[
"\"\"",
"[]"
],
[
"\"ahmed , gamal\"",
"[\"ahmed\", \"gamal\"]"
]
] |
[] |
[
[
"\"Hi, my name is John\"",
"[\"Hi\", \"my\", \"name\", \"is\", \"John\"]"
],
[
"\"One, two, three, four, five, six\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
]
] |
words_string
|
MultiLineInfilling/HumanEval/101/L0_L1
|
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
def words_string(s):
"""
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
"""
|
for letter in s:
if letter == ',':
s_list.append(' ')
else:
s_list.append(letter)
s_list = "".join(s_list)
return s_list.split()
|
if not s:
return []
s_list = []
|
[
[
"\"Hi, my name is John\"",
"[\"Hi\", \"my\", \"name\", \"is\", \"John\"]"
],
[
"\"One, two, three, four, five, six\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
],
[
"\"Hi, my name\"",
"[\"Hi\", \"my\", \"name\"]"
],
[
"\"One,, two, three, four, five, six,\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
],
[
"\"\"",
"[]"
],
[
"\"ahmed , gamal\"",
"[\"ahmed\", \"gamal\"]"
]
] |
[] |
[
[
"\"Hi, my name is John\"",
"[\"Hi\", \"my\", \"name\", \"is\", \"John\"]"
],
[
"\"One, two, three, four, five, six\"",
"[\"One\", \"two\", \"three\", \"four\", \"five\", \"six\"]"
]
] |
words_string
|
MultiLineInfilling/HumanEval/101/L0_L3
|
You will be given a string of words separated by commas or spaces. Your task is
to split the string into words and return an array of the words.
|
HumanEval_MultiLineInfilling
|
code_infilling
|
[] |
python
|
python
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.