dataset_name
string | data_id
int64 | src_lang
null | tgt_lang
string | task_name
string | doc_string
string | prefix
string | suffix
string | solution
string | demos
sequence | compare_func
string | test_cases
sequence | import_str
sequence | entry_func
string | type
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
MBPP_sanitized | 227 | null | python | code_generation | def min_of_three(a, b, c):
"""
Write a function to find minimum of three numbers.
"""
| def min_of_three(a, b, c):
"""
Write a function to find minimum of three numbers.
"""
if a <= b and a <= c:
smallest = a
elif b <= a and b <= c:
smallest = b
else:
smallest = c
return smallest | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"10,20,0",
"0"
],
[
"19,15,18",
"15"
],
[
"-10,-20,-30",
"-30"
]
] | [] | min_of_three | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": [
"int"
],
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": [
"int"
],
"base1": null,
"base2": null,
"c": [
"int"
],
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 228 | null | python | code_generation | def all_Bits_Set_In_The_Given_Range(n, l, r):
"""
Write a python function to check whether all the bits are unset in the given range or not.
"""
| def all_Bits_Set_In_The_Given_Range(n, l, r):
"""
Write a python function to check whether all the bits are unset in the given range or not.
"""
num = (1 << r) - 1 ^ (1 << l - 1) - 1
new_num = n & num
if new_num == 0:
return True
return False | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"4,1,2",
"True"
],
[
"17,2,4",
"True"
],
[
"39,4,6",
"False"
]
] | [] | all_Bits_Set_In_The_Given_Range | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": [
"int"
],
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": [
"int"
],
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 229 | null | python | code_generation | def re_arrange_array(arr, n):
"""
Write a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved.
"""
| def re_arrange_array(arr, n):
"""
Write a function that takes in an array and an integer n, and re-arranges the first n elements of the given array so that all negative elements appear before positive ones, and where the relative order among negative and positive elements is preserved.
"""
j = 0
for i in range(0, n):
if arr[i] < 0:
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp
j = j + 1
return arr | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[-1, 2, -3, 4, 5, 6, -7, 8, 9], 9",
"[-1, -3, -7, 4, 5, 6, 2, 8, 9]"
],
[
"[12, -14, -26, 13, 15], 5",
"[-14, -26, 12, 13, 15]"
],
[
"[10, 24, 36, -42, -39, -78, 85], 7",
"[-42, -39, -78, 10, 24, 36, 85]"
]
] | [] | re_arrange_array | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": [
"list"
],
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 230 | null | python | code_generation | def replace_blank(str1, char):
"""
Write a function that takes in a string and character, replaces blank spaces in the string with the character, and returns the string.
"""
| def replace_blank(str1, char):
"""
Write a function that takes in a string and character, replaces blank spaces in the string with the character, and returns the string.
"""
str2 = str1.replace(' ', char)
return str2 | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"hello people\",'@'",
"(\"hello@people\")"
],
[
"\"python program language\",'$'",
"(\"python$program$language\")"
],
[
"\"blank space\",\"-\"",
"(\"blank-space\")"
]
] | [] | replace_blank | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": [
"str"
],
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": [
"str"
],
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"str"
]
} |
||
MBPP_sanitized | 232 | null | python | code_generation | import heapq
def larg_nnum(list1, n):
"""
Write a function that takes in a list and an integer n and returns a list containing the n largest items from the list.
"""
| import heapq
def larg_nnum(list1, n):
"""
Write a function that takes in a list and an integer n and returns a list containing the n largest items from the list.
"""
largest = heapq.nlargest(n, list1)
return largest | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],2",
"[100,90]"
],
[
"[10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],5",
"[100,90,80,70,60]"
],
[
"[10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],3",
"[100,90,80]"
]
] | [
"import heapq"
] | larg_nnum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"set"
]
} |
||
MBPP_sanitized | 233 | null | python | code_generation | def lateralsuface_cylinder(r, h):
"""
Write a function to find the lateral surface area of a cylinder.
"""
| def lateralsuface_cylinder(r, h):
"""
Write a function to find the lateral surface area of a cylinder.
"""
lateralsurface = 2 * 3.1415 * r * h
return lateralsurface | [] | import math
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assert math.isclose(candidate(*inp), exp, rel_tol=0.001) | [
[
"10,5",
"314.15000000000003"
],
[
"4,5",
"125.66000000000001"
],
[
"4,10",
"251.32000000000002"
]
] | [] | lateralsuface_cylinder | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": [
"int"
],
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": [
"int"
],
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 234 | null | python | code_generation | def volume_cube(l):
"""
Write a function to find the volume of a cube given its side length.
"""
| def volume_cube(l):
"""
Write a function to find the volume of a cube given its side length.
"""
volume = l * l * l
return volume | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"3",
"27"
],
[
"2",
"8"
],
[
"5",
"125"
]
] | [] | volume_cube | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": [
"int"
],
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 235 | null | python | code_generation | def even_bit_set_number(n):
"""
Write a python function to set all even bits of a given number.
"""
| def even_bit_set_number(n):
"""
Write a python function to set all even bits of a given number.
"""
count = 0
res = 0
temp = n
while temp > 0:
if count % 2 == 1:
res |= 1 << count
count += 1
temp >>= 1
return n | res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"10",
"10"
],
[
"20",
"30"
],
[
"30",
"30"
]
] | [] | even_bit_set_number | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 237 | null | python | code_generation | from collections import Counter
def check_occurences(test_list):
"""
Write a function that takes in a list of tuples and returns a dictionary mapping each unique tuple to the number of times it occurs in the list.
"""
| from collections import Counter
def check_occurences(test_list):
"""
Write a function that takes in a list of tuples and returns a dictionary mapping each unique tuple to the number of times it occurs in the list.
"""
res = dict(Counter((tuple(ele) for ele in map(sorted, test_list))))
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[(3, 1), (1, 3), (2, 5), (5, 2), (6, 3)] ",
"{(1, 3): 2, (2, 5): 2, (3, 6): 1}"
],
[
"[(4, 2), (2, 4), (3, 6), (6, 3), (7, 4)] ",
"{(2, 4): 2, (3, 6): 2, (4, 7): 1}"
],
[
"[(13, 2), (11, 23), (12, 25), (25, 12), (16, 23)] ",
"{(2, 13): 1, (11, 23): 1, (12, 25): 2, (16, 23): 1}"
]
] | [
"from collections import Counter "
] | check_occurences | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": [
"list"
],
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"dict"
]
} |
||
MBPP_sanitized | 238 | null | python | code_generation | def number_of_substrings(str):
"""
Write a python function to count the number of non-empty substrings of a given string.
"""
| def number_of_substrings(str):
"""
Write a python function to count the number of non-empty substrings of a given string.
"""
str_len = len(str)
return int(str_len * (str_len + 1) / 2) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"abc\"",
"6"
],
[
"\"abcd\"",
"10"
],
[
"\"abcde\"",
"15"
]
] | [] | number_of_substrings | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": [
"str"
],
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 239 | null | python | code_generation | def get_total_number_of_sequences(m, n):
"""
Write a function that takes in positive integers m and n and finds the number of possible sequences of length n, such that each element is a positive integer and is greater than or equal to twice the previous element but less than or equal to m.
"""
| def get_total_number_of_sequences(m, n):
"""
Write a function that takes in positive integers m and n and finds the number of possible sequences of length n, such that each element is a positive integer and is greater than or equal to twice the previous element but less than or equal to m.
"""
T = [[0 for i in range(n + 1)] for i in range(m + 1)]
for i in range(m + 1):
for j in range(n + 1):
if i == 0 or j == 0:
T[i][j] = 0
elif i < j:
T[i][j] = 0
elif j == 1:
T[i][j] = i
else:
T[i][j] = T[i - 1][j] + T[i // 2][j - 1]
return T[m][n] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"10, 4",
"4"
],
[
"5, 2",
"6"
],
[
"16, 3",
"84"
]
] | [] | get_total_number_of_sequences | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": [
"int"
],
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 240 | null | python | code_generation | def replace_list(list1, list2):
"""
Write a function that takes in two lists and replaces the last element of the first list with the elements of the second list.
"""
| def replace_list(list1, list2):
"""
Write a function that takes in two lists and replaces the last element of the first list with the elements of the second list.
"""
list1[-1:] = list2
replace_list = list1
return replace_list | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1, 3, 5, 7, 9, 10],[2, 4, 6, 8]",
"[1, 3, 5, 7, 9, 2, 4, 6, 8]"
],
[
"[1,2,3,4,5],[5,6,7,8]",
"[1,2,3,4,5,6,7,8]"
],
[
"[\"red\",\"blue\",\"green\"],[\"yellow\"]",
"[\"red\",\"blue\",\"yellow\"]"
]
] | [] | replace_list | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": [
"list"
],
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 242 | null | python | code_generation | def count_charac(str1):
"""
Write a function to count the total number of characters in a string.
"""
| def count_charac(str1):
"""
Write a function to count the total number of characters in a string.
"""
total = 0
for i in str1:
total = total + 1
return total | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"python programming\"",
"18"
],
[
"\"language\"",
"8"
],
[
"\"words\"",
"5"
]
] | [] | count_charac | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": [
"str"
],
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 244 | null | python | code_generation | import math
def next_Perfect_Square(N):
"""
Write a python function to find the next perfect square greater than a given number.
"""
| import math
def next_Perfect_Square(N):
"""
Write a python function to find the next perfect square greater than a given number.
"""
nextN = math.floor(math.sqrt(N)) + 1
return nextN * nextN | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"35",
"36"
],
[
"6",
"9"
],
[
"9",
"16"
]
] | [
"import math "
] | next_Perfect_Square | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": [
"int"
],
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 245 | null | python | code_generation | def max_sum(arr):
"""
Write a function that takes an array and finds the maximum sum of a bitonic subsequence for the given array, where a sequence is bitonic if it is first increasing and then decreasing.
"""
| def max_sum(arr):
"""
Write a function that takes an array and finds the maximum sum of a bitonic subsequence for the given array, where a sequence is bitonic if it is first increasing and then decreasing.
"""
MSIBS = arr[:]
for i in range(len(arr)):
for j in range(0, i):
if arr[i] > arr[j] and MSIBS[i] < MSIBS[j] + arr[i]:
MSIBS[i] = MSIBS[j] + arr[i]
MSDBS = arr[:]
for i in range(1, len(arr) + 1):
for j in range(1, i):
if arr[-i] > arr[-j] and MSDBS[-i] < MSDBS[-j] + arr[-i]:
MSDBS[-i] = MSDBS[-j] + arr[-i]
max_sum = float('-Inf')
for (i, j, k) in zip(MSIBS, MSDBS, arr):
max_sum = max(max_sum, i + j - k)
return max_sum | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1, 15, 51, 45, 33, 100, 12, 18, 9]",
"194"
],
[
"[80, 60, 30, 40, 20, 10]",
"210"
],
[
"[2, 3 ,14, 16, 21, 23, 29, 30]",
"138"
]
] | [] | max_sum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": [
"list"
],
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 246 | null | python | code_generation | def babylonian_squareroot(number):
"""
Write a function for computing square roots using the babylonian method.
"""
| def babylonian_squareroot(number):
"""
Write a function for computing square roots using the babylonian method.
"""
if number == 0:
return 0
g = number / 2.0
g2 = g + 1
while g != g2:
n = number / g
g2 = g
g = (g + n) / 2
return g | [] | import math
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assert math.isclose(candidate(*inp), exp, rel_tol=0.001) | [
[
"10",
"3.162277660168379"
],
[
"2",
"1.414213562373095"
],
[
"9",
"3.0"
]
] | [] | babylonian_squareroot | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": [
"int"
],
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 247 | null | python | code_generation | def lps(str):
"""
Write a function to find the length of the longest palindromic subsequence in the given string.
"""
| def lps(str):
"""
Write a function to find the length of the longest palindromic subsequence in the given string.
"""
n = len(str)
L = [[0 for x in range(n)] for x in range(n)]
for i in range(n):
L[i][i] = 1
for cl in range(2, n + 1):
for i in range(n - cl + 1):
j = i + cl - 1
if str[i] == str[j] and cl == 2:
L[i][j] = 2
elif str[i] == str[j]:
L[i][j] = L[i + 1][j - 1] + 2
else:
L[i][j] = max(L[i][j - 1], L[i + 1][j])
return L[0][n - 1] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"TENS FOR TENS\"",
"5"
],
[
"\"CARDIO FOR CARDS\"",
"7"
],
[
"\"PART OF THE JOURNEY IS PART\"",
"9"
]
] | [] | lps | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": [
"str"
],
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 248 | null | python | code_generation | def harmonic_sum(n):
"""
Write a function that takes in an integer n and calculates the harmonic sum of n-1.
"""
| def harmonic_sum(n):
"""
Write a function that takes in an integer n and calculates the harmonic sum of n-1.
"""
if n < 2:
return 1
else:
return 1 / n + harmonic_sum(n - 1) | [] | import math
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assert math.isclose(candidate(*inp), exp, rel_tol=0.001) | [
[
"7",
"2.5928571428571425"
],
[
"4",
"2.083333333333333"
],
[
"19",
"3.547739657143682"
]
] | [] | harmonic_sum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 249 | null | python | code_generation | def intersection_array(array_nums1, array_nums2):
"""
Write a function to find the intersection of two arrays.
"""
| def intersection_array(array_nums1, array_nums2):
"""
Write a function to find the intersection of two arrays.
"""
result = list(filter(lambda x: x in array_nums1, array_nums2))
return result | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1, 2, 3, 5, 7, 8, 9, 10],[1, 2, 4, 8, 9]",
"[1, 2, 8, 9]"
],
[
"[1, 2, 3, 5, 7, 8, 9, 10],[3,5,7,9]",
"[3,5,7,9]"
],
[
"[1, 2, 3, 5, 7, 8, 9, 10],[10,20,30,40]",
"[10]"
]
] | [] | intersection_array | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": [
"list"
],
"array_nums2": [
"list"
],
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 250 | null | python | code_generation | def count_X(tup, x):
"""
Write a python function that takes in a tuple and an element and counts the occcurences of the element in the tuple.
"""
| def count_X(tup, x):
"""
Write a python function that takes in a tuple and an element and counts the occcurences of the element in the tuple.
"""
count = 0
for ele in tup:
if ele == x:
count = count + 1
return count | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),4",
"0"
],
[
"(10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),10",
"3"
],
[
"(10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),8",
"4"
]
] | [] | count_X | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": [
"tuple"
],
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": [
"int"
],
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 251 | null | python | code_generation | def insert_element(list, element):
"""
Write a function that takes in a list and an element and inserts the element before each element in the list, and returns the resulting list.
"""
| def insert_element(list, element):
"""
Write a function that takes in a list and an element and inserts the element before each element in the list, and returns the resulting list.
"""
list = [v for elt in list for v in (element, elt)]
return list | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"['Red', 'Green', 'Black'] ,'c'",
"['c', 'Red', 'c', 'Green', 'c', 'Black']"
],
[
"['python', 'java'] ,'program'",
"['program', 'python', 'program', 'java']"
],
[
"['happy', 'sad'] ,'laugh'",
"['laugh', 'happy', 'laugh', 'sad']"
]
] | [] | insert_element | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": [
"str"
],
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": [
"list"
],
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 252 | null | python | code_generation | import cmath
def convert(numbers):
"""
Write a python function to convert complex numbers to polar coordinates.
"""
| import cmath
def convert(numbers):
"""
Write a python function to convert complex numbers to polar coordinates.
"""
num = cmath.polar(numbers)
return num | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"1",
"(1.0, 0.0)"
],
[
"4",
"(4.0,0.0)"
],
[
"5",
"(5.0,0.0)"
]
] | [
"import cmath "
] | convert | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": [
"int"
],
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 253 | null | python | code_generation | def count_integer(list1):
"""
Write a python function that returns the number of integer elements in a given list.
"""
| def count_integer(list1):
"""
Write a python function that returns the number of integer elements in a given list.
"""
ctr = 0
for i in list1:
if isinstance(i, int):
ctr = ctr + 1
return ctr | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,2,'abc',1.2]",
"2"
],
[
"[1,2,3]",
"3"
],
[
"[1,1.2,4,5.1]",
"2"
]
] | [] | count_integer | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 255 | null | python | code_generation | from itertools import combinations_with_replacement
def combinations_colors(l, n):
"""
Write a function that takes in a list and length n, and generates all combinations (with repetition) of the elements of the list and returns a list with a tuple for each combination.
"""
| from itertools import combinations_with_replacement
def combinations_colors(l, n):
"""
Write a function that takes in a list and length n, and generates all combinations (with repetition) of the elements of the list and returns a list with a tuple for each combination.
"""
return list(combinations_with_replacement(l, n)) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
" [\"Red\",\"Green\",\"Blue\"],1",
"[('Red',), ('Green',), ('Blue',)]"
],
[
" [\"Red\",\"Green\",\"Blue\"],2",
"[('Red', 'Red'), ('Red', 'Green'), ('Red', 'Blue'), ('Green', 'Green'), ('Green', 'Blue'), ('Blue', 'Blue')]"
],
[
" [\"Red\",\"Green\",\"Blue\"],3",
"[('Red', 'Red', 'Red'), ('Red', 'Red', 'Green'), ('Red', 'Red', 'Blue'), ('Red', 'Green', 'Green'), ('Red', 'Green', 'Blue'), ('Red', 'Blue', 'Blue'), ('Green', 'Green', 'Green'), ('Green', 'Green', 'Blue'), ('Green', 'Blue', 'Blue'), ('Blue', 'Blue', 'Blue')]"
]
] | [
"from itertools import combinations_with_replacement "
] | combinations_colors | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": [
"list"
],
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 256 | null | python | code_generation | def count_Primes_nums(n):
"""
Write a python function that takes in a non-negative number and returns the number of prime numbers less than the given non-negative number.
"""
| def count_Primes_nums(n):
"""
Write a python function that takes in a non-negative number and returns the number of prime numbers less than the given non-negative number.
"""
ctr = 0
for num in range(n):
if num <= 1:
continue
for i in range(2, num):
if num % i == 0:
break
else:
ctr += 1
return ctr | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"5",
"2"
],
[
"10",
"4"
],
[
"100",
"25"
]
] | [] | count_Primes_nums | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 257 | null | python | code_generation | def swap_numbers(a, b):
"""
Write a function that takes in two numbers and returns a tuple with the second number and then the first number.
"""
| def swap_numbers(a, b):
"""
Write a function that takes in two numbers and returns a tuple with the second number and then the first number.
"""
temp = a
a = b
b = temp
return (a, b) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"10,20",
"(20,10)"
],
[
"15,17",
"(17,15)"
],
[
"100,200",
"(200,100)"
]
] | [] | swap_numbers | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": [
"int"
],
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": [
"int"
],
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 259 | null | python | code_generation | def maximize_elements(test_tup1, test_tup2):
"""
Write a function to maximize the given two tuples.
"""
| def maximize_elements(test_tup1, test_tup2):
"""
Write a function to maximize the given two tuples.
"""
res = tuple((tuple((max(a, b) for (a, b) in zip(tup1, tup2))) for (tup1, tup2) in zip(test_tup1, test_tup2)))
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))",
"((6, 7), (4, 9), (2, 9), (7, 10))"
],
[
"((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))",
"((7, 8), (5, 10), (3, 10), (8, 11))"
],
[
"((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))",
"((8, 9), (6, 11), (4, 11), (9, 12))"
]
] | [] | maximize_elements | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": [
"tuple"
],
"test_tup2": [
"tuple"
],
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 260 | null | python | code_generation | def newman_prime(n):
"""
Write a function to find the nth newman–shanks–williams prime number.
"""
| def newman_prime(n):
"""
Write a function to find the nth newman–shanks–williams prime number.
"""
if n == 0 or n == 1:
return 1
return 2 * newman_prime(n - 1) + newman_prime(n - 2) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"3",
"7"
],
[
"4",
"17"
],
[
"5",
"41"
]
] | [] | newman_prime | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 261 | null | python | code_generation | def division_elements(test_tup1, test_tup2):
"""
Write a function that takes in two tuples and performs mathematical division operation element-wise across the given tuples.
"""
| def division_elements(test_tup1, test_tup2):
"""
Write a function that takes in two tuples and performs mathematical division operation element-wise across the given tuples.
"""
res = tuple((ele1 // ele2 for (ele1, ele2) in zip(test_tup1, test_tup2)))
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(10, 4, 6, 9),(5, 2, 3, 3)",
"(2, 2, 2, 3)"
],
[
"(12, 6, 8, 16),(6, 3, 4, 4)",
"(2, 2, 2, 4)"
],
[
"(20, 14, 36, 18),(5, 7, 6, 9)",
"(4, 2, 6, 2)"
]
] | [] | division_elements | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": [
"tuple"
],
"test_tup2": [
"tuple"
],
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 262 | null | python | code_generation | def split_two_parts(list1, L):
"""
Write a function that takes in a list and an integer L and splits the given list into two parts where the length of the first part of the list is L, and returns the resulting lists in a tuple.
"""
| def split_two_parts(list1, L):
"""
Write a function that takes in a list and an integer L and splits the given list into two parts where the length of the first part of the list is L, and returns the resulting lists in a tuple.
"""
return (list1[:L], list1[L:]) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,1,2,3,4,4,5,1],3",
"([1, 1, 2], [3, 4, 4, 5, 1])"
],
[
"['a', 'b', 'c', 'd'],2",
"(['a', 'b'], ['c', 'd'])"
],
[
"['p', 'y', 't', 'h', 'o', 'n'],4",
"(['p', 'y', 't', 'h'], ['o', 'n'])"
]
] | [] | split_two_parts | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": [
"int"
],
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 264 | null | python | code_generation | def dog_age(h_age):
"""
Write a function to calculate a dog's age in dog's years.
"""
| def dog_age(h_age):
"""
Write a function to calculate a dog's age in dog's years.
"""
if h_age < 0:
exit()
elif h_age <= 2:
d_age = h_age * 10.5
else:
d_age = 21 + (h_age - 2) * 4
return d_age | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"12",
"61"
],
[
"15",
"73"
],
[
"24",
"109"
]
] | [] | dog_age | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": [
"int"
],
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 265 | null | python | code_generation | def list_split(S, step):
"""
Write a function that takes in a list and an integer n and splits a list for every nth element, returning a list of the resulting lists.
"""
| def list_split(S, step):
"""
Write a function that takes in a list and an integer n and splits a list for every nth element, returning a list of the resulting lists.
"""
return [S[i::step] for i in range(step)] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'],3",
"[['a', 'd', 'g', 'j', 'm'], ['b', 'e', 'h', 'k', 'n'], ['c', 'f', 'i', 'l']]"
],
[
"[1,2,3,4,5,6,7,8,9,10,11,12,13,14],3",
"[[1,4,7,10,13], [2,5,8,11,14], [3,6,9,12]]"
],
[
"['python','java','C','C++','DBMS','SQL'],2",
"[['python', 'C', 'DBMS'], ['java', 'C++', 'SQL']]"
]
] | [] | list_split | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": [
"list"
],
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": [
"int"
],
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 266 | null | python | code_generation | def lateralsurface_cube(l):
"""
Write a function to find the lateral surface area of a cube given its side length.
"""
| def lateralsurface_cube(l):
"""
Write a function to find the lateral surface area of a cube given its side length.
"""
LSA = 4 * (l * l)
return LSA | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"5",
"100"
],
[
"9",
"324"
],
[
"10",
"400"
]
] | [] | lateralsurface_cube | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": [
"int"
],
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 267 | null | python | code_generation | def square_Sum(n):
"""
Write a python function that takes in an integer n and returns the sum of the squares of the first n odd natural numbers.
"""
| def square_Sum(n):
"""
Write a python function that takes in an integer n and returns the sum of the squares of the first n odd natural numbers.
"""
return int(n * (4 * n * n - 1) / 3) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"2",
"10"
],
[
"3",
"35"
],
[
"4",
"84"
]
] | [] | square_Sum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 268 | null | python | code_generation | def find_star_num(n):
"""
Write a function to find the n'th star number.
"""
| def find_star_num(n):
"""
Write a function to find the n'th star number.
"""
return 6 * n * (n - 1) + 1 | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"3",
"37"
],
[
"4",
"73"
],
[
"5",
"121"
]
] | [] | find_star_num | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 269 | null | python | code_generation | def ascii_value(k):
"""
Write a function to find the ascii value of a character.
"""
| def ascii_value(k):
"""
Write a function to find the ascii value of a character.
"""
ch = k
return ord(ch) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"'A'",
"65"
],
[
"'R'",
"82"
],
[
"'S'",
"83"
]
] | [] | ascii_value | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": [
"str"
],
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 270 | null | python | code_generation | def sum_even_and_even_index(arr):
"""
Write a python function to find the sum of even numbers at even positions of a list.
"""
| def sum_even_and_even_index(arr):
"""
Write a python function to find the sum of even numbers at even positions of a list.
"""
i = 0
sum = 0
for i in range(0, len(arr), 2):
if arr[i] % 2 == 0:
sum += arr[i]
return sum | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[5, 6, 12, 1, 18, 8]",
"30"
],
[
"[3, 20, 17, 9, 2, 10, 18, 13, 6, 18]",
"26"
],
[
"[5, 6, 12, 1]",
"12"
]
] | [] | sum_even_and_even_index | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": [
"list"
],
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 271 | null | python | code_generation | def even_Power_Sum(n):
"""
Write a python function that takes in an integer n and finds the sum of the first n even natural numbers that are raised to the fifth power.
"""
| def even_Power_Sum(n):
"""
Write a python function that takes in an integer n and finds the sum of the first n even natural numbers that are raised to the fifth power.
"""
sum = 0
for i in range(1, n + 1):
j = 2 * i
sum = sum + j * j * j * j * j
return sum | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"2",
"1056"
],
[
"3",
"8832"
],
[
"1",
"32"
]
] | [] | even_Power_Sum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 272 | null | python | code_generation | def rear_extract(test_list):
"""
Write a function that takes in a list of tuples and returns a list containing the rear element of each tuple.
"""
| def rear_extract(test_list):
"""
Write a function that takes in a list of tuples and returns a list containing the rear element of each tuple.
"""
res = [lis[-1] for lis in test_list]
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[(1, 'Rash', 21), (2, 'Varsha', 20), (3, 'Kil', 19)]",
"[21, 20, 19]"
],
[
"[(1, 'Sai', 36), (2, 'Ayesha', 25), (3, 'Salman', 45)]",
"[36, 25, 45]"
],
[
"[(1, 'Sudeep', 14), (2, 'Vandana', 36), (3, 'Dawood', 56)]",
"[14, 36, 56]"
]
] | [] | rear_extract | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": [
"list"
],
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 273 | null | python | code_generation | def substract_elements(test_tup1, test_tup2):
"""
Write a function that takes in two tuples and subtracts the elements of the first tuple by the elements of the second tuple with the same index.
"""
| def substract_elements(test_tup1, test_tup2):
"""
Write a function that takes in two tuples and subtracts the elements of the first tuple by the elements of the second tuple with the same index.
"""
res = tuple(map(lambda i, j: i - j, test_tup1, test_tup2))
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(10, 4, 5), (2, 5, 18)",
"(8, -1, -13)"
],
[
"(11, 2, 3), (24, 45 ,16)",
"(-13, -43, -13)"
],
[
"(7, 18, 9), (10, 11, 12)",
"(-3, 7, -3)"
]
] | [] | substract_elements | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": [
"tuple"
],
"test_tup2": [
"tuple"
],
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 274 | null | python | code_generation | import math
def even_binomial_Coeff_Sum(n):
"""
Write a python function that takes in a positive integer n and finds the sum of even index binomial coefficients.
"""
| import math
def even_binomial_Coeff_Sum(n):
"""
Write a python function that takes in a positive integer n and finds the sum of even index binomial coefficients.
"""
return 1 << n - 1 | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"4",
"8"
],
[
"6",
"32"
],
[
"2",
"2"
]
] | [
"import math "
] | even_binomial_Coeff_Sum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 276 | null | python | code_generation | def volume_cylinder(r, h):
"""
Write a function that takes in the radius and height of a cylinder and returns the the volume.
"""
| def volume_cylinder(r, h):
"""
Write a function that takes in the radius and height of a cylinder and returns the the volume.
"""
volume = 3.1415 * r * r * h
return volume | [] | import math
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assert math.isclose(candidate(*inp), exp, rel_tol=0.001) | [
[
"10, 5",
"1570.7500000000002"
],
[
"4, 5",
"251.32000000000002"
],
[
"4, 10",
"502.64000000000004"
]
] | [] | volume_cylinder | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": [
"int"
],
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": [
"int"
],
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 277 | null | python | code_generation | def dict_filter(dict, n):
"""
Write a function that takes in a dictionary and integer n and filters the dictionary to only include entries with values greater than or equal to n.
"""
| def dict_filter(dict, n):
"""
Write a function that takes in a dictionary and integer n and filters the dictionary to only include entries with values greater than or equal to n.
"""
result = {key: value for (key, value) in dict.items() if value >= n}
return result | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},170",
"{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Pierre Cox': 190}"
],
[
"{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},180",
"{ 'Alden Cantrell': 180, 'Pierre Cox': 190}"
],
[
"{'Cierra Vega': 175, 'Alden Cantrell': 180, 'Kierra Gentry': 165, 'Pierre Cox': 190},190",
"{ 'Pierre Cox': 190}"
]
] | [] | dict_filter | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": [
"dict"
],
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"dict"
]
} |
||
MBPP_sanitized | 278 | null | python | code_generation | def count_first_elements(test_tup):
"""
Write a function to find the number of elements that occurs before the tuple element in the given tuple.
"""
| def count_first_elements(test_tup):
"""
Write a function to find the number of elements that occurs before the tuple element in the given tuple.
"""
for (count, ele) in enumerate(test_tup):
if isinstance(ele, tuple):
break
return count | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(1, 5, 7, (4, 6), 10) ",
"3"
],
[
"(2, 9, (5, 7), 11) ",
"2"
],
[
"(11, 15, 5, 8, (2, 3), 8) ",
"4"
]
] | [] | count_first_elements | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": [
"int"
],
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 279 | null | python | code_generation | def is_num_decagonal(n):
"""
Write a function to find the nth decagonal number.
"""
| def is_num_decagonal(n):
"""
Write a function to find the nth decagonal number.
"""
return 4 * n * n - 3 * n | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"3",
"27"
],
[
"7",
"175"
],
[
"10",
"370"
]
] | [] | is_num_decagonal | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 280 | null | python | code_generation | def sequential_search(dlist, item):
"""
Write a function that takes in an array and element and returns a tuple containing a boolean that indicates if the element is in the array and the index position of the element (or -1 if the element is not found).
"""
| def sequential_search(dlist, item):
"""
Write a function that takes in an array and element and returns a tuple containing a boolean that indicates if the element is in the array and the index position of the element (or -1 if the element is not found).
"""
pos = 0
found = False
while pos < len(dlist) and (not found):
if dlist[pos] == item:
found = True
else:
pos = pos + 1
return (found, pos) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[11,23,58,31,56,77,43,12,65,19],31",
"(True, 3)"
],
[
"[12, 32, 45, 62, 35, 47, 44, 61],61",
"(True, 7)"
],
[
"[9, 10, 17, 19, 22, 39, 48, 56],48",
"(True, 6)"
]
] | [] | sequential_search | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": [
"list"
],
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": [
"int"
],
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 281 | null | python | code_generation | def all_unique(test_list):
"""
Write a python function to check if the elements of a given list are unique or not.
"""
| def all_unique(test_list):
"""
Write a python function to check if the elements of a given list are unique or not.
"""
if len(test_list) > len(set(test_list)):
return False
return True | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,2,3]",
"True"
],
[
"[1,2,1,2]",
"False"
],
[
"[1,2,3,4,5]",
"True"
]
] | [] | all_unique | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": [
"list"
],
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 282 | null | python | code_generation | def sub_list(nums1, nums2):
"""
Write a function to subtract two lists element-wise.
"""
| def sub_list(nums1, nums2):
"""
Write a function to subtract two lists element-wise.
"""
result = map(lambda x, y: x - y, nums1, nums2)
return list(result) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1, 2, 3],[4,5,6]",
"[-3,-3,-3]"
],
[
"[1,2],[3,4]",
"[-2,-2]"
],
[
"[90,120],[50,70]",
"[40,50]"
]
] | [] | sub_list | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": [
"list"
],
"nums2": [
"list"
],
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 283 | null | python | code_generation | def validate(n):
"""
Write a python function takes in an integer and check whether the frequency of each digit in the integer is less than or equal to the digit itself.
"""
| def validate(n):
"""
Write a python function takes in an integer and check whether the frequency of each digit in the integer is less than or equal to the digit itself.
"""
for i in range(10):
temp = n
count = 0
while temp:
if temp % 10 == i:
count += 1
if count > i:
return False
temp //= 10
return True | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"1234",
"True"
],
[
"51241",
"False"
],
[
"321",
"True"
]
] | [] | validate | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 284 | null | python | code_generation | def check_element(list, element):
"""
Write a function that takes in a list and element and checks whether all items in the list are equal to the given element.
"""
| def check_element(list, element):
"""
Write a function that takes in a list and element and checks whether all items in the list are equal to the given element.
"""
check_element = all((v == element for v in list))
return check_element | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[\"green\", \"orange\", \"black\", \"white\"],'blue'",
"False"
],
[
"[1,2,3,4],7",
"False"
],
[
"[\"green\", \"green\", \"green\", \"green\"],'green'",
"True"
]
] | [] | check_element | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": [
"str"
],
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": [
"list"
],
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 285 | null | python | code_generation | import re
def text_match_two_three(text):
"""
Write a function that checks whether a string contains the 'a' character followed by two or three 'b' characters.
"""
| import re
def text_match_two_three(text):
"""
Write a function that checks whether a string contains the 'a' character followed by two or three 'b' characters.
"""
patterns = 'ab{2,3}'
if re.search(patterns, text):
return True
else:
return False | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"ac\"",
"(False)"
],
[
"\"dc\"",
"(False)"
],
[
"\"abbbba\"",
"(True)"
]
] | [
"import re"
] | text_match_two_three | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": [
"str"
],
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 286 | null | python | code_generation | def max_sub_array_sum_repeated(a, n, k):
"""
Write a function to find the largest sum of a contiguous array in the modified array which is formed by repeating the given array k times.
"""
| def max_sub_array_sum_repeated(a, n, k):
"""
Write a function to find the largest sum of a contiguous array in the modified array which is formed by repeating the given array k times.
"""
max_so_far = -2147483648
max_ending_here = 0
for i in range(n * k):
max_ending_here = max_ending_here + a[i % n]
if max_so_far < max_ending_here:
max_so_far = max_ending_here
if max_ending_here < 0:
max_ending_here = 0
return max_so_far | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[10, 20, -30, -1], 4, 3",
"30"
],
[
"[-1, 10, 20], 3, 2",
"59"
],
[
"[-1, -2, -3], 3, 3",
"-1"
]
] | [] | max_sub_array_sum_repeated | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": [
"list"
],
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": [
"int"
],
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 287 | null | python | code_generation | def square_Sum(n):
"""
Write a python function takes in an integer n and returns the sum of squares of first n even natural numbers.
"""
| def square_Sum(n):
"""
Write a python function takes in an integer n and returns the sum of squares of first n even natural numbers.
"""
return int(2 * n * (n + 1) * (2 * n + 1) / 3) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"2",
"20"
],
[
"3",
"56"
],
[
"4",
"120"
]
] | [] | square_Sum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 290 | null | python | code_generation | def max_length(list1):
"""
Write a function to find the list of maximum length in a list of lists.
"""
| def max_length(list1):
"""
Write a function to find the list of maximum length in a list of lists.
"""
max_length = max((len(x) for x in list1))
max_list = max((x for x in list1))
return (max_length, max_list) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]]",
"(3, [13, 15, 17])"
],
[
"[[1], [5, 7], [10, 12, 14,15]]",
"(4, [10, 12, 14,15])"
],
[
"[[5], [15,20,25]]",
"(3, [15,20,25])"
]
] | [] | max_length | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 291 | null | python | code_generation | def count_no_of_ways(n, k):
"""
Write a function to find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n posts and k colors.
"""
| def count_no_of_ways(n, k):
"""
Write a function to find out the number of ways of painting the fence such that at most 2 adjacent posts have the same color for the given fence with n posts and k colors.
"""
dp = [0] * (n + 1)
total = k
mod = 1000000007
dp[1] = k
dp[2] = k * k
for i in range(3, n + 1):
dp[i] = (k - 1) * (dp[i - 1] + dp[i - 2]) % mod
return dp[n] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"2, 4",
"16"
],
[
"3, 2",
"6"
],
[
"4, 4",
"228"
]
] | [] | count_no_of_ways | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": [
"int"
],
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 292 | null | python | code_generation | def find(n, m):
"""
Write a python function to find quotient of two numbers (rounded down to the nearest integer).
"""
| def find(n, m):
"""
Write a python function to find quotient of two numbers (rounded down to the nearest integer).
"""
q = n // m
return q | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"10,3",
"3"
],
[
"4,2",
"2"
],
[
"20,5",
"4"
]
] | [] | find | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": [
"int"
],
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 293 | null | python | code_generation | import math
def otherside_rightangle(w, h):
"""
Write a function to find the third side of a right angled triangle.
"""
| import math
def otherside_rightangle(w, h):
"""
Write a function to find the third side of a right angled triangle.
"""
s = math.sqrt(w * w + h * h)
return s | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"7,8",
"10.63014581273465"
],
[
"3,4",
"5"
],
[
"7,15",
"16.55294535724685"
]
] | [
"import math"
] | otherside_rightangle | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": [
"int"
],
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": [
"int"
],
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 294 | null | python | code_generation | def max_val(listval):
"""
Write a function to find the maximum value in a given heterogeneous list.
"""
| def max_val(listval):
"""
Write a function to find the maximum value in a given heterogeneous list.
"""
max_val = max((i for i in listval if isinstance(i, int)))
return max_val | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"['Python', 3, 2, 4, 5, 'version']",
"5"
],
[
"['Python', 15, 20, 25]",
"25"
],
[
"['Python', 30, 20, 40, 50, 'version']",
"50"
]
] | [] | max_val | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": [
"list"
],
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 295 | null | python | code_generation | def sum_div(number):
"""
Write a function to return the sum of all divisors of a number.
"""
| def sum_div(number):
"""
Write a function to return the sum of all divisors of a number.
"""
divisors = [1]
for i in range(2, number):
if number % i == 0:
divisors.append(i)
return sum(divisors) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"8",
"7"
],
[
"12",
"16"
],
[
"7",
"1"
]
] | [] | sum_div | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": [
"int"
],
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 296 | null | python | code_generation | def get_Inv_Count(arr):
"""
Write a python function to count inversions in an array.
"""
| def get_Inv_Count(arr):
"""
Write a python function to count inversions in an array.
"""
inv_count = 0
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
if arr[i] > arr[j]:
inv_count += 1
return inv_count | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,20,6,4,5]",
"5"
],
[
"[1,2,1]",
"1"
],
[
"[1,2,5,6,1]",
"3"
]
] | [] | get_Inv_Count | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": [
"list"
],
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 297 | null | python | code_generation | def flatten_list(list1):
"""
Write a function to flatten a given nested list structure.
"""
| def flatten_list(list1):
"""
Write a function to flatten a given nested list structure.
"""
result_list = []
if not list1:
return result_list
stack = [list(list1)]
while stack:
c_num = stack.pop()
next = c_num.pop()
if c_num:
stack.append(c_num)
if isinstance(next, list):
if next:
stack.append(list(next))
else:
result_list.append(next)
result_list.reverse()
return result_list | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[0, 10, [20, 30], 40, 50, [60, 70, 80], [90, 100, 110, 120]]",
"[0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120]"
],
[
"[[10, 20], [40], [30, 56, 25], [10, 20], [33], [40]]",
"[10, 20, 40, 30, 56, 25, 10, 20, 33, 40]"
],
[
"[[1,2,3], [4,5,6], [10,11,12], [7,8,9]]",
"[1, 2, 3, 4, 5, 6, 10, 11, 12, 7, 8, 9]"
]
] | [] | flatten_list | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 299 | null | python | code_generation | from collections import defaultdict
def max_aggregate(stdata):
"""
Write a function to calculate the maximum aggregate from the list of tuples.
"""
| from collections import defaultdict
def max_aggregate(stdata):
"""
Write a function to calculate the maximum aggregate from the list of tuples.
"""
temp = defaultdict(int)
for (name, marks) in stdata:
temp[name] += marks
return max(temp.items(), key=lambda x: x[1]) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[('Juan Whelan',90),('Sabah Colley',88),('Peter Nichols',7),('Juan Whelan',122),('Sabah Colley',84)]",
"('Juan Whelan', 212)"
],
[
"[('Juan Whelan',50),('Sabah Colley',48),('Peter Nichols',37),('Juan Whelan',22),('Sabah Colley',14)]",
"('Juan Whelan', 72)"
],
[
"[('Juan Whelan',10),('Sabah Colley',20),('Peter Nichols',30),('Juan Whelan',40),('Sabah Colley',50)]",
"('Sabah Colley', 70)"
]
] | [
"from collections import defaultdict"
] | max_aggregate | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": [
"list"
],
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 300 | null | python | code_generation | def count_binary_seq(n):
"""
Write a function to find the count of all binary sequences of length 2n such that sum of first n bits is same as sum of last n bits.
"""
| def count_binary_seq(n):
"""
Write a function to find the count of all binary sequences of length 2n such that sum of first n bits is same as sum of last n bits.
"""
nCr = 1
res = 1
for r in range(1, n + 1):
nCr = nCr * (n + 1 - r) / r
res += nCr * nCr
return res | [] | import math
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assert math.isclose(candidate(*inp), exp, rel_tol=0.001) | [
[
"1",
"2.0"
],
[
"2",
"6.0"
],
[
"3",
"20.0"
]
] | [] | count_binary_seq | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 301 | null | python | code_generation | def dict_depth(d):
"""
Write a function to find the depth of a dictionary.
"""
| def dict_depth(d):
"""
Write a function to find the depth of a dictionary.
"""
if isinstance(d, dict):
return 1 + (max(map(dict_depth, d.values())) if d else 0)
return 0 | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"{'a':1, 'b': {'c': {'d': {}}}}",
"4"
],
[
"{'a':1, 'b': {'c':'python'}}",
"2"
],
[
"{1: 'Sun', 2: {3: {4:'Mon'}}}",
"3"
]
] | [] | dict_depth | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": [
"dict"
],
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 304 | null | python | code_generation | def find_Element(arr, ranges, rotations, index):
"""
Write a python function to find element at a given index after number of rotations.
"""
| def find_Element(arr, ranges, rotations, index):
"""
Write a python function to find element at a given index after number of rotations.
"""
for i in range(rotations - 1, -1, -1):
left = ranges[i][0]
right = ranges[i][1]
if left <= index and right >= index:
if index == left:
index = right
else:
index = index - 1
return arr[index] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,2,3,4,5],[[0,2],[0,3]],2,1",
"3"
],
[
"[1,2,3,4],[[0,1],[0,2]],1,2",
"3"
],
[
"[1,2,3,4,5,6],[[0,1],[0,2]],1,1",
"1"
]
] | [] | find_Element | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": [
"list"
],
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": [
"int"
],
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": [
"list"
],
"rotations": [
"int"
],
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 305 | null | python | code_generation | import re
def start_withp(words):
"""
Write a function to return two words from a list of words starting with letter 'p'.
"""
| import re
def start_withp(words):
"""
Write a function to return two words from a list of words starting with letter 'p'.
"""
for w in words:
m = re.match('(P\\w+)\\W(P\\w+)', w)
if m:
return m.groups() | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[\"Python PHP\", \"Java JavaScript\", \"c c++\"]",
"('Python', 'PHP')"
],
[
"[\"Python Programming\",\"Java Programming\"]",
"('Python','Programming')"
],
[
"[\"Pqrst Pqr\",\"qrstuv\"]",
"('Pqrst','Pqr')"
]
] | [
"import re"
] | start_withp | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": [
"list"
],
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 306 | null | python | code_generation | def max_sum_increasing_subseq(a, n, index, k):
"""
Write a function to find the maximum sum of increasing subsequence from prefix until ith index and also including a given kth element which is after i, i.e., k > i .
"""
| def max_sum_increasing_subseq(a, n, index, k):
"""
Write a function to find the maximum sum of increasing subsequence from prefix until ith index and also including a given kth element which is after i, i.e., k > i .
"""
dp = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
if a[i] > a[0]:
dp[0][i] = a[i] + a[0]
else:
dp[0][i] = a[i]
for i in range(1, n):
for j in range(n):
if a[j] > a[i] and j > i:
if dp[i - 1][i] + a[j] > dp[i - 1][j]:
dp[i][j] = dp[i - 1][i] + a[j]
else:
dp[i][j] = dp[i - 1][j]
else:
dp[i][j] = dp[i - 1][j]
return dp[index][k] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1, 101, 2, 3, 100, 4, 5 ], 7, 4, 6",
"11"
],
[
"[1, 101, 2, 3, 100, 4, 5 ], 7, 2, 5",
"7"
],
[
"[11, 15, 19, 21, 26, 28, 31], 7, 2, 4",
"71"
]
] | [] | max_sum_increasing_subseq | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": [
"list"
],
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": [
"int"
],
"input_list": null,
"item": null,
"k": [
"int"
],
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 307 | null | python | code_generation | from copy import deepcopy
def colon_tuplex(tuplex, m, n):
"""
Write a function to get a colon of a tuple.
"""
| from copy import deepcopy
def colon_tuplex(tuplex, m, n):
"""
Write a function to get a colon of a tuple.
"""
tuplex_colon = deepcopy(tuplex)
tuplex_colon[m].append(n)
return tuplex_colon | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(\"HELLO\", 5, [], True) ,2,50",
"(\"HELLO\", 5, [50], True)"
],
[
"(\"HELLO\", 5, [], True) ,2,100",
"((\"HELLO\", 5, [100],True))"
],
[
"(\"HELLO\", 5, [], True) ,2,500",
"(\"HELLO\", 5, [500], True)"
]
] | [
"from copy import deepcopy"
] | colon_tuplex | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": [
"int"
],
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": [
"tuple"
],
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 308 | null | python | code_generation | def large_product(nums1, nums2, N):
"""
Write a function to find the specified number of largest products from two given lists, selecting one factor from each list.
"""
| def large_product(nums1, nums2, N):
"""
Write a function to find the specified number of largest products from two given lists, selecting one factor from each list.
"""
result = sorted([x * y for x in nums1 for y in nums2], reverse=True)[:N]
return result | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],3",
"[60, 54, 50]"
],
[
"[1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],4",
"[60, 54, 50, 48]"
],
[
"[1, 2, 3, 4, 5, 6],[3, 6, 8, 9, 10, 6],5",
"[60, 54, 50, 48, 45]"
]
] | [] | large_product | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": [
"int"
],
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": [
"list"
],
"nums2": [
"list"
],
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 309 | null | python | code_generation | def maximum(a, b):
"""
Write a python function to find the maximum of two numbers.
"""
| def maximum(a, b):
"""
Write a python function to find the maximum of two numbers.
"""
if a >= b:
return a
else:
return b | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"5,10",
"10"
],
[
"-1,-2",
"-1"
],
[
"9,7",
"9"
]
] | [] | maximum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": [
"int"
],
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": [
"int"
],
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 310 | null | python | code_generation | def string_to_tuple(str1):
"""
Write a function to convert a given string to a tuple of characters.
"""
| def string_to_tuple(str1):
"""
Write a function to convert a given string to a tuple of characters.
"""
result = tuple((x for x in str1 if not x.isspace()))
return result | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"python 3.0\"",
"('p', 'y', 't', 'h', 'o', 'n', '3', '.', '0')"
],
[
"\"item1\"",
"('i', 't', 'e', 'm', '1')"
],
[
"\"15.10\"",
"('1', '5', '.', '1', '0')"
]
] | [] | string_to_tuple | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": [
"str"
],
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 311 | null | python | code_generation | def set_left_most_unset_bit(n):
"""
Write a python function to set the left most unset bit.
"""
| def set_left_most_unset_bit(n):
"""
Write a python function to set the left most unset bit.
"""
if not n & n + 1:
return n
(pos, temp, count) = (0, n, 0)
while temp:
if not temp & 1:
pos = count
count += 1
temp >>= 1
return n | 1 << pos | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"10",
"14"
],
[
"12",
"14"
],
[
"15",
"15"
]
] | [] | set_left_most_unset_bit | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 312 | null | python | code_generation | import math
def volume_cone(r, h):
"""
Write a function to find the volume of a cone.
"""
| import math
def volume_cone(r, h):
"""
Write a function to find the volume of a cone.
"""
volume = 1.0 / 3 * math.pi * r * r * h
return volume | [] | import math
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assert math.isclose(candidate(*inp), exp, rel_tol=0.001) | [
[
"5,12",
"314.15926535897927"
],
[
"10,15",
"1570.7963267948965"
],
[
"19,17",
"6426.651371693521"
]
] | [
"import math"
] | volume_cone | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": [
"int"
],
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": [
"int"
],
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 388 | null | python | code_generation | def highest_Power_of_2(n):
"""
Write a python function to find the highest power of 2 that is less than or equal to n.
"""
| def highest_Power_of_2(n):
"""
Write a python function to find the highest power of 2 that is less than or equal to n.
"""
res = 0
for i in range(n, 0, -1):
if i & i - 1 == 0:
res = i
break
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"10",
"8"
],
[
"19",
"16"
],
[
"32",
"32"
]
] | [] | highest_Power_of_2 | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 389 | null | python | code_generation | def find_lucas(n):
"""
Write a function to find the n'th lucas number.
"""
| def find_lucas(n):
"""
Write a function to find the n'th lucas number.
"""
if n == 0:
return 2
if n == 1:
return 1
return find_lucas(n - 1) + find_lucas(n - 2) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"9",
"76"
],
[
"4",
"7"
],
[
"3",
"4"
]
] | [] | find_lucas | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 390 | null | python | code_generation | def add_string(list_, string):
"""
Write a function to apply a given format string to all of the elements in a list.
"""
| def add_string(list_, string):
"""
Write a function to apply a given format string to all of the elements in a list.
"""
add_string = [string.format(i) for i in list_]
return add_string | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,2,3,4],'temp{0}'",
"['temp1', 'temp2', 'temp3', 'temp4']"
],
[
"['a','b','c','d'], 'python{0}'",
"[ 'pythona', 'pythonb', 'pythonc', 'pythond']"
],
[
"[5,6,7,8],'string{0}'",
"['string5', 'string6', 'string7', 'string8']"
]
] | [] | add_string | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": [
"list"
],
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": [
"str"
],
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 391 | null | python | code_generation | def convert_list_dictionary(l1, l2, l3):
"""
Write a function to convert more than one list to nested dictionary.
"""
| def convert_list_dictionary(l1, l2, l3):
"""
Write a function to convert more than one list to nested dictionary.
"""
result = [{x: {y: z}} for (x, y, z) in zip(l1, l2, l3)]
return result | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[\"S001\", \"S002\", \"S003\", \"S004\"],[\"Adina Park\", \"Leyton Marsh\", \"Duncan Boyle\", \"Saim Richards\"] ,[85, 98, 89, 92]",
"[{'S001': {'Adina Park': 85}}, {'S002': {'Leyton Marsh': 98}}, {'S003': {'Duncan Boyle': 89}}, {'S004': {'Saim Richards': 92}}]"
],
[
"[\"abc\",\"def\",\"ghi\",\"jkl\"],[\"python\",\"program\",\"language\",\"programs\"],[100,200,300,400]",
"[{'abc':{'python':100}},{'def':{'program':200}},{'ghi':{'language':300}},{'jkl':{'programs':400}}]"
],
[
"[\"A1\",\"A2\",\"A3\",\"A4\"],[\"java\",\"C\",\"C++\",\"DBMS\"],[10,20,30,40]",
"[{'A1':{'java':10}},{'A2':{'C':20}},{'A3':{'C++':30}},{'A4':{'DBMS':40}}]"
]
] | [] | convert_list_dictionary | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": [
"list"
],
"l2": [
"list"
],
"l3": [
"list"
],
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 392 | null | python | code_generation | def get_max_sum(n):
"""
Write a function to find the maximum sum possible by using the given equation f(n) = max( (f(n/2) + f(n/3) + f(n/4) + f(n/5)), n).
"""
| def get_max_sum(n):
"""
Write a function to find the maximum sum possible by using the given equation f(n) = max( (f(n/2) + f(n/3) + f(n/4) + f(n/5)), n).
"""
res = list()
res.append(0)
res.append(1)
i = 2
while i < n + 1:
res.append(max(i, res[int(i / 2)] + res[int(i / 3)] + res[int(i / 4)] + res[int(i / 5)]))
i = i + 1
return res[n] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"60",
"106"
],
[
"10",
"12"
],
[
"2",
"2"
]
] | [] | get_max_sum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 393 | null | python | code_generation | def max_length_list(input_list):
"""
Write a function to find the list with maximum length.
"""
| def max_length_list(input_list):
"""
Write a function to find the list with maximum length.
"""
max_length = max((len(x) for x in input_list))
max_list = max(input_list, key=lambda i: len(i))
return (max_length, max_list) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]]",
"(3, [13, 15, 17])"
],
[
"[[1,2,3,4,5],[1,2,3,4],[1,2,3],[1,2],[1]]",
"(5,[1,2,3,4,5])"
],
[
"[[3,4,5],[6,7,8,9],[10,11,12]]",
"(4,[6,7,8,9])"
]
] | [] | max_length_list | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": [
"list"
],
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 394 | null | python | code_generation | def check_distinct(test_tup):
"""
Write a function to check if given tuple contains no duplicates.
"""
| def check_distinct(test_tup):
"""
Write a function to check if given tuple contains no duplicates.
"""
res = True
temp = set()
for ele in test_tup:
if ele in temp:
res = False
break
temp.add(ele)
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(1, 4, 5, 6, 1, 4)",
"False"
],
[
"(1, 4, 5, 6)",
"True"
],
[
"(2, 3, 4, 5, 6)",
"True"
]
] | [] | check_distinct | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": [
"int"
],
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 395 | null | python | code_generation | def first_non_repeating_character(str1):
"""
Write a python function to find the first non-repeated character in a given string.
"""
| def first_non_repeating_character(str1):
"""
Write a python function to find the first non-repeated character in a given string.
"""
char_order = []
ctr = {}
for c in str1:
if c in ctr:
ctr[c] += 1
else:
ctr[c] = 1
char_order.append(c)
for c in char_order:
if ctr[c] == 1:
return c
return None | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"abcabc\"",
null
],
[
"\"abc\"",
"\"a\""
],
[
"\"ababc\"",
"\"c\""
]
] | [] | first_non_repeating_character | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": [
"str"
],
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"str"
]
} |
||
MBPP_sanitized | 396 | null | python | code_generation | import re
regex = '^[a-z]$|^([a-z]).*\\1$'
def check_char(string):
"""
Write a function to check whether the given string starts and ends with the same character or not.
"""
| import re
regex = '^[a-z]$|^([a-z]).*\\1$'
def check_char(string):
"""
Write a function to check whether the given string starts and ends with the same character or not.
"""
if re.search(regex, string):
return 'Valid'
else:
return 'Invalid' | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"\"abba\"",
"\"Valid\""
],
[
"\"a\"",
"\"Valid\""
],
[
"\"abcd\"",
"\"Invalid\""
]
] | [
"import re "
] | check_char | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": [
"str"
],
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"str"
]
} |
||
MBPP_sanitized | 397 | null | python | code_generation | def median_numbers(a, b, c):
"""
Write a function to find the median of three numbers.
"""
| def median_numbers(a, b, c):
"""
Write a function to find the median of three numbers.
"""
if a > b:
if a < c:
median = a
elif b > c:
median = b
else:
median = c
elif a > c:
median = a
elif b < c:
median = b
else:
median = c
return median | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"25,55,65",
"55.0"
],
[
"20,10,30",
"20.0"
],
[
"15,45,75",
"45.0"
]
] | [] | median_numbers | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": [
"int"
],
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": [
"int"
],
"base1": null,
"base2": null,
"c": [
"int"
],
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"float"
]
} |
||
MBPP_sanitized | 398 | null | python | code_generation | def sum_of_digits(nums):
"""
Write a function to compute the sum of digits of each number of a given list.
"""
| def sum_of_digits(nums):
"""
Write a function to compute the sum of digits of each number of a given list.
"""
return sum((int(el) for n in nums for el in str(n) if el.isdigit())) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[10,2,56]",
"14"
],
[
"[[10,20,4,5,'b',70,'a']]",
"19"
],
[
"[10,20,-4,5,-70]",
"19"
]
] | [] | sum_of_digits | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": [
"list"
],
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 399 | null | python | code_generation | def bitwise_xor(test_tup1, test_tup2):
"""
Write a function to perform the mathematical bitwise xor operation across the given tuples.
"""
| def bitwise_xor(test_tup1, test_tup2):
"""
Write a function to perform the mathematical bitwise xor operation across the given tuples.
"""
res = tuple((ele1 ^ ele2 for (ele1, ele2) in zip(test_tup1, test_tup2)))
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(10, 4, 6, 9), (5, 2, 3, 3)",
"(15, 6, 5, 10)"
],
[
"(11, 5, 7, 10), (6, 3, 4, 4)",
"(13, 6, 3, 14)"
],
[
"(12, 6, 8, 11), (7, 4, 5, 6)",
"(11, 2, 13, 13)"
]
] | [] | bitwise_xor | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": [
"tuple"
],
"test_tup2": [
"tuple"
],
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 400 | null | python | code_generation | def extract_freq(test_list):
"""
Write a function to extract the number of unique tuples in the given list.
"""
| def extract_freq(test_list):
"""
Write a function to extract the number of unique tuples in the given list.
"""
res = len(list(set((tuple(sorted(sub)) for sub in test_list))))
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[(3, 4), (1, 2), (4, 3), (5, 6)] ",
"3"
],
[
"[(4, 15), (2, 3), (5, 4), (6, 7)] ",
"4"
],
[
"[(5, 16), (2, 3), (6, 5), (6, 9)] ",
"4"
]
] | [] | extract_freq | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": [
"list"
],
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 401 | null | python | code_generation | def add_nested_tuples(test_tup1, test_tup2):
"""
Write a function to perform index wise addition of tuple elements in the given two nested tuples.
"""
| def add_nested_tuples(test_tup1, test_tup2):
"""
Write a function to perform index wise addition of tuple elements in the given two nested tuples.
"""
res = tuple((tuple((a + b for (a, b) in zip(tup1, tup2))) for (tup1, tup2) in zip(test_tup1, test_tup2)))
return res | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))",
"((7, 10), (7, 14), (3, 10), (8, 13))"
],
[
"((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))",
"((9, 12), (9, 16), (5, 12), (10, 15))"
],
[
"((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))",
"((11, 14), (11, 18), (7, 14), (12, 17))"
]
] | [] | add_nested_tuples | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": [
"tuple"
],
"test_tup2": [
"tuple"
],
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 404 | null | python | code_generation | def minimum(a, b):
"""
Write a python function to find the minimum of two numbers.
"""
| def minimum(a, b):
"""
Write a python function to find the minimum of two numbers.
"""
if a <= b:
return a
else:
return b | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"1,2",
"1"
],
[
"-5,-4",
"-5"
],
[
"0,0",
"0"
]
] | [] | minimum | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": [
"int"
],
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": [
"int"
],
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 405 | null | python | code_generation | def check_tuplex(tuplex, tuple1):
"""
Write a function to check whether an element exists within a tuple.
"""
| def check_tuplex(tuplex, tuple1):
"""
Write a function to check whether an element exists within a tuple.
"""
if tuple1 in tuplex:
return True
else:
return False | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"(\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'r'",
"True"
],
[
"(\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),'5'",
"False"
],
[
"(\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\",\"e\"),3",
"True"
]
] | [] | check_tuplex | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": [
"str"
],
"tuplex": [
"tuple"
],
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 406 | null | python | code_generation | def find_Parity(x):
"""
Write a python function to find whether the parity of a given number is odd.
"""
| def find_Parity(x):
"""
Write a python function to find whether the parity of a given number is odd.
"""
y = x ^ x >> 1
y = y ^ y >> 2
y = y ^ y >> 4
y = y ^ y >> 8
y = y ^ y >> 16
if y & 1:
return True
return False | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"12",
"False"
],
[
"7",
"True"
],
[
"10",
"False"
]
] | [] | find_Parity | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": [
"int"
],
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 407 | null | python | code_generation | def rearrange_bigger(n):
"""
Write a function to create the next bigger number by rearranging the digits of a given number.
"""
| def rearrange_bigger(n):
"""
Write a function to create the next bigger number by rearranging the digits of a given number.
"""
nums = list(str(n))
for i in range(len(nums) - 2, -1, -1):
if nums[i] < nums[i + 1]:
z = nums[i:]
y = min(filter(lambda x: x > z[0], z))
z.remove(y)
z.sort()
nums[i:] = [y] + z
return int(''.join(nums))
return False | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"12",
"21"
],
[
"10",
"False"
],
[
"102",
"120"
]
] | [] | rearrange_bigger | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 408 | null | python | code_generation | import heapq
def k_smallest_pairs(nums1, nums2, k):
"""
Write a function to find k number of smallest pairs which consist of one element from the first array and one element from the second array.
"""
| import heapq
def k_smallest_pairs(nums1, nums2, k):
"""
Write a function to find k number of smallest pairs which consist of one element from the first array and one element from the second array.
"""
queue = []
def push(i, j):
if i < len(nums1) and j < len(nums2):
heapq.heappush(queue, [nums1[i] + nums2[j], i, j])
push(0, 0)
pairs = []
while queue and len(pairs) < k:
(_, i, j) = heapq.heappop(queue)
pairs.append([nums1[i], nums2[j]])
push(i, j + 1)
if j == 0:
push(i + 1, 0)
return pairs | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,3,7],[2,4,6],2",
"[[1, 2], [1, 4]]"
],
[
"[1,3,7],[2,4,6],1",
"[[1, 2]]"
],
[
"[1,3,7],[2,4,6],7",
"[[1, 2], [1, 4], [3, 2], [1, 6], [3, 4], [3, 6], [7, 2]]"
]
] | [
"import heapq"
] | k_smallest_pairs | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": [
"int"
],
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": [
"list"
],
"nums2": [
"list"
],
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 409 | null | python | code_generation | def min_product_tuple(list1):
"""
Write a function to find the minimum product from the pairs of tuples within a given list.
"""
| def min_product_tuple(list1):
"""
Write a function to find the minimum product from the pairs of tuples within a given list.
"""
result_min = min([abs(x * y) for (x, y) in list1])
return result_min | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[(2, 7), (2, 6), (1, 8), (4, 9)] ",
"8"
],
[
"[(10,20), (15,2), (5,10)] ",
"30"
],
[
"[(11,44), (10,15), (20,5), (12, 9)] ",
"100"
]
] | [] | min_product_tuple | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 410 | null | python | code_generation | def min_val(listval):
"""
Write a function to find the minimum value in a given heterogeneous list.
"""
| def min_val(listval):
"""
Write a function to find the minimum value in a given heterogeneous list.
"""
min_val = min((i for i in listval if isinstance(i, int)))
return min_val | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"['Python', 3, 2, 4, 5, 'version']",
"2"
],
[
"['Python', 15, 20, 25]",
"15"
],
[
"['Python', 30, 20, 40, 50, 'version']",
"20"
]
] | [] | min_val | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": [
"list"
],
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"int"
]
} |
||
MBPP_sanitized | 411 | null | python | code_generation | import re
def snake_to_camel(word):
"""
Write a function to convert the given snake case string to camel case string.
"""
| import re
def snake_to_camel(word):
"""
Write a function to convert the given snake case string to camel case string.
"""
return ''.join((x.capitalize() or '_' for x in word.split('_'))) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"'android_tv'",
"'AndroidTv'"
],
[
"'google_pixel'",
"'GooglePixel'"
],
[
"'apple_watch'",
"'AppleWatch'"
]
] | [
"import re"
] | snake_to_camel | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": [
"str"
],
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"str"
]
} |
||
MBPP_sanitized | 412 | null | python | code_generation | def remove_odd(l):
"""
Write a python function to remove odd numbers from a given list.
"""
| def remove_odd(l):
"""
Write a python function to remove odd numbers from a given list.
"""
for i in l:
if i % 2 != 0:
l.remove(i)
return l | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,2,3]",
"[2]"
],
[
"[2,4,6]",
"[2,4,6]"
],
[
"[10,20,3]",
"[10,20]"
]
] | [] | remove_odd | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": [
"list"
],
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 413 | null | python | code_generation | def extract_nth_element(list1, n):
"""
Write a function to extract the nth element from a given list of tuples.
"""
| def extract_nth_element(list1, n):
"""
Write a function to extract the nth element from a given list of tuples.
"""
result = [x[n] for x in list1]
return result | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,0",
"['Greyson Fulton', 'Brady Kent', 'Wyatt Knott', 'Beau Turnbull']"
],
[
"[('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)] ,2",
"[99, 96, 94, 98]"
],
[
"[('Greyson Fulton', 98, 99), ('Brady Kent', 97, 96), ('Wyatt Knott', 91, 94), ('Beau Turnbull', 94, 98)],1",
"[98, 97, 91, 94]"
]
] | [] | extract_nth_element | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": [
"int"
],
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
||
MBPP_sanitized | 414 | null | python | code_generation | def overlapping(list1, list2):
"""
Write a python function to check whether any value in a sequence exists in a sequence or not.
"""
| def overlapping(list1, list2):
"""
Write a python function to check whether any value in a sequence exists in a sequence or not.
"""
for i in range(len(list1)):
for j in range(len(list2)):
if list1[i] == list2[j]:
return True
return False | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,2,3,4,5],[6,7,8,9]",
"False"
],
[
"[1,2,3],[4,5,6]",
"False"
],
[
"[1,4,5],[1,4,5]",
"True"
]
] | [] | overlapping | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": [
"list"
],
"list2": [
"list"
],
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"bool"
]
} |
||
MBPP_sanitized | 415 | null | python | code_generation | def max_Product(arr):
"""
Write a python function to find a pair with highest product from a given array of integers.
"""
| def max_Product(arr):
"""
Write a python function to find a pair with highest product from a given array of integers.
"""
arr_len = len(arr)
if arr_len < 2:
return 'No pairs exists'
x = arr[0]
y = arr[1]
for i in range(0, arr_len):
for j in range(i + 1, arr_len):
if arr[i] * arr[j] > x * y:
x = arr[i]
y = arr[j]
return (x, y) | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[1,2,3,4,7,0,8,4]",
"(7,8)"
],
[
"[0,-1,-2,-4,5,0,-6]",
"(-4,-6)"
],
[
"[1,2,3]",
"(2,3)"
]
] | [] | max_Product | {
"input": {
"A": null,
"Input": null,
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": [
"list"
],
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"tuple"
]
} |
||
MBPP_sanitized | 417 | null | python | code_generation | def group_tuples(Input):
"""
Write a function to find common first element in given list of tuple.
"""
| def group_tuples(Input):
"""
Write a function to find common first element in given list of tuple.
"""
out = {}
for elem in Input:
try:
out[elem[0]].extend(elem[1:])
except KeyError:
out[elem[0]] = list(elem)
return [tuple(values) for values in out.values()] | [] | import numpy as np
def is_floats(x) -> bool:
# check if it is float; List[float]; Tuple[float]
if isinstance(x, float):
return True
if isinstance(x, (list, tuple)):
return all(isinstance(i, float) for i in x)
if isinstance(x, np.ndarray):
return x.dtype == np.float64 or x.dtype == np.float32
return False
def assertion(out, exp, atol):
exact_match = out == exp
if atol == 0 and is_floats(exp):
atol = 1e-6
if not exact_match and atol != 0:
assert np.allclose(out, exp, rtol=1e-07, atol=atol)
else:
assert exact_match
inputs = {input_list}
results = {output_list}
candidate = {func_entry}
for i, (inp, exp) in enumerate(zip(inputs, results)):
assertion(candidate(*inp), exp, 0) | [
[
"[('x', 'y'), ('x', 'z'), ('w', 't')]",
"[('x', 'y', 'z'), ('w', 't')]"
],
[
"[('a', 'b'), ('a', 'c'), ('d', 'e')]",
"[('a', 'b', 'c'), ('d', 'e')]"
],
[
"[('f', 'g'), ('f', 'g'), ('h', 'i')]",
"[('f', 'g', 'g'), ('h', 'i')]"
]
] | [] | group_tuples | {
"input": {
"A": null,
"Input": [
"list"
],
"K": null,
"L": null,
"M": null,
"N": null,
"S": null,
"a": null,
"actual_cost": null,
"arr": null,
"array_nums1": null,
"array_nums2": null,
"arraynums": null,
"b": null,
"base1": null,
"base2": null,
"c": null,
"ch": null,
"char": null,
"colors": null,
"d": null,
"data_list": null,
"dict": null,
"dict1": null,
"dict2": null,
"dict3": null,
"dlist": null,
"dt": null,
"element": null,
"h": null,
"h_age": null,
"height": null,
"index": null,
"input_list": null,
"item": null,
"k": null,
"l": null,
"l1": null,
"l2": null,
"l3": null,
"limit": null,
"list": null,
"list1": null,
"list2": null,
"list3": null,
"list_": null,
"listval": null,
"lst": null,
"m": null,
"monthnum2": null,
"my_list": null,
"my_matrix": null,
"n": null,
"nestedlist": null,
"newch": null,
"num": null,
"num1": null,
"num2": null,
"num3": null,
"number": null,
"numbers": null,
"nums": null,
"nums1": null,
"nums2": null,
"patterns": null,
"r": null,
"ranges": null,
"rotations": null,
"s": null,
"sale_amount": null,
"second_string": null,
"stdata": null,
"step": null,
"str": null,
"str1": null,
"string": null,
"stringlist": null,
"strr": null,
"sub_str": null,
"subjectmarks": null,
"test_list": null,
"test_list1": null,
"test_list2": null,
"test_tup": null,
"test_tup1": null,
"test_tup2": null,
"test_tuple": null,
"text": null,
"text1": null,
"tup": null,
"tup1": null,
"tuple1": null,
"tuplex": null,
"w": null,
"word": null,
"words": null,
"x": null,
"xs": null,
"y": null
},
"output": [
"list"
]
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.