i
int64
src_path
string
pyc_path
string
input
string
expected
string
provenance
dict
license
dict
csn_repo
string
csn_func
string
n_instr
int64
100
src/00100.py
pyc/00100.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_Of_Subarray_Prod> MAKE_FUNCTION 0 STORE_NAME sum_Of_Subarray_Prod RETURN_CONST None END CODE sum_Of_Subarray_Prod(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST ans LOAD_CONST 0 STORE_FAST res LOAD_FAST n LOAD_CONST 1 BINARY_OP - STORE_FAST i LOAD_FA...
def sum_Of_Subarray_Prod(arr, n): ans = 0 res = 0 i = n - 1 while i >= 0: incr = arr[i] * (1 + res) ans += incr res = incr i -= 1 return ans
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 734, "mbpp_split": "train", "prompt": "Write a python function to find sum of products of all possible subarrays.", "test_list": [ "assert sum_Of_Subarray_Prod([1,2,3],3) == 20", "assert sum_Of_Subarray_Prod([1,2],2) == 5", "...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_734
48
101
src/00101.py
pyc/00101.pyc
CODE <module>() RESUME 0 LOAD_CONST <code set_middle_bits> MAKE_FUNCTION 0 STORE_NAME set_middle_bits LOAD_CONST <code toggle_middle_bits> MAKE_FUNCTION 0 STORE_NAME toggle_middle_bits RETURN_CONST None END CODE set_middle_bits(n) RESUME 0 LOAD_FAST n LOAD_FAST n LOAD_CONST 1 BINARY_OP >> BI...
def set_middle_bits(n): n |= n >> 1 n |= n >> 2 n |= n >> 4 n |= n >> 8 n |= n >> 16 return n >> 1 ^ 1 def toggle_middle_bits(n): if n == 1: return 1 return n ^ set_middle_bits(n)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 735, "mbpp_split": "train", "prompt": "Write a python function to toggle bits of the number except the first and the last bit.", "test_list": [ "assert toggle_middle_bits(9) == 15", "assert toggle_middle_bits(10) == 12", "ass...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_735
63
102
src/00102.py
pyc/00102.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME bisect STORE_NAME bisect LOAD_CONST <code left_insertion> MAKE_FUNCTION 0 STORE_NAME left_insertion RETURN_CONST None END CODE left_insertion(a, x) RESUME 0 LOAD_GLOBAL NULL + bisect LOAD_ATTR bisect_left LOAD_FAST a LOAD_FAST...
import bisect def left_insertion(a, x): i = bisect.bisect_left(a, x) return i
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 736, "mbpp_split": "train", "prompt": "Write a function to locate the left insertion point for a specified value in sorted order.", "test_list": [ "assert left_insertion([1,2,4,5],6)==4", "assert left_insertion([1,2,4,5],3)==2", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_736
21
103
src/00103.py
pyc/00103.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST '^[aeiouAEIOU][A-Za-z0-9_]*' STORE_NAME regex LOAD_CONST <code check_str> MAKE_FUNCTION 0 STORE_NAME check_str RETURN_CONST None END CODE check_str(string) RESUME 0 LOAD_GLOBAL NULL + re LOAD_ATTR s...
import re regex = '^[aeiouAEIOU][A-Za-z0-9_]*' def check_str(string): if re.search(regex, string): return 'Valid' else: return 'Invalid'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 737, "mbpp_split": "train", "prompt": "Write a function to check whether the given string is starting with a vowel or not using regex.", "test_list": [ "assert check_str(\"annie\") == 'Valid'", "assert check_str(\"dawood\") == 'I...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_737
24
104
src/00104.py
pyc/00104.pyc
CODE <module>() RESUME 0 LOAD_CONST <code geometric_sum> MAKE_FUNCTION 0 STORE_NAME geometric_sum RETURN_CONST None END CODE geometric_sum(n) RESUME 0 LOAD_FAST n LOAD_CONST 0 COMPARE_OP < POP_JUMP_IF_FALSE L1 RETURN_CONST 0 L1: LOAD_CONST 1 LOAD_GLOBAL NULL + pow LOAD_CONST 2 LOAD_FAST n ...
def geometric_sum(n): if n < 0: return 0 else: return 1 / pow(2, n) + geometric_sum(n - 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 738, "mbpp_split": "train", "prompt": "Write a function to calculate the geometric sum of n-1.", "test_list": [ "assert geometric_sum(7) == 1.9921875", "assert geometric_sum(4) == 1.9375", "assert geometric_sum(8) == 1.996093...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_738
28
105
src/00105.py
pyc/00105.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code find_Index> MAKE_FUNCTION 0 STORE_NAME find_Index RETURN_CONST None END CODE find_Index(n) RESUME 0 LOAD_GLOBAL NULL + math LOAD_ATTR sqrt LOAD_CONST 2 LOAD_GLOBAL NULL + math LOAD_ATTR ...
import math def find_Index(n): x = math.sqrt(2 * math.pow(10, n - 1)) return round(x)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 739, "mbpp_split": "train", "prompt": "Write a python function to find the index of smallest triangular number with n digits.", "test_list": [ "assert find_Index(2) == 4", "assert find_Index(3) == 14", "assert find_Index(4) =...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_739
30
106
src/00106.py
pyc/00106.pyc
CODE <module>() RESUME 0 LOAD_CONST <code tuple_to_dict> MAKE_FUNCTION 0 STORE_NAME tuple_to_dict RETURN_CONST None END CODE tuple_to_dict(test_tup) MAKE_CELL test_tup RESUME 0 LOAD_GLOBAL NULL + dict LOAD_CLOSURE test_tup BUILD_TUPLE 1 LOAD_CONST <code tuple_to_dict.<locals>.<genexpr>> MAKE_FUN...
def tuple_to_dict(test_tup): res = dict((test_tup[idx:idx + 2] for idx in range(0, len(test_tup), 2))) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 740, "mbpp_split": "train", "prompt": "Write a function to convert the given tuple to a key-value dictionary using adjacent elements.", "test_list": [ "assert tuple_to_dict((1, 5, 7, 10, 13, 5)) == {1: 5, 7: 10, 13: 5}", "assert ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_740
56
107
src/00107.py
pyc/00107.pyc
CODE <module>() RESUME 0 LOAD_CONST <code all_Characters_Same> MAKE_FUNCTION 0 STORE_NAME all_Characters_Same RETURN_CONST None END CODE all_Characters_Same(s) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST s CALL 1 STORE_FAST n LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_FAST n CALL 2 GET_ITER ...
def all_Characters_Same(s): n = len(s) for i in range(1, n): if s[i] != s[0]: return False return True
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 741, "mbpp_split": "train", "prompt": "Write a python function to check whether all the characters are same or not.", "test_list": [ "assert all_Characters_Same(\"python\") == False", "assert all_Characters_Same(\"aaa\") == True"...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_741
36
108
src/00108.py
pyc/00108.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code area_tetrahedron> MAKE_FUNCTION 0 STORE_NAME area_tetrahedron RETURN_CONST None END CODE area_tetrahedron(side) RESUME 0 LOAD_GLOBAL NULL + math LOAD_ATTR sqrt LOAD_CONST 3 CALL 1 LOAD_F...
import math def area_tetrahedron(side): area = math.sqrt(3) * (side * side) return area
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 742, "mbpp_split": "train", "prompt": "Write a function to caluclate the area of a tetrahedron.", "test_list": [ "assert area_tetrahedron(3)==15.588457268119894", "assert area_tetrahedron(20)==692.8203230275509", "assert area...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_742
24
109
src/00109.py
pyc/00109.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_none> MAKE_FUNCTION 0 STORE_NAME check_none RETURN_CONST None END CODE check_none(test_tup) RESUME 0 LOAD_GLOBAL NULL + any LOAD_GLOBAL NULL + map LOAD_CONST <code check_none.<locals>.<lambda>> MAKE_FUNCTION 0 LOAD_FAST test_tup CALL 2 CALL 1 S...
def check_none(test_tup): res = any(map(lambda ele: ele is None, test_tup)) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 744, "mbpp_split": "train", "prompt": "Write a function to check if the given tuple has any none value or not.", "test_list": [ "assert check_none((10, 4, 5, 6, None)) == True", "assert check_none((7, 8, 9, 11, 14)) == False", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_744
26
110
src/00110.py
pyc/00110.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sector_area> MAKE_FUNCTION 0 STORE_NAME sector_area RETURN_CONST None END CODE sector_area(r, a) RESUME 0 LOAD_CONST 3.142857142857143 STORE_FAST pi LOAD_FAST a LOAD_CONST 360 COMPARE_OP >= POP_JUMP_IF_FALSE L1 RETURN_CONST None L1: LOAD_FAST pi LO...
def sector_area(r, a): pi = 22 / 7 if a >= 360: return None sectorarea = pi * r ** 2 * (a / 360) return sectorarea
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 746, "mbpp_split": "train", "prompt": "Write a function to find area of a sector.", "test_list": [ "assert sector_area(4,45)==6.285714285714286", "assert sector_area(9,45)==31.82142857142857", "assert sector_area(9,360)==None...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_746
29
111
src/00111.py
pyc/00111.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sort_numeric_strings> MAKE_FUNCTION 0 STORE_NAME sort_numeric_strings RETURN_CONST None END CODE sort_numeric_strings(nums_str) RESUME 0 LOAD_FAST nums_str GET_ITER LOAD_FAST_AND_CLEAR x SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L3 STORE_FAST x L...
def sort_numeric_strings(nums_str): result = [int(x) for x in nums_str] result.sort() return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 749, "mbpp_split": "train", "prompt": "Write a function to sort a given list of strings of numbers numerically.", "test_list": [ "assert sort_numeric_strings( ['4','12','45','7','0','100','200','-12','-500'])==[-500, -12, 0, 4, 7, 12...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_749
42
112
src/00112.py
pyc/00112.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_min_heap> MAKE_FUNCTION 0 STORE_NAME check_min_heap RETURN_CONST None END CODE check_min_heap(arr, i) RESUME 0 LOAD_CONST 2 LOAD_FAST i BINARY_OP * LOAD_CONST 2 BINARY_OP + LOAD_GLOBAL NULL + len LOAD_FAST arr CALL 1 COMPARE_OP > POP_JUMP_I...
def check_min_heap(arr, i): if 2 * i + 2 > len(arr): return True left_child = arr[i] <= arr[2 * i + 1] and check_min_heap(arr, 2 * i + 1) right_child = 2 * i + 2 == len(arr) or (arr[i] <= arr[2 * i + 2] and check_min_heap(arr, 2 * i + 2)) return left_child and right_child
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 751, "mbpp_split": "train", "prompt": "Write a function to check if the given array represents min heap or not.", "test_list": [ "assert check_min_heap([1, 2, 3, 4, 5, 6], 0) == True", "assert check_min_heap([2, 3, 4, 5, 10, 15],...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_751
88
113
src/00113.py
pyc/00113.pyc
CODE <module>() RESUME 0 LOAD_CONST <code jacobsthal_num> MAKE_FUNCTION 0 STORE_NAME jacobsthal_num RETURN_CONST None END CODE jacobsthal_num(n) RESUME 0 LOAD_CONST 0 BUILD_LIST 1 LOAD_FAST n LOAD_CONST 1 BINARY_OP + BINARY_OP * STORE_FAST dp LOAD_CONST 0 LOAD_FAST dp LOAD_CONST 0 STOR...
def jacobsthal_num(n): dp = [0] * (n + 1) dp[0] = 0 dp[1] = 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + 2 * dp[i - 2] return dp[n]
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 752, "mbpp_split": "train", "prompt": "Write a function to find the nth jacobsthal number.", "test_list": [ "assert jacobsthal_num(5) == 11", "assert jacobsthal_num(2) == 1", "assert jacobsthal_num(4) == 5" ], "transform"...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_752
57
114
src/00114.py
pyc/00114.pyc
CODE <module>() RESUME 0 LOAD_CONST <code extract_index_list> MAKE_FUNCTION 0 STORE_NAME extract_index_list RETURN_CONST None END CODE extract_index_list(l1, l2, l3) RESUME 0 BUILD_LIST 0 STORE_FAST result LOAD_GLOBAL NULL + zip LOAD_FAST l1 LOAD_FAST l2 LOAD_FAST l3 CALL 3 GET_ITER L1: FO...
def extract_index_list(l1, l2, l3): result = [] for m, n, o in zip(l1, l2, l3): if m == n == o: result.append(m) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 754, "mbpp_split": "train", "prompt": "Write a function to find common index elements from three lists.", "test_list": [ "assert extract_index_list([1, 1, 3, 4, 5, 6, 7],[0, 1, 2, 3, 4, 5, 7],[0, 1, 2, 3, 4, 5, 7])==[1, 7]", "ass...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_754
49
115
src/00115.py
pyc/00115.pyc
CODE <module>() RESUME 0 LOAD_CONST <code second_smallest> MAKE_FUNCTION 0 STORE_NAME second_smallest RETURN_CONST None END CODE second_smallest(numbers) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST numbers CALL 1 LOAD_CONST 2 COMPARE_OP < POP_JUMP_IF_FALSE L1 RETURN_CONST None L1: LOAD_GLOBAL ...
def second_smallest(numbers): if len(numbers) < 2: return if len(numbers) == 2 and numbers[0] == numbers[1]: return dup_items = set() uniq_items = [] for x in numbers: if x not in dup_items: uniq_items.append(x) dup_items.add(x) uniq_items.sort() ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 755, "mbpp_split": "train", "prompt": "Write a function to find the second smallest number in a list.", "test_list": [ "assert second_smallest([1, 2, -8, -2, 0, -2])==-2", "assert second_smallest([1, 1, -0.5, 0, 2, -2, -2])==-0.5...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_755
70
116
src/00116.py
pyc/00116.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code text_match_zero_one> MAKE_FUNCTION 0 STORE_NAME text_match_zero_one RETURN_CONST None END CODE text_match_zero_one(text) RESUME 0 LOAD_CONST 'ab?' STORE_FAST patterns LOAD_GLOBAL NULL + re LOA...
import re def text_match_zero_one(text): patterns = 'ab?' if re.search(patterns, text): return 'Found a match!' else: return 'Not matched!'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 756, "mbpp_split": "train", "prompt": "Write a function that matches a string that has an a followed by zero or one 'b'.", "test_list": [ "assert text_match_zero_one(\"ac\")==('Found a match!')", "assert text_match_zero_one(\"dc\...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_756
24
117
src/00117.py
pyc/00117.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_reverse_pairs> MAKE_FUNCTION 0 STORE_NAME count_reverse_pairs RETURN_CONST None END CODE count_reverse_pairs(test_list) RESUME 0 LOAD_GLOBAL NULL + sum LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_GLOBAL NULL + len LOAD_FAST test_list CALL 1 CALL 2...
def count_reverse_pairs(test_list): res = sum([1 for idx in range(0, len(test_list)) for idxn in range(idx, len(test_list)) if test_list[idxn] == str(''.join(list(reversed(test_list[idx]))))]) return str(res)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 757, "mbpp_split": "train", "prompt": "Write a function to count the pairs of reverse strings in the given string list.", "test_list": [ "assert count_reverse_pairs([\"julia\", \"best\", \"tseb\", \"for\", \"ailuj\"])== '2'", "as...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_757
83
118
src/00118.py
pyc/00118.pyc
CODE <module>() RESUME 0 LOAD_CONST <code unique_sublists> MAKE_FUNCTION 0 STORE_NAME unique_sublists RETURN_CONST None END CODE unique_sublists(list1) RESUME 0 BUILD_MAP 0 STORE_FAST result LOAD_FAST list1 GET_ITER L1: FOR_ITER L2 STORE_FAST l LOAD_FAST result LOAD_ATTR NULL|self + setdefau...
def unique_sublists(list1): result = {} for l in list1: result.setdefault(tuple(l), list()).append(1) for a, b in result.items(): result[a] = sum(b) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 758, "mbpp_split": "train", "prompt": "Write a function to count number of unique lists within a list.", "test_list": [ "assert unique_sublists([[1, 3], [5, 7], [1, 3], [13, 15, 17], [5, 7], [9, 11]] )=={(1, 3): 2, (5, 7): 2, (13, 15...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_758
51
119
src/00119.py
pyc/00119.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_decimal> MAKE_FUNCTION 0 STORE_NAME is_decimal RETURN_CONST None END CODE is_decimal(num) RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_FAST re LOAD_FAST re LOAD_ATTR NULL|self + compile LOAD_CONST '^[0-9]+(\\.[0-9]{1,2})?$' CALL 1 ...
def is_decimal(num): import re dnumre = re.compile('^[0-9]+(\\.[0-9]{1,2})?$') result = dnumre.search(num) return bool(result)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 759, "mbpp_split": "train", "prompt": "Write a function to check a decimal with a precision of 2.", "test_list": [ "assert is_decimal('123.11')==True", "assert is_decimal('e666.86')==False", "assert is_decimal('3.124587')==Fa...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_759
27
120
src/00120.py
pyc/00120.pyc
CODE <module>() RESUME 0 LOAD_CONST <code unique_Element> MAKE_FUNCTION 0 STORE_NAME unique_Element RETURN_CONST None END CODE unique_Element(arr, n) RESUME 0 LOAD_GLOBAL NULL + set LOAD_FAST arr CALL 1 STORE_FAST s LOAD_GLOBAL NULL + len LOAD_FAST s CALL 1 LOAD_CONST 1 COMPARE_OP == POP...
def unique_Element(arr, n): s = set(arr) if len(s) == 1: return 'YES' else: return 'NO'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 760, "mbpp_split": "train", "prompt": "Write a python function to check whether an array contains only one distinct element or not.", "test_list": [ "assert unique_Element([1,1,1],3) == 'YES'", "assert unique_Element([1,2,1,2],4)...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_760
22
121
src/00121.py
pyc/00121.pyc
CODE <module>() RESUME 0 LOAD_CONST <code arc_length> MAKE_FUNCTION 0 STORE_NAME arc_length RETURN_CONST None END CODE arc_length(d, a) RESUME 0 LOAD_CONST 3.142857142857143 STORE_FAST pi LOAD_FAST a LOAD_CONST 360 COMPARE_OP >= POP_JUMP_IF_FALSE L1 RETURN_CONST None L1: LOAD_FAST pi LOAD_...
def arc_length(d, a): pi = 22 / 7 if a >= 360: return None arclength = pi * d * (a / 360) return arclength
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 761, "mbpp_split": "train", "prompt": "Write a function to caluclate arc length of an angle.", "test_list": [ "assert arc_length(9,45)==3.5357142857142856", "assert arc_length(9,480)==None", "assert arc_length(5,270)==11.7857...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_761
27
122
src/00122.py
pyc/00122.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_monthnumber_number> MAKE_FUNCTION 0 STORE_NAME check_monthnumber_number RETURN_CONST None END CODE check_monthnumber_number(monthnum3) RESUME 0 LOAD_FAST monthnum3 LOAD_CONST 4 COMPARE_OP == POP_JUMP_IF_TRUE L1 LOAD_FAST monthnum3 LOAD_CONST 6 CO...
def check_monthnumber_number(monthnum3): if monthnum3 == 4 or monthnum3 == 6 or monthnum3 == 9 or (monthnum3 == 11): return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 762, "mbpp_split": "train", "prompt": "Write a function to check whether the given month number contains 30 days or not.", "test_list": [ "assert check_monthnumber_number(6)==True", "assert check_monthnumber_number(2)==False", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_762
29
123
src/00123.py
pyc/00123.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_Min_Diff> MAKE_FUNCTION 0 STORE_NAME find_Min_Diff RETURN_CONST None END CODE find_Min_Diff(arr, n) RESUME 0 LOAD_GLOBAL NULL + sorted LOAD_FAST arr CALL 1 STORE_FAST arr LOAD_CONST 100000000000000000000 STORE_FAST diff LOAD_GLOBAL NULL + range ...
def find_Min_Diff(arr, n): arr = sorted(arr) diff = 10 ** 20 for i in range(n - 1): if arr[i + 1] - arr[i] < diff: diff = arr[i + 1] - arr[i] return diff
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 763, "mbpp_split": "train", "prompt": "Write a python function to find the minimum difference between any two elements in a given array.", "test_list": [ "assert find_Min_Diff((1,5,3,19,18,25),6) == 1", "assert find_Min_Diff((4,3...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_763
53
124
src/00124.py
pyc/00124.pyc
CODE <module>() RESUME 0 LOAD_CONST <code number_ctr> MAKE_FUNCTION 0 STORE_NAME number_ctr RETURN_CONST None END CODE number_ctr(str) RESUME 0 LOAD_CONST 0 STORE_FAST number_ctr LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST str CALL 1 CALL 1 GET_ITER L1: FOR_ITER L4 STORE_FA...
def number_ctr(str): number_ctr = 0 for i in range(len(str)): if str[i] >= '0' and str[i] <= '9': number_ctr += 1 return number_ctr
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 764, "mbpp_split": "train", "prompt": "Write a python function to count numeric values in a given string.", "test_list": [ "assert number_ctr('program2bedone') == 1", "assert number_ctr('3wonders') ==1", "assert number_ctr('1...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_764
45
125
src/00125.py
pyc/00125.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code is_polite> MAKE_FUNCTION 0 STORE_NAME is_polite RETURN_CONST None END CODE is_polite(n) RESUME 0 LOAD_FAST n LOAD_CONST 1 BINARY_OP + STORE_FAST n LOAD_GLOBAL NULL + int LOAD_FAST n ...
import math def is_polite(n): n = n + 1 return int(n + math.log(n + math.log(n, 2), 2))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 765, "mbpp_split": "train", "prompt": "Write a function to find nth polite number.", "test_list": [ "assert is_polite(7) == 11", "assert is_polite(4) == 7", "assert is_polite(9) == 13" ], "transform": "ast.unparse via scr...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_765
33
126
src/00126.py
pyc/00126.pyc
CODE <module>() RESUME 0 LOAD_CONST <code pair_wise> MAKE_FUNCTION 0 STORE_NAME pair_wise RETURN_CONST None END CODE pair_wise(l1) RESUME 0 BUILD_LIST 0 STORE_FAST temp LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST l1 CALL 1 LOAD_CONST 1 BINARY_OP - CALL 1 GET_ITER L1: FOR_...
def pair_wise(l1): temp = [] for i in range(len(l1) - 1): current_element, next_element = (l1[i], l1[i + 1]) x = (current_element, next_element) temp.append(x) return temp
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 766, "mbpp_split": "train", "prompt": "Write a function to iterate over all pairs of consecutive items in a given list.", "test_list": [ "assert pair_wise([1,1,2,3,3,4,4,5])==[(1, 1), (1, 2), (2, 3), (3, 3), (3, 4), (4, 4), (4, 5)]",...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_766
46
127
src/00127.py
pyc/00127.pyc
CODE <module>() RESUME 0 LOAD_CONST <code get_Pairs_Count> MAKE_FUNCTION 0 STORE_NAME get_Pairs_Count RETURN_CONST None END CODE get_Pairs_Count(arr, n, sum) RESUME 0 LOAD_CONST 0 STORE_FAST count LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_FAST n CALL 2 GET_ITER L1: FOR_ITER L5 STORE_FAST ...
def get_Pairs_Count(arr, n, sum): count = 0 for i in range(0, n): for j in range(i + 1, n): if arr[i] + arr[j] == sum: count += 1 return count
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 767, "mbpp_split": "train", "prompt": "Write a python function to count the number of pairs whose sum is equal to ‘sum’.", "test_list": [ "assert get_Pairs_Count([1,1,1,1],4,2) == 6", "assert get_Pairs_Count([1,5,7,-1,5],5,6) == ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_767
53
128
src/00128.py
pyc/00128.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_Odd_Parity> MAKE_FUNCTION 0 STORE_NAME check_Odd_Parity RETURN_CONST None END CODE check_Odd_Parity(x) RESUME 0 LOAD_CONST 0 STORE_FAST parity LOAD_FAST x LOAD_CONST 0 COMPARE_OP != POP_JUMP_IF_FALSE L2 L1: LOAD_FAST x LOAD_FAST x LOAD_CONST ...
def check_Odd_Parity(x): parity = 0 while x != 0: x = x & x - 1 parity += 1 if parity % 2 == 1: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 768, "mbpp_split": "train", "prompt": "Write a python function to check for odd parity of a given number.", "test_list": [ "assert check_Odd_Parity(13) == True", "assert check_Odd_Parity(21) == True", "assert check_Odd_Parity...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_768
41
129
src/00129.py
pyc/00129.pyc
CODE <module>() RESUME 0 LOAD_CONST <code Diff> MAKE_FUNCTION 0 STORE_NAME Diff RETURN_CONST None END CODE Diff(li1, li2) RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + set LOAD_FAST li1 CALL 1 LOAD_GLOBAL NULL + set LOAD_FAST li2 CALL 1 BINARY_OP - CALL 1 ...
def Diff(li1, li2): return list(list(set(li1) - set(li2)) + list(set(li2) - set(li1)))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 769, "mbpp_split": "train", "prompt": "Write a python function to get the difference between two lists.", "test_list": [ "assert (Diff([10, 15, 20, 25, 30, 35, 40], [25, 40, 35])) == [10, 20, 30, 15]", "assert (Diff([1,2,3,4,5], ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_769
31
130
src/00130.py
pyc/00130.pyc
CODE <module>() RESUME 0 LOAD_CONST <code odd_Num_Sum> MAKE_FUNCTION 0 STORE_NAME odd_Num_Sum RETURN_CONST None END CODE odd_Num_Sum(n) RESUME 0 LOAD_CONST 0 STORE_FAST j LOAD_CONST 0 STORE_FAST sm LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_FAST n LOAD_CONST 1 BINARY_OP + CALL 2 GET_IT...
def odd_Num_Sum(n): j = 0 sm = 0 for i in range(1, n + 1): j = 2 * i - 1 sm = sm + j * j * j * j return sm
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 770, "mbpp_split": "train", "prompt": "Write a python function to find the sum of fourth power of first n odd natural numbers.", "test_list": [ "assert odd_Num_Sum(2) == 82", "assert odd_Num_Sum(3) == 707", "assert odd_Num_Su...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_770
44
131
src/00131.py
pyc/00131.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('deque',) IMPORT_NAME collections IMPORT_FROM deque STORE_NAME deque POP_TOP LOAD_CONST <code check_expression> MAKE_FUNCTION 0 STORE_NAME check_expression RETURN_CONST None END CODE check_expression(exp) RESUME 0 LOAD_GLOBAL NULL + len LOAD_...
from collections import deque def check_expression(exp): if len(exp) & 1: return False stack = deque() for ch in exp: if ch == '(' or ch == '{' or ch == '[': stack.append(ch) if ch == ')' or ch == '}' or ch == ']': if not stack: return False ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 771, "mbpp_split": "train", "prompt": "Write a function to check if the given expression is balanced or not.", "test_list": [ "assert check_expression(\"{()}[{}]\") == True", "assert check_expression(\"{()}[{]\") == False", "...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_771
110
132
src/00132.py
pyc/00132.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_length> MAKE_FUNCTION 0 STORE_NAME remove_length RETURN_CONST None END CODE remove_length(test_str, K) RESUME 0 LOAD_FAST test_str LOAD_ATTR NULL|self + split CALL 0 STORE_FAST temp LOAD_FAST temp GET_ITER LOAD_FAST_AND_CLEAR ele SWAP 2 L1: ...
def remove_length(test_str, K): temp = test_str.split() res = [ele for ele in temp if len(ele) != K] res = ' '.join(res) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 772, "mbpp_split": "train", "prompt": "Write a function to remove all the words with k length in the given string.", "test_list": [ "assert remove_length('The person is most value tet', 3) == 'person is most value'", "assert remo...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_772
55
133
src/00133.py
pyc/00133.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST '^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$' STORE_NAME regex LOAD_CONST <code check_email> MAKE_FUNCTION 0 STORE_NAME check_email RETURN_CONST None END CODE check_email(email) RESUME 0 LOAD_GLOBAL...
import re regex = '^[a-z0-9]+[\\._]?[a-z0-9]+[@]\\w+[.]\\w{2,3}$' def check_email(email): if re.search(regex, email): return 'Valid Email' else: return 'Invalid Email'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 774, "mbpp_split": "train", "prompt": "Write a function to check if the string is a valid email address or not using regex.", "test_list": [ "assert check_email(\"ankitrai326@gmail.com\") == 'Valid Email'", "assert check_email(\"...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_774
24
134
src/00134.py
pyc/00134.pyc
CODE <module>() RESUME 0 LOAD_CONST <code odd_position> MAKE_FUNCTION 0 STORE_NAME odd_position RETURN_CONST None END CODE odd_position(nums) MAKE_CELL nums RESUME 0 LOAD_GLOBAL NULL + all LOAD_CLOSURE nums BUILD_TUPLE 1 LOAD_CONST <code odd_position.<locals>.<genexpr>> MAKE_FUNCTION closure L...
def odd_position(nums): return all((nums[i] % 2 == i % 2 for i in range(len(nums))))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 775, "mbpp_split": "train", "prompt": "Write a python function to check whether every odd index contains odd numbers of a given list.", "test_list": [ "assert odd_position([2,1,4,3,6,7,6,3]) == True", "assert odd_position([4,1,2]...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_775
55
135
src/00135.py
pyc/00135.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_vowels> MAKE_FUNCTION 0 STORE_NAME count_vowels RETURN_CONST None END CODE count_vowels(test_str) RESUME 0 LOAD_CONST 0 STORE_FAST res BUILD_LIST 0 LOAD_CONST ('a', 'e', 'i', 'o', 'u') LIST_EXTEND 1 STORE_FAST vow_list LOAD_GLOBAL NULL + range ...
def count_vowels(test_str): res = 0 vow_list = ['a', 'e', 'i', 'o', 'u'] for idx in range(1, len(test_str) - 1): if test_str[idx] not in vow_list and (test_str[idx - 1] in vow_list or test_str[idx + 1] in vow_list): res += 1 if test_str[0] not in vow_list and test_str[1] in vow_list:...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 776, "mbpp_split": "train", "prompt": "Write a function to count those characters which have vowels as their neighbors in the given string.", "test_list": [ "assert count_vowels('bestinstareels') == 7", "assert count_vowels('part...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_776
96
136
src/00136.py
pyc/00136.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('groupby',) IMPORT_NAME itertools IMPORT_FROM groupby STORE_NAME groupby POP_TOP LOAD_CONST <code pack_consecutive_duplicates> MAKE_FUNCTION 0 STORE_NAME pack_consecutive_duplicates RETURN_CONST None END CODE pack_consecutive_duplicates(list1) RE...
from itertools import groupby def pack_consecutive_duplicates(list1): return [list(group) for key, group in groupby(list1)]
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 778, "mbpp_split": "train", "prompt": "Write a function to pack consecutive duplicates of a given list elements into sublists.", "test_list": [ "assert pack_consecutive_duplicates([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4])==[[...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_778
50
137
src/00137.py
pyc/00137.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('combinations',) IMPORT_NAME itertools IMPORT_FROM combinations STORE_NAME combinations POP_TOP LOAD_CONST <code find_combinations> MAKE_FUNCTION 0 STORE_NAME find_combinations RETURN_CONST None END CODE find_combinations(test_list) RESUME 0 LO...
from itertools import combinations def find_combinations(test_list): res = [(b1 + a1, b2 + a2) for (a1, a2), (b1, b2) in combinations(test_list, 2)] return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 780, "mbpp_split": "train", "prompt": "Write a function to find the combinations of sums with tuples in the given tuple list.", "test_list": [ "assert find_combinations([(2, 4), (6, 7), (5, 1), (6, 10)]) == [(8, 11), (7, 5), (8, 14),...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_780
66
138
src/00138.py
pyc/00138.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code count_Divisors> MAKE_FUNCTION 0 STORE_NAME count_Divisors RETURN_CONST None END CODE count_Divisors(n) RESUME 0 LOAD_CONST 0 STORE_FAST count LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_G...
import math def count_Divisors(n): count = 0 for i in range(1, int(math.sqrt(n)) + 2): if n % i == 0: if n // i == i: count = count + 1 else: count = count + 2 if count % 2 == 0: return 'Even' else: return 'Odd'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 781, "mbpp_split": "train", "prompt": "Write a python function to check whether the count of divisors is even or odd.", "test_list": [ "assert count_Divisors(10) == \"Even\"", "assert count_Divisors(100) == \"Odd\"", "assert ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_781
66
139
src/00139.py
pyc/00139.pyc
CODE <module>() RESUME 0 LOAD_CONST <code Odd_Length_Sum> MAKE_FUNCTION 0 STORE_NAME Odd_Length_Sum RETURN_CONST None END CODE Odd_Length_Sum(arr) RESUME 0 LOAD_CONST 0 STORE_FAST Sum LOAD_GLOBAL NULL + len LOAD_FAST arr CALL 1 STORE_FAST l LOAD_GLOBAL NULL + range LOAD_FAST l CALL 1 GET...
def Odd_Length_Sum(arr): Sum = 0 l = len(arr) for i in range(l): Sum += ((i + 1) * (l - i) + 1) // 2 * arr[i] return Sum
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 782, "mbpp_split": "train", "prompt": "Write a python function to find the sum of all odd length subarrays.", "test_list": [ "assert Odd_Length_Sum([1,2,4]) == 14", "assert Odd_Length_Sum([1,2,1,2]) == 15", "assert Odd_Length...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_782
45
140
src/00140.py
pyc/00140.pyc
CODE <module>() RESUME 0 LOAD_CONST <code mul_even_odd> MAKE_FUNCTION 0 STORE_NAME mul_even_odd RETURN_CONST None END CODE mul_even_odd(list1) RESUME 0 LOAD_GLOBAL NULL + next LOAD_CONST <code mul_even_odd.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_FAST list1 GET_ITER CALL 0 LOAD_CONST -1 CALL...
def mul_even_odd(list1): first_even = next((el for el in list1 if el % 2 == 0), -1) first_odd = next((el for el in list1 if el % 2 != 0), -1) return first_even * first_odd
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 784, "mbpp_split": "train", "prompt": "Write a function to find the product of first even and odd number of a given list.", "test_list": [ "assert mul_even_odd([1,3,5,7,4,1,6,8])==4", "assert mul_even_odd([1,2,3,4,5,6,7,8,9,10])=...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_784
95
141
src/00141.py
pyc/00141.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME bisect STORE_NAME bisect LOAD_CONST <code right_insertion> MAKE_FUNCTION 0 STORE_NAME right_insertion RETURN_CONST None END CODE right_insertion(a, x) RESUME 0 LOAD_GLOBAL NULL + bisect LOAD_ATTR bisect_right LOAD_FAST a LOAD_...
import bisect def right_insertion(a, x): i = bisect.bisect_right(a, x) return i
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 786, "mbpp_split": "train", "prompt": "Write a function to locate the right insertion point for a specified value in sorted order.", "test_list": [ "assert right_insertion([1,2,4,5],6)==4", "assert right_insertion([1,2,4,5],3)==2...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_786
21
142
src/00142.py
pyc/00142.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code text_match_three> MAKE_FUNCTION 0 STORE_NAME text_match_three RETURN_CONST None END CODE text_match_three(text) RESUME 0 LOAD_CONST 'ab{3}?' STORE_FAST patterns LOAD_GLOBAL NULL + re LOAD_ATTR...
import re def text_match_three(text): patterns = 'ab{3}?' if re.search(patterns, text): return 'Found a match!' else: return 'Not matched!'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 787, "mbpp_split": "train", "prompt": "Write a function that matches a string that has an a followed by three 'b'.", "test_list": [ "assert text_match_three(\"ac\")==('Not matched!')", "assert text_match_three(\"dc\")==('Not matc...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_787
24
143
src/00143.py
pyc/00143.pyc
CODE <module>() RESUME 0 LOAD_CONST <code new_tuple> MAKE_FUNCTION 0 STORE_NAME new_tuple RETURN_CONST None END CODE new_tuple(test_list, test_str) RESUME 0 LOAD_GLOBAL NULL + tuple LOAD_FAST test_list LOAD_FAST test_str BUILD_LIST 1 BINARY_OP + CALL 1 STORE_FAST res LOAD_FAST res RETURN_V...
def new_tuple(test_list, test_str): res = tuple(test_list + [test_str]) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 788, "mbpp_split": "train", "prompt": "Write a function to create a new tuple from the given string and list.", "test_list": [ "assert new_tuple([\"WEB\", \"is\"], \"best\") == ('WEB', 'is', 'best')", "assert new_tuple([\"We\", \...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_788
18
144
src/00144.py
pyc/00144.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('tan', 'pi') IMPORT_NAME math IMPORT_FROM tan STORE_NAME tan IMPORT_FROM pi STORE_NAME pi POP_TOP LOAD_CONST <code perimeter_polygon> MAKE_FUNCTION 0 STORE_NAME perimeter_polygon RETURN_CONST None END CODE perimeter_polygon(s, l) RESUME 0 L...
from math import tan, pi def perimeter_polygon(s, l): perimeter = s * l return perimeter
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 789, "mbpp_split": "train", "prompt": "Write a function to calculate the perimeter of a regular polygon.", "test_list": [ "assert perimeter_polygon(4,20)==80", "assert perimeter_polygon(10,15)==150", "assert perimeter_polygon...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_789
23
145
src/00145.py
pyc/00145.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_nested> MAKE_FUNCTION 0 STORE_NAME remove_nested RETURN_CONST None END CODE remove_nested(test_tup) RESUME 0 LOAD_GLOBAL NULL + tuple CALL 0 STORE_FAST res LOAD_GLOBAL NULL + enumerate LOAD_FAST test_tup CALL 1 GET_ITER L1: FOR_ITER L3 UNPAC...
def remove_nested(test_tup): res = tuple() for count, ele in enumerate(test_tup): if not isinstance(ele, tuple): res = res + (ele,) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 791, "mbpp_split": "train", "prompt": "Write a function to remove the nested record from the given tuple.", "test_list": [ "assert remove_nested((1, 5, 7, (4, 6), 10)) == (1, 5, 7, 10)", "assert remove_nested((2, 6, 8, (5, 7), 11...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_791
38
146
src/00146.py
pyc/00146.pyc
CODE <module>() RESUME 0 LOAD_CONST <code last> MAKE_FUNCTION 0 STORE_NAME last RETURN_CONST None END CODE last(arr, x, n) RESUME 0 LOAD_CONST 0 STORE_FAST low LOAD_FAST n LOAD_CONST 1 BINARY_OP - STORE_FAST high LOAD_CONST -1 STORE_FAST res LOAD_FAST low LOAD_FAST high COMPARE_OP <= ...
def last(arr, x, n): low = 0 high = n - 1 res = -1 while low <= high: mid = (low + high) // 2 if arr[mid] > x: high = mid - 1 elif arr[mid] < x: low = mid + 1 else: res = mid low = mid + 1 return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 793, "mbpp_split": "train", "prompt": "Write a python function to find the last position of an element in a sorted array.", "test_list": [ "assert last([1,2,3],1,3) == 0", "assert last([1,1,1,2,3,4],1,6) == 2", "assert last([...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_793
67
147
src/00147.py
pyc/00147.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code text_starta_endb> MAKE_FUNCTION 0 STORE_NAME text_starta_endb RETURN_CONST None END CODE text_starta_endb(text) RESUME 0 LOAD_CONST 'a.*?b$' STORE_FAST patterns LOAD_GLOBAL NULL + re LOAD_ATTR...
import re def text_starta_endb(text): patterns = 'a.*?b$' if re.search(patterns, text): return 'Found a match!' else: return 'Not matched!'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 794, "mbpp_split": "train", "prompt": "Write a function that matches a string that has an 'a' followed by anything, ending in 'b'.", "test_list": [ "assert text_starta_endb(\"aabbbb\")==('Found a match!')", "assert text_starta_en...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_794
24
148
src/00148.py
pyc/00148.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_Odd> MAKE_FUNCTION 0 STORE_NAME sum_Odd LOAD_CONST <code sum_in_Range> MAKE_FUNCTION 0 STORE_NAME sum_in_Range RETURN_CONST None END CODE sum_Odd(n) RESUME 0 LOAD_FAST n LOAD_CONST 1 BINARY_OP + LOAD_CONST 2 BINARY_OP // STORE_FAST terms LOAD...
def sum_Odd(n): terms = (n + 1) // 2 sum1 = terms * terms return sum1 def sum_in_Range(l, r): return sum_Odd(r) - sum_Odd(l - 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 797, "mbpp_split": "train", "prompt": "Write a python function to find the sum of all odd natural numbers within the range l and r.", "test_list": [ "assert sum_in_Range(2,5) == 8", "assert sum_in_Range(5,7) == 12", "assert s...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_797
37
149
src/00149.py
pyc/00149.pyc
CODE <module>() RESUME 0 LOAD_CONST <code test_three_equal> MAKE_FUNCTION 0 STORE_NAME test_three_equal RETURN_CONST None END CODE test_three_equal(x, y, z) RESUME 0 LOAD_GLOBAL NULL + set LOAD_FAST x LOAD_FAST y LOAD_FAST z BUILD_LIST 3 CALL 1 STORE_FAST result LOAD_GLOBAL NULL + len LOAD...
def test_three_equal(x, y, z): result = set([x, y, z]) if len(result) == 3: return 0 else: return 4 - len(result)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 801, "mbpp_split": "train", "prompt": "Write a python function to count the number of equal numbers from three given integers.", "test_list": [ "assert test_three_equal(1,1,1) == 3", "assert test_three_equal(-1,-2,-3) == 0", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_801
30
150
src/00150.py
pyc/00150.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_Rotation> MAKE_FUNCTION 0 STORE_NAME count_Rotation RETURN_CONST None END CODE count_Rotation(arr, n) RESUME 0 LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_FAST n CALL 2 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_FAST arr LOAD_FAST i BINARY_S...
def count_Rotation(arr, n): for i in range(1, n): if arr[i] < arr[i - 1]: return i return 0
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 802, "mbpp_split": "train", "prompt": "Write a python function to count the number of rotations required to generate a sorted array.", "test_list": [ "assert count_Rotation([3,2,1],3) == 1", "assert count_Rotation([4,5,1,2,3],5) ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_802
36
151
src/00151.py
pyc/00151.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_Perfect_Square> MAKE_FUNCTION 0 STORE_NAME is_Perfect_Square RETURN_CONST None END CODE is_Perfect_Square(n) RESUME 0 LOAD_CONST 1 STORE_FAST i LOAD_FAST i LOAD_FAST i BINARY_OP * LOAD_FAST n COMPARE_OP <= POP_JUMP_IF_FALSE L3 L1: LOAD_FAST n ...
def is_Perfect_Square(n): i = 1 while i * i <= n: if n % i == 0 and n / i == i: return True i = i + 1 return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 803, "mbpp_split": "train", "prompt": "Write a python function to check whether the given number is a perfect square or not.", "test_list": [ "assert is_Perfect_Square(10) == False", "assert is_Perfect_Square(36) == True", "a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_803
45
152
src/00152.py
pyc/00152.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_Product_Even> MAKE_FUNCTION 0 STORE_NAME is_Product_Even RETURN_CONST None END CODE is_Product_Even(arr, n) RESUME 0 LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_FAST n CALL 2 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_FAST arr LOAD_FAST i BINAR...
def is_Product_Even(arr, n): for i in range(0, n): if arr[i] & 1 == 0: return True return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 804, "mbpp_split": "train", "prompt": "Write a python function to check whether the product of numbers is even or not.", "test_list": [ "assert is_Product_Even([1,2,3],3) == True", "assert is_Product_Even([1,2,1,4],4) == True", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_804
32
153
src/00153.py
pyc/00153.pyc
CODE <module>() RESUME 0 LOAD_CONST <code max_run_uppercase> MAKE_FUNCTION 0 STORE_NAME max_run_uppercase RETURN_CONST None END CODE max_run_uppercase(test_str) RESUME 0 LOAD_CONST 0 STORE_FAST cnt LOAD_CONST 0 STORE_FAST res LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_GLOBAL NULL + len LOAD_...
def max_run_uppercase(test_str): cnt = 0 res = 0 for idx in range(0, len(test_str)): if test_str[idx].isupper(): cnt += 1 else: res = cnt cnt = 0 if test_str[len(test_str) - 1].isupper(): res = cnt return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 806, "mbpp_split": "train", "prompt": "Write a function to find maximum run of uppercase characters in the given string.", "test_list": [ "assert max_run_uppercase('GeMKSForGERksISBESt') == 5", "assert max_run_uppercase('PrECIOus...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_806
57
154
src/00154.py
pyc/00154.pyc
CODE <module>() RESUME 0 LOAD_CONST <code first_odd> MAKE_FUNCTION 0 STORE_NAME first_odd RETURN_CONST None END CODE first_odd(nums) RESUME 0 LOAD_GLOBAL NULL + next LOAD_CONST <code first_odd.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_FAST nums GET_ITER CALL 0 LOAD_CONST -1 CALL 2 STORE_FAS...
def first_odd(nums): first_odd = next((el for el in nums if el % 2 != 0), -1) return first_odd
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 807, "mbpp_split": "train", "prompt": "Write a python function to find the first odd number in a given list of numbers.", "test_list": [ "assert first_odd([1,3,5]) == 1", "assert first_odd([2,4,1,3]) == 1", "assert first_odd ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_807
52
155
src/00155.py
pyc/00155.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_K> MAKE_FUNCTION 0 STORE_NAME check_K RETURN_CONST None END CODE check_K(test_tup, K) RESUME 0 LOAD_CONST False STORE_FAST res LOAD_FAST test_tup GET_ITER L1: FOR_ITER L3 STORE_FAST ele LOAD_FAST ele LOAD_FAST K COMPARE_OP == POP_JUMP_IF_TR...
def check_K(test_tup, K): res = False for ele in test_tup: if ele == K: res = True break return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 808, "mbpp_split": "train", "prompt": "Write a function to check if the given tuples contain the k or not.", "test_list": [ "assert check_K((10, 4, 5, 6, 8), 6) == True", "assert check_K((1, 2, 3, 4, 5, 6), 7) == False", "ass...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_808
31
156
src/00156.py
pyc/00156.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_smaller> MAKE_FUNCTION 0 STORE_NAME check_smaller RETURN_CONST None END CODE check_smaller(test_tup1, test_tup2) RESUME 0 LOAD_GLOBAL NULL + all LOAD_CONST <code check_smaller.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_GLOBAL NULL + zip LOAD_FAST test_...
def check_smaller(test_tup1, test_tup2): res = all((x > y for x, y in zip(test_tup1, test_tup2))) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 809, "mbpp_split": "train", "prompt": "Write a function to check if each element of second tuple is smaller than its corresponding index in first tuple.", "test_list": [ "assert check_smaller((1, 2, 3), (2, 3, 4)) == False", "ass...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_809
48
157
src/00157.py
pyc/00157.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_identical> MAKE_FUNCTION 0 STORE_NAME check_identical RETURN_CONST None END CODE check_identical(test_list1, test_list2) RESUME 0 LOAD_FAST test_list1 LOAD_FAST test_list2 COMPARE_OP == STORE_FAST res LOAD_FAST res RETURN_VALUE END
def check_identical(test_list1, test_list2): res = test_list1 == test_list2 return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 811, "mbpp_split": "train", "prompt": "Write a function to check if two lists of tuples are identical or not.", "test_list": [ "assert check_identical([(10, 4), (2, 5)], [(10, 4), (2, 5)]) == True", "assert check_identical([(1, 2...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_811
15
158
src/00158.py
pyc/00158.pyc
CODE <module>() RESUME 0 LOAD_CONST <code rombus_area> MAKE_FUNCTION 0 STORE_NAME rombus_area RETURN_CONST None END CODE rombus_area(p, q) RESUME 0 LOAD_FAST p LOAD_FAST q BINARY_OP * LOAD_CONST 2 BINARY_OP / STORE_FAST area LOAD_FAST area RETURN_VALUE END
def rombus_area(p, q): area = p * q / 2 return area
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 814, "mbpp_split": "train", "prompt": "Write a function to find the area of a rombus.", "test_list": [ "assert rombus_area(10,20)==100", "assert rombus_area(10,5)==25", "assert rombus_area(4,2)==4" ], "transform": "ast.un...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_814
17
159
src/00159.py
pyc/00159.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sort_by_dnf> MAKE_FUNCTION 0 STORE_NAME sort_by_dnf RETURN_CONST None END CODE sort_by_dnf(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST low LOAD_CONST 0 STORE_FAST mid LOAD_FAST n LOAD_CONST 1 BINARY_OP - STORE_FAST high LOAD_FAST mid LOAD_FAST high ...
def sort_by_dnf(arr, n): low = 0 mid = 0 high = n - 1 while mid <= high: if arr[mid] == 0: arr[low], arr[mid] = (arr[mid], arr[low]) low = low + 1 mid = mid + 1 elif arr[mid] == 1: mid = mid + 1 else: arr[mid], arr[high]...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 815, "mbpp_split": "train", "prompt": "Write a function to sort the given array without using any sorting algorithm. the given array consists of only 0, 1, and 2.", "test_list": [ "assert sort_by_dnf([1,2,0,1,0,1,2,1,1], 9) == [0, 0,...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_815
89
160
src/00160.py
pyc/00160.pyc
CODE <module>() RESUME 0 LOAD_CONST <code clear_tuple> MAKE_FUNCTION 0 STORE_NAME clear_tuple RETURN_CONST None END CODE clear_tuple(test_tup) RESUME 0 LOAD_GLOBAL NULL + list LOAD_FAST test_tup CALL 1 STORE_FAST temp LOAD_FAST temp LOAD_ATTR NULL|self + clear CALL 0 POP_TOP LOAD_GLOBAL NU...
def clear_tuple(test_tup): temp = list(test_tup) temp.clear() test_tup = tuple(temp) return test_tup
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 816, "mbpp_split": "train", "prompt": "Write a function to clear the values of the given tuples.", "test_list": [ "assert clear_tuple((1, 5, 3, 6, 8)) == ()", "assert clear_tuple((2, 1, 4 ,5 ,6)) == ()", "assert clear_tuple((...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_816
23
161
src/00161.py
pyc/00161.pyc
CODE <module>() RESUME 0 LOAD_CONST <code div_of_nums> MAKE_FUNCTION 0 STORE_NAME div_of_nums RETURN_CONST None END CODE div_of_nums(nums, m, n) MAKE_CELL m MAKE_CELL n RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + filter LOAD_CLOSURE m LOAD_CLOSURE n BUILD_TUPLE 2 LOAD_CONST <code div...
def div_of_nums(nums, m, n): result = list(filter(lambda x: x % m == 0 or x % n == 0, nums)) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 817, "mbpp_split": "train", "prompt": "Write a function to find numbers divisible by m or n from a list of numbers using lambda function.", "test_list": [ "assert div_of_nums([19, 65, 57, 39, 152, 639, 121, 44, 90, 190],19,13)==[19, ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_817
43
162
src/00162.py
pyc/00162.pyc
CODE <module>() RESUME 0 LOAD_CONST <code lower_ctr> MAKE_FUNCTION 0 STORE_NAME lower_ctr RETURN_CONST None END CODE lower_ctr(str) RESUME 0 LOAD_CONST 0 STORE_FAST lower_ctr LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST str CALL 1 CALL 1 GET_ITER L1: FOR_ITER L4 STORE_FAST i...
def lower_ctr(str): lower_ctr = 0 for i in range(len(str)): if str[i] >= 'a' and str[i] <= 'z': lower_ctr += 1 return lower_ctr
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 818, "mbpp_split": "train", "prompt": "Write a python function to count lower case letters in a given string.", "test_list": [ "assert lower_ctr('abc') == 3", "assert lower_ctr('string') == 6", "assert lower_ctr('Python') == ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_818
45
163
src/00163.py
pyc/00163.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_duplic> MAKE_FUNCTION 0 STORE_NAME count_duplic RETURN_CONST None END CODE count_duplic(lists) RESUME 0 BUILD_LIST 0 STORE_FAST element BUILD_LIST 0 STORE_FAST frequency LOAD_FAST lists POP_JUMP_IF_TRUE L1 LOAD_FAST element RETURN_VALUE L1: L...
def count_duplic(lists): element = [] frequency = [] if not lists: return element running_count = 1 for i in range(len(lists) - 1): if lists[i] == lists[i + 1]: running_count += 1 else: frequency.append(running_count) element.append(lists[i...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 819, "mbpp_split": "train", "prompt": "Write a function to count the frequency of consecutive duplicate elements in a given list of numbers.", "test_list": [ "assert count_duplic([1,2,2,2,4,4,4,5,5,5,5])==([1, 2, 4, 5], [1, 3, 3, 4])...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_819
82
164
src/00164.py
pyc/00164.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_monthnum_number> MAKE_FUNCTION 0 STORE_NAME check_monthnum_number RETURN_CONST None END CODE check_monthnum_number(monthnum1) RESUME 0 LOAD_FAST monthnum1 LOAD_CONST 2 COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST True L1: RETURN_CONST False END
def check_monthnum_number(monthnum1): if monthnum1 == 2: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 820, "mbpp_split": "train", "prompt": "Write a function to check whether the given month number contains 28 days or not.", "test_list": [ "assert check_monthnum_number(2)==True", "assert check_monthnum_number(1)==False", "ass...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_820
16
165
src/00165.py
pyc/00165.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code pass_validity> MAKE_FUNCTION 0 STORE_NAME pass_validity RETURN_CONST None END CODE pass_validity(p) RESUME 0 LOAD_CONST True STORE_FAST x LOAD_FAST x POP_JUMP_IF_FALSE L8 LOAD_GLOBAL NULL + ...
import re def pass_validity(p): x = True while x: if len(p) < 6 or len(p) > 12: break elif not re.search('[a-z]', p): break elif not re.search('[0-9]', p): break elif not re.search('[A-Z]', p): break elif not re.search('[$#...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 822, "mbpp_split": "train", "prompt": "Write a function to return true if the password is valid.", "test_list": [ "assert pass_validity(\"password\")==False", "assert pass_validity(\"Password@10\")==True", "assert pass_validi...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_822
79
166
src/00166.py
pyc/00166.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code check_substring> MAKE_FUNCTION 0 STORE_NAME check_substring RETURN_CONST None END CODE check_substring(string, sample) RESUME 0 LOAD_FAST sample LOAD_FAST string CONTAINS_OP 0 POP_JUMP_IF_FALS...
import re def check_substring(string, sample): if sample in string: y = '\\A' + sample x = re.search(y, string) if x: return 'string starts with the given substring' else: return 'string doesnt start with the given substring' else: return 'entered...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 823, "mbpp_split": "train", "prompt": "Write a function to check if the given string starts with a substring using regex.", "test_list": [ "assert check_substring(\"dreams for dreams makes life fun\", \"makes\") == 'string doesnt sta...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_823
34
167
src/00167.py
pyc/00167.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_even> MAKE_FUNCTION 0 STORE_NAME remove_even RETURN_CONST None END CODE remove_even(l) RESUME 0 LOAD_FAST l GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_FAST i LOAD_CONST 2 BINARY_OP % LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_TRUE L2 JUMP_BA...
def remove_even(l): for i in l: if i % 2 == 0: l.remove(i) return l
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 824, "mbpp_split": "train", "prompt": "Write a python function to remove even numbers from a given list.", "test_list": [ "assert remove_even([1,3,5,2]) == [1,3,5]", "assert remove_even([5,6,7]) == [5,7]", "assert remove_even...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_824
32
168
src/00168.py
pyc/00168.pyc
CODE <module>() RESUME 0 LOAD_CONST <code access_elements> MAKE_FUNCTION 0 STORE_NAME access_elements RETURN_CONST None END CODE access_elements(nums, list_index) RESUME 0 LOAD_FAST list_index GET_ITER LOAD_FAST_AND_CLEAR i SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L3 STORE_FAST i LOAD_F...
def access_elements(nums, list_index): result = [nums[i] for i in list_index] return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 825, "mbpp_split": "train", "prompt": "Write a python function to access multiple elements of specified index from a given list.", "test_list": [ "assert access_elements([2,3,8,4,7,9],[0,3,5]) == [2, 4, 9]", "assert access_elemen...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_825
38
169
src/00169.py
pyc/00169.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_column> MAKE_FUNCTION 0 STORE_NAME sum_column RETURN_CONST None END CODE sum_column(list1, C) MAKE_CELL C RESUME 0 LOAD_GLOBAL NULL + sum LOAD_CLOSURE C BUILD_TUPLE 1 LOAD_CONST <code sum_column.<locals>.<genexpr>> MAKE_FUNCTION closure LOAD_FAST l...
def sum_column(list1, C): result = sum((row[C] for row in list1)) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 827, "mbpp_split": "train", "prompt": "Write a function to sum a specific column of a list in a given list of lists.", "test_list": [ "assert sum_column( [[1,2,3,2],[4,5,6,2],[7,8,9,5],],0)==12", "assert sum_column( [[1,2,3,2],[4...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_827
47
170
src/00170.py
pyc/00170.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_alpha_dig_spl> MAKE_FUNCTION 0 STORE_NAME count_alpha_dig_spl RETURN_CONST None END CODE count_alpha_dig_spl(string) RESUME 0 LOAD_CONST 0 COPY 1 STORE_FAST alphabets COPY 1 STORE_FAST digits STORE_FAST special LOAD_GLOBAL NULL + range LOAD_GLO...
def count_alpha_dig_spl(string): alphabets = digits = special = 0 for i in range(len(string)): if string[i].isalpha(): alphabets = alphabets + 1 elif string[i].isdigit(): digits = digits + 1 else: special = special + 1 return (alphabets, digits, sp...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 828, "mbpp_split": "train", "prompt": "Write a function to count alphabets,digits and special charactes in a given string.", "test_list": [ "assert count_alpha_dig_spl(\"abc!@#123\")==(3,3,3)", "assert count_alpha_dig_spl(\"dgsuy...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_828
60
171
src/00171.py
pyc/00171.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST <code second_frequent> MAKE_FUNCTION 0 STORE_NAME second_frequent RETURN_CONST None END CODE second_frequent(input) RESUME 0 LOAD_GLOBAL NULL + Counte...
from collections import Counter def second_frequent(input): dict = Counter(input) value = sorted(dict.values(), reverse=True) second_large = value[1] for key, val in dict.items(): if val == second_large: return key
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 829, "mbpp_split": "train", "prompt": "Write a function to find out the second most repeated (or frequent) string in the given sequence.", "test_list": [ "assert second_frequent(['aaa','bbb','ccc','bbb','aaa','aaa']) == 'bbb'", "...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_829
53
172
src/00172.py
pyc/00172.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_Pairs> MAKE_FUNCTION 0 STORE_NAME count_Pairs RETURN_CONST None END CODE count_Pairs(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST cnt LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L5 STORE_FAST i LOAD_GLOBAL NULL + range LOA...
def count_Pairs(arr, n): cnt = 0 for i in range(n): for j in range(i + 1, n): if arr[i] == arr[j]: cnt += 1 return cnt
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 831, "mbpp_split": "train", "prompt": "Write a python function to count equal element pairs from the given array.", "test_list": [ "assert count_Pairs([1,1,1,1],4) == 6", "assert count_Pairs([1,5,1],3) == 1", "assert count_Pa...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_831
50
173
src/00173.py
pyc/00173.pyc
CODE <module>() RESUME 0 LOAD_CONST <code generate_matrix> MAKE_FUNCTION 0 STORE_NAME generate_matrix RETURN_CONST None END CODE generate_matrix(n) RESUME 0 LOAD_FAST n LOAD_CONST 0 COMPARE_OP <= POP_JUMP_IF_FALSE L1 BUILD_LIST 0 RETURN_VALUE L1: LOAD_CONST 0 BUILD_LIST 1 LOAD_FAST n BIN...
def generate_matrix(n): if n <= 0: return [] matrix = [row[:] for row in [[0] * n] * n] row_st = 0 row_ed = n - 1 col_st = 0 col_ed = n - 1 current = 1 while True: if current > n * n: break for c in range(col_st, col_ed + 1): matrix[row_st]...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 834, "mbpp_split": "train", "prompt": "Write a function to generate a square matrix filled with elements from 1 to n raised to the power of 2 in spiral order.", "test_list": [ "assert generate_matrix(3)==[[1, 2, 3], [8, 9, 4], [7, 6,...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_834
187
174
src/00174.py
pyc/00174.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('maxsize',) IMPORT_NAME sys IMPORT_FROM maxsize STORE_NAME maxsize POP_TOP LOAD_CONST <code max_sub_array_sum> MAKE_FUNCTION 0 STORE_NAME max_sub_array_sum RETURN_CONST None END CODE max_sub_array_sum(a, size) RESUME 0 LOAD_GLOBAL maxsize UNA...
from sys import maxsize def max_sub_array_sum(a, size): max_so_far = -maxsize - 1 max_ending_here = 0 start = 0 end = 0 s = 0 for i in range(0, size): max_ending_here += a[i] if max_so_far < max_ending_here: max_so_far = max_ending_here start = s ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 836, "mbpp_split": "train", "prompt": "Write a function to find length of the subarray having maximum sum.", "test_list": [ "assert max_sub_array_sum([-2, -3, 4, -1, -2, 1, 5, -3],8) == 5", "assert max_sub_array_sum([1, -2, 1, 1,...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_836
74
175
src/00175.py
pyc/00175.pyc
CODE <module>() RESUME 0 LOAD_CONST <code cube_Sum> MAKE_FUNCTION 0 STORE_NAME cube_Sum RETURN_CONST None END CODE cube_Sum(n) RESUME 0 LOAD_CONST 0 STORE_FAST sum LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_FAST n CALL 2 GET_ITER L1: FOR_ITER L2 STORE_FAST i LOAD_FAST sum LOAD_CONST 2 ...
def cube_Sum(n): sum = 0 for i in range(0, n): sum += (2 * i + 1) * (2 * i + 1) * (2 * i + 1) return sum
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 837, "mbpp_split": "train", "prompt": "Write a python function to find the cube sum of first n odd natural numbers.", "test_list": [ "assert cube_Sum(2) == 28", "assert cube_Sum(3) == 153", "assert cube_Sum(4) == 496" ], ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_837
44
176
src/00176.py
pyc/00176.pyc
CODE <module>() RESUME 0 LOAD_CONST <code min_Swaps> MAKE_FUNCTION 0 STORE_NAME min_Swaps RETURN_CONST None END CODE min_Swaps(s1, s2) RESUME 0 LOAD_CONST 0 STORE_FAST c0 LOAD_CONST 0 STORE_FAST c1 LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST s1 CALL 1 CALL 1 GET_ITER L1: ...
def min_Swaps(s1, s2): c0 = 0 c1 = 0 for i in range(len(s1)): if s1[i] == '0' and s2[i] == '1': c0 += 1 elif s1[i] == '1' and s2[i] == '0': c1 += 1 result = c0 // 2 + c1 // 2 if c0 % 2 == 0 and c1 % 2 == 0: return result elif (c0 + c1) % 2 == 0: ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 838, "mbpp_split": "train", "prompt": "Write a python function to find minimum number swaps required to make two binary strings equal.", "test_list": [ "assert min_Swaps(\"0011\",\"1111\") == 1", "assert min_Swaps(\"00011\",\"010...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_838
100
177
src/00177.py
pyc/00177.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sort_tuple> MAKE_FUNCTION 0 STORE_NAME sort_tuple RETURN_CONST None END CODE sort_tuple(tup) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST tup CALL 1 STORE_FAST n LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L5 STORE_FAST i LOA...
def sort_tuple(tup): n = len(tup) for i in range(n): for j in range(n - i - 1): if tup[j][0] > tup[j + 1][0]: tup[j], tup[j + 1] = (tup[j + 1], tup[j]) return tup
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 839, "mbpp_split": "train", "prompt": "Write a function to sort the tuples alphabetically by the first item of each tuple.", "test_list": [ "assert sort_tuple([(\"Amana\", 28), (\"Zenat\", 30), (\"Abhishek\", 29),(\"Nikhil\", 21), (\...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_839
72
178
src/00178.py
pyc/00178.pyc
CODE <module>() RESUME 0 LOAD_CONST <code Check_Solution> MAKE_FUNCTION 0 STORE_NAME Check_Solution RETURN_CONST None END CODE Check_Solution(a, b, c) RESUME 0 LOAD_FAST b LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST 'Yes' L1: RETURN_CONST 'No' END
def Check_Solution(a, b, c): if b == 0: return 'Yes' else: return 'No'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 840, "mbpp_split": "train", "prompt": "Write a python function to check whether the roots of a quadratic equation are numerically equal but opposite in sign or not.", "test_list": [ "assert Check_Solution(2,0,-1) == \"Yes\"", "as...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_840
16
179
src/00179.py
pyc/00179.pyc
CODE <module>() RESUME 0 LOAD_CONST <code get_inv_count> MAKE_FUNCTION 0 STORE_NAME get_inv_count RETURN_CONST None END CODE get_inv_count(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST inv_count LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L5 STORE_FAST i LOAD_GLOBAL NULL +...
def get_inv_count(arr, n): inv_count = 0 for i in range(n): for j in range(i + 1, n): if arr[i] > arr[j]: inv_count += 1 return inv_count
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 841, "mbpp_split": "train", "prompt": "Write a function to count the number of inversions in the given array.", "test_list": [ "assert get_inv_count([1, 20, 6, 4, 5], 5) == 5", "assert get_inv_count([8, 4, 2, 1], 4) == 6", "a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_841
50
180
src/00180.py
pyc/00180.pyc
CODE <module>() RESUME 0 LOAD_CONST <code get_odd_occurence> MAKE_FUNCTION 0 STORE_NAME get_odd_occurence RETURN_CONST None END CODE get_odd_occurence(arr, arr_size) RESUME 0 LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_FAST arr_size CALL 2 GET_ITER L1: FOR_ITER L6 STORE_FAST i LOAD_CONST 0 ...
def get_odd_occurence(arr, arr_size): for i in range(0, arr_size): count = 0 for j in range(0, arr_size): if arr[i] == arr[j]: count += 1 if count % 2 != 0: return arr[i] return -1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 842, "mbpp_split": "train", "prompt": "Write a function to find the number which occurs for odd number of times in the given array.", "test_list": [ "assert get_odd_occurence([2, 3, 5, 4, 5, 2, 4, 3, 5, 2, 4, 4, 2], 13) == 5", "a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_842
61
181
src/00181.py
pyc/00181.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME heapq STORE_NAME heapq LOAD_CONST <code nth_super_ugly_number> MAKE_FUNCTION 0 STORE_NAME nth_super_ugly_number RETURN_CONST None END CODE nth_super_ugly_number(n, primes) MAKE_CELL uglies RESUME 0 LOAD_CONST 1 BUILD_LIST 1 ST...
import heapq def nth_super_ugly_number(n, primes): uglies = [1] def gen(prime): for ugly in uglies: yield (ugly * prime) merged = heapq.merge(*map(gen, primes)) while len(uglies) < n: ugly = next(merged) if ugly != uglies[-1]: uglies.append(ugly) ret...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 843, "mbpp_split": "train", "prompt": "Write a function to find the nth super ugly number from a given prime list of size k using heap queue algorithm.", "test_list": [ "assert nth_super_ugly_number(12,[2,7,13,19])==32", "assert ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_843
91
182
src/00182.py
pyc/00182.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code find_Digits> MAKE_FUNCTION 0 STORE_NAME find_Digits RETURN_CONST None END CODE find_Digits(n) RESUME 0 LOAD_FAST n LOAD_CONST 0 COMPARE_OP < POP_JUMP_IF_FALSE L1 RETURN_CONST 0 L1: LOA...
import math def find_Digits(n): if n < 0: return 0 if n <= 1: return 1 x = n * math.log10(n / math.e) + math.log10(2 * math.pi * n) / 2.0 return math.floor(x) + 1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 845, "mbpp_split": "train", "prompt": "Write a python function to count the number of digits in factorial of a given number.", "test_list": [ "assert find_Digits(7) == 4", "assert find_Digits(5) == 3", "assert find_Digits(4) ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_845
54
183
src/00183.py
pyc/00183.pyc
CODE <module>() RESUME 0 LOAD_CONST <code Sum> MAKE_FUNCTION 0 STORE_NAME Sum RETURN_CONST None END CODE Sum(N) RESUME 0 LOAD_CONST 0 BUILD_LIST 1 LOAD_FAST N LOAD_CONST 1 BINARY_OP + BINARY_OP * STORE_FAST SumOfPrimeDivisors LOAD_GLOBAL NULL + range LOAD_CONST 2 LOAD_FAST N LOAD_CONST...
def Sum(N): SumOfPrimeDivisors = [0] * (N + 1) for i in range(2, N + 1): if SumOfPrimeDivisors[i] == 0: for j in range(i, N + 1, i): SumOfPrimeDivisors[j] += i return SumOfPrimeDivisors[N]
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 849, "mbpp_split": "train", "prompt": "Write a python function to find sum of all prime divisors of a given number.", "test_list": [ "assert Sum(60) == 10", "assert Sum(39) == 16", "assert Sum(40) == 7" ], "transform": "a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_849
65
184
src/00184.py
pyc/00184.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_triangleexists> MAKE_FUNCTION 0 STORE_NAME is_triangleexists RETURN_CONST None END CODE is_triangleexists(a, b, c) RESUME 0 LOAD_FAST a LOAD_CONST 0 COMPARE_OP != POP_JUMP_IF_FALSE L3 LOAD_FAST b LOAD_CONST 0 COMPARE_OP != POP_JUMP_IF_FALSE L3 L...
def is_triangleexists(a, b, c): if a != 0 and b != 0 and (c != 0) and (a + b + c == 180): if a + b >= c or b + c >= a or a + c >= b: return True else: return False else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 850, "mbpp_split": "train", "prompt": "Write a function to check if a triangle of positive area is possible with the given angles.", "test_list": [ "assert is_triangleexists(50,60,70)==True", "assert is_triangleexists(90,45,45)==...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_850
53
185
src/00185.py
pyc/00185.pyc
CODE <module>() RESUME 0 LOAD_CONST <code Sum_of_Inverse_Divisors> MAKE_FUNCTION 0 STORE_NAME Sum_of_Inverse_Divisors RETURN_CONST None END CODE Sum_of_Inverse_Divisors(N, Sum) RESUME 0 LOAD_GLOBAL NULL + float LOAD_FAST Sum CALL 1 LOAD_CONST 1.0 BINARY_OP * LOAD_GLOBAL NULL + float LOAD_FAST ...
def Sum_of_Inverse_Divisors(N, Sum): ans = float(Sum) * 1.0 / float(N) return round(ans, 2)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 851, "mbpp_split": "train", "prompt": "Write a python function to find sum of inverse of divisors.", "test_list": [ "assert Sum_of_Inverse_Divisors(6,12) == 2", "assert Sum_of_Inverse_Divisors(9,13) == 1.44", "assert Sum_of_I...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_851
24
186
src/00186.py
pyc/00186.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_negs> MAKE_FUNCTION 0 STORE_NAME remove_negs RETURN_CONST None END CODE remove_negs(num_list) RESUME 0 LOAD_FAST num_list GET_ITER L1: FOR_ITER L3 STORE_FAST item LOAD_FAST item LOAD_CONST 0 COMPARE_OP < POP_JUMP_IF_TRUE L2 JUMP_BACKWARD L1 ...
def remove_negs(num_list): for item in num_list: if item < 0: num_list.remove(item) return num_list
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 852, "mbpp_split": "train", "prompt": "Write a python function to remove negative numbers from a list.", "test_list": [ "assert remove_negs([1,-2,3,-4]) == [1,3]", "assert remove_negs([1,2,3,-4]) == [1,2,3]", "assert remove_n...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_852
30
187
src/00187.py
pyc/00187.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code sum_of_odd_Factors> MAKE_FUNCTION 0 STORE_NAME sum_of_odd_Factors RETURN_CONST None END CODE sum_of_odd_Factors(n) RESUME 0 LOAD_CONST 1 STORE_FAST res LOAD_FAST n LOAD_CONST 2 BINARY_OP...
import math def sum_of_odd_Factors(n): res = 1 while n % 2 == 0: n = n // 2 for i in range(3, int(math.sqrt(n) + 1)): count = 0 curr_sum = 1 curr_term = 1 while n % i == 0: count += 1 n = n // i curr_term *= i curr_sum ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 853, "mbpp_split": "train", "prompt": "Write a python function to find sum of odd factors of a number.", "test_list": [ "assert sum_of_odd_Factors(30) == 24", "assert sum_of_odd_Factors(18) == 13", "assert sum_of_odd_Factors(...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_853
106
188
src/00188.py
pyc/00188.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME heapq STORE_NAME hq LOAD_CONST <code raw_heap> MAKE_FUNCTION 0 STORE_NAME raw_heap RETURN_CONST None END CODE raw_heap(rawheap) RESUME 0 LOAD_GLOBAL NULL + hq LOAD_ATTR heapify LOAD_FAST rawheap CALL 1 POP_TOP LOAD_FAST ra...
import heapq as hq def raw_heap(rawheap): hq.heapify(rawheap) return rawheap
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 854, "mbpp_split": "train", "prompt": "Write a function which accepts an arbitrary list and converts it to a heap using heap queue algorithm.", "test_list": [ "assert raw_heap([25, 44, 68, 21, 39, 23, 89])==[21, 25, 23, 44, 39, 68, 8...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_854
20
189
src/00189.py
pyc/00189.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_Even_Parity> MAKE_FUNCTION 0 STORE_NAME check_Even_Parity RETURN_CONST None END CODE check_Even_Parity(x) RESUME 0 LOAD_CONST 0 STORE_FAST parity LOAD_FAST x LOAD_CONST 0 COMPARE_OP != POP_JUMP_IF_FALSE L2 L1: LOAD_FAST x LOAD_FAST x LOAD_CON...
def check_Even_Parity(x): parity = 0 while x != 0: x = x & x - 1 parity += 1 if parity % 2 == 0: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 855, "mbpp_split": "train", "prompt": "Write a python function to check for even parity of a given number.", "test_list": [ "assert check_Even_Parity(10) == True", "assert check_Even_Parity(11) == False", "assert check_Even_P...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_855
41
190
src/00190.py
pyc/00190.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_list> MAKE_FUNCTION 0 STORE_NAME count_list RETURN_CONST None END CODE count_list(input_list) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST input_list CALL 1 LOAD_CONST 2 BINARY_OP ** RETURN_VALUE END
def count_list(input_list): return len(input_list) ** 2
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 858, "mbpp_split": "train", "prompt": "Write a function to count number of lists in a given list of lists and square the count.", "test_list": [ "assert count_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==25", "assert count...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_858
15
191
src/00191.py
pyc/00191.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('combinations',) IMPORT_NAME itertools IMPORT_FROM combinations STORE_NAME combinations POP_TOP LOAD_CONST <code sub_lists> MAKE_FUNCTION 0 STORE_NAME sub_lists RETURN_CONST None END CODE sub_lists(my_list) RESUME 0 BUILD_LIST 0 STORE_FAST su...
from itertools import combinations def sub_lists(my_list): subs = [] for i in range(0, len(my_list) + 1): temp = [list(x) for x in combinations(my_list, i)] if len(temp) > 0: subs.extend(temp) return subs
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 859, "mbpp_split": "train", "prompt": "Write a function to generate all sublists of a given list.", "test_list": [ "assert sub_lists([10, 20, 30, 40])==[[], [10], [20], [30], [40], [10, 20], [10, 30], [10, 40], [20, 30], [20, 40], [3...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_859
77
192
src/00192.py
pyc/00192.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST '[a-zA-z0-9]$' STORE_NAME regex LOAD_CONST <code check_alphanumeric> MAKE_FUNCTION 0 STORE_NAME check_alphanumeric RETURN_CONST None END CODE check_alphanumeric(string) RESUME 0 LOAD_GLOBAL NULL + re ...
import re regex = '[a-zA-z0-9]$' def check_alphanumeric(string): if re.search(regex, string): return 'Accept' else: return 'Discard'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 860, "mbpp_split": "train", "prompt": "Write a function to check whether the given string is ending with only alphanumeric characters or not using regex.", "test_list": [ "assert check_alphanumeric(\"dawood@\") == 'Discard'", "as...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_860
24
193
src/00193.py
pyc/00193.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST <code anagram_lambda> MAKE_FUNCTION 0 STORE_NAME anagram_lambda RETURN_CONST None END CODE anagram_lambda(texts, str) MAKE_CELL str RESUME 0 LOAD_GL...
from collections import Counter def anagram_lambda(texts, str): result = list(filter(lambda x: Counter(str) == Counter(x), texts)) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 861, "mbpp_split": "train", "prompt": "Write a function to find all anagrams of a string in a given list of strings using lambda function.", "test_list": [ "assert anagram_lambda([\"bcda\", \"abce\", \"cbda\", \"cbea\", \"adcb\"],\"a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_861
40
194
src/00194.py
pyc/00194.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code n_common_words> MAKE_FUNCTION 0 STORE_NAME n_common_words RETURN_CONST None END CO...
from collections import Counter import re def n_common_words(text, n): words = re.findall('\\w+', text) n_common_words = Counter(words).most_common(n) return list(n_common_words)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 862, "mbpp_split": "train", "prompt": "Write a function to find the occurrences of n most common words in a given text.", "test_list": [ "assert n_common_words(\"python is a programming language\",1)==[('python', 1)]", "assert n_...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_862
36
195
src/00195.py
pyc/00195.pyc
CODE <module>() RESUME 0 LOAD_CONST <code palindrome_lambda> MAKE_FUNCTION 0 STORE_NAME palindrome_lambda RETURN_CONST None END CODE palindrome_lambda(texts) RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + filter LOAD_CONST <code palindrome_lambda.<locals>.<lambda>> MAKE_FUNCTION 0 LOAD_FAST t...
def palindrome_lambda(texts): result = list(filter(lambda x: x == ''.join(reversed(x)), texts)) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 864, "mbpp_split": "train", "prompt": "Write a function to find palindromes in a given list of strings using lambda function.", "test_list": [ "assert palindrome_lambda([\"php\", \"res\", \"Python\", \"abcd\", \"Java\", \"aaa\"])==['...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_864
31
196
src/00196.py
pyc/00196.pyc
CODE <module>() RESUME 0 LOAD_CONST <code ntimes_list> MAKE_FUNCTION 0 STORE_NAME ntimes_list RETURN_CONST None END CODE ntimes_list(nums, n) MAKE_CELL n RESUME 0 LOAD_GLOBAL NULL + map LOAD_CLOSURE n BUILD_TUPLE 1 LOAD_CONST <code ntimes_list.<locals>.<lambda>> MAKE_FUNCTION closure LOAD_FAST...
def ntimes_list(nums, n): result = map(lambda x: n * x, nums) return list(result)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 865, "mbpp_split": "train", "prompt": "Write a function to print n-times a list using map function.", "test_list": [ "assert ntimes_list([1, 2, 3, 4, 5, 6, 7],3)==[3, 6, 9, 12, 15, 18, 21]", "assert ntimes_list([1, 2, 3, 4, 5, 6,...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_865
30
197
src/00197.py
pyc/00197.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_monthnumb> MAKE_FUNCTION 0 STORE_NAME check_monthnumb RETURN_CONST None END CODE check_monthnumb(monthname2) RESUME 0 LOAD_FAST monthname2 LOAD_CONST 'January' COMPARE_OP == POP_JUMP_IF_TRUE L1 LOAD_FAST monthname2 LOAD_CONST 'March' COMPARE_OP =...
def check_monthnumb(monthname2): if monthname2 == 'January' or monthname2 == 'March' or monthname2 == 'May' or (monthname2 == 'July') or (monthname2 == 'Augest') or (monthname2 == 'October') or (monthname2 == 'December'): return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 866, "mbpp_split": "train", "prompt": "Write a function to check whether the given month name contains 31 days or not.", "test_list": [ "assert check_monthnumb(\"February\")==False", "assert check_monthnumb(\"January\")==True", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_866
41
198
src/00198.py
pyc/00198.pyc
CODE <module>() RESUME 0 LOAD_CONST <code min_Num> MAKE_FUNCTION 0 STORE_NAME min_Num RETURN_CONST None END CODE min_Num(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST odd LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_FAST arr LOAD_FAST i BINARY_SUBSC...
def min_Num(arr, n): odd = 0 for i in range(n): if arr[i] % 2: odd += 1 if odd % 2: return 1 return 2
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 867, "mbpp_split": "train", "prompt": "Write a python function to add a minimum number such that the sum of array becomes even.", "test_list": [ "assert min_Num([1,2,3,4,5,6,7,8,9],9) == 1", "assert min_Num([1,2,3,4,5,6,7,8],8) =...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_867
40
199
src/00199.py
pyc/00199.pyc
CODE <module>() RESUME 0 LOAD_CONST <code length_Of_Last_Word> MAKE_FUNCTION 0 STORE_NAME length_Of_Last_Word RETURN_CONST None END CODE length_Of_Last_Word(a) RESUME 0 LOAD_CONST 0 STORE_FAST l LOAD_FAST a LOAD_ATTR NULL|self + strip CALL 0 STORE_FAST x LOAD_GLOBAL NULL + range LOAD_GLOBAL ...
def length_Of_Last_Word(a): l = 0 x = a.strip() for i in range(len(x)): if x[i] == ' ': l = 0 else: l += 1 return l
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 868, "mbpp_split": "train", "prompt": "Write a python function to find the length of the last word in a given string.", "test_list": [ "assert length_Of_Last_Word(\"python language\") == 8", "assert length_Of_Last_Word(\"PHP\") =...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_868
43