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
418
null
python
code_generation
def Find_Max(lst): """ Write a python function to find the element of a list having maximum length. """
def Find_Max(lst): """ Write a python function to find the element of a list having maximum length. """ maxList = max((x for x in lst)) return maxList
[]
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'],['A','B'],['A','B','C']]", "['A','B','C']" ], [ "[[1],[1,2],[1,2,3]]", "[1,2,3]" ], [ "[[1,1],[1,2,3],[1,5,6,1]]", "[1,5,6,1]" ] ]
[]
Find_Max
{ "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": [ "list" ], "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
419
null
python
code_generation
def round_and_sum(list1): """ Write a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list. """
def round_and_sum(list1): """ Write a function to round every number of a given list of numbers and print the total sum multiplied by the length of the list. """ lenght = len(list1) round_and_sum = sum(list(map(round, list1)) * lenght) return round_and_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)
[ [ "[22.4, 4.0, -16.22, -9.10, 11.00, -12.22, 14.20, -5.20, 17.50]", "243" ], [ "[5,2,9,24.3,29]", "345" ], [ "[25.0,56.7,89.2]", "513" ] ]
[]
round_and_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": [ "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
420
null
python
code_generation
def cube_Sum(n): """ Write a python function to find the cube sum of first n even natural numbers. """
def cube_Sum(n): """ Write a python function to find the cube sum of first n even natural numbers. """ sum = 0 for i in range(1, n + 1): sum += 2 * i * (2 * i) * (2 * 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)
[ [ "2", "72" ], [ "3", "288" ], [ "4", "800" ] ]
[]
cube_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
421
null
python
code_generation
def concatenate_tuple(test_tup): """ Write a function to concatenate each element of tuple by the delimiter. """
def concatenate_tuple(test_tup): """ Write a function to concatenate each element of tuple by the delimiter. """ delim = '-' res = ''.join([str(ele) + delim for ele in test_tup]) res = res[:len(res) - len(delim)] return str(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)
[ [ "(\"ID\", \"is\", 4, \"UTS\") ", "'ID-is-4-UTS'" ], [ "(\"QWE\", \"is\", 4, \"RTY\") ", "'QWE-is-4-RTY'" ], [ "(\"ZEN\", \"is\", 4, \"OP\") ", "'ZEN-is-4-OP'" ] ]
[]
concatenate_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": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": [ "str" ], "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
422
null
python
code_generation
def find_Average_Of_Cube(n): """ Write a python function to find the average of cubes of first n natural numbers. """
def find_Average_Of_Cube(n): """ Write a python function to find the average of cubes of first n natural numbers. """ sum = 0 for i in range(1, n + 1): sum += i * i * i return round(sum / n, 6)
[]
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.5" ], [ "3", "12" ], [ "1", "1" ] ]
[]
find_Average_Of_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": 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
424
null
python
code_generation
def extract_rear(test_tuple): """ Write a function to extract only the rear index element of each string in the given tuple. """
def extract_rear(test_tuple): """ Write a function to extract only the rear index element of each string in the given tuple. """ res = list((sub[len(sub) - 1] for sub in test_tuple)) 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)
[ [ "('Mers', 'for', 'Vers') ", "['s', 'r', 's']" ], [ "('Avenge', 'for', 'People') ", "['e', 'r', 'e']" ], [ "('Gotta', 'get', 'go') ", "['a', 't', 'o']" ] ]
[]
extract_rear
{ "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": [ "str" ], "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
425
null
python
code_generation
def count_element_in_list(list1, x): """ Write a function to count the number of sublists containing a particular element. """
def count_element_in_list(list1, x): """ Write a function to count the number of sublists containing a particular element. """ ctr = 0 for i in range(len(list1)): if x in list1[i]: 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, 3], [5, 7], [1, 11], [1, 15, 7]],1", "3" ], [ "[['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'A'", "3" ], [ "[['A', 'B'], ['A', 'C'], ['A', 'D', 'E'], ['B', 'C', 'D']],'E'", "1" ] ]
[]
count_element_in_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": [ "int" ], "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
426
null
python
code_generation
def filter_oddnumbers(nums): """ Write a function to filter odd numbers. """
def filter_oddnumbers(nums): """ Write a function to filter odd numbers. """ odd_nums = list(filter(lambda x: x % 2 != 0, nums)) return odd_nums
[]
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, 10]", "[1,3,5,7,9]" ], [ "[10,20,45,67,84,93]", "[45,67,93]" ], [ "[5,7,9,8,6,4,3]", "[5,7,9,3]" ] ]
[]
filter_oddnumbers
{ "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": [ "list" ] }
MBPP_sanitized
427
null
python
code_generation
import re def change_date_format(dt): """ Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format. """
import re def change_date_format(dt): """ Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format. """ return re.sub('(\\d{4})-(\\d{1,2})-(\\d{1,2})', '\\3-\\2-\\1', dt)
[]
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)
[ [ "\"2026-01-02\"", "'02-01-2026'" ], [ "\"2020-11-13\"", "'13-11-2020'" ], [ "\"2021-04-26\"", "'26-04-2021'" ] ]
[ "import re" ]
change_date_format
{ "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": [ "str" ], "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": [ "str" ] }
MBPP_sanitized
428
null
python
code_generation
def shell_sort(my_list): """ Write a function to sort the given array by using shell sort. """
def shell_sort(my_list): """ Write a function to sort the given array by using shell sort. """ gap = len(my_list) // 2 while gap > 0: for i in range(gap, len(my_list)): current_item = my_list[i] j = i while j >= gap and my_list[j - gap] > current_item: my_list[j] = my_list[j - gap] j -= gap my_list[j] = current_item gap //= 2 return my_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)
[ [ "[12, 23, 4, 5, 3, 2, 12, 81, 56, 95]", "[2, 3, 4, 5, 12, 12, 23, 56, 81, 95]" ], [ "[24, 22, 39, 34, 87, 73, 68]", "[22, 24, 34, 39, 68, 73, 87]" ], [ "[32, 30, 16, 96, 82, 83, 74]", "[16, 30, 32, 74, 82, 83, 96]" ] ]
[]
shell_sort
{ "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": [ "list" ], "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
429
null
python
code_generation
def and_tuples(test_tup1, test_tup2): """ Write a function to extract the elementwise and tuples from the given two tuples. """
def and_tuples(test_tup1, test_tup2): """ Write a function to extract the elementwise and tuples from the given two 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)", "(0, 0, 2, 1)" ], [ "(1, 2, 3, 4), (5, 6, 7, 8)", "(1, 2, 3, 0)" ], [ "(8, 9, 11, 12), (7, 13, 14, 17)", "(0, 9, 10, 0)" ] ]
[]
and_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
430
null
python
code_generation
def parabola_directrix(a, b, c): """ Write a function to find the directrix of a parabola. """
def parabola_directrix(a, b, c): """ Write a function to find the directrix of a parabola. """ directrix = int(c - (b * b + 1) * 4 * a) return directrix
[]
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,3,2", "-198" ], [ "9,8,4", "-2336" ], [ "2,4,6", "-130" ] ]
[]
parabola_directrix
{ "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
431
null
python
code_generation
def common_element(list1, list2): """ Write a function that takes two lists and returns true if they have at least one common element. """
def common_element(list1, list2): """ Write a function that takes two lists and returns true if they have at least one common element. """ result = False for x in list1: for y in list2: if x == y: result = True 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], [5,6,7,8,9]", "True" ], [ "[1,2,3,4,5], [6,7,8,9]", null ], [ "['a','b','c'], ['d','b','e']", "True" ] ]
[]
common_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": [ "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
432
null
python
code_generation
def median_trapezium(base1, base2, height): """ Write a function to find the median length of a trapezium. """
def median_trapezium(base1, base2, height): """ Write a function to find the median length of a trapezium. """ median = 0.5 * (base1 + base2) 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)
[ [ "15,25,35", "20" ], [ "10,20,30", "15" ], [ "6,9,4", "7.5" ] ]
[]
median_trapezium
{ "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": [ "int" ], "base2": [ "int" ], "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": [ "int" ], "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
433
null
python
code_generation
def check_greater(arr, number): """ Write a function to check whether the entered number is greater than the elements of the given array. """
def check_greater(arr, number): """ Write a function to check whether the entered number is greater than the elements of the given array. """ arr.sort() return number > arr[-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)
[ [ "[1, 2, 3, 4, 5], 4", "False" ], [ "[2, 3, 4, 5, 6], 8", "True" ], [ "[9, 7, 4, 8, 6, 1], 11", "True" ] ]
[]
check_greater
{ "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": [ "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": [ "bool" ] }
MBPP_sanitized
434
null
python
code_generation
import re def text_match_one(text): """ Write a function that matches a string that has an a followed by one or more b's. """
import re def text_match_one(text): """ Write a function that matches a string that has an a followed by one or more b's. """ patterns = 'ab+?' 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" ], [ "\"abba\"", "True" ] ]
[ "import re" ]
text_match_one
{ "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
435
null
python
code_generation
def last_Digit(n): """ Write a python function to find the last digit of a given number. """
def last_Digit(n): """ Write a python function to find the last digit of a given number. """ return n % 10
[]
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)
[ [ "123", "3" ], [ "25", "5" ], [ "30", "0" ] ]
[]
last_Digit
{ "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
436
null
python
code_generation
def neg_nos(list1): """ Write a python function to return the negative numbers in a list. """
def neg_nos(list1): """ Write a python function to return the negative numbers in a list. """ out = [] for num in list1: if num < 0: out.append(num) return out
[]
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,-6]" ], [ "[-1,-2,3,4]", "[-1,-2]" ], [ "[-7,-6,8,9]", "[-7,-6]" ] ]
[]
neg_nos
{ "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
437
null
python
code_generation
def remove_odd(str1): """ Write a function to remove odd characters in a string. """
def remove_odd(str1): """ Write a function to remove odd characters in a string. """ str2 = '' for i in range(1, len(str1) + 1): if i % 2 == 0: str2 = str2 + str1[i - 1] 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)
[ [ "\"python\"", "(\"yhn\")" ], [ "\"program\"", "(\"rga\")" ], [ "\"language\"", "(\"agae\")" ] ]
[]
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": 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
438
null
python
code_generation
def count_bidirectional(test_list): """ Write a function to count bidirectional tuple pairs. """
def count_bidirectional(test_list): """ Write a function to count bidirectional tuple pairs. """ res = 0 for idx in range(0, len(test_list)): for iidx in range(idx + 1, len(test_list)): if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]: res += 1 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)
[ [ "[(5, 6), (1, 2), (6, 5), (9, 1), (6, 5), (2, 1)] ", "3" ], [ "[(5, 6), (1, 3), (6, 5), (9, 1), (6, 5), (2, 1)] ", "2" ], [ "[(5, 6), (1, 2), (6, 5), (9, 2), (6, 5), (2, 1)] ", "4" ] ]
[]
count_bidirectional
{ "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
439
null
python
code_generation
def multiple_to_single(L): """ Write a function to join a list of multiple integers into a single integer. """
def multiple_to_single(L): """ Write a function to join a list of multiple integers into a single integer. """ x = int(''.join(map(str, L))) return x
[]
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, 33, 50]", "113350" ], [ "[-1,2,3,4,5,6]", "-123456" ], [ "[10,15,20,25]", "10152025" ] ]
[]
multiple_to_single
{ "input": { "A": null, "Input": null, "K": null, "L": [ "list" ], "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": [ "int" ] }
MBPP_sanitized
440
null
python
code_generation
import re def find_adverb_position(text): """ Write a function to find the first adverb and their positions in a given sentence. """
import re def find_adverb_position(text): """ Write a function to find the first adverb and their positions in a given sentence. """ for m in re.finditer('\\w+ly', text): return (m.start(), m.end(), m.group(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)
[ [ "\"clearly!! we can see the sky\"", "(0, 7, 'clearly')" ], [ "\"seriously!! there are many roses\"", "(0, 9, 'seriously')" ], [ "\"unfortunately!! sita is going to home\"", "(0, 13, 'unfortunately')" ] ]
[ "import re" ]
find_adverb_position
{ "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": [ "tuple" ] }
MBPP_sanitized
441
null
python
code_generation
def surfacearea_cube(l): """ Write a function to find the surface area of a cube of a given size. """
def surfacearea_cube(l): """ Write a function to find the surface area of a cube of a given size. """ surfacearea = 6 * l * l return surfacearea
[]
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", "150" ], [ "3", "54" ], [ "10", "600" ] ]
[]
surfacearea_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
442
null
python
code_generation
from array import array def positive_count(nums): """ Write a function to find the ration of positive numbers in an array of integers. """
from array import array def positive_count(nums): """ Write a function to find the ration of positive numbers in an array of integers. """ n = len(nums) n1 = 0 for x in nums: if x > 0: n1 += 1 else: None return round(n1 / 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)
[ [ "[0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8]", "0.54" ], [ "[2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8]", "0.69" ], [ "[2, 4, -6, -9, 11, -12, 14, -5, 17]", "0.56" ] ]
[ "from array import array" ]
positive_count
{ "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": [ "float" ] }
MBPP_sanitized
443
null
python
code_generation
def largest_neg(list1): """ Write a python function to find the largest negative number from the given list. """
def largest_neg(list1): """ Write a python function to find the largest negative number from the given list. """ max = list1[0] for x in list1: if x < max: max = x return max
[]
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,-6]", "-6" ], [ "[1,2,3,-8,-9]", "-9" ], [ "[1,2,3,4,-1]", "-1" ] ]
[]
largest_neg
{ "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
444
null
python
code_generation
def trim_tuple(test_list, K): """ Write a function to trim each tuple by k in the given tuple list. """
def trim_tuple(test_list, K): """ Write a function to trim each tuple by k in the given tuple list. """ res = [] for ele in test_list: N = len(ele) res.append(tuple(list(ele)[K:N - K])) return str(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)
[ [ "[(5, 3, 2, 1, 4), (3, 4, 9, 2, 1),(9, 1, 2, 3, 5), (4, 8, 2, 1, 7)], 2", "'[(2,), (9,), (2,), (2,)]'" ], [ "[(5, 3, 2, 1, 4), (3, 4, 9, 2, 1), (9, 1, 2, 3, 5), (4, 8, 2, 1, 7)], 1", "'[(3, 2, 1), (4, 9, 2), (1, 2, 3), (8, 2, 1)]'" ], [ "[(7, 8, 4, 9), (11, 8, 12, 4),(4, 1, 7, 8), (3, 6, 9, 7)], 1", "'[(8, 4), (8, 12), (1, 7), (6, 9)]'" ] ]
[]
trim_tuple
{ "input": { "A": null, "Input": null, "K": [ "int" ], "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": [ "str" ] }
MBPP_sanitized
445
null
python
code_generation
def index_multiplication(test_tup1, test_tup2): """ Write a function to perform index wise multiplication of tuple elements in the given two tuples. """
def index_multiplication(test_tup1, test_tup2): """ Write a function to perform index wise multiplication of tuple elements in the given two 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)) ", "((6, 21), (12, 45), (2, 9), (7, 30))" ], [ "((2, 4), (5, 6), (3, 10), (2, 11)),((7, 8), (4, 10), (2, 2), (8, 4)) ", "((14, 32), (20, 60), (6, 20), (16, 44))" ], [ "((3, 5), (6, 7), (4, 11), (3, 12)),((8, 9), (5, 11), (3, 3), (9, 5)) ", "((24, 45), (30, 77), (12, 33), (27, 60))" ] ]
[]
index_multiplication
{ "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
446
null
python
code_generation
from collections import Counter def count_Occurrence(tup, lst): """ Write a python function to count the occurence of all elements of list in a tuple. """
from collections import Counter def count_Occurrence(tup, lst): """ Write a python function to count the occurence of all elements of list in a tuple. """ count = 0 for item in tup: if item in lst: 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)
[ [ "('a', 'a', 'c', 'b', 'd'),['a', 'b'] ", "3" ], [ "(1, 2, 3, 1, 4, 6, 7, 1, 4),[1, 4, 7]", "6" ], [ "(1,2,3,4,5,6),[1,2]", "2" ] ]
[ "from collections import Counter " ]
count_Occurrence
{ "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": [ "list" ], "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": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
447
null
python
code_generation
def cube_nums(nums): """ Write a function to find cubes of individual elements in a list. """
def cube_nums(nums): """ Write a function to find cubes of individual elements in a list. """ cube_nums = list(map(lambda x: x ** 3, nums)) return cube_nums
[]
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, 10]", "[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]" ], [ "[10,20,30]", "([1000, 8000, 27000])" ], [ "[12,15]", "([1728, 3375])" ] ]
[]
cube_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": 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": [ "list" ] }
MBPP_sanitized
448
null
python
code_generation
def cal_sum(n): """ Write a function to calculate the sum of perrin numbers. """
def cal_sum(n): """ Write a function to calculate the sum of perrin numbers. """ a = 3 b = 0 c = 2 if n == 0: return 3 if n == 1: return 3 if n == 2: return 5 sum = 5 while n > 2: d = a + b sum = sum + d a = b b = c c = d n = n - 1 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)
[ [ "9", "49" ], [ "10", "66" ], [ "11", "88" ] ]
[]
cal_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
450
null
python
code_generation
def extract_string(str, l): """ Write a function to extract specified size of strings from a given list of string values. """
def extract_string(str, l): """ Write a function to extract specified size of strings from a given list of string values. """ result = [e for e in str if len(e) == l] 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', 'list', 'exercises', 'practice', 'solution'] ,8", "['practice', 'solution']" ], [ "['Python', 'list', 'exercises', 'practice', 'solution'] ,6", "['Python']" ], [ "['Python', 'list', 'exercises', 'practice', 'solution'] ,9", "['exercises']" ] ]
[]
extract_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": [ "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": [ "list" ], "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
451
null
python
code_generation
import re def remove_whitespaces(text1): """ Write a function to remove all whitespaces from the given string. """
import re def remove_whitespaces(text1): """ Write a function to remove all whitespaces from the given string. """ return re.sub('\\s+', '', text1)
[]
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)
[ [ "' Google Flutter '", "'GoogleFlutter'" ], [ "' Google Dart '", "'GoogleDart'" ], [ "' iOS Swift '", "'iOSSwift'" ] ]
[ "import re" ]
remove_whitespaces
{ "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": [ "str" ], "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "str" ] }
MBPP_sanitized
452
null
python
code_generation
def loss_amount(actual_cost, sale_amount): """ Write a function that gives loss amount on a sale if the given amount has loss else return 0. """
def loss_amount(actual_cost, sale_amount): """ Write a function that gives loss amount on a sale if the given amount has loss else return 0. """ if sale_amount > actual_cost: amount = sale_amount - actual_cost return amount else: 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)
[ [ "1500,1200", "0" ], [ "100,200", "100" ], [ "2000,5000", "3000" ] ]
[]
loss_amount
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": [ "int" ], "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": [ "int" ], "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
453
null
python
code_generation
import math def sumofFactors(n): """ Write a python function to find the sum of even factors of a number. """
import math def sumofFactors(n): """ Write a python function to find the sum of even factors of a number. """ if n % 2 != 0: return 0 res = 1 for i in range(2, int(math.sqrt(n)) + 1): count = 0 curr_sum = 1 curr_term = 1 while n % i == 0: count = count + 1 n = n // i if i == 2 and count == 1: curr_sum = 0 curr_term = curr_term * i curr_sum = curr_sum + curr_term res = res * curr_sum if n >= 2: res = res * (1 + n) 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)
[ [ "18", "26" ], [ "30", "48" ], [ "6", "8" ] ]
[ "import math " ]
sumofFactors
{ "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
454
null
python
code_generation
import re def text_match_wordz(text): """ Write a function that matches a word containing 'z'. """
import re def text_match_wordz(text): """ Write a function that matches a word containing 'z'. """ patterns = '\\w*z.\\w*' 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)
[ [ "\"pythonz.\"", "True" ], [ "\"xyz.\"", "True" ], [ "\" lang .\"", "False" ] ]
[ "import re" ]
text_match_wordz
{ "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
455
null
python
code_generation
def check_monthnumb_number(monthnum2): """ Write a function to check whether the given month number contains 31 days or not. """
def check_monthnumb_number(monthnum2): """ Write a function to check whether the given month number contains 31 days or not. """ if monthnum2 == 1 or monthnum2 == 3 or monthnum2 == 5 or (monthnum2 == 7) or (monthnum2 == 8) or (monthnum2 == 10) or (monthnum2 == 12): 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)
[ [ "5", "True" ], [ "2", "False" ], [ "6", "False" ] ]
[]
check_monthnumb_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": [ "int" ], "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
456
null
python
code_generation
def reverse_string_list(stringlist): """ Write a function to reverse each string in a given list of string values. """
def reverse_string_list(stringlist): """ Write a function to reverse each string in a given list of string values. """ result = [x[::-1] for x in stringlist] 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)
[ [ "['Red', 'Green', 'Blue', 'White', 'Black']", "['deR', 'neerG', 'eulB', 'etihW', 'kcalB']" ], [ "['john','amal','joel','george']", "['nhoj','lama','leoj','egroeg']" ], [ "['jack','john','mary']", "['kcaj','nhoj','yram']" ] ]
[]
reverse_string_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": 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": [ "list" ], "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
457
null
python
code_generation
def Find_Min(lst): """ Write a python function to find the sublist having minimum length. """
def Find_Min(lst): """ Write a python function to find the sublist having minimum length. """ return min(lst, key=len)
[]
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],[1,2,3]]", "[1]" ], [ "[[1,1],[1,1,1],[1,2,7,8]]", "[1,1]" ], [ "[['x'],['x','y'],['x','y','z']]", "['x']" ] ]
[]
Find_Min
{ "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": [ "list" ], "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
458
null
python
code_generation
def rectangle_area(l, b): """ Write a function to find the area of a rectangle. """
def rectangle_area(l, b): """ Write a function to find the area of a rectangle. """ area = l * b return area
[]
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", "200" ], [ "10,5", "50" ], [ "4,2", "8" ] ]
[]
rectangle_area
{ "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": [ "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": [ "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
459
null
python
code_generation
import re def remove_uppercase(str1): """ Write a function to remove uppercase substrings from a given string. """
import re def remove_uppercase(str1): """ Write a function to remove uppercase substrings from a given string. """ return re.sub('[A-Z]', '', str1)
[]
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)
[ [ "'cAstyoUrFavoRitETVshoWs'", "'cstyoravoitshos'" ], [ "'wAtchTheinTernEtrAdIo'", "'wtchheinerntrdo'" ], [ "'VoicESeaRchAndreComMendaTionS'", "'oiceachndreomendaion'" ] ]
[ "import re" ]
remove_uppercase
{ "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
460
null
python
code_generation
def Extract(lst): """ Write a python function to get the first element of each sublist. """
def Extract(lst): """ Write a python function to get the first element of each sublist. """ return [item[0] for item in lst]
[]
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]]", "[1, 3, 6]" ], [ "[[1,2,3],[4, 5]]", "[1,4]" ], [ "[[9,8,1],[1,2]]", "[9,1]" ] ]
[]
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": [ "list" ], "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
461
null
python
code_generation
def upper_ctr(str): """ Write a python function to count the upper case characters in a given string. """
def upper_ctr(str): """ Write a python function to count the upper case characters in a given string. """ upper_ctr = 0 for i in range(len(str)): if str[i] >= 'A' and str[i] <= 'Z': upper_ctr += 1 return upper_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)
[ [ "'PYthon'", "1" ], [ "'BigData'", "1" ], [ "'program'", "0" ] ]
[]
upper_ctr
{ "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
462
null
python
code_generation
def combinations_list(list1): """ Write a function to find all possible combinations of the elements of a given list. """
def combinations_list(list1): """ Write a function to find all possible combinations of the elements of a given list. """ if len(list1) == 0: return [[]] result = [] for el in combinations_list(list1[1:]): result += [el, el + [list1[0]]] 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)
[ [ "['orange', 'red', 'green', 'blue']", "[[], ['orange'], ['red'], ['red', 'orange'], ['green'], ['green', 'orange'], ['green', 'red'], ['green', 'red', 'orange'], ['blue'], ['blue', 'orange'], ['blue', 'red'], ['blue', 'red', 'orange'], ['blue', 'green'], ['blue', 'green', 'orange'], ['blue', 'green', 'red'], ['blue', 'green', 'red', 'orange']]" ], [ "['red', 'green', 'blue', 'white', 'black', 'orange']", "[[], ['red'], ['green'], ['green', 'red'], ['blue'], ['blue', 'red'], ['blue', 'green'], ['blue', 'green', 'red'], ['white'], ['white', 'red'], ['white', 'green'], ['white', 'green', 'red'], ['white', 'blue'], ['white', 'blue', 'red'], ['white', 'blue', 'green'], ['white', 'blue', 'green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['black', 'blue'], ['black', 'blue', 'red'], ['black', 'blue', 'green'], ['black', 'blue', 'green', 'red'], ['black', 'white'], ['black', 'white', 'red'], ['black', 'white', 'green'], ['black', 'white', 'green', 'red'], ['black', 'white', 'blue'], ['black', 'white', 'blue', 'red'], ['black', 'white', 'blue', 'green'], ['black', 'white', 'blue', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'blue'], ['orange', 'blue', 'red'], ['orange', 'blue', 'green'], ['orange', 'blue', 'green', 'red'], ['orange', 'white'], ['orange', 'white', 'red'], ['orange', 'white', 'green'], ['orange', 'white', 'green', 'red'], ['orange', 'white', 'blue'], ['orange', 'white', 'blue', 'red'], ['orange', 'white', 'blue', 'green'], ['orange', 'white', 'blue', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red'], ['orange', 'black', 'blue'], ['orange', 'black', 'blue', 'red'], ['orange', 'black', 'blue', 'green'], ['orange', 'black', 'blue', 'green', 'red'], ['orange', 'black', 'white'], ['orange', 'black', 'white', 'red'], ['orange', 'black', 'white', 'green'], ['orange', 'black', 'white', 'green', 'red'], ['orange', 'black', 'white', 'blue'], ['orange', 'black', 'white', 'blue', 'red'], ['orange', 'black', 'white', 'blue', 'green'], ['orange', 'black', 'white', 'blue', 'green', 'red']]" ], [ "['red', 'green', 'black', 'orange']", "[[], ['red'], ['green'], ['green', 'red'], ['black'], ['black', 'red'], ['black', 'green'], ['black', 'green', 'red'], ['orange'], ['orange', 'red'], ['orange', 'green'], ['orange', 'green', 'red'], ['orange', 'black'], ['orange', 'black', 'red'], ['orange', 'black', 'green'], ['orange', 'black', 'green', 'red']]" ] ]
[]
combinations_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
463
null
python
code_generation
def max_subarray_product(arr): """ Write a function to find the maximum product subarray of the given array. """
def max_subarray_product(arr): """ Write a function to find the maximum product subarray of the given array. """ n = len(arr) max_ending_here = 1 min_ending_here = 1 max_so_far = 0 flag = 0 for i in range(0, n): if arr[i] > 0: max_ending_here = max_ending_here * arr[i] min_ending_here = min(min_ending_here * arr[i], 1) flag = 1 elif arr[i] == 0: max_ending_here = 1 min_ending_here = 1 else: temp = max_ending_here max_ending_here = max(min_ending_here * arr[i], 1) min_ending_here = temp * arr[i] if max_so_far < max_ending_here: max_so_far = max_ending_here if flag == 0 and max_so_far == 0: return 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)
[ [ "[1, -2, -3, 0, 7, -8, -2]", "112" ], [ "[6, -3, -10, 0, 2]", "180" ], [ "[-2, -40, 0, -2, -3]", "80" ] ]
[]
max_subarray_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": [ "int" ] }
MBPP_sanitized
464
null
python
code_generation
def check_value(dict, n): """ Write a function to check if all values are same in a dictionary. """
def check_value(dict, n): """ Write a function to check if all values are same in a dictionary. """ result = all((x == n for x in dict.values())) 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': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},10", "False" ], [ "{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},12", "True" ], [ "{'Cierra Vega': 12, 'Alden Cantrell': 12, 'Kierra Gentry': 12, 'Pierre Cox': 12},5", "False" ] ]
[]
check_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": [ "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": [ "bool" ] }
MBPP_sanitized
465
null
python
code_generation
def drop_empty(dict1): """ Write a function to drop empty items from a given dictionary. """
def drop_empty(dict1): """ Write a function to drop empty items from a given dictionary. """ dict1 = {key: value for (key, value) in dict1.items() if value is not None} return dict1
[]
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)
[ [ "{'c1': 'Red', 'c2': 'Green', 'c3':None}", "{'c1': 'Red', 'c2': 'Green'}" ], [ "{'c1': 'Red', 'c2': None, 'c3':None}", "{'c1': 'Red'}" ], [ "{'c1': None, 'c2': 'Green', 'c3':None}", "{ 'c2': 'Green'}" ] ]
[]
drop_empty
{ "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": [ "dict" ], "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": [ "dict" ] }
MBPP_sanitized
468
null
python
code_generation
def max_product(arr): """ Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """
def max_product(arr): """ Write a function to find the maximum product formed by multiplying numbers of an increasing subsequence of that array. """ n = len(arr) mpis = arr[:] for i in range(n): current_prod = arr[i] j = i + 1 while j < n: if arr[j - 1] > arr[j]: break current_prod *= arr[j] if current_prod > mpis[j]: mpis[j] = current_prod j = j + 1 return max(mpis)
[]
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, 100, 4, 5, 150, 6]", "3000" ], [ "[4, 42, 55, 68, 80]", "50265600" ], [ "[10, 22, 9, 33, 21, 50, 41, 60]", "2460" ] ]
[]
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": [ "int" ] }
MBPP_sanitized
470
null
python
code_generation
def add_pairwise(test_tup): """ Write a function to find the pairwise addition of the neighboring elements of the given tuple. """
def add_pairwise(test_tup): """ Write a function to find the pairwise addition of the neighboring elements of the given tuple. """ res = tuple((i + j for (i, j) in zip(test_tup, test_tup[1:]))) 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, 5, 7, 8, 10)", "(6, 12, 15, 18)" ], [ "(2, 6, 8, 9, 11)", "(8, 14, 17, 20)" ], [ "(3, 7, 9, 10, 12)", "(10, 16, 19, 22)" ] ]
[]
add_pairwise
{ "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": [ "tuple" ] }
MBPP_sanitized
471
null
python
code_generation
def find_remainder(arr, n): """ Write a python function to find the product of the array multiplication modulo n. """
def find_remainder(arr, n): """ Write a python function to find the product of the array multiplication modulo n. """ mul = 1 for i in range(len(arr)): mul = mul * (arr[i] % n) % n return mul % 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)
[ [ "[ 100, 10, 5, 25, 35, 14 ],11", "9" ], [ "[1,1,1],1", "0" ], [ "[1,2,1],2", "0" ] ]
[]
find_remainder
{ "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": [ "int" ] }
MBPP_sanitized
472
null
python
code_generation
def check_Consecutive(l): """ Write a python function to check whether the given list contains consecutive numbers or not. """
def check_Consecutive(l): """ Write a python function to check whether the given list contains consecutive numbers or not. """ return sorted(l) == list(range(min(l), max(l) + 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)
[ [ "[1,2,3,4,5]", "True" ], [ "[1,2,3,5,6]", "False" ], [ "[1,2,1]", "False" ] ]
[]
check_Consecutive
{ "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": [ "bool" ] }
MBPP_sanitized
473
null
python
code_generation
def tuple_intersection(test_list1, test_list2): """ Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order. """
def tuple_intersection(test_list1, test_list2): """ Write a function to find the tuple intersection of elements in the given tuple list irrespective of their order. """ res = set([tuple(sorted(ele)) for ele in test_list1]) & set([tuple(sorted(ele)) for ele in test_list2]) 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), (5, 6), (9, 10), (4, 5)] , [(5, 4), (3, 4), (6, 5), (9, 11)]", "{(4, 5), (3, 4), (5, 6)}" ], [ "[(4, 1), (7, 4), (11, 13), (17, 14)] , [(1, 4), (7, 4), (16, 12), (10, 13)]", "{(4, 7), (1, 4)}" ], [ "[(2, 1), (3, 2), (1, 3), (1, 4)] , [(11, 2), (2, 3), (6, 2), (1, 3)]", "{(1, 3), (2, 3)}" ] ]
[]
tuple_intersection
{ "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": [ "list" ], "test_list2": [ "list" ], "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
474
null
python
code_generation
def replace_char(str1, ch, newch): """ Write a function to replace characters in a string. """
def replace_char(str1, ch, newch): """ Write a function to replace characters in a string. """ str2 = str1.replace(ch, newch) 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)
[ [ "\"polygon\",'y','l'", "(\"pollgon\")" ], [ "\"character\",'c','a'", "(\"aharaater\")" ], [ "\"python\",'l','a'", "(\"python\")" ] ]
[]
replace_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": [ "str" ], "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": [ "str" ], "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
475
null
python
code_generation
from collections import Counter def sort_counter(dict1): """ Write a function to sort a dictionary by value. """
from collections import Counter def sort_counter(dict1): """ Write a function to sort a dictionary by value. """ x = Counter(dict1) sort_counter = x.most_common() return sort_counter
[]
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)
[ [ "{'Math':81, 'Physics':83, 'Chemistry':87}", "[('Chemistry', 87), ('Physics', 83), ('Math', 81)]" ], [ "{'Math':400, 'Physics':300, 'Chemistry':250}", "[('Math', 400), ('Physics', 300), ('Chemistry', 250)]" ], [ "{'Math':900, 'Physics':1000, 'Chemistry':1250}", "[('Chemistry', 1250), ('Physics', 1000), ('Math', 900)]" ] ]
[ "from collections import Counter" ]
sort_counter
{ "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": [ "dict" ], "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
476
null
python
code_generation
def big_sum(nums): """ Write a python function to find the sum of the largest and smallest value in a given array. """
def big_sum(nums): """ Write a python function to find the sum of the largest and smallest value in a given array. """ sum = max(nums) + min(nums) 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)
[ [ "[1,2,3]", "4" ], [ "[-1,2,3,4]", "3" ], [ "[2,3,6]", "8" ] ]
[]
big_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": 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
477
null
python
code_generation
def is_lower(string): """ Write a python function to convert the given string to lower case. """
def is_lower(string): """ Write a python function to convert the given string to lower case. """ return string.lower()
[]
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)
[ [ "\"InValid\"", "\"invalid\"" ], [ "\"TruE\"", "\"true\"" ], [ "\"SenTenCE\"", "\"sentence\"" ] ]
[]
is_lower
{ "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
478
null
python
code_generation
import re def remove_lowercase(str1): """ Write a function to remove lowercase substrings from a given string. """
import re def remove_lowercase(str1): """ Write a function to remove lowercase substrings from a given string. """ return re.sub('[a-z]', '', str1)
[]
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\"", "('PYTH')" ], [ "\"FInD\"", "('FID')" ], [ "\"STRinG\"", "('STRG')" ] ]
[ "import re" ]
remove_lowercase
{ "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
479
null
python
code_generation
def first_Digit(n): """ Write a python function to find the first digit of a given number. """
def first_Digit(n): """ Write a python function to find the first digit of a given number. """ while n >= 10: n = n / 10 return int(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)
[ [ "123", "1" ], [ "456", "4" ], [ "12", "1" ] ]
[]
first_Digit
{ "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" ] }