Dataset Viewer
Auto-converted to Parquet
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
11
null
python
code_generation
def remove_Occ(s, ch): """ Write a python function to remove first and last occurrence of a given character from the string. """
def remove_Occ(s, ch): """ Write a python function to remove first and last occurrence of a given character from the string. """ for i in range(len(s)): if s[i] == ch: s = s[0:i] + s[i + 1:] break for i in range(len(s) - 1, -1, -1): if s[i] == ch: s = s[0:i] + s[i + 1:] break return s
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "\"hello\",\"l\"", "\"heo\"" ], [ "\"abcda\",\"a\"", "\"bcd\"" ], [ "\"PHP\",\"P\"", "\"H\"" ] ]
[]
remove_Occ
{ "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": 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": [ "str" ], "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
12
null
python
code_generation
def sort_matrix(M): """ Write a function to sort a given matrix in ascending order according to the sum of its rows. """
def sort_matrix(M): """ Write a function to sort a given matrix in ascending order according to the sum of its rows. """ result = sorted(M, key=sum) 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], [2, 4, 5], [1, 1, 1]]", "[[1, 1, 1], [1, 2, 3], [2, 4, 5]]" ], [ "[[1, 2, 3], [-2, 4, -5], [1, -1, 1]]", "[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]" ], [ "[[5,8,9],[6,4,3],[2,1,4]]", "[[2, 1, 4], [6, 4, 3], [5, 8, 9]]" ] ]
[]
sort_matrix
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": [ "list" ], "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "list" ] }
MBPP_sanitized
14
null
python
code_generation
def find_Volume(l, b, h): """ Write a python function to find the volume of a triangular prism. """
def find_Volume(l, b, h): """ Write a python function to find the volume of a triangular prism. """ return l * b * h / 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)
[ [ "10,8,6", "240" ], [ "3,2,2", "6" ], [ "1,2,1", "1" ] ]
[]
find_Volume
{ "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": [ "int" ], "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
16
null
python
code_generation
import re def text_lowercase_underscore(text): """ Write a function to that returns true if the input string contains sequences of lowercase letters joined with an underscore and false otherwise. """
import re def text_lowercase_underscore(text): """ Write a function to that returns true if the input string contains sequences of lowercase letters joined with an underscore and false otherwise. """ patterns = '^[a-z]+_[a-z]+$' 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)
[ [ "\"aab_cbbbc\"", "(True)" ], [ "\"aab_Abbbc\"", "(False)" ], [ "\"Aaab_abbbc\"", "(False)" ] ]
[ "import re" ]
text_lowercase_underscore
{ "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
17
null
python
code_generation
def square_perimeter(a): """ Write a function that returns the perimeter of a square given its side length as input. """
def square_perimeter(a): """ Write a function that returns the perimeter of a square given its side length as input. """ perimeter = 4 * a return perimeter
[]
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", "40" ], [ "5", "20" ], [ "4", "16" ] ]
[]
square_perimeter
{ "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": 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
18
null
python
code_generation
NO_OF_CHARS = 256 def str_to_list(string): temp = [] for x in string: temp.append(x) return temp def lst_to_string(List): return ''.join(List) def get_char_count_array(string): count = [0] * NO_OF_CHARS for i in string: count[ord(i)] += 1 return count def remove_dirty_chars(string, second_string): """ Write a function to remove characters from the first string which are present in the second string. """
NO_OF_CHARS = 256 def str_to_list(string): temp = [] for x in string: temp.append(x) return temp def lst_to_string(List): return ''.join(List) def get_char_count_array(string): count = [0] * NO_OF_CHARS for i in string: count[ord(i)] += 1 return count def remove_dirty_chars(string, second_string): """ Write a function to remove characters from the first string which are present in the second string. """ count = get_char_count_array(second_string) ip_ind = 0 res_ind = 0 temp = '' str_list = str_to_list(string) while ip_ind != len(str_list): temp = str_list[ip_ind] if count[ord(temp)] == 0: str_list[res_ind] = str_list[ip_ind] res_ind += 1 ip_ind += 1 return lst_to_string(str_list[0:res_ind])
[]
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)
[ [ "\"probasscurve\", \"pros\"", "'bacuve'" ], [ "\"digitalindia\", \"talent\"", "'digiidi'" ], [ "\"exoticmiles\", \"toxic\"", "'emles'" ] ]
[]
remove_dirty_chars
{ "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": [ "str" ], "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
19
null
python
code_generation
def test_duplicate(arraynums): """ Write a function to find whether a given array of integers contains any duplicate element. """
def test_duplicate(arraynums): """ Write a function to find whether a given array of integers contains any duplicate element. """ nums_set = set(arraynums) return len(arraynums) != len(nums_set)
[]
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])", "False" ], [ "([1,2,3,4, 4])", "True" ], [ "[1,1,2,2,3,3,4,4,5]", "True" ] ]
[]
test_duplicate
{ "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": [ "list" ], "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": [ "bool" ] }
MBPP_sanitized
20
null
python
code_generation
def is_woodall(x): """ Write a function to check if the given number is woodball or not. """
def is_woodall(x): """ Write a function to check if the given number is woodball or not. """ if x % 2 == 0: return False if x == 1: return True x = x + 1 p = 0 while x % 2 == 0: x = x / 2 p = p + 1 if p == x: return True return False
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "383", "True" ], [ "254", "False" ], [ "200", "False" ] ]
[]
is_woodall
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": [ "int" ], "xs": null, "y": null }, "output": [ "bool" ] }
MBPP_sanitized
56
null
python
code_generation
def rev(num): rev_num = 0 while num > 0: rev_num = rev_num * 10 + num % 10 num = num // 10 return rev_num def check(n): """ Write a python function to check if a given number is one less than twice its reverse. """
def rev(num): rev_num = 0 while num > 0: rev_num = rev_num * 10 + num % 10 num = num // 10 return rev_num def check(n): """ Write a python function to check if a given number is one less than twice its reverse. """ return 2 * rev(n) == n + 1
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "70", "False" ], [ "23", "False" ], [ "73", "True" ] ]
[]
check
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "bool" ] }
MBPP_sanitized
57
null
python
code_generation
def find_Max_Num(arr): """ Write a python function to find the largest number that can be formed with the given list of digits. """
def find_Max_Num(arr): """ Write a python function to find the largest number that can be formed with the given list of digits. """ n = len(arr) arr.sort(reverse=True) num = arr[0] for i in range(1, n): num = num * 10 + arr[i] return num
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[1,2,3]", "321" ], [ "[4,5,6,1]", "6541" ], [ "[1,2,3,9]", "9321" ] ]
[]
find_Max_Num
{ "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
58
null
python
code_generation
def opposite_Signs(x, y): """ Write a python function to check whether the given two integers have opposite sign or not. """
def opposite_Signs(x, y): """ Write a python function to check whether the given two integers have opposite sign or not. """ return x ^ y < 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)
[ [ "1,-2", "True" ], [ "3,2", "False" ], [ "-10,-10", "False" ], [ "-2,2", "True" ] ]
[]
opposite_Signs
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": [ "int" ], "xs": null, "y": [ "int" ] }, "output": [ "bool" ] }
MBPP_sanitized
59
null
python
code_generation
def is_octagonal(n): """ Write a function to find the nth octagonal number. """
def is_octagonal(n): """ Write a function to find the nth octagonal number. """ return 3 * n * n - 2 * 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)
[ [ "5", "65" ], [ "10", "280" ], [ "15", "645" ] ]
[]
is_octagonal
{ "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
61
null
python
code_generation
from collections import defaultdict def count_Substrings(s): """ Write a python function to count the number of substrings with the sum of digits equal to their length. """
from collections import defaultdict def count_Substrings(s): """ Write a python function to count the number of substrings with the sum of digits equal to their length. """ n = len(s) (count, sum) = (0, 0) mp = defaultdict(lambda : 0) mp[0] += 1 for i in range(n): sum += ord(s[i]) - ord('0') count += mp[sum - (i + 1)] mp[sum - (i + 1)] += 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)
[ [ "'112112'", "6" ], [ "'111'", "6" ], [ "'1101112'", "12" ] ]
[ "from collections import defaultdict" ]
count_Substrings
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": [ "str" ], "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
62
null
python
code_generation
def smallest_num(xs): """ Write a python function to find smallest number in a list. """
def smallest_num(xs): """ Write a python function to find smallest number in a list. """ return min(xs)
[]
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, 1, 45, 99]", "1" ], [ "[1, 2, 3]", "1" ], [ "[45, 46, 50, 60]", "45" ] ]
[]
smallest_num
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": 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": [ "list" ], "y": null }, "output": [ "int" ] }
MBPP_sanitized
63
null
python
code_generation
def max_difference(test_list): """ Write a function to find the maximum difference between available pairs in the given tuple list. """
def max_difference(test_list): """ Write a function to find the maximum difference between available pairs in the given tuple list. """ temp = [abs(b - a) for (a, b) in test_list] res = max(temp) 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, 5), (1, 7), (10, 3), (1, 2)]", "7" ], [ "[(4, 6), (2, 17), (9, 13), (11, 12)]", "15" ], [ "[(12, 35), (21, 27), (13, 23), (41, 22)]", "23" ] ]
[]
max_difference
{ "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
64
null
python
code_generation
def subject_marks(subjectmarks): """ Write a function to sort a list of tuples using the second value of each tuple. """
def subject_marks(subjectmarks): """ Write a function to sort a list of tuples using the second value of each tuple. """ subjectmarks.sort(key=lambda x: x[1]) return subjectmarks
[]
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)
[ [ "[('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)]", "[('Social sciences', 82), ('English', 88), ('Science', 90), ('Maths', 97)]" ], [ "[('Telugu',49),('Hindhi',54),('Social',33)]", "([('Social',33),('Telugu',49),('Hindhi',54)])" ], [ "[('Physics',96),('Chemistry',97),('Biology',45)]", "([('Biology',45),('Physics',96),('Chemistry',97)])" ] ]
[]
subject_marks
{ "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": [ "list" ], "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
65
null
python
code_generation
def recursive_list_sum(data_list): """ Write a function to flatten a list and sum all of its elements. """
def recursive_list_sum(data_list): """ Write a function to flatten a list and sum all of its elements. """ total = 0 for element in data_list: if type(element) == type([]): total = total + recursive_list_sum(element) else: total = total + element return total
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "([1, 2, [3,4],[5,6]])", "21" ], [ "([7, 10, [15,14],[19,41]])", "106" ], [ "([10, 20, [30,40],[50,60]])", "210" ] ]
[]
recursive_list_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": [ "list" ], "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
66
null
python
code_generation
def pos_count(list): """ Write a python function to count the number of positive numbers in a list. """
def pos_count(list): """ Write a python function to count the number of positive numbers in a list. """ pos_count = 0 for num in list: if num >= 0: pos_count += 1 return pos_count
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[1,-2,3,-4]", "2" ], [ "[3,4,5,-1]", "3" ], [ "[1,2,3,4]", "4" ] ]
[]
pos_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": [ "list" ], "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
67
null
python
code_generation
def bell_number(n): """ Write a function to find the number of ways to partition a set of Bell numbers. """
def bell_number(n): """ Write a function to find the number of ways to partition a set of Bell numbers. """ bell = [[0 for i in range(n + 1)] for j in range(n + 1)] bell[0][0] = 1 for i in range(1, n + 1): bell[i][0] = bell[i - 1][i - 1] for j in range(1, i + 1): bell[i][j] = bell[i - 1][j - 1] + bell[i][j - 1] return bell[n][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)
[ [ "2", "2" ], [ "10", "115975" ], [ "56", "6775685320645824322581483068371419745979053216268760300" ] ]
[]
bell_number
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
68
null
python
code_generation
def is_Monotonic(A): """ Write a python function to check whether the given array is monotonic or not. """
def is_Monotonic(A): """ Write a python function to check whether the given array is monotonic or not. """ return all((A[i] <= A[i + 1] for i in range(len(A) - 1))) or all((A[i] >= A[i + 1] for i in range(len(A) - 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)
[ [ "[6, 5, 4, 4]", "True" ], [ "[1, 2, 2, 3]", "True" ], [ "[1, 3, 2]", "False" ] ]
[]
is_Monotonic
{ "input": { "A": [ "list" ], "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "bool" ] }
MBPP_sanitized
69
null
python
code_generation
def is_sublist(l, s): """ Write a function to check whether a list contains the given sublist or not. """
def is_sublist(l, s): """ Write a function to check whether a list contains the given sublist or not. """ sub_set = False if s == []: sub_set = True elif s == l: sub_set = True elif len(s) > len(l): sub_set = False else: for i in range(len(l)): if l[i] == s[0]: n = 1 while n < len(s) and l[i + n] == s[n]: n += 1 if n == len(s): sub_set = True return sub_set
[]
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,3,5,7],[3,7]", "False" ], [ "[2,4,3,5,7],[4,3]", "True" ], [ "[2,4,3,5,7],[1,6]", "False" ] ]
[]
is_sublist
{ "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": [ "list" ], "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
70
null
python
code_generation
def find_equal_tuple(Input): k = 0 if not Input else len(Input[0]) flag = 1 for tuple in Input: if len(tuple) != k: flag = 0 break return flag def get_equal(Input): """ Write a function to find whether all the given tuples have equal length or not. """
def find_equal_tuple(Input): k = 0 if not Input else len(Input[0]) flag = 1 for tuple in Input: if len(tuple) != k: flag = 0 break return flag def get_equal(Input): """ Write a function to find whether all the given tuples have equal length or not. """ return find_equal_tuple(Input) == 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)
[ [ "[(11, 22, 33), (44, 55, 66)]", "True" ], [ "[(1, 2, 3), (4, 5, 6, 7)]", "False" ], [ "[(1, 2), (3, 4)]", "True" ] ]
[]
get_equal
{ "input": { "A": null, "Input": [ "list" ], "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "bool" ] }
MBPP_sanitized
71
null
python
code_generation
def comb_sort(nums): """ Write a function to sort a list of elements. """
def comb_sort(nums): """ Write a function to sort a list of elements. """ shrink_fact = 1.3 gaps = len(nums) swapped = True i = 0 while gaps > 1 or swapped: gaps = int(float(gaps) / shrink_fact) swapped = False i = 0 while gaps + i < len(nums): if nums[i] > nums[i + gaps]: (nums[i], nums[i + gaps]) = (nums[i + gaps], nums[i]) swapped = True i += 1 return 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)
[ [ "[5, 15, 37, 25, 79]", "[5, 15, 25, 37, 79]" ], [ "[41, 32, 15, 19, 22]", "[15, 19, 22, 32, 41]" ], [ "[99, 15, 13, 47]", "[13, 15, 47, 99]" ] ]
[]
comb_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": 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
72
null
python
code_generation
def dif_Square(n): """ Write a python function to check whether the given number can be represented as the difference of two squares or not. """
def dif_Square(n): """ Write a python function to check whether the given number can be represented as the difference of two squares or not. """ if n % 4 != 2: return True return False
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "5", "True" ], [ "10", "False" ], [ "15", "True" ] ]
[]
dif_Square
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "bool" ] }
MBPP_sanitized
74
null
python
code_generation
def is_samepatterns(colors, patterns): """ Write a function to check whether it follows the sequence given in the patterns array. """
def is_samepatterns(colors, patterns): """ Write a function to check whether it follows the sequence given in the patterns array. """ if len(colors) != len(patterns): return False sdict = {} pset = set() sset = set() for i in range(len(patterns)): pset.add(patterns[i]) sset.add(colors[i]) if patterns[i] not in sdict.keys(): sdict[patterns[i]] = [] keys = sdict[patterns[i]] keys.append(colors[i]) sdict[patterns[i]] = keys if len(pset) != len(sset): return False for values in sdict.values(): for i in range(len(values) - 1): if values[i] != values[i + 1]: return False return True
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[\"red\",\"green\",\"green\"], [\"a\", \"b\", \"b\"]", "True" ], [ "[\"red\",\"green\",\"greenn\"], [\"a\",\"b\",\"b\"]", "False" ], [ "[\"red\",\"green\",\"greenn\"], [\"a\",\"b\"]", "False" ] ]
[]
is_samepatterns
{ "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": [ "list" ], "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": [ "list" ], "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
75
null
python
code_generation
def find_tuples(test_list, K): """ Write a function to find tuples which have all elements divisible by k from the given list of tuples. """
def find_tuples(test_list, K): """ Write a function to find tuples which have all elements divisible by k from the given list of tuples. """ res = [sub for sub in test_list if all((ele % K == 0 for ele in sub))] 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)
[ [ "[(6, 24, 12), (7, 9, 6), (12, 18, 21)], 6", "[(6, 24, 12)]" ], [ "[(5, 25, 30), (4, 2, 3), (7, 8, 9)], 5", "[(5, 25, 30)]" ], [ "[(7, 9, 16), (8, 16, 4), (19, 17, 18)], 4", "[(8, 16, 4)]" ] ]
[]
find_tuples
{ "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": [ "list" ] }
MBPP_sanitized
77
null
python
code_generation
def is_Diff(n): """ Write a python function to find whether a number is divisible by 11. """
def is_Diff(n): """ Write a python function to find whether a number is divisible by 11. """ return n % 11 == 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)
[ [ "1212112", "True" ], [ "1212", "False" ] ]
[]
is_Diff
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "bool" ] }
MBPP_sanitized
79
null
python
code_generation
def word_len(s): """ Write a python function to check whether the length of the word is odd or not. """
def word_len(s): """ Write a python function to check whether the length of the word is odd or not. """ s = s.split(' ') for word in s: if len(word) % 2 != 0: 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)
[ [ "\"Hadoop\"", "False" ], [ "\"great\"", "True" ], [ "\"structure\"", "True" ] ]
[]
word_len
{ "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": [ "str" ], "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
80
null
python
code_generation
def tetrahedral_number(n): """ Write a function to find the nth tetrahedral number. """
def tetrahedral_number(n): """ Write a function to find the nth tetrahedral number. """ return n * (n + 1) * (n + 2) / 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)
[ [ "5", "35" ], [ "6", "56" ], [ "7", "84" ] ]
[]
tetrahedral_number
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
82
null
python
code_generation
import math def volume_sphere(r): """ Write a function to find the volume of a sphere. """
import math def volume_sphere(r): """ Write a function to find the volume of a sphere. """ volume = 4 / 3 * math.pi * r * r * r return volume
[]
import math inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assert math.isclose(candidate(*inp), exp, rel_tol=0.001)
[ [ "10", "4188.790204786391" ], [ "25", "65449.84694978735" ], [ "20", "33510.32163829113" ] ]
[ "import math" ]
volume_sphere
{ "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": [ "int" ], "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "float" ] }
MBPP_sanitized
83
null
python
code_generation
def get_Char(strr): """ Write a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26. """
def get_Char(strr): """ Write a python function to find the character made by adding the ASCII value of all the characters of the given string modulo 26. """ summ = 0 for i in range(len(strr)): summ += ord(strr[i]) - ord('a') + 1 if summ % 26 == 0: return ord('z') else: summ = summ % 26 return chr(ord('a') + summ - 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)
[ [ "\"abc\"", "\"f\"" ], [ "\"gfg\"", "\"t\"" ], [ "\"ab\"", "\"c\"" ] ]
[]
get_Char
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": [ "str" ], "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
84
null
python
code_generation
def sequence(n): """ Write a function to find the nth number in the newman conway sequence. """
def sequence(n): """ Write a function to find the nth number in the newman conway sequence. """ if n == 1 or n == 2: return 1 else: return sequence(sequence(n - 1)) + sequence(n - sequence(n - 1))
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "10", "6" ], [ "2", "1" ], [ "3", "2" ] ]
[]
sequence
{ "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
85
null
python
code_generation
import math def surfacearea_sphere(r): """ Write a function to find the surface area of a sphere. """
import math def surfacearea_sphere(r): """ Write a function to find the surface area of a sphere. """ surfacearea = 4 * math.pi * r * r return surfacearea
[]
import math inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assert math.isclose(candidate(*inp), exp, rel_tol=0.001)
[ [ "10", "1256.6370614359173" ], [ "15", "2827.4333882308138" ], [ "20", "5026.548245743669" ] ]
[ "import math" ]
surfacearea_sphere
{ "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": [ "int" ], "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "float" ] }
MBPP_sanitized
86
null
python
code_generation
def centered_hexagonal_number(n): """ Write a function to find nth centered hexagonal number. """
def centered_hexagonal_number(n): """ Write a function to find nth centered hexagonal number. """ return 3 * n * (n - 1) + 1
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "10", "271" ], [ "2", "7" ], [ "9", "217" ] ]
[]
centered_hexagonal_number
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
87
null
python
code_generation
import collections as ct def merge_dictionaries_three(dict1, dict2, dict3): """ Write a function to merge three dictionaries into a single dictionary. """
import collections as ct def merge_dictionaries_three(dict1, dict2, dict3): """ Write a function to merge three dictionaries into a single dictionary. """ merged_dict = dict(ct.ChainMap({}, dict1, dict2, dict3)) return merged_dict
[]
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)
[ [ "{ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" }, { \"G\": \"Green\", \"W\": \"White\" },{ \"O\": \"Orange\", \"W\": \"White\", \"B\": \"Black\" }", "{'B': 'Black', 'R': 'Red', 'P': 'Pink', 'G': 'Green', 'W': 'White', 'O': 'Orange'}" ], [ "{ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" }, { \"G\": \"Green\", \"W\": \"White\" },{\"L\":\"lavender\",\"B\":\"Blue\"}", "{'W': 'White', 'P': 'Pink', 'B': 'Black', 'R': 'Red', 'G': 'Green', 'L': 'lavender'}" ], [ "{ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" },{\"L\":\"lavender\",\"B\":\"Blue\"},{ \"G\": \"Green\", \"W\": \"White\" }", "{'B': 'Black', 'P': 'Pink', 'R': 'Red', 'G': 'Green', 'L': 'lavender', 'W': 'White'}" ] ]
[ "import collections as ct" ]
merge_dictionaries_three
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": [ "dict" ], "dict2": [ "dict" ], "dict3": [ "dict" ], "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
88
null
python
code_generation
import collections def freq_count(list1): """ Write a function to get the frequency of all the elements in a list, returned as a dictionary. """
import collections def freq_count(list1): """ Write a function to get the frequency of all the elements in a list, returned as a dictionary. """ freq_count = collections.Counter(list1) return freq_count
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[10,10,10,10,20,20,20,20,40,40,50,50,30]", "({10: 4, 20: 4, 40: 2, 50: 2, 30: 1})" ], [ "[1,2,3,4,3,2,4,1,3,1,4]", "({1:3, 2:2,3:3,4:3})" ], [ "[5,6,7,4,9,10,4,5,6,7,9,5]", "({10:1,5:3,6:2,7:2,4:2,9:2})" ] ]
[ "import collections" ]
freq_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": [ "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": [ "dict" ] }
MBPP_sanitized
89
null
python
code_generation
def closest_num(N): """ Write a function to find the closest smaller number than n. """
def closest_num(N): """ Write a function to find the closest smaller number than n. """ return N - 1
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "11", "10" ], [ "7", "6" ], [ "12", "11" ] ]
[]
closest_num
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": [ "int" ], "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
90
null
python
code_generation
def len_log(list1): """ Write a python function to find the length of the longest word. """
def len_log(list1): """ Write a python function to find the length of the longest word. """ max = len(list1[0]) for i in list1: if len(i) > max: max = len(i) 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)
[ [ "[\"python\",\"PHP\",\"bigdata\"]", "7" ], [ "[\"a\",\"ab\",\"abc\"]", "3" ], [ "[\"small\",\"big\",\"tall\"]", "5" ] ]
[]
len_log
{ "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
91
null
python
code_generation
def find_substring(str1, sub_str): """ Write a function to check if a string is present as a substring in a given list of string values. """
def find_substring(str1, sub_str): """ Write a function to check if a string is present as a substring in a given list of string values. """ if any((sub_str in s for s in str1)): return True return False
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ack\"", "True" ], [ "[\"red\", \"black\", \"white\", \"green\", \"orange\"],\"abc\"", "False" ], [ "[\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ange\"", "True" ] ]
[]
find_substring
{ "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": [ "list" ], "string": null, "stringlist": null, "strr": null, "sub_str": [ "str" ], "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
92
null
python
code_generation
def is_undulating(n): """ Write a function to check whether the given number is undulating or not. """
def is_undulating(n): """ Write a function to check whether the given number is undulating or not. """ n = str(n) if len(n) <= 2: return False for i in range(2, len(n)): if n[i - 2] != n[i]: return False return True
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "1212121", "True" ], [ "1991", "False" ], [ "121", "True" ] ]
[]
is_undulating
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "bool" ] }
MBPP_sanitized
93
null
python
code_generation
def power(a, b): """ Write a function to calculate the value of 'a' to the power 'b'. """
def power(a, b): """ Write a function to calculate the value of 'a' to the power 'b'. """ if b == 0: return 1 elif a == 0: return 0 elif b == 1: return a else: return a * power(a, b - 1)
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "3,4", "81" ], [ "2,3", "8" ], [ "5,5", "3125" ] ]
[]
power
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": [ "int" ], "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": [ "int" ], "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
94
null
python
code_generation
from operator import itemgetter def index_minimum(test_list): """ Given a list of tuples, write a function that returns the first value of the tuple with the smallest second value. """
from operator import itemgetter def index_minimum(test_list): """ Given a list of tuples, write a function that returns the first value of the tuple with the smallest second value. """ res = min(test_list, key=itemgetter(1))[0] 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)
[ [ "[('Rash', 143), ('Manjeet', 200), ('Varsha', 100)]", "'Varsha'" ], [ "[('Yash', 185), ('Dawood', 125), ('Sanya', 175)]", "'Dawood'" ], [ "[('Sai', 345), ('Salman', 145), ('Ayesha', 96)]", "'Ayesha'" ] ]
[ "from operator import itemgetter " ]
index_minimum
{ "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": [ "str" ] }
MBPP_sanitized
95
null
python
code_generation
def Find_Min_Length(lst): """ Write a python function to find the length of the smallest list in a list of lists. """
def Find_Min_Length(lst): """ Write a python function to find the length of the smallest list in a list of lists. """ minLength = min((len(x) for x in lst)) return minLength
[]
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" ], [ "[[1,2],[1,2,3],[1,2,3,4]]", "2" ], [ "[[3,3,3],[4,4,4,4]]", "3" ] ]
[]
Find_Min_Length
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": 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": [ "int" ] }
MBPP_sanitized
96
null
python
code_generation
def divisor(n): """ Write a python function to find the number of divisors of a given integer. """
def divisor(n): """ Write a python function to find the number of divisors of a given integer. """ for i in range(n): x = len([i for i in range(1, n + 1) if not n % i]) 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)
[ [ "15", "4" ], [ "12", "6" ], [ "9", "3" ] ]
[]
divisor
{ "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
97
null
python
code_generation
def frequency_lists(list1): """ Write a function to find frequency of each element in a flattened list of lists, returned in a dictionary. """
def frequency_lists(list1): """ Write a function to find frequency of each element in a flattened list of lists, returned in a dictionary. """ list1 = [item for sublist in list1 for item in sublist] dic_data = {} for num in list1: if num in dic_data.keys(): dic_data[num] += 1 else: key = num value = 1 dic_data[key] = value return dic_data
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[[1, 2, 3, 2], [4, 5, 6, 2], [7, 8, 9, 5]]", "{1: 1, 2: 3, 3: 1, 4: 1, 5: 2, 6: 1, 7: 1, 8: 1, 9: 1}" ], [ "[[1,2,3,4],[5,6,7,8],[9,10,11,12]]", "{1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1,10:1,11:1,12:1}" ], [ "[[20,30,40,17],[18,16,14,13],[10,20,30,40]]", "{20:2,30:2,40:2,17: 1,18:1, 16: 1,14: 1,13: 1, 10: 1}" ] ]
[]
frequency_lists
{ "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": [ "dict" ] }
MBPP_sanitized
98
null
python
code_generation
def multiply_num(numbers): """ Write a function to multiply all the numbers in a list and divide with the length of the list. """
def multiply_num(numbers): """ Write a function to multiply all the numbers in a list and divide with the length of the list. """ total = 1 for x in numbers: total *= x return total / len(numbers)
[]
import math inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assert math.isclose(candidate(*inp), exp, rel_tol=0.001)
[ [ "(8, 2, 3, -1, 7)", "-67.2" ], [ "(-10,-20,-30)", "-2000.0" ], [ "(19,15,18)", "1710.0" ] ]
[]
multiply_num
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": [ "int" ], "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "float" ] }
MBPP_sanitized
99
null
python
code_generation
def decimal_to_binary(n): """ Write a function to convert the given decimal number to its binary equivalent, represented as a string with no leading zeros. """
def decimal_to_binary(n): """ Write a function to convert the given decimal number to its binary equivalent, represented as a string with no leading zeros. """ return bin(n).replace('0b', '')
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "8", "'1000'" ], [ "18", "'10010'" ], [ "7", "'111'" ] ]
[]
decimal_to_binary
{ "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": [ "str" ] }
MBPP_sanitized
100
null
python
code_generation
import sys def next_smallest_palindrome(num): """ Write a function to find the next smallest palindrome of a specified integer, returned as an integer. """
import sys def next_smallest_palindrome(num): """ Write a function to find the next smallest palindrome of a specified integer, returned as an integer. """ numstr = str(num) for i in range(num + 1, sys.maxsize): if str(i) == str(i)[::-1]: return i
[]
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)
[ [ "99", "101" ], [ "1221", "1331" ], [ "120", "121" ] ]
[ "import sys" ]
next_smallest_palindrome
{ "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": [ "int" ], "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
101
null
python
code_generation
def kth_element(arr, k): """ Write a function to find the kth element in the given array using 1-based indexing. """
def kth_element(arr, k): """ Write a function to find the kth element in the given array using 1-based indexing. """ n = len(arr) for i in range(n): for j in range(0, n - i - 1): if arr[j] > arr[j + 1]: (arr[j], arr[j + 1] == arr[j + 1], arr[j]) return arr[k - 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)
[ [ "[12,3,5,7,19], 2", "3" ], [ "[17,24,8,23], 3", "8" ], [ "[16,21,25,36,4], 4", "36" ] ]
[]
kth_element
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": [ "list" ], "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": [ "int" ], "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": 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
102
null
python
code_generation
def snake_to_camel(word): """ Write a function to convert a snake case string to camel case string. """
def snake_to_camel(word): """ Write a function to convert a snake case string to camel case string. """ import re return ''.join((x.capitalize() or '_' for x in word.split('_')))
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "'python_program'", "'PythonProgram'" ], [ "'python_language'", "('PythonLanguage')" ], [ "'programming_language'", "('ProgrammingLanguage')" ] ]
[ "import re" ]
snake_to_camel
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": [ "str" ], "words": null, "x": null, "xs": null, "y": null }, "output": [ "str" ] }
MBPP_sanitized
103
null
python
code_generation
def eulerian_num(n, m): """ Write a function to find the Eulerian number a(n, m). """
def eulerian_num(n, m): """ Write a function to find the Eulerian number a(n, m). """ if m >= n or n == 0: return 0 if m == 0: return 1 return (n - m) * eulerian_num(n - 1, m - 1) + (m + 1) * eulerian_num(n - 1, m)
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "3, 1", "4" ], [ "4, 1", "11" ], [ "5, 3", "26" ] ]
[]
eulerian_num
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": [ "int" ], "monthnum2": null, "my_list": null, "my_matrix": null, "n": [ "int" ], "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
MBPP_sanitized
104
null
python
code_generation
def sort_sublists(input_list): """ Write a function to sort each sublist of strings in a given list of lists. """
def sort_sublists(input_list): """ Write a function to sort each sublist of strings in a given list of lists. """ result = [sorted(x, key=lambda x: x[0]) for x in input_list] 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)
[ [ "([\"green\", \"orange\"], [\"black\", \"white\"], [\"white\", \"black\", \"orange\"])", "[['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]" ], [ "([\" red \",\"green\" ],[\"blue \",\" black\"],[\" orange\",\"brown\"])", "[[' red ', 'green'], [' black', 'blue '], [' orange', 'brown']]" ], [ "([\"zilver\",\"gold\"], [\"magnesium\",\"aluminium\"], [\"steel\", \"bronze\"])", "[['gold', 'zilver'],['aluminium', 'magnesium'], ['bronze', 'steel']]" ] ]
[]
sort_sublists
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": [ "list" ], "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "list" ] }
MBPP_sanitized
105
null
python
code_generation
def count(lst): """ Write a python function to count true booleans in the given list. """
def count(lst): """ Write a python function to count true booleans in the given list. """ return sum(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)
[ [ "[True,False,True]", "2" ], [ "[False,False]", "0" ], [ "[True,True,True]", "3" ] ]
[]
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": [ "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": [ "int" ] }
MBPP_sanitized
106
null
python
code_generation
def add_lists(test_list, test_tup): """ Write a function to append the given list to the given tuples. """
def add_lists(test_list, test_tup): """ Write a function to append the given list to the given tuples. """ res = tuple(list(test_tup) + test_list) return res
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[5, 6, 7], (9, 10)", "(9, 10, 5, 6, 7)" ], [ "[6, 7, 8], (10, 11)", "(10, 11, 6, 7, 8)" ], [ "[7, 8, 9], (11, 12)", "(11, 12, 7, 8, 9)" ] ]
[]
add_lists
{ "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": [ "tuple" ], "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
108
null
python
code_generation
import heapq def merge_sorted_list(num1, num2, num3): """ Write a function to merge three lists into a single sorted list. """
import heapq def merge_sorted_list(num1, num2, num3): """ Write a function to merge three lists into a single sorted list. """ num1 = sorted(num1) num2 = sorted(num2) num3 = sorted(num3) result = heapq.merge(num1, num2, num3) return list(result)
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "[25, 24, 15, 4, 5, 29, 110],[19, 20, 11, 56, 25, 233, 154],[24, 26, 54, 48]", "[4, 5, 11, 15, 19, 20, 24, 24, 25, 25, 26, 29, 48, 54, 56, 110, 154, 233]" ], [ "[1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12]", "[1, 1, 2, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 11, 12]" ], [ "[18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1],[25, 35, 22, 85, 14, 65, 75, 25, 58],[12, 74, 9, 50, 61, 41]", "[1, 2, 3, 4, 7, 8, 9, 9, 9, 10, 12, 14, 14, 18, 22, 25, 25, 35, 41, 50, 58, 61, 65, 74, 75, 85]" ] ]
[ "import heapq" ]
merge_sorted_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": [ "list" ], "num2": [ "list" ], "num3": [ "list" ], "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
109
null
python
code_generation
def odd_Equivalent(s, n): """ Write a python function to find the number of numbers with an odd value when rotating a binary string the given number of times. """
def odd_Equivalent(s, n): """ Write a python function to find the number of numbers with an odd value when rotating a binary string the given number of times. """ count = 0 for i in range(0, n): if s[i] == '1': count = count + 1 return count
[]
import numpy as np def is_floats(x) -> bool: # check if it is float; List[float]; Tuple[float] if isinstance(x, float): return True if isinstance(x, (list, tuple)): return all(isinstance(i, float) for i in x) if isinstance(x, np.ndarray): return x.dtype == np.float64 or x.dtype == np.float32 return False def assertion(out, exp, atol): exact_match = out == exp if atol == 0 and is_floats(exp): atol = 1e-6 if not exact_match and atol != 0: assert np.allclose(out, exp, rtol=1e-07, atol=atol) else: assert exact_match inputs = {input_list} results = {output_list} candidate = {func_entry} for i, (inp, exp) in enumerate(zip(inputs, results)): assertion(candidate(*inp), exp, 0)
[ [ "\"011001\",6", "3" ], [ "\"11011\",5", "4" ], [ "\"1010\",4", "2" ] ]
[]
odd_Equivalent
{ "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": [ "str" ], "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
111
null
python
code_generation
def common_in_nested_lists(nestedlist): """ Write a function to find the common elements in given nested lists. """
def common_in_nested_lists(nestedlist): """ Write a function to find the common elements in given nested lists. """ result = list(set.intersection(*map(set, nestedlist))) 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)
[ [ "[[12, 18, 23, 25, 45], [7, 12, 18, 24, 28], [1, 5, 8, 12, 15, 16, 18]]", "[18, 12]" ], [ "[[12, 5, 23, 25, 45], [7, 11, 5, 23, 28], [1, 5, 8, 18, 23, 16]]", "[5,23]" ], [ "[[2, 3,4, 1], [4, 5], [6,4, 8],[4, 5], [6, 8,4]]", "[4]" ] ]
[]
common_in_nested_lists
{ "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": [ "list" ], "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "set" ] }
MBPP_sanitized
113
null
python
code_generation
def check_integer(text): """ Write a function to check if a string represents an integer or not. """
def check_integer(text): """ Write a function to check if a string represents an integer or not. """ text = text.strip() if len(text) < 1: return None elif all((text[i] in '0123456789' for i in range(len(text)))): return True elif text[0] in '+-' and all((text[i] in '0123456789' for i in range(1, len(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)
[ [ "\"python\"", "False" ], [ "\"1\"", "True" ], [ "\"12345\"", "True" ] ]
[]
check_integer
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": 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
115
null
python
code_generation
def empty_dit(list1): """ Write a function to check whether all dictionaries in a list are empty or not. """
def empty_dit(list1): """ Write a function to check whether all dictionaries in a list are empty or not. """ empty_dit = all((not d for d in list1)) return empty_dit
[]
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)
[ [ "[{},{},{}]", "True" ], [ "[{1,2},{},{}]", "False" ], [ "{}", "True" ] ]
[]
empty_dit
{ "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": [ "bool" ] }
MBPP_sanitized
116
null
python
code_generation
def tuple_to_int(nums): """ Write a function to convert a given tuple of positive integers into a single integer. """
def tuple_to_int(nums): """ Write a function to convert a given tuple of positive integers into a single integer. """ result = int(''.join(map(str, nums))) 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)", "123" ], [ "(4,5,6)", "456" ], [ "(5,6,7)", "567" ] ]
[]
tuple_to_int
{ "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": [ "int" ], "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
117
null
python
code_generation
def list_to_float(test_list): """ Write a function to convert all possible convertible elements in a list of lists to floats. """
def list_to_float(test_list): """ Write a function to convert all possible convertible elements in a list of lists to floats. """ res = [] for tup in test_list: temp = [] for ele in tup: if ele.isalpha(): temp.append(ele) else: temp.append(float(ele)) res.append((temp[0], temp[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)
[ [ " [(\"3\", \"4\"), (\"1\", \"26.45\"), (\"7.32\", \"8\"), (\"4\", \"8\")] ", "[(3.0, 4.0), (1.0, 26.45), (7.32, 8.0), (4.0, 8.0)]" ], [ " [(\"4\", \"4\"), (\"2\", \"27\"), (\"4.12\", \"9\"), (\"7\", \"11\")] ", "[(4.0, 4.0), (2.0, 27.0), (4.12, 9.0), (7.0, 11.0)]" ], [ " [(\"6\", \"78\"), (\"5\", \"26.45\"), (\"1.33\", \"4\"), (\"82\", \"13\")] ", "[(6.0, 78.0), (5.0, 26.45), (1.33, 4.0), (82.0, 13.0)]" ] ]
[]
list_to_float
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": null, "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": [ "list" ], "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "list" ] }
MBPP_sanitized
118
null
python
code_generation
def string_to_list(string): """ Write a function to convert a string to a list of strings split on the space character. """
def string_to_list(string): """ Write a function to convert a string to a list of strings split on the space character. """ lst = list(string.split(' ')) return 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)
[ [ "\"python programming\"", "['python','programming']" ], [ "\"lists tuples strings\"", "['lists','tuples','strings']" ], [ "\"write a program\"", "['write','a','program']" ] ]
[]
string_to_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": [ "str" ], "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "list" ] }
MBPP_sanitized
119
null
python
code_generation
def search(arr): """ Write a python function to find the element that appears only once in a sorted array. """
def search(arr): """ Write a python function to find the element that appears only once in a sorted array. """ n = len(arr) XOR = 0 for i in range(n): XOR = XOR ^ arr[i] return XOR
[]
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,2,3]", "3" ], [ "[1,1,3,3,4,4,5,5,7,7,8]", "8" ], [ "[1,2,2,3,3,4,4]", "1" ] ]
[]
search
{ "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
120
null
python
code_generation
def max_product_tuple(list1): """ Write a function to find the maximum absolute product between numbers in pairs of tuples within a given list. """
def max_product_tuple(list1): """ Write a function to find the maximum absolute product between numbers in pairs of tuples within a given list. """ result_max = max([abs(x * y) for (x, y) in list1]) return result_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)
[ [ "[(2, 7), (2, 6), (1, 8), (4, 9)] ", "36" ], [ "[(10,20), (15,2), (5,10)] ", "200" ], [ "[(11,44), (10,15), (20,5), (12, 9)] ", "484" ] ]
[]
max_product_tuple
{ "input": { "A": null, "Input": null, "K": null, "L": null, "M": null, "N": null, "S": null, "a": null, "actual_cost": null, "arr": null, "array_nums1": null, "array_nums2": null, "arraynums": null, "b": null, "base1": null, "base2": null, "c": null, "ch": null, "char": null, "colors": null, "d": null, "data_list": null, "dict": null, "dict1": null, "dict2": null, "dict3": null, "dlist": null, "dt": null, "element": null, "h": null, "h_age": null, "height": null, "index": null, "input_list": null, "item": null, "k": null, "l": null, "l1": null, "l2": null, "l3": null, "limit": null, "list": null, "list1": [ "list" ], "list2": null, "list3": null, "list_": null, "listval": null, "lst": null, "m": null, "monthnum2": null, "my_list": null, "my_matrix": null, "n": null, "nestedlist": null, "newch": null, "num": null, "num1": null, "num2": null, "num3": null, "number": null, "numbers": null, "nums": null, "nums1": null, "nums2": null, "patterns": null, "r": null, "ranges": null, "rotations": null, "s": null, "sale_amount": null, "second_string": null, "stdata": null, "step": null, "str": null, "str1": null, "string": null, "stringlist": null, "strr": null, "sub_str": null, "subjectmarks": null, "test_list": null, "test_list1": null, "test_list2": null, "test_tup": null, "test_tup1": null, "test_tup2": null, "test_tuple": null, "text": null, "text1": null, "tup": null, "tup1": null, "tuple1": null, "tuplex": null, "w": null, "word": null, "words": null, "x": null, "xs": null, "y": null }, "output": [ "int" ] }
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
225