Datasets:
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 |
|---|---|---|---|---|---|---|---|---|---|
0 | src/00000.py | pyc/00000.pyc | CODE <module>()
RESUME 0
PUSH_NULL
LOAD_BUILD_CLASS
LOAD_CONST <code Pair>
MAKE_FUNCTION 0
LOAD_CONST 'Pair'
LOAD_NAME object
CALL 3
STORE_NAME Pair
LOAD_CONST <code max_chain_length>
MAKE_FUNCTION 0
STORE_NAME max_chain_length
RETURN_CONST None
END
CODE Pair()
DOC 'Pair'
RESUME 0
LOAD_N... | class Pair(object):
def __init__(self, a, b):
self.a = a
self.b = b
def max_chain_length(arr, n):
max = 0
mcl = [1 for i in range(n)]
for i in range(1, n):
for j in range(0, i):
if arr[i].a > arr[j].b and mcl[i] < mcl[j] + 1:
mcl[i] = mcl[j] + 1
... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 601,
"mbpp_split": "train",
"prompt": "Write a function to find the longest chain which can be formed from the given set of pairs.",
"test_list": [
"assert max_chain_length([Pair(5, 24), Pair(15, 25),Pair(27, 40), Pair(50, 60)], 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_601 | 146 |
1 | src/00001.py | pyc/00001.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code first_repeated_char>
MAKE_FUNCTION 0
STORE_NAME first_repeated_char
RETURN_CONST None
END
CODE first_repeated_char(str1)
RESUME 0
LOAD_GLOBAL NULL + enumerate
LOAD_FAST str1
CALL 1
GET_ITER
L1:
FOR_ITER L3
UNPACK_SEQUENCE 2
STORE_FAST index
STORE_FAS... | def first_repeated_char(str1):
for index, c in enumerate(str1):
if str1[:index + 1].count(c) > 1:
return c
return 'None' | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 602,
"mbpp_split": "train",
"prompt": "Write a python function to find the first repeated character in a given string.",
"test_list": [
"assert first_repeated_char(\"abcabc\") == \"a\"",
"assert first_repeated_char(\"abc\") == \"... | {
"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_602 | 39 |
2 | src/00002.py | pyc/00002.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code get_ludic>
MAKE_FUNCTION 0
STORE_NAME get_ludic
RETURN_CONST None
END
CODE get_ludic(n)
RESUME 0
BUILD_LIST 0
STORE_FAST ludics
LOAD_GLOBAL NULL + range
LOAD_CONST 1
LOAD_FAST n
LOAD_CONST 1
BINARY_OP +
CALL 2
GET_ITER
L1:
FOR_ITER L2
STORE_FAS... | def get_ludic(n):
ludics = []
for i in range(1, n + 1):
ludics.append(i)
index = 1
while index != len(ludics):
first_ludic = ludics[index]
remove_index = index + first_ludic
while remove_index < len(ludics):
ludics.remove(ludics[remove_index])
remo... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 603,
"mbpp_split": "train",
"prompt": "Write a function to get a lucid number smaller than or equal to n.",
"test_list": [
"assert get_ludic(10) == [1, 2, 3, 5, 7]",
"assert get_ludic(25) == [1, 2, 3, 5, 7, 11, 13, 17, 23, 25]",
... | {
"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_603 | 88 |
3 | src/00003.py | pyc/00003.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code reverse_words>
MAKE_FUNCTION 0
STORE_NAME reverse_words
RETURN_CONST None
END
CODE reverse_words(s)
RESUME 0
LOAD_CONST ' '
LOAD_ATTR NULL|self + join
LOAD_GLOBAL NULL + reversed
LOAD_FAST s
LOAD_ATTR NULL|self + split
CALL 0
CALL 1
CALL 1
RETURN_V... | def reverse_words(s):
return ' '.join(reversed(s.split())) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 604,
"mbpp_split": "train",
"prompt": "Write a function to reverse words in a given string.",
"test_list": [
"assert reverse_words(\"python program\")==(\"program python\")",
"assert reverse_words(\"java language\")==(\"language ... | {
"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_604 | 18 |
4 | src/00004.py | pyc/00004.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code prime_num>
MAKE_FUNCTION 0
STORE_NAME prime_num
RETURN_CONST None
END
CODE prime_num(num)
RESUME 0
LOAD_FAST num
LOAD_CONST 1
COMPARE_OP >=
POP_JUMP_IF_FALSE L3
LOAD_GLOBAL NULL + range
LOAD_CONST 2
LOAD_FAST num
LOAD_CONST 2
BINARY_OP //
CALL 2
... | def prime_num(num):
if num >= 1:
for i in range(2, num // 2):
if num % i == 0:
return False
else:
return True
else:
return False | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 605,
"mbpp_split": "train",
"prompt": "Write a function to check if the given integer is a prime number.",
"test_list": [
"assert prime_num(13)==True",
"assert prime_num(7)==True",
"assert prime_num(-1010)==False"
],
"tra... | {
"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_605 | 38 |
5 | src/00005.py | pyc/00005.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME math
STORE_NAME math
LOAD_CONST <code radian_degree>
MAKE_FUNCTION 0
STORE_NAME radian_degree
RETURN_CONST None
END
CODE radian_degree(degree)
RESUME 0
LOAD_FAST degree
LOAD_GLOBAL math
LOAD_ATTR pi
LOAD_CONST 180
BINARY_OP ... | import math
def radian_degree(degree):
radian = degree * (math.pi / 180)
return radian | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 606,
"mbpp_split": "train",
"prompt": "Write a function to convert degrees to radians.",
"test_list": [
"assert radian_degree(90)==1.5707963267948966",
"assert radian_degree(60)==1.0471975511965976",
"assert radian_degree(120... | {
"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_606 | 22 |
6 | src/00006.py | pyc/00006.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code bell_Number>
MAKE_FUNCTION 0
STORE_NAME bell_Number
RETURN_CONST None
END
CODE bell_Number(n)
RESUME 0
LOAD_GLOBAL NULL + range
LOAD_FAST n
LOAD_CONST 1
BINARY_OP +
CALL 1
GET_ITER
LOAD_FAST_AND_CLEAR j
LOAD_FAST_AND_CLEAR i
SWAP 3
L1:
BUILD_LIST... | def bell_Number(n):
bell = [[0 for i in range(n + 1)] for j in range(n + 1)]
bell[0][0] = 1
for i in range(1, n + 1):
bell[i][0] = bell[i - 1][i - 1]
for j in range(1, i + 1):
bell[i][j] = bell[i - 1][j - 1] + bell[i][j - 1]
return bell[n][0] | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 608,
"mbpp_split": "train",
"prompt": "Write a python function to find nth bell number.",
"test_list": [
"assert bell_Number(2) == 2",
"assert bell_Number(3) == 5",
"assert bell_Number(4) == 15"
],
"transform": "ast.unpar... | {
"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_608 | 145 |
7 | src/00007.py | pyc/00007.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code remove_kth_element>
MAKE_FUNCTION 0
STORE_NAME remove_kth_element
RETURN_CONST None
END
CODE remove_kth_element(list1, L)
RESUME 0
LOAD_FAST list1
LOAD_CONST None
LOAD_FAST L
LOAD_CONST 1
BINARY_OP -
BINARY_SLICE
LOAD_FAST list1
LOAD_FAST L
LOAD_CO... | def remove_kth_element(list1, L):
return list1[:L - 1] + list1[L:] | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 610,
"mbpp_split": "train",
"prompt": "Write a python function to remove the k'th element from a given list.",
"test_list": [
"assert remove_kth_element([1,1,2,3,4,4,5,1],3)==[1, 1, 3, 4, 4, 5, 1]",
"assert remove_kth_element([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_610 | 21 |
8 | src/00008.py | pyc/00008.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code merge>
MAKE_FUNCTION 0
STORE_NAME merge
RETURN_CONST None
END
CODE merge(lst)
RESUME 0
LOAD_GLOBAL NULL + list
LOAD_GLOBAL NULL + zip
LOAD_FAST lst
CALL_FUNCTION_EX 0
CALL 1
GET_ITER
LOAD_FAST_AND_CLEAR ele
SWAP 2
L1:
BUILD_LIST 0
SWAP 2
L2:
FO... | def merge(lst):
return [list(ele) for ele in list(zip(*lst))] | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 612,
"mbpp_split": "train",
"prompt": "Write a python function to merge the first and last elements separately in a list of lists.",
"test_list": [
"assert merge([['x', 'y'], ['a', 'b'], ['m', 'n']]) == [['x', 'a', 'm'], ['y', 'b', '... | {
"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_612 | 41 |
9 | src/00009.py | pyc/00009.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code maximum_value>
MAKE_FUNCTION 0
STORE_NAME maximum_value
RETURN_CONST None
END
CODE maximum_value(test_list)
RESUME 0
LOAD_FAST test_list
GET_ITER
LOAD_FAST_AND_CLEAR key
LOAD_FAST_AND_CLEAR lst
SWAP 3
L1:
BUILD_LIST 0
SWAP 2
L2:
FOR_ITER L3
UNPACK_... | def maximum_value(test_list):
res = [(key, max(lst)) for key, lst in test_list]
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 613,
"mbpp_split": "train",
"prompt": "Write a function to find the maximum value in record list as tuple attribute in the given tuple list.",
"test_list": [
"assert maximum_value([('key1', [3, 4, 5]), ('key2', [1, 4, 2]), ('key3', [... | {
"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_613 | 45 |
10 | src/00010.py | pyc/00010.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code cummulative_sum>
MAKE_FUNCTION 0
STORE_NAME cummulative_sum
RETURN_CONST None
END
CODE cummulative_sum(test_list)
RESUME 0
LOAD_GLOBAL NULL + sum
LOAD_GLOBAL NULL + map
LOAD_GLOBAL sum
LOAD_FAST test_list
CALL 2
CALL 1
STORE_FAST res
LOAD_FAST res
... | def cummulative_sum(test_list):
res = sum(map(sum, test_list))
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 614,
"mbpp_split": "train",
"prompt": "Write a function to find the cumulative sum of all the values that are present in the given tuple list.",
"test_list": [
"assert cummulative_sum([(1, 3), (5, 6, 7), (2, 6)]) == 30",
"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_614 | 18 |
11 | src/00011.py | pyc/00011.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code average_tuple>
MAKE_FUNCTION 0
STORE_NAME average_tuple
RETURN_CONST None
END
CODE average_tuple(nums)
RESUME 0
LOAD_GLOBAL NULL + zip
LOAD_FAST nums
CALL_FUNCTION_EX 0
GET_ITER
LOAD_FAST_AND_CLEAR x
SWAP 2
L1:
BUILD_LIST 0
SWAP 2
L2:
FOR_ITER L3
... | def average_tuple(nums):
result = [sum(x) / len(x) for x in zip(*nums)]
return result | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 615,
"mbpp_split": "train",
"prompt": "Write a function to find average value of the numbers in a given tuple of tuples.",
"test_list": [
"assert average_tuple(((10, 10, 10, 12), (30, 45, 56, 45), (81, 80, 39, 32), (1, 2, 3, 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_615 | 44 |
12 | src/00012.py | pyc/00012.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code tuple_modulo>
MAKE_FUNCTION 0
STORE_NAME tuple_modulo
RETURN_CONST None
END
CODE tuple_modulo(test_tup1, test_tup2)
RESUME 0
LOAD_GLOBAL NULL + tuple
LOAD_CONST <code tuple_modulo.<locals>.<genexpr>>
MAKE_FUNCTION 0
LOAD_GLOBAL NULL + zip
LOAD_FAST test_tu... | def tuple_modulo(test_tup1, test_tup2):
res = tuple((ele1 % ele2 for ele1, ele2 in zip(test_tup1, test_tup2)))
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 616,
"mbpp_split": "train",
"prompt": "Write a function to perfom the modulo of tuple elements in the given two tuples.",
"test_list": [
"assert tuple_modulo((10, 4, 5, 6), (5, 6, 7, 5)) == (0, 4, 5, 1)",
"assert tuple_modulo((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_616 | 48 |
13 | src/00013.py | pyc/00013.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code div_list>
MAKE_FUNCTION 0
STORE_NAME div_list
RETURN_CONST None
END
CODE div_list(nums1, nums2)
RESUME 0
LOAD_GLOBAL NULL + map
LOAD_CONST <code div_list.<locals>.<lambda>>
MAKE_FUNCTION 0
LOAD_FAST nums1
LOAD_FAST nums2
CALL 3
STORE_FAST result
LOAD... | def div_list(nums1, nums2):
result = map(lambda x, y: x / y, nums1, nums2)
return list(result) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 618,
"mbpp_split": "train",
"prompt": "Write a function to divide two lists using map and lambda function.",
"test_list": [
"assert div_list([4,5,6],[1, 2, 3])==[4.0,2.5,2.0]",
"assert div_list([3,2],[1,4])==[3.0, 0.5]",
"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_618 | 27 |
14 | src/00014.py | pyc/00014.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code move_num>
MAKE_FUNCTION 0
STORE_NAME move_num
RETURN_CONST None
END
CODE move_num(test_str)
RESUME 0
LOAD_CONST ''
STORE_FAST res
LOAD_CONST ''
STORE_FAST dig
LOAD_FAST test_str
GET_ITER
L1:
FOR_ITER L3
STORE_FAST ele
LOAD_FAST ele
LOAD_ATTR NULL... | def move_num(test_str):
res = ''
dig = ''
for ele in test_str:
if ele.isdigit():
dig += ele
else:
res += ele
res += dig
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 619,
"mbpp_split": "train",
"prompt": "Write a function to move all the numbers in it to the given string.",
"test_list": [
"assert move_num('I1love143you55three3000thousand') == 'Iloveyouthreethousand1143553000'",
"assert move_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_619 | 41 |
15 | src/00015.py | pyc/00015.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code increment_numerics>
MAKE_FUNCTION 0
STORE_NAME increment_numerics
RETURN_CONST None
END
CODE increment_numerics(test_list, K)
RESUME 0
LOAD_FAST test_list
GET_ITER
LOAD_FAST_AND_CLEAR ele
SWAP 2
L1:
BUILD_LIST 0
SWAP 2
L2:
FOR_ITER L5
STORE_FAST ele
... | def increment_numerics(test_list, K):
res = [str(int(ele) + K) if ele.isdigit() else ele for ele in test_list]
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 621,
"mbpp_split": "train",
"prompt": "Write a function to increment the numeric values in the given strings by k.",
"test_list": [
"assert increment_numerics([\"MSM\", \"234\", \"is\", \"98\", \"123\", \"best\", \"4\"] , 6) == ['MSM... | {
"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_621 | 50 |
16 | src/00016.py | pyc/00016.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code get_median>
MAKE_FUNCTION 0
STORE_NAME get_median
RETURN_CONST None
END
CODE get_median(arr1, arr2, n)
RESUME 0
LOAD_CONST 0
STORE_FAST i
LOAD_CONST 0
STORE_FAST j
LOAD_CONST -1
STORE_FAST m1
LOAD_CONST -1
STORE_FAST m2
LOAD_CONST 0
STORE_FAST co... | def get_median(arr1, arr2, n):
i = 0
j = 0
m1 = -1
m2 = -1
count = 0
while count < n + 1:
count += 1
if i == n:
m1 = m2
m2 = arr2[0]
break
elif j == n:
m1 = m2
m2 = arr1[0]
break
if arr1[i] <=... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 622,
"mbpp_split": "train",
"prompt": "Write a function to find the median of two sorted arrays of same size.",
"test_list": [
"assert get_median([1, 12, 15, 26, 38], [2, 13, 17, 30, 45], 5) == 16.0",
"assert get_median([2, 4, 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_622 | 99 |
17 | src/00017.py | pyc/00017.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code nth_nums>
MAKE_FUNCTION 0
STORE_NAME nth_nums
RETURN_CONST None
END
CODE nth_nums(nums, n)
MAKE_CELL n
RESUME 0
LOAD_GLOBAL NULL + list
LOAD_GLOBAL NULL + map
LOAD_CLOSURE n
BUILD_TUPLE 1
LOAD_CONST <code nth_nums.<locals>.<lambda>>
MAKE_FUNCTION closu... | def nth_nums(nums, n):
nth_nums = list(map(lambda x: x ** n, nums))
return nth_nums | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 623,
"mbpp_split": "train",
"prompt": "Write a function to find the n-th power of individual elements in a list using lambda function.",
"test_list": [
"assert nth_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],2)==[1, 4, 9, 16, 25, 36, 49, 64... | {
"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_623 | 30 |
18 | src/00018.py | pyc/00018.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code swap_List>
MAKE_FUNCTION 0
STORE_NAME swap_List
RETURN_CONST None
END
CODE swap_List(newList)
RESUME 0
LOAD_GLOBAL NULL + len
LOAD_FAST newList
CALL 1
STORE_FAST size
LOAD_FAST newList
LOAD_CONST 0
BINARY_SUBSCR
STORE_FAST temp
LOAD_FAST newList
... | def swap_List(newList):
size = len(newList)
temp = newList[0]
newList[0] = newList[size - 1]
newList[size - 1] = temp
return newList | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 625,
"mbpp_split": "train",
"prompt": "Write a python function to interchange first and last elements in a given list.",
"test_list": [
"assert swap_List([1,2,3]) == [3,2,1]",
"assert swap_List([1,2,3,4,4]) == [4,2,3,4,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_625 | 33 |
19 | src/00019.py | pyc/00019.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code triangle_area>
MAKE_FUNCTION 0
STORE_NAME triangle_area
RETURN_CONST None
END
CODE triangle_area(r)
RESUME 0
LOAD_FAST r
LOAD_CONST 0
COMPARE_OP <
POP_JUMP_IF_FALSE L1
RETURN_CONST -1
L1:
LOAD_FAST r
LOAD_FAST r
BINARY_OP *
RETURN_VALUE
END | def triangle_area(r):
if r < 0:
return -1
return r * r | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 626,
"mbpp_split": "train",
"prompt": "Write a python function to find the largest triangle that can be inscribed in the semicircle.",
"test_list": [
"assert triangle_area(0) == 0",
"assert triangle_area(-1) == -1",
"assert t... | {
"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_626 | 19 |
20 | src/00020.py | pyc/00020.pyc | CODE <module>()
RESUME 0
LOAD_CONST 1000
STORE_NAME MAX
LOAD_CONST <code replace_spaces>
MAKE_FUNCTION 0
STORE_NAME replace_spaces
RETURN_CONST None
END
CODE replace_spaces(string)
RESUME 0
LOAD_FAST string
LOAD_ATTR NULL|self + strip
CALL 0
STORE_FAST string
LOAD_GLOBAL NULL + len
LOAD_FAST... | MAX = 1000
def replace_spaces(string):
string = string.strip()
i = len(string)
space_count = string.count(' ')
new_length = i + space_count * 2
if new_length > MAX:
return -1
index = new_length - 1
string = list(string)
for f in range(i - 2, new_length - 2):
string.appen... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 628,
"mbpp_split": "train",
"prompt": "Write a function to replace all spaces in the given string with character * list item * list item * list item * list item '%20'.",
"test_list": [
"assert replace_spaces(\"My Name is Dawood\") ==... | {
"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_628 | 121 |
21 | src/00021.py | pyc/00021.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code Split>
MAKE_FUNCTION 0
STORE_NAME Split
RETURN_CONST None
END
CODE Split(list)
RESUME 0
BUILD_LIST 0
STORE_FAST ev_li
LOAD_FAST list
GET_ITER
L1:
FOR_ITER L3
STORE_FAST i
LOAD_FAST i
LOAD_CONST 2
BINARY_OP %
LOAD_CONST 0
COMPARE_OP ==
POP_JUM... | def Split(list):
ev_li = []
for i in list:
if i % 2 == 0:
ev_li.append(i)
return ev_li | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 629,
"mbpp_split": "train",
"prompt": "Write a python function to find even numbers from a mixed list.",
"test_list": [
"assert Split([1,2,3,4,5]) == [2,4]",
"assert Split([4,5,6,7,8,0,1]) == [4,6,8,0]",
"assert Split ([8,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_629 | 34 |
22 | src/00022.py | pyc/00022.pyc | CODE <module>()
RESUME 0
BUILD_LIST 0
BUILD_TUPLE 1
LOAD_CONST <code adjac>
MAKE_FUNCTION defaults
STORE_NAME adjac
LOAD_CONST <code get_coordinates>
MAKE_FUNCTION 0
STORE_NAME get_coordinates
RETURN_CONST None
END
CODE adjac(ele, sub)
RETURN_GENERATOR
POP_TOP
L1:
RESUME 0
LOAD_FAST ele
PO... | def adjac(ele, sub=[]):
if not ele:
yield sub
else:
yield from [idx for j in range(ele[0] - 1, ele[0] + 2) for idx in adjac(ele[1:], sub + [j])]
def get_coordinates(test_tup):
res = list(adjac(test_tup))
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 630,
"mbpp_split": "train",
"prompt": "Write a function to extract all the adjacent coordinates of the given coordinate tuple.",
"test_list": [
"assert get_coordinates((3, 4)) == [[2, 3], [2, 4], [2, 5], [3, 3], [3, 4], [3, 5], [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_630 | 116 |
23 | src/00023.py | pyc/00023.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME re
STORE_NAME re
LOAD_CONST 'Python Exercises'
STORE_NAME text
LOAD_CONST <code replace_spaces>
MAKE_FUNCTION 0
STORE_NAME replace_spaces
RETURN_CONST None
END
CODE replace_spaces(text)
RESUME 0
LOAD_FAST text
LOAD_ATTR NULL|s... | import re
text = 'Python Exercises'
def replace_spaces(text):
text = text.replace(' ', '_')
return text
text = text.replace('_', ' ')
return text | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 631,
"mbpp_split": "train",
"prompt": "Write a function to replace whitespaces with an underscore and vice versa in a given string by using regex.",
"test_list": [
"assert replace_spaces('Jumanji The Jungle') == 'Jumanji_The_Jungle'"... | {
"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_631 | 23 |
24 | src/00024.py | pyc/00024.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code move_zero>
MAKE_FUNCTION 0
STORE_NAME move_zero
RETURN_CONST None
END
CODE move_zero(num_list)
RESUME 0
LOAD_GLOBAL NULL + range
LOAD_FAST num_list
LOAD_ATTR NULL|self + count
LOAD_CONST 0
CALL 1
CALL 1
GET_ITER
LOAD_FAST_AND_CLEAR i
SWAP 2
L1:
B... | def move_zero(num_list):
a = [0 for i in range(num_list.count(0))]
x = [i for i in num_list if i != 0]
x.extend(a)
return x | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 632,
"mbpp_split": "train",
"prompt": "Write a python function to move all zeroes to the end of the given list.",
"test_list": [
"assert move_zero([1,0,2,0,3,4]) == [1,2,3,4,0,0]",
"assert move_zero([2,3,2,0,0,4,0,5,0]) == [2,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_632 | 79 |
25 | src/00025.py | pyc/00025.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code pair_OR_Sum>
MAKE_FUNCTION 0
STORE_NAME pair_OR_Sum
RETURN_CONST None
END
CODE pair_OR_Sum(arr, n)
RESUME 0
LOAD_CONST 0
STORE_FAST ans
LOAD_GLOBAL NULL + range
LOAD_CONST 0
LOAD_FAST n
CALL 2
GET_ITER
L1:
FOR_ITER L4
STORE_FAST i
LOAD_GLOBAL NUL... | def pair_OR_Sum(arr, n):
ans = 0
for i in range(0, n):
for j in range(i + 1, n):
ans = ans + (arr[i] ^ arr[j])
return ans | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 633,
"mbpp_split": "train",
"prompt": "Write a python function to find the sum of xor of all pairs of numbers in the given array.",
"test_list": [
"assert pair_OR_Sum([5,9,7,6],4) == 47",
"assert pair_OR_Sum([7,3,5],3) == 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_633 | 47 |
26 | src/00026.py | pyc/00026.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code even_Power_Sum>
MAKE_FUNCTION 0
STORE_NAME even_Power_Sum
RETURN_CONST None
END
CODE even_Power_Sum(n)
RESUME 0
LOAD_CONST 0
STORE_FAST sum
LOAD_GLOBAL NULL + range
LOAD_CONST 1
LOAD_FAST n
LOAD_CONST 1
BINARY_OP +
CALL 2
GET_ITER
L1:
FOR_ITER L2... | def even_Power_Sum(n):
sum = 0
for i in range(1, n + 1):
j = 2 * i
sum = sum + j * j * j * j
return sum | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 634,
"mbpp_split": "train",
"prompt": "Write a python function to find the sum of fourth power of first n even natural numbers.",
"test_list": [
"assert even_Power_Sum(2) == 272",
"assert even_Power_Sum(3) == 1568",
"assert e... | {
"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_634 | 40 |
27 | src/00027.py | pyc/00027.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME heapq
STORE_NAME hq
LOAD_CONST <code heap_sort>
MAKE_FUNCTION 0
STORE_NAME heap_sort
RETURN_CONST None
END
CODE heap_sort(iterable)
RESUME 0
BUILD_LIST 0
STORE_FAST h
LOAD_FAST iterable
GET_ITER
L1:
FOR_ITER L2
STORE_FAST ... | import heapq as hq
def heap_sort(iterable):
h = []
for value in iterable:
hq.heappush(h, value)
return [hq.heappop(h) for i in range(len(h))] | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 635,
"mbpp_split": "train",
"prompt": "Write a function to push all values into a heap and then pop off the smallest values one at a time.",
"test_list": [
"assert heap_sort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])==[0, 1, 2, 3, 4, 5, 6, 7, 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_635 | 62 |
28 | src/00028.py | pyc/00028.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 a
LOAD_FAST c
COMPARE_OP ==
POP_JUMP_IF_FALSE L1
RETURN_CONST 'Yes'
L1:
RETURN_CONST 'No'
END | def Check_Solution(a, b, c):
if a == c:
return 'Yes'
else:
return 'No' | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 636,
"mbpp_split": "train",
"prompt": "Write a python function to check if roots of a quadratic equation are reciprocal of each other or not.",
"test_list": [
"assert Check_Solution(2,0,2) == \"Yes\"",
"assert Check_Solution(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_636 | 16 |
29 | src/00029.py | pyc/00029.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code noprofit_noloss>
MAKE_FUNCTION 0
STORE_NAME noprofit_noloss
RETURN_CONST None
END
CODE noprofit_noloss(actual_cost, sale_amount)
RESUME 0
LOAD_FAST sale_amount
LOAD_FAST actual_cost
COMPARE_OP ==
POP_JUMP_IF_FALSE L1
RETURN_CONST True
L1:
RETURN_CONST Fa... | def noprofit_noloss(actual_cost, sale_amount):
if sale_amount == actual_cost:
return True
else:
return False | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 637,
"mbpp_split": "train",
"prompt": "Write a function to check whether the given amount has no profit and no loss",
"test_list": [
"assert noprofit_noloss(1500,1200)==False",
"assert noprofit_noloss(100,100)==True",
"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_637 | 16 |
30 | src/00030.py | pyc/00030.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code sample_nam>
MAKE_FUNCTION 0
STORE_NAME sample_nam
RETURN_CONST None
END
CODE sample_nam(sample_names)
RESUME 0
LOAD_GLOBAL NULL + list
LOAD_GLOBAL NULL + filter
LOAD_CONST <code sample_nam.<locals>.<lambda>>
MAKE_FUNCTION 0
LOAD_FAST sample_names
CALL 2
... | def sample_nam(sample_names):
sample_names = list(filter(lambda el: el[0].isupper() and el[1:].islower(), sample_names))
return len(''.join(sample_names)) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 639,
"mbpp_split": "train",
"prompt": "Write a function to sum the length of the names of a given list of names after removing the names that start with a lowercase letter.",
"test_list": [
"assert sample_nam(['sally', 'Dylan', 'rebe... | {
"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_639 | 43 |
31 | src/00031.py | pyc/00031.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME re
STORE_NAME re
LOAD_CONST <code remove_parenthesis>
MAKE_FUNCTION 0
STORE_NAME remove_parenthesis
RETURN_CONST None
END
CODE remove_parenthesis(items)
RESUME 0
LOAD_FAST items
GET_ITER
FOR_ITER L1
STORE_FAST item
LOAD_GLOB... | import re
def remove_parenthesis(items):
for item in items:
return re.sub(' ?\\([^)]+\\)', '', item) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 640,
"mbpp_split": "train",
"prompt": "Write a function to remove the parenthesis area in a string.",
"test_list": [
"assert remove_parenthesis([\"python (chrome)\"])==(\"python\")",
"assert remove_parenthesis([\"string(.abc)\"])... | {
"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_640 | 29 |
32 | src/00032.py | pyc/00032.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code is_nonagonal>
MAKE_FUNCTION 0
STORE_NAME is_nonagonal
RETURN_CONST None
END
CODE is_nonagonal(n)
RESUME 0
LOAD_GLOBAL NULL + int
LOAD_FAST n
LOAD_CONST 7
LOAD_FAST n
BINARY_OP *
LOAD_CONST 5
BINARY_OP -
BINARY_OP *
LOAD_CONST 2
BINARY_OP /
CALL... | def is_nonagonal(n):
return int(n * (7 * n - 5) / 2) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 641,
"mbpp_split": "train",
"prompt": "Write a function to find the nth nonagonal number.",
"test_list": [
"assert is_nonagonal(10) == 325",
"assert is_nonagonal(15) == 750",
"assert is_nonagonal(18) == 1089"
],
"transfor... | {
"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_641 | 21 |
33 | src/00033.py | pyc/00033.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code remove_similar_row>
MAKE_FUNCTION 0
STORE_NAME remove_similar_row
RETURN_CONST None
END
CODE remove_similar_row(test_list)
RESUME 0
LOAD_GLOBAL NULL + set
LOAD_GLOBAL NULL + sorted
LOAD_FAST test_list
GET_ITER
LOAD_FAST_AND_CLEAR sub
SWAP 2
L1:
BUILD_L... | def remove_similar_row(test_list):
res = set(sorted([tuple(sorted(set(sub))) for sub in test_list]))
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 642,
"mbpp_split": "train",
"prompt": "Write a function to remove similar rows from the given tuple matrix.",
"test_list": [
"assert remove_similar_row([[(4, 5), (3, 2)], [(2, 2), (4, 6)], [(3, 2), (4, 5)]] ) == {((2, 2), (4, 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_642 | 47 |
34 | src/00034.py | pyc/00034.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME re
STORE_NAME re
LOAD_CONST <code text_match_wordz_middle>
MAKE_FUNCTION 0
STORE_NAME text_match_wordz_middle
RETURN_CONST None
END
CODE text_match_wordz_middle(text)
RESUME 0
LOAD_CONST '\\Bz\\B'
STORE_FAST patterns
LOAD_GLOBAL... | import re
def text_match_wordz_middle(text):
patterns = '\\Bz\\B'
if re.search(patterns, text):
return 'Found a match!'
else:
return 'Not matched!' | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 643,
"mbpp_split": "train",
"prompt": "Write a function that matches a word containing 'z', not at the start or end of the word.",
"test_list": [
"assert text_match_wordz_middle(\"pythonzabc.\")==('Found a match!')",
"assert text... | {
"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_643 | 24 |
35 | src/00035.py | pyc/00035.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code reverse_Array_Upto_K>
MAKE_FUNCTION 0
STORE_NAME reverse_Array_Upto_K
RETURN_CONST None
END
CODE reverse_Array_Upto_K(input, k)
RESUME 0
LOAD_FAST input
LOAD_FAST k
LOAD_CONST 1
BINARY_OP -
LOAD_CONST None
LOAD_CONST -1
BUILD_SLICE 3
BINARY_SUBSCR
... | def reverse_Array_Upto_K(input, k):
return input[k - 1::-1] + input[k:] | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 644,
"mbpp_split": "train",
"prompt": "Write a python function to reverse an array upto a given position.",
"test_list": [
"assert reverse_Array_Upto_K([1, 2, 3, 4, 5, 6],4) == [4, 3, 2, 1, 5, 6]",
"assert reverse_Array_Upto_K([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_644 | 23 |
36 | src/00036.py | pyc/00036.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code get_product>
MAKE_FUNCTION 0
STORE_NAME get_product
LOAD_CONST <code find_k_product>
MAKE_FUNCTION 0
STORE_NAME find_k_product
RETURN_CONST None
END
CODE get_product(val)
RESUME 0
LOAD_CONST 1
STORE_FAST res
LOAD_FAST val
GET_ITER
L1:
FOR_ITER L2
S... | def get_product(val):
res = 1
for ele in val:
res *= ele
return res
def find_k_product(test_list, K):
res = get_product([sub[K] for sub in test_list])
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 645,
"mbpp_split": "train",
"prompt": "Write a function to find the product of it’s kth index in the given tuples.",
"test_list": [
"assert find_k_product([(5, 6, 7), (1, 3, 5), (8, 9, 19)], 2) == 665",
"assert find_k_product([(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_645 | 63 |
37 | src/00037.py | pyc/00037.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code No_of_cubes>
MAKE_FUNCTION 0
STORE_NAME No_of_cubes
RETURN_CONST None
END
CODE No_of_cubes(N, K)
RESUME 0
LOAD_CONST 0
STORE_FAST No
LOAD_FAST N
LOAD_FAST K
BINARY_OP -
LOAD_CONST 1
BINARY_OP +
STORE_FAST No
LOAD_GLOBAL NULL + pow
LOAD_FAST No
... | def No_of_cubes(N, K):
No = 0
No = N - K + 1
No = pow(No, 3)
return No | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 646,
"mbpp_split": "train",
"prompt": "Write a python function to count number of cubes of size k in a cube of size n.",
"test_list": [
"assert No_of_cubes(2,1) == 8",
"assert No_of_cubes(5,2) == 64",
"assert No_of_cubes(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_646 | 24 |
38 | src/00038.py | pyc/00038.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST ('zip_longest', 'chain', 'tee')
IMPORT_NAME itertools
IMPORT_FROM zip_longest
STORE_NAME zip_longest
IMPORT_FROM chain
STORE_NAME chain
IMPORT_FROM tee
STORE_NAME tee
POP_TOP
LOAD_CONST <code exchange_elements>
MAKE_FUNCTION 0
STORE_NAME excha... | from itertools import zip_longest, chain, tee
def exchange_elements(lst):
lst1, lst2 = tee(iter(lst), 2)
return list(chain.from_iterable(zip_longest(lst[1::2], lst[::2]))) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 648,
"mbpp_split": "train",
"prompt": "Write a function to exchange the position of every n-th value with (n+1)th value and (n+1)th value with n-th value in a given list.",
"test_list": [
"assert exchange_elements([0,1,2,3,4,5])==[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_648 | 48 |
39 | src/00039.py | pyc/00039.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code are_Equal>
MAKE_FUNCTION 0
STORE_NAME are_Equal
RETURN_CONST None
END
CODE are_Equal(arr1, arr2, n, m)
RESUME 0
LOAD_FAST n
LOAD_FAST m
COMPARE_OP !=
POP_JUMP_IF_FALSE L1
RETURN_CONST False
L1:
LOAD_FAST arr1
LOAD_ATTR NULL|self + sort
CALL 0
POP_T... | def are_Equal(arr1, arr2, n, m):
if n != m:
return False
arr1.sort()
arr2.sort()
for i in range(0, n - 1):
if arr1[i] != arr2[i]:
return False
return True | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 650,
"mbpp_split": "train",
"prompt": "Write a python function to check whether the given two arrays are equal or not.",
"test_list": [
"assert are_Equal([1,2,3],[3,2,1],3,3) == True",
"assert are_Equal([1,1,1],[2,2,2],3,3) == 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_650 | 48 |
40 | src/00040.py | pyc/00040.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code check_subset>
MAKE_FUNCTION 0
STORE_NAME check_subset
RETURN_CONST None
END
CODE check_subset(test_tup1, test_tup2)
RESUME 0
LOAD_GLOBAL NULL + set
LOAD_FAST test_tup2
CALL 1
LOAD_ATTR NULL|self + issubset
LOAD_FAST test_tup1
CALL 1
STORE_FAST res
LO... | def check_subset(test_tup1, test_tup2):
res = set(test_tup2).issubset(test_tup1)
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 651,
"mbpp_split": "train",
"prompt": "Write a function to check if one tuple is a subset of another tuple.",
"test_list": [
"assert check_subset((10, 4, 5, 6), (5, 10)) == True",
"assert check_subset((1, 2, 3, 4), (5, 6)) == Fal... | {
"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_651 | 18 |
41 | src/00041.py | pyc/00041.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code matrix_to_list>
MAKE_FUNCTION 0
STORE_NAME matrix_to_list
RETURN_CONST None
END
CODE matrix_to_list(test_list)
RESUME 0
LOAD_FAST test_list
GET_ITER
LOAD_FAST_AND_CLEAR sub
LOAD_FAST_AND_CLEAR ele
SWAP 3
L1:
BUILD_LIST 0
SWAP 2
L2:
FOR_ITER L5
STOR... | def matrix_to_list(test_list):
temp = [ele for sub in test_list for ele in sub]
res = list(zip(*temp))
return str(res) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 652,
"mbpp_split": "train",
"prompt": "Write a function to flatten the given tuple matrix into the tuple list with each tuple representing each column.",
"test_list": [
"assert matrix_to_list([[(4, 5), (7, 8)], [(10, 13), (18, 17)], ... | {
"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_652 | 55 |
42 | src/00042.py | pyc/00042.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST ('defaultdict',)
IMPORT_NAME collections
IMPORT_FROM defaultdict
STORE_NAME defaultdict
POP_TOP
LOAD_CONST <code grouping_dictionary>
MAKE_FUNCTION 0
STORE_NAME grouping_dictionary
RETURN_CONST None
END
CODE grouping_dictionary(l)
RESUME 0
LOAD_... | from collections import defaultdict
def grouping_dictionary(l):
d = defaultdict(list)
for k, v in l:
d[k].append(v)
return d | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 653,
"mbpp_split": "train",
"prompt": "Write a function to group a sequence of key-value pairs into a dictionary of lists using collections module.",
"test_list": [
"assert grouping_dictionary([('yellow', 1), ('blue', 2), ('yellow', ... | {
"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_653 | 38 |
43 | src/00043.py | pyc/00043.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code rectangle_perimeter>
MAKE_FUNCTION 0
STORE_NAME rectangle_perimeter
RETURN_CONST None
END
CODE rectangle_perimeter(l, b)
RESUME 0
LOAD_CONST 2
LOAD_FAST l
LOAD_FAST b
BINARY_OP +
BINARY_OP *
STORE_FAST perimeter
LOAD_FAST perimeter
RETURN_VALUE
END | def rectangle_perimeter(l, b):
perimeter = 2 * (l + b)
return perimeter | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 654,
"mbpp_split": "train",
"prompt": "Write a function to find the perimeter of a rectangle.",
"test_list": [
"assert rectangle_perimeter(10,20)==60",
"assert rectangle_perimeter(10,5)==30",
"assert rectangle_perimeter(4,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_654 | 17 |
44 | src/00044.py | pyc/00044.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code fifth_Power_Sum>
MAKE_FUNCTION 0
STORE_NAME fifth_Power_Sum
RETURN_CONST None
END
CODE fifth_Power_Sum(n)
RESUME 0
LOAD_CONST 0
STORE_FAST sm
LOAD_GLOBAL NULL + range
LOAD_CONST 1
LOAD_FAST n
LOAD_CONST 1
BINARY_OP +
CALL 2
GET_ITER
L1:
FOR_ITER ... | def fifth_Power_Sum(n):
sm = 0
for i in range(1, n + 1):
sm = sm + i * i * i * i * i
return sm | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 655,
"mbpp_split": "train",
"prompt": "Write a python function to find the sum of fifth power of n natural numbers.",
"test_list": [
"assert fifth_Power_Sum(2) == 33",
"assert fifth_Power_Sum(4) == 1300",
"assert fifth_Power_... | {
"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_655 | 38 |
45 | src/00045.py | pyc/00045.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME math
STORE_NAME math
LOAD_CONST <code first_Digit>
MAKE_FUNCTION 0
STORE_NAME first_Digit
RETURN_CONST None
END
CODE first_Digit(n)
RESUME 0
LOAD_CONST 1
STORE_FAST fact
LOAD_GLOBAL NULL + range
LOAD_CONST 2
LOAD_FAST n
LO... | import math
def first_Digit(n):
fact = 1
for i in range(2, n + 1):
fact = fact * i
while fact % 10 == 0:
fact = int(fact / 10)
while fact >= 10:
fact = int(fact / 10)
return math.floor(fact) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 657,
"mbpp_split": "train",
"prompt": "Write a python function to find the first digit in factorial of a given number.",
"test_list": [
"assert first_Digit(5) == 1",
"assert first_Digit(10) == 3",
"assert first_Digit(7) == 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_657 | 76 |
46 | src/00046.py | pyc/00046.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code max_occurrences>
MAKE_FUNCTION 0
STORE_NAME max_occurrences
RETURN_CONST None
END
CODE max_occurrences(list1)
RESUME 0
LOAD_CONST 0
STORE_FAST max_val
LOAD_FAST list1
LOAD_CONST 0
BINARY_SUBSCR
STORE_FAST result
LOAD_FAST list1
GET_ITER
L1:
FOR_ITE... | def max_occurrences(list1):
max_val = 0
result = list1[0]
for i in list1:
occu = list1.count(i)
if occu > max_val:
max_val = occu
result = i
return result | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 658,
"mbpp_split": "train",
"prompt": "Write a function to find the item with maximum occurrences in a given list.",
"test_list": [
"assert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,4,6,9,1,2])==2",
"assert max_occurrences([... | {
"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_658 | 40 |
47 | src/00047.py | pyc/00047.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code Repeat>
MAKE_FUNCTION 0
STORE_NAME Repeat
RETURN_CONST None
END
CODE Repeat(x)
RESUME 0
LOAD_GLOBAL NULL + len
LOAD_FAST x
CALL 1
STORE_FAST _size
BUILD_LIST 0
STORE_FAST repeated
LOAD_GLOBAL NULL + range
LOAD_FAST _size
CALL 1
GET_ITER
L1:
FOR... | def Repeat(x):
_size = len(x)
repeated = []
for i in range(_size):
k = i + 1
for j in range(k, _size):
if x[i] == x[j] and x[i] not in repeated:
repeated.append(x[i])
return repeated | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 659,
"mbpp_split": "train",
"prompt": "Write a python function to print duplicants from a list of integers.",
"test_list": [
"assert Repeat([10, 20, 30, 20, 20, 30, 40, 50, -20, 60, 60, -20, -20]) == [20, 30, -20, 60]",
"assert R... | {
"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_659 | 67 |
48 | src/00048.py | pyc/00048.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code find_Points>
MAKE_FUNCTION 0
STORE_NAME find_Points
RETURN_CONST None
END
CODE find_Points(l1, r1, l2, r2)
RESUME 0
LOAD_FAST l1
LOAD_FAST l2
COMPARE_OP !=
POP_JUMP_IF_FALSE L1
LOAD_GLOBAL NULL + min
LOAD_FAST l1
LOAD_FAST l2
CALL 2
JUMP_FORWARD L2... | def find_Points(l1, r1, l2, r2):
x = min(l1, l2) if l1 != l2 else -1
y = max(r1, r2) if r1 != r2 else -1
return (x, y) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 660,
"mbpp_split": "train",
"prompt": "Write a python function to choose points from two ranges such that no point lies in both the ranges.",
"test_list": [
"assert find_Points(5,10,1,5) == (1,10)",
"assert find_Points(3,5,7,9) =... | {
"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_660 | 39 |
49 | src/00049.py | pyc/00049.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code max_sum_of_three_consecutive>
MAKE_FUNCTION 0
STORE_NAME max_sum_of_three_consecutive
RETURN_CONST None
END
CODE max_sum_of_three_consecutive(arr, n)
RESUME 0
LOAD_GLOBAL NULL + range
LOAD_FAST n
CALL 1
GET_ITER
LOAD_FAST_AND_CLEAR k
SWAP 2
L1:
BUILD_L... | def max_sum_of_three_consecutive(arr, n):
sum = [0 for k in range(n)]
if n >= 1:
sum[0] = arr[0]
if n >= 2:
sum[1] = arr[0] + arr[1]
if n > 2:
sum[2] = max(sum[1], max(arr[1] + arr[2], arr[0] + arr[2]))
for i in range(3, n):
sum[i] = max(max(sum[i - 1], sum[i - 2] + a... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 661,
"mbpp_split": "train",
"prompt": "Write a function to find the maximum sum that can be formed which has no three consecutive elements present.",
"test_list": [
"assert max_sum_of_three_consecutive([100, 1000, 100, 1000, 1], 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_661 | 144 |
50 | src/00050.py | pyc/00050.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code average_Even>
MAKE_FUNCTION 0
STORE_NAME average_Even
RETURN_CONST None
END
CODE average_Even(n)
RESUME 0
LOAD_FAST n
LOAD_CONST 2
BINARY_OP %
LOAD_CONST 0
COMPARE_OP !=
POP_JUMP_IF_FALSE L1
RETURN_CONST 'Invalid Input'
L1:
LOAD_CONST 0
STORE_FAST ... | def average_Even(n):
if n % 2 != 0:
return 'Invalid Input'
return -1
sm = 0
count = 0
while n >= 2:
count = count + 1
sm = sm + n
n = n - 2
return sm // count | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 664,
"mbpp_split": "train",
"prompt": "Write a python function to find the average of even numbers till a given even number.",
"test_list": [
"assert average_Even(2) == 2",
"assert average_Even(4) == 3",
"assert average_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_664 | 48 |
51 | src/00051.py | pyc/00051.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code move_last>
MAKE_FUNCTION 0
STORE_NAME move_last
RETURN_CONST None
END
CODE move_last(num_list)
RESUME 0
LOAD_GLOBAL NULL + range
LOAD_FAST num_list
LOAD_ATTR NULL|self + count
LOAD_FAST num_list
LOAD_CONST 0
BINARY_SUBSCR
CALL 1
CALL 1
GET_ITER
L... | def move_last(num_list):
a = [num_list[0] for i in range(num_list.count(num_list[0]))]
x = [i for i in num_list if i != num_list[0]]
x.extend(a)
return x | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 665,
"mbpp_split": "train",
"prompt": "Write a python function to shift first element to the end of given list.",
"test_list": [
"assert move_last([1,2,3,4]) == [2,3,4,1]",
"assert move_last([2,3,4,1,5,0]) == [3,4,1,5,0,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_665 | 85 |
52 | src/00052.py | pyc/00052.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code count_char>
MAKE_FUNCTION 0
STORE_NAME count_char
RETURN_CONST None
END
CODE count_char(string, char)
RESUME 0
LOAD_CONST 0
STORE_FAST count
LOAD_GLOBAL NULL + range
LOAD_GLOBAL NULL + len
LOAD_FAST string
CALL 1
CALL 1
GET_ITER
L1:
FOR_ITER L3
S... | def count_char(string, char):
count = 0
for i in range(len(string)):
if string[i] == char:
count = count + 1
return count | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 666,
"mbpp_split": "train",
"prompt": "Write a function to count occurrence of a character in a string.",
"test_list": [
"assert count_char(\"Python\",'o')==1",
"assert count_char(\"little\",'t')==2",
"assert count_char(\"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_666 | 37 |
53 | src/00053.py | pyc/00053.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code Check_Vow>
MAKE_FUNCTION 0
STORE_NAME Check_Vow
RETURN_CONST None
END
CODE Check_Vow(string, vowels)
RESUME 0
LOAD_FAST string
GET_ITER
LOAD_FAST_AND_CLEAR each
SWAP 2
L1:
BUILD_LIST 0
SWAP 2
L2:
FOR_ITER L5
STORE_FAST each
LOAD_FAST each
LOAD_FA... | def Check_Vow(string, vowels):
final = [each for each in string if each in vowels]
return len(final) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 667,
"mbpp_split": "train",
"prompt": "Write a python function to count number of vowels in the string.",
"test_list": [
"assert Check_Vow('corner','AaEeIiOoUu') == 2",
"assert Check_Vow('valid','AaEeIiOoUu') == 2",
"assert C... | {
"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_667 | 46 |
54 | src/00054.py | pyc/00054.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME re
STORE_NAME re
LOAD_CONST '^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\.( \n\t\t\t25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\.( \n\t\t\t25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\.( \n\t\t\t25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$'
STORE_NAME rege... | import re
regex = '^(25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\.( \n\t\t\t25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\.( \n\t\t\t25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)\\.( \n\t\t\t25[0-5]|2[0-4][0-9]|[0-1]?[0-9][0-9]?)$'
def check_IP(Ip):
if re.search(regex, Ip):
return 'Valid IP address'
else:
retur... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 669,
"mbpp_split": "train",
"prompt": "Write a function to check whether the given ip address is valid or not using regex.",
"test_list": [
"assert check_IP(\"192.168.0.1\") == 'Valid IP address'",
"assert check_IP(\"110.234.52.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_669 | 24 |
55 | src/00055.py | pyc/00055.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code decreasing_trend>
MAKE_FUNCTION 0
STORE_NAME decreasing_trend
RETURN_CONST None
END
CODE decreasing_trend(nums)
RESUME 0
LOAD_GLOBAL NULL + sorted
LOAD_FAST nums
CALL 1
LOAD_FAST nums
COMPARE_OP ==
POP_JUMP_IF_FALSE L1
RETURN_CONST True
L1:
RETURN_CO... | def decreasing_trend(nums):
if sorted(nums) == nums:
return True
else:
return False | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 670,
"mbpp_split": "train",
"prompt": "Write a python function to check whether a sequence of numbers has a decreasing trend or not.",
"test_list": [
"assert decreasing_trend([-4,-3,-2,-1]) == True",
"assert decreasing_trend([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_670 | 18 |
56 | src/00056.py | pyc/00056.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME math
STORE_NAME math
LOAD_CONST <code get_Pos_Of_Right_most_Set_Bit>
MAKE_FUNCTION 0
STORE_NAME get_Pos_Of_Right_most_Set_Bit
LOAD_CONST <code set_Right_most_Unset_Bit>
MAKE_FUNCTION 0
STORE_NAME set_Right_most_Unset_Bit
RETURN_CO... | import math
def get_Pos_Of_Right_most_Set_Bit(n):
return int(math.log2(n & -n) + 1)
def set_Right_most_Unset_Bit(n):
if n == 0:
return 1
if n & n + 1 == 0:
return n
pos = get_Pos_Of_Right_most_Set_Bit(~n)
return 1 << pos - 1 | n | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 671,
"mbpp_split": "train",
"prompt": "Write a python function to set the right most unset bit.",
"test_list": [
"assert set_Right_most_Unset_Bit(21) == 23",
"assert set_Right_most_Unset_Bit(11) == 15",
"assert set_Right_most... | {
"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_671 | 61 |
57 | src/00057.py | pyc/00057.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code convert>
MAKE_FUNCTION 0
STORE_NAME convert
RETURN_CONST None
END
CODE convert(list)
RESUME 0
LOAD_FAST list
GET_ITER
LOAD_FAST_AND_CLEAR i
SWAP 2
L1:
BUILD_LIST 0
SWAP 2
L2:
FOR_ITER L3
STORE_FAST i
LOAD_GLOBAL NULL + str
LOAD_FAST i
CALL 1
... | def convert(list):
s = [str(i) for i in list]
res = int(''.join(s))
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 673,
"mbpp_split": "train",
"prompt": "Write a python function to convert a list of multiple integers into a single integer.",
"test_list": [
"assert convert([1,2,3]) == 123",
"assert convert([4,5,6]) == 456",
"assert convert... | {
"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_673 | 45 |
58 | src/00058.py | pyc/00058.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST ('OrderedDict',)
IMPORT_NAME collections
IMPORT_FROM OrderedDict
STORE_NAME OrderedDict
POP_TOP
LOAD_CONST <code remove_duplicate>
MAKE_FUNCTION 0
STORE_NAME remove_duplicate
RETURN_CONST None
END
CODE remove_duplicate(string)
RESUME 0
LOAD_CONS... | from collections import OrderedDict
def remove_duplicate(string):
result = ' '.join(OrderedDict(((w, w) for w in string.split())).keys())
return result | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 674,
"mbpp_split": "train",
"prompt": "Write a function to remove duplicate words from a given string using collections module.",
"test_list": [
"assert remove_duplicate(\"Python Exercises Practice Solution Exercises\")==(\"Python Ex... | {
"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_674 | 56 |
59 | src/00059.py | pyc/00059.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code remove_spaces>
MAKE_FUNCTION 0
STORE_NAME remove_spaces
RETURN_CONST None
END
CODE remove_spaces(str1)
RESUME 0
LOAD_FAST str1
LOAD_ATTR NULL|self + replace
LOAD_CONST ' '
LOAD_CONST ''
CALL 2
STORE_FAST str1
LOAD_FAST str1
RETURN_VALUE
END | def remove_spaces(str1):
str1 = str1.replace(' ', '')
return str1 | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 678,
"mbpp_split": "train",
"prompt": "Write a python function to remove spaces from a given string.",
"test_list": [
"assert remove_spaces(\"a b c\") == \"abc\"",
"assert remove_spaces(\"1 2 3\") == \"123\"",
"assert remove_... | {
"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_678 | 17 |
60 | src/00060.py | pyc/00060.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code access_key>
MAKE_FUNCTION 0
STORE_NAME access_key
RETURN_CONST None
END
CODE access_key(ditionary, key)
RESUME 0
LOAD_GLOBAL NULL + list
LOAD_FAST ditionary
CALL 1
LOAD_FAST key
BINARY_SUBSCR
RETURN_VALUE
END | def access_key(ditionary, key):
return list(ditionary)[key] | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 679,
"mbpp_split": "train",
"prompt": "Write a function to access dictionary key’s element by index.",
"test_list": [
"assert access_key({'physics': 80, 'math': 90, 'chemistry': 86},0)== 'physics'",
"assert access_key({'python':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_679 | 15 |
61 | src/00061.py | pyc/00061.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code smallest_Divisor>
MAKE_FUNCTION 0
STORE_NAME smallest_Divisor
RETURN_CONST None
END
CODE smallest_Divisor(n)
RESUME 0
LOAD_FAST n
LOAD_CONST 2
BINARY_OP %
LOAD_CONST 0
COMPARE_OP ==
POP_JUMP_IF_FALSE L1
RETURN_CONST 2
L1:
LOAD_CONST 3
STORE_FAST i
... | def smallest_Divisor(n):
if n % 2 == 0:
return 2
i = 3
while i * i <= n:
if n % i == 0:
return i
i += 2
return n | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 681,
"mbpp_split": "train",
"prompt": "Write a python function to find the smallest prime divisor of a number.",
"test_list": [
"assert smallest_Divisor(10) == 2",
"assert smallest_Divisor(25) == 5",
"assert smallest_Divisor(... | {
"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_681 | 49 |
62 | src/00062.py | pyc/00062.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code mul_list>
MAKE_FUNCTION 0
STORE_NAME mul_list
RETURN_CONST None
END
CODE mul_list(nums1, nums2)
RESUME 0
LOAD_GLOBAL NULL + map
LOAD_CONST <code mul_list.<locals>.<lambda>>
MAKE_FUNCTION 0
LOAD_FAST nums1
LOAD_FAST nums2
CALL 3
STORE_FAST result
LOAD... | def mul_list(nums1, nums2):
result = map(lambda x, y: x * y, nums1, nums2)
return list(result) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 682,
"mbpp_split": "train",
"prompt": "Write a function to multiply two lists using map and lambda function.",
"test_list": [
"assert mul_list([1, 2, 3],[4,5,6])==[4,10,18]",
"assert mul_list([1,2],[3,4])==[3,8]",
"assert mul... | {
"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_682 | 27 |
63 | src/00063.py | pyc/00063.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code sum_Square>
MAKE_FUNCTION 0
STORE_NAME sum_Square
RETURN_CONST None
END
CODE sum_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 L5
L1:
LOAD_CONST 1
STORE_FAST j
LOAD_... | def sum_Square(n):
i = 1
while i * i <= n:
j = 1
while j * j <= n:
if i * i + j * j == n:
return True
j = j + 1
i = i + 1
return False | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 683,
"mbpp_split": "train",
"prompt": "Write a python function to check whether the given number can be represented by sum of two squares or not.",
"test_list": [
"assert sum_Square(25) == True",
"assert sum_Square(24) == 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_683 | 64 |
64 | src/00064.py | pyc/00064.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code count_Char>
MAKE_FUNCTION 0
STORE_NAME count_Char
RETURN_CONST None
END
CODE count_Char(str, x)
RESUME 0
LOAD_CONST 0
STORE_FAST count
LOAD_GLOBAL NULL + range
LOAD_GLOBAL NULL + len
LOAD_FAST str
CALL 1
CALL 1
GET_ITER
L1:
FOR_ITER L3
STORE_FAST... | def count_Char(str, x):
count = 0
for i in range(len(str)):
if str[i] == x:
count += 1
n = 10
repititions = n // len(str)
count = count * repititions
l = n % len(str)
for i in range(l):
if str[i] == x:
count += 1
return count | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 684,
"mbpp_split": "train",
"prompt": "Write a python function to count occurences of a character in a repeated string.",
"test_list": [
"assert count_Char(\"abcac\",'a') == 4",
"assert count_Char(\"abca\",'c') == 2",
"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_684 | 77 |
65 | src/00065.py | pyc/00065.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code sum_Of_Primes>
MAKE_FUNCTION 0
STORE_NAME sum_Of_Primes
RETURN_CONST None
END
CODE sum_Of_Primes(n)
RESUME 0
LOAD_CONST True
BUILD_LIST 1
LOAD_FAST n
LOAD_CONST 1
BINARY_OP +
BINARY_OP *
STORE_FAST prime
LOAD_CONST 2
STORE_FAST p
LOAD_FAST p
LO... | def sum_Of_Primes(n):
prime = [True] * (n + 1)
p = 2
while p * p <= n:
if prime[p] == True:
i = p * 2
while i <= n:
prime[i] = False
i += p
p += 1
sum = 0
for i in range(2, n + 1):
if prime[i]:
sum += i
r... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 685,
"mbpp_split": "train",
"prompt": "Write a python function to find sum of prime numbers between 1 to n.",
"test_list": [
"assert sum_Of_Primes(10) == 17",
"assert sum_Of_Primes(20) == 77",
"assert sum_Of_Primes(5) == 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_685 | 93 |
66 | src/00066.py | pyc/00066.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST ('defaultdict',)
IMPORT_NAME collections
IMPORT_FROM defaultdict
STORE_NAME defaultdict
POP_TOP
LOAD_CONST <code freq_element>
MAKE_FUNCTION 0
STORE_NAME freq_element
RETURN_CONST None
END
CODE freq_element(test_tup)
RESUME 0
LOAD_GLOBAL NULL + ... | from collections import defaultdict
def freq_element(test_tup):
res = defaultdict(int)
for ele in test_tup:
res[ele] += 1
return str(dict(res)) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 686,
"mbpp_split": "train",
"prompt": "Write a function to find the frequency of each element in the given list.",
"test_list": [
"assert freq_element((4, 5, 4, 5, 6, 6, 5, 5, 4) ) == '{4: 3, 5: 4, 6: 2}'",
"assert freq_element((... | {
"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_686 | 43 |
67 | src/00067.py | pyc/00067.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME cmath
STORE_NAME cmath
LOAD_CONST <code len_complex>
MAKE_FUNCTION 0
STORE_NAME len_complex
RETURN_CONST None
END
CODE len_complex(a, b)
RESUME 0
LOAD_GLOBAL NULL + complex
LOAD_FAST a
LOAD_FAST b
CALL 2
STORE_FAST cn
LOAD... | import cmath
def len_complex(a, b):
cn = complex(a, b)
length = abs(cn)
return length | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 688,
"mbpp_split": "train",
"prompt": "Write a function to get the length of a complex number.",
"test_list": [
"assert len_complex(3,4)==5.0",
"assert len_complex(9,10)==13.45362404707371",
"assert len_complex(7,9)==11.40175... | {
"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_688 | 24 |
68 | src/00068.py | pyc/00068.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code min_jumps>
MAKE_FUNCTION 0
STORE_NAME min_jumps
RETURN_CONST None
END
CODE min_jumps(arr, n)
RESUME 0
LOAD_GLOBAL NULL + range
LOAD_FAST n
CALL 1
GET_ITER
LOAD_FAST_AND_CLEAR i
SWAP 2
L1:
BUILD_LIST 0
SWAP 2
L2:
FOR_ITER L3
STORE_FAST i
LOAD_CO... | def min_jumps(arr, n):
jumps = [0 for i in range(n)]
if n == 0 or arr[0] == 0:
return float('inf')
jumps[0] = 0
for i in range(1, n):
jumps[i] = float('inf')
for j in range(i):
if i <= j + arr[j] and jumps[j] != float('inf'):
jumps[i] = min(jumps[i], j... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 689,
"mbpp_split": "train",
"prompt": "## write a function to find the minimum number of jumps to reach the end of the array for the given array of integers where each element represents the max number of steps that can be made forward fro... | {
"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_689 | 123 |
69 | src/00069.py | pyc/00069.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code mul_consecutive_nums>
MAKE_FUNCTION 0
STORE_NAME mul_consecutive_nums
RETURN_CONST None
END
CODE mul_consecutive_nums(nums)
RESUME 0
LOAD_GLOBAL NULL + zip
LOAD_FAST nums
LOAD_CONST None
LOAD_CONST -1
BINARY_SLICE
LOAD_FAST nums
LOAD_CONST 1
LOAD_CON... | def mul_consecutive_nums(nums):
result = [b * a for a, b in zip(nums[:-1], nums[1:])]
return result | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 690,
"mbpp_split": "train",
"prompt": "Write a function to multiply consecutive numbers of a given list.",
"test_list": [
"assert mul_consecutive_nums([1, 1, 3, 4, 4, 5, 6, 7])==[1, 3, 12, 16, 20, 30, 42]",
"assert mul_consecutiv... | {
"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_690 | 52 |
70 | src/00070.py | pyc/00070.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 group_element>
MAKE_FUNCTION 0
STORE_NAME group_element
RETURN_CONST None
END
CODE group_element(test_list)
RESUME 0
LOAD_GLOBAL NULL + dict
CAL... | from itertools import groupby
def group_element(test_list):
res = dict()
for key, val in groupby(sorted(test_list, key=lambda ele: ele[1]), key=lambda ele: ele[1]):
res[key] = [ele[0] for ele in val]
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 691,
"mbpp_split": "train",
"prompt": "Write a function to group the 1st elements on the basis of 2nd elements in the given tuple list.",
"test_list": [
"assert group_element([(6, 5), (2, 7), (2, 5), (8, 7), (9, 8), (3, 7)]) == {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_691 | 84 |
71 | src/00071.py | pyc/00071.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code last_Two_Digits>
MAKE_FUNCTION 0
STORE_NAME last_Two_Digits
RETURN_CONST None
END
CODE last_Two_Digits(N)
RESUME 0
LOAD_FAST N
LOAD_CONST 10
COMPARE_OP >=
POP_JUMP_IF_FALSE L1
RETURN_CONST None
L1:
LOAD_CONST 1
STORE_FAST fac
LOAD_GLOBAL NULL + range... | def last_Two_Digits(N):
if N >= 10:
return
fac = 1
for i in range(1, N + 1):
fac = fac * i % 100
return fac | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 692,
"mbpp_split": "train",
"prompt": "Write a python function to find the last two digits in factorial of a given number.",
"test_list": [
"assert last_Two_Digits(7) == 40",
"assert last_Two_Digits(5) == 20",
"assert last_Tw... | {
"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_692 | 38 |
72 | src/00072.py | pyc/00072.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code check_greater>
MAKE_FUNCTION 0
STORE_NAME check_greater
RETURN_CONST None
END
CODE check_greater(test_tup1, test_tup2)
RESUME 0
LOAD_GLOBAL NULL + all
LOAD_CONST <code check_greater.<locals>.<genexpr>>
MAKE_FUNCTION 0
LOAD_GLOBAL NULL + zip
LOAD_FAST test_... | def check_greater(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": 695,
"mbpp_split": "train",
"prompt": "Write a function to check if each element of the second tuple is greater than its corresponding index in the first tuple.",
"test_list": [
"assert check_greater((10, 4, 5), (13, 5, 18)) == 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_695 | 48 |
73 | src/00073.py | pyc/00073.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code zip_list>
MAKE_FUNCTION 0
STORE_NAME zip_list
RETURN_CONST None
END
CODE zip_list(list1, list2)
RESUME 0
LOAD_GLOBAL NULL + list
LOAD_GLOBAL NULL + map
LOAD_GLOBAL list
LOAD_ATTR __add__
LOAD_FAST list1
LOAD_FAST list2
CALL 3
CALL 1
STORE_FAST resu... | def zip_list(list1, list2):
result = list(map(list.__add__, list1, list2))
return result | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 696,
"mbpp_split": "train",
"prompt": "Write a function to zip two given lists of lists.",
"test_list": [
"assert zip_list([[1, 3], [5, 7], [9, 11]] ,[[2, 4], [6, 8], [10, 12, 14]] )==[[1, 3, 2, 4], [5, 7, 6, 8], [9, 11, 10, 12, 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_696 | 20 |
74 | src/00074.py | pyc/00074.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code count_even>
MAKE_FUNCTION 0
STORE_NAME count_even
RETURN_CONST None
END
CODE count_even(array_nums)
RESUME 0
LOAD_GLOBAL NULL + len
LOAD_GLOBAL NULL + list
LOAD_GLOBAL NULL + filter
LOAD_CONST <code count_even.<locals>.<lambda>>
MAKE_FUNCTION 0
LOAD_FAST... | def count_even(array_nums):
count_even = len(list(filter(lambda x: x % 2 == 0, array_nums)))
return count_even | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 697,
"mbpp_split": "train",
"prompt": "Write a function to find number of even elements in the given list using lambda function.",
"test_list": [
"assert count_even([1, 2, 3, 5, 7, 8, 9, 10])==3",
"assert count_even([10,15,14,13,... | {
"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_697 | 30 |
75 | src/00075.py | pyc/00075.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code min_Swaps>
MAKE_FUNCTION 0
STORE_NAME min_Swaps
RETURN_CONST None
END
CODE min_Swaps(str1, str2)
RESUME 0
LOAD_CONST 0
STORE_FAST count
LOAD_GLOBAL NULL + range
LOAD_GLOBAL NULL + len
LOAD_FAST str1
CALL 1
CALL 1
GET_ITER
L1:
FOR_ITER L3
STORE_FA... | def min_Swaps(str1, str2):
count = 0
for i in range(len(str1)):
if str1[i] != str2[i]:
count += 1
if count % 2 == 0:
return count // 2
else:
return 'Not Possible' | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 699,
"mbpp_split": "train",
"prompt": "Write a python function to find the minimum number of swaps required to convert one binary string to another.",
"test_list": [
"assert min_Swaps(\"1101\",\"1110\") == 1",
"assert min_Swaps(\... | {
"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_699 | 49 |
76 | src/00076.py | pyc/00076.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code count_range_in_list>
MAKE_FUNCTION 0
STORE_NAME count_range_in_list
RETURN_CONST None
END
CODE count_range_in_list(li, min, max)
RESUME 0
LOAD_CONST 0
STORE_FAST ctr
LOAD_FAST li
GET_ITER
L1:
FOR_ITER L5
STORE_FAST x
LOAD_FAST min
LOAD_FAST x
SWAP ... | def count_range_in_list(li, min, max):
ctr = 0
for x in li:
if min <= x <= max:
ctr += 1
return ctr | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 700,
"mbpp_split": "train",
"prompt": "Write a function to count the number of elements in a list which are within a specific range.",
"test_list": [
"assert count_range_in_list([10,20,30,40,40,40,70,80,99],40,100)==6",
"assert c... | {
"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_700 | 41 |
77 | src/00077.py | pyc/00077.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code equilibrium_index>
MAKE_FUNCTION 0
STORE_NAME equilibrium_index
RETURN_CONST None
END
CODE equilibrium_index(arr)
RESUME 0
LOAD_GLOBAL NULL + sum
LOAD_FAST arr
CALL 1
STORE_FAST total_sum
LOAD_CONST 0
STORE_FAST left_sum
LOAD_GLOBAL NULL + enumerate
... | def equilibrium_index(arr):
total_sum = sum(arr)
left_sum = 0
for i, num in enumerate(arr):
total_sum -= num
if left_sum == total_sum:
return i
left_sum += num
return -1 | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 701,
"mbpp_split": "train",
"prompt": "Write a function to find the equilibrium index of the given array.",
"test_list": [
"assert equilibrium_index([1, 2, 3, 4, 1, 2, 3]) == 3",
"assert equilibrium_index([-7, 1, 5, 2, -4, 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_701 | 45 |
78 | src/00078.py | pyc/00078.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code harmonic_sum>
MAKE_FUNCTION 0
STORE_NAME harmonic_sum
RETURN_CONST None
END
CODE harmonic_sum(n)
RESUME 0
LOAD_FAST n
LOAD_CONST 2
COMPARE_OP <
POP_JUMP_IF_FALSE L1
RETURN_CONST 1
L1:
LOAD_CONST 1
LOAD_FAST n
BINARY_OP /
LOAD_GLOBAL NULL + harmonic... | def harmonic_sum(n):
if n < 2:
return 1
else:
return 1 / n + harmonic_sum(n - 1) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 704,
"mbpp_split": "train",
"prompt": "Write a function to calculate the harmonic sum of n-1.",
"test_list": [
"assert harmonic_sum(10)==2.9289682539682538",
"assert harmonic_sum(4)==2.083333333333333",
"assert harmonic_sum(7... | {
"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_704 | 25 |
79 | src/00079.py | pyc/00079.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code sort_sublists>
MAKE_FUNCTION 0
STORE_NAME sort_sublists
RETURN_CONST None
END
CODE sort_sublists(list1)
RESUME 0
LOAD_FAST list1
LOAD_ATTR NULL|self + sort
CALL 0
POP_TOP
LOAD_FAST list1
LOAD_ATTR NULL|self + sort
LOAD_GLOBAL len
KW_NAMES ('key',)
... | def sort_sublists(list1):
list1.sort()
list1.sort(key=len)
return list1 | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 705,
"mbpp_split": "train",
"prompt": "Write a function to sort a list of lists by length and value.",
"test_list": [
"assert sort_sublists([[2], [0], [1, 3], [0, 7], [9, 11], [13, 15, 17]])==[[0], [2], [0, 7], [1, 3], [9, 11], [13, ... | {
"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_705 | 21 |
80 | src/00080.py | pyc/00080.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code count_Set_Bits>
MAKE_FUNCTION 0
STORE_NAME count_Set_Bits
RETURN_CONST None
END
CODE count_Set_Bits(n)
RESUME 0
LOAD_FAST n
LOAD_CONST 1
BINARY_OP +=
STORE_FAST n
LOAD_CONST 2
STORE_FAST powerOf2
LOAD_FAST n
LOAD_CONST 2
BINARY_OP //
STORE_FAST c... | def count_Set_Bits(n):
n += 1
powerOf2 = 2
cnt = n // 2
while powerOf2 <= n:
totalPairs = n // powerOf2
cnt += totalPairs // 2 * powerOf2
if totalPairs & 1:
cnt += n % powerOf2
else:
cnt += 0
powerOf2 <<= 1
return cnt | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 707,
"mbpp_split": "train",
"prompt": "Write a python function to count the total set bits from 1 to n.",
"test_list": [
"assert count_Set_Bits(16) == 33",
"assert count_Set_Bits(2) == 2",
"assert count_Set_Bits(14) == 28"
... | {
"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_707 | 65 |
81 | src/00081.py | pyc/00081.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code Convert>
MAKE_FUNCTION 0
STORE_NAME Convert
RETURN_CONST None
END
CODE Convert(string)
RESUME 0
LOAD_GLOBAL NULL + list
LOAD_FAST string
LOAD_ATTR NULL|self + split
LOAD_CONST ' '
CALL 1
CALL 1
STORE_FAST li
LOAD_FAST li
RETURN_VALUE
END | def Convert(string):
li = list(string.split(' '))
return li | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 708,
"mbpp_split": "train",
"prompt": "Write a python function to convert a string to a list.",
"test_list": [
"assert Convert('python program') == ['python','program']",
"assert Convert('Data Analysis') ==['Data','Analysis']",
... | {
"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_708 | 18 |
82 | src/00082.py | pyc/00082.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST ('defaultdict',)
IMPORT_NAME collections
IMPORT_FROM defaultdict
STORE_NAME defaultdict
POP_TOP
LOAD_CONST <code get_unique>
MAKE_FUNCTION 0
STORE_NAME get_unique
RETURN_CONST None
END
CODE get_unique(test_list)
RESUME 0
LOAD_GLOBAL NULL + defau... | from collections import defaultdict
def get_unique(test_list):
res = defaultdict(list)
for sub in test_list:
res[sub[1]].append(sub[0])
res = dict(res)
res_dict = dict()
for key in res:
res_dict[key] = len(list(set(res[key])))
return str(res_dict) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 709,
"mbpp_split": "train",
"prompt": "Write a function to count unique keys for each value present in the tuple.",
"test_list": [
"assert get_unique([(3, 4), (1, 2), (2, 4), (8, 2), (7, 2), (8, 1), (9, 1), (8, 4), (10, 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_709 | 69 |
83 | src/00083.py | pyc/00083.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code front_and_rear>
MAKE_FUNCTION 0
STORE_NAME front_and_rear
RETURN_CONST None
END
CODE front_and_rear(test_tup)
RESUME 0
LOAD_FAST test_tup
LOAD_CONST 0
BINARY_SUBSCR
LOAD_FAST test_tup
LOAD_CONST -1
BINARY_SUBSCR
BUILD_TUPLE 2
STORE_FAST res
LOAD_FA... | def front_and_rear(test_tup):
res = (test_tup[0], test_tup[-1])
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 710,
"mbpp_split": "train",
"prompt": "Write a function to access the initial and last data of the given tuple record.",
"test_list": [
"assert front_and_rear((10, 4, 5, 6, 7)) == (10, 7)",
"assert front_and_rear((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_710 | 19 |
84 | src/00084.py | pyc/00084.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code product_Equal>
MAKE_FUNCTION 0
STORE_NAME product_Equal
RETURN_CONST None
END
CODE product_Equal(n)
RESUME 0
LOAD_FAST n
LOAD_CONST 10
COMPARE_OP <
POP_JUMP_IF_FALSE L1
RETURN_CONST False
L1:
LOAD_CONST 1
STORE_FAST prodOdd
LOAD_CONST 1
STORE_FAST ... | def product_Equal(n):
if n < 10:
return False
prodOdd = 1
prodEven = 1
while n > 0:
digit = n % 10
prodOdd *= digit
n = n // 10
if n == 0:
break
digit = n % 10
prodEven *= digit
n = n // 10
if prodOdd == prodEven:
re... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 711,
"mbpp_split": "train",
"prompt": "Write a python function to check whether the product of digits of a number at even and odd places is equal or not.",
"test_list": [
"assert product_Equal(2841) == True",
"assert product_Equa... | {
"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_711 | 67 |
85 | src/00085.py | pyc/00085.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME itertools
STORE_NAME itertools
LOAD_CONST <code remove_duplicate>
MAKE_FUNCTION 0
STORE_NAME remove_duplicate
RETURN_CONST None
END
CODE remove_duplicate(list1)
RESUME 0
LOAD_GLOBAL list
LOAD_ATTR NULL|self + sort
LOAD_FAST list... | import itertools
def remove_duplicate(list1):
list.sort(list1)
remove_duplicate = list((list1 for list1, _ in itertools.groupby(list1)))
return remove_duplicate | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 712,
"mbpp_split": "train",
"prompt": "Write a function to remove duplicates from a list of lists.",
"test_list": [
"assert remove_duplicate([[10, 20], [40], [30, 56, 25], [10, 20], [33], [40]])==[[10, 20], [30, 56, 25], [33], [40]] ... | {
"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_712 | 55 |
86 | src/00086.py | pyc/00086.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code check_valid>
MAKE_FUNCTION 0
STORE_NAME check_valid
RETURN_CONST None
END
CODE check_valid(test_tup)
RESUME 0
LOAD_GLOBAL NULL + any
LOAD_GLOBAL NULL + map
LOAD_CONST <code check_valid.<locals>.<lambda>>
MAKE_FUNCTION 0
LOAD_FAST test_tup
CALL 2
CALL 1... | def check_valid(test_tup):
res = not any(map(lambda ele: not ele, test_tup))
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 713,
"mbpp_split": "train",
"prompt": "Write a function to check if the given tuple contains all valid values or not.",
"test_list": [
"assert check_valid((True, True, True, True) ) == True",
"assert check_valid((True, False, Tru... | {
"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_713 | 26 |
87 | src/00087.py | pyc/00087.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code count_Fac>
MAKE_FUNCTION 0
STORE_NAME count_Fac
RETURN_CONST None
END
CODE count_Fac(n)
RESUME 0
LOAD_FAST n
STORE_FAST m
LOAD_CONST 0
STORE_FAST count
LOAD_CONST 2
STORE_FAST i
LOAD_FAST i
LOAD_FAST i
BINARY_OP *
LOAD_FAST m
COMPARE_OP <=
PO... | def count_Fac(n):
m = n
count = 0
i = 2
while i * i <= m:
total = 0
while n % i == 0:
n /= i
total += 1
temp = 0
j = 1
while temp + j <= total:
temp += j
count += 1
j += 1
i += 1
if n != 1:
... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 714,
"mbpp_split": "train",
"prompt": "Write a python function to count the number of distinct power of prime factor of given number.",
"test_list": [
"assert count_Fac(24) == 3",
"assert count_Fac(12) == 2",
"assert count_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_714 | 101 |
88 | src/00088.py | pyc/00088.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code rombus_perimeter>
MAKE_FUNCTION 0
STORE_NAME rombus_perimeter
RETURN_CONST None
END
CODE rombus_perimeter(a)
RESUME 0
LOAD_CONST 4
LOAD_FAST a
BINARY_OP *
STORE_FAST perimeter
LOAD_FAST perimeter
RETURN_VALUE
END | def rombus_perimeter(a):
perimeter = 4 * a
return perimeter | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 716,
"mbpp_split": "train",
"prompt": "Write a function to find the perimeter of a rombus.",
"test_list": [
"assert rombus_perimeter(10)==40",
"assert rombus_perimeter(5)==20",
"assert rombus_perimeter(4)==16"
],
"transfo... | {
"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_716 | 15 |
89 | src/00089.py | pyc/00089.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME math
STORE_NAME math
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME sys
STORE_NAME sys
LOAD_CONST <code sd_calc>
MAKE_FUNCTION 0
STORE_NAME sd_calc
LOAD_CONST <code avg_calc>
MAKE_FUNCTION 0
STORE_NAME avg_calc
RETURN_CONST None... | import math
import sys
def sd_calc(data):
n = len(data)
if n <= 1:
return 0.0
mean, sd = (avg_calc(data), 0.0)
for el in data:
sd += (float(el) - mean) ** 2
sd = math.sqrt(sd / float(n - 1))
return sd
def avg_calc(ls):
n, mean = (len(ls), 0.0)
if n <= 1:
return ... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 717,
"mbpp_split": "train",
"prompt": "Write a function to calculate the standard deviation.",
"test_list": [
"assert sd_calc([4, 2, 5, 8, 6])== 2.23606797749979",
"assert sd_calc([1,2,3,4,5,6,7])==2.160246899469287",
"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_717 | 107 |
90 | src/00090.py | pyc/00090.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code alternate_elements>
MAKE_FUNCTION 0
STORE_NAME alternate_elements
RETURN_CONST None
END
CODE alternate_elements(list1)
RESUME 0
BUILD_LIST 0
STORE_FAST result
LOAD_FAST list1
LOAD_CONST None
LOAD_CONST None
LOAD_CONST 2
BUILD_SLICE 3
BINARY_SUBSCR
... | def alternate_elements(list1):
result = []
for item in list1[::2]:
result.append(item)
return result | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 718,
"mbpp_split": "train",
"prompt": "Write a function to create a list taking alternate elements from another given list.",
"test_list": [
"assert alternate_elements([\"red\", \"black\", \"white\", \"green\", \"orange\"])==['red', ... | {
"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_718 | 31 |
91 | src/00091.py | pyc/00091.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME re
STORE_NAME re
LOAD_CONST <code text_match>
MAKE_FUNCTION 0
STORE_NAME text_match
RETURN_CONST None
END
CODE text_match(text)
RESUME 0
LOAD_CONST 'ab*?'
STORE_FAST patterns
LOAD_GLOBAL NULL + re
LOAD_ATTR search
LOAD_FAST ... | import re
def text_match(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": 719,
"mbpp_split": "train",
"prompt": "Write a function that matches a string that has an a followed by zero or more b's.",
"test_list": [
"assert text_match(\"ac\")==('Found a match!')",
"assert text_match(\"dc\")==('Not matched... | {
"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_719 | 24 |
92 | src/00092.py | pyc/00092.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code add_dict_to_tuple>
MAKE_FUNCTION 0
STORE_NAME add_dict_to_tuple
RETURN_CONST None
END
CODE add_dict_to_tuple(test_tup, test_dict)
RESUME 0
LOAD_GLOBAL NULL + list
LOAD_FAST test_tup
CALL 1
STORE_FAST test_tup
LOAD_FAST test_tup
LOAD_ATTR NULL|self + appe... | def add_dict_to_tuple(test_tup, test_dict):
test_tup = list(test_tup)
test_tup.append(test_dict)
test_tup = tuple(test_tup)
return test_tup | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 720,
"mbpp_split": "train",
"prompt": "Write a function to add a dictionary to the tuple.",
"test_list": [
"assert add_dict_to_tuple((4, 5, 6), {\"MSAM\" : 1, \"is\" : 2, \"best\" : 3} ) == (4, 5, 6, {'MSAM': 1, 'is': 2, 'best': 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_720 | 24 |
93 | src/00093.py | pyc/00093.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST ('eq',)
IMPORT_NAME operator
IMPORT_FROM eq
STORE_NAME eq
POP_TOP
LOAD_CONST <code count_same_pair>
MAKE_FUNCTION 0
STORE_NAME count_same_pair
RETURN_CONST None
END
CODE count_same_pair(nums1, nums2)
RESUME 0
LOAD_GLOBAL NULL + sum
LOAD_GLOBAL... | from operator import eq
def count_same_pair(nums1, nums2):
result = sum(map(eq, nums1, nums2))
return result | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 723,
"mbpp_split": "train",
"prompt": "Write a function to count the same pair in two given lists using map function.",
"test_list": [
"assert count_same_pair([1, 2, 3, 4, 5, 6, 7, 8],[2, 2, 3, 1, 2, 6, 7, 9])==4",
"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_723 | 25 |
94 | src/00094.py | pyc/00094.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code multiply_elements>
MAKE_FUNCTION 0
STORE_NAME multiply_elements
RETURN_CONST None
END
CODE multiply_elements(test_tup)
RESUME 0
LOAD_GLOBAL NULL + tuple
LOAD_CONST <code multiply_elements.<locals>.<genexpr>>
MAKE_FUNCTION 0
LOAD_GLOBAL NULL + zip
LOAD_FAST... | def multiply_elements(test_tup):
res = tuple((i * j for i, j in zip(test_tup, test_tup[1:])))
return res | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 726,
"mbpp_split": "train",
"prompt": "Write a function to multiply the adjacent elements of the given tuple.",
"test_list": [
"assert multiply_elements((1, 5, 7, 8, 10)) == (5, 35, 56, 80)",
"assert multiply_elements((2, 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_726 | 51 |
95 | src/00095.py | pyc/00095.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code sum_list>
MAKE_FUNCTION 0
STORE_NAME sum_list
RETURN_CONST None
END
CODE sum_list(lst1, lst2)
RESUME 0
LOAD_GLOBAL NULL + range
LOAD_GLOBAL NULL + len
LOAD_FAST lst1
CALL 1
CALL 1
GET_ITER
LOAD_FAST_AND_CLEAR i
SWAP 2
L1:
BUILD_LIST 0
SWAP 2
L2:
... | def sum_list(lst1, lst2):
res_list = [lst1[i] + lst2[i] for i in range(len(lst1))]
return res_list | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 728,
"mbpp_split": "train",
"prompt": "Write a function to sum elements in two lists.",
"test_list": [
"assert sum_list([10,20,30],[15,25,35])==[25,45,65]",
"assert sum_list([1,2,3],[5,6,7])==[6,8,10]",
"assert sum_list([15,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_728 | 46 |
96 | src/00096.py | pyc/00096.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code add_list>
MAKE_FUNCTION 0
STORE_NAME add_list
RETURN_CONST None
END
CODE add_list(nums1, nums2)
RESUME 0
LOAD_GLOBAL NULL + map
LOAD_CONST <code add_list.<locals>.<lambda>>
MAKE_FUNCTION 0
LOAD_FAST nums1
LOAD_FAST nums2
CALL 3
STORE_FAST result
LOAD... | def add_list(nums1, nums2):
result = map(lambda x, y: x + y, nums1, nums2)
return list(result) | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 729,
"mbpp_split": "train",
"prompt": "Write a function to add two lists using map and lambda function.",
"test_list": [
"assert add_list([1, 2, 3],[4,5,6])==[5, 7, 9]",
"assert add_list([1,2],[3,4])==[4,6]",
"assert add_list... | {
"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_729 | 27 |
97 | src/00097.py | pyc/00097.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 consecutive_duplicates>
MAKE_FUNCTION 0
STORE_NAME consecutive_duplicates
RETURN_CONST None
END
CODE consecutive_duplicates(nums)
RESUME 0
LOAD_GL... | from itertools import groupby
def consecutive_duplicates(nums):
return [key for key, group in groupby(nums)] | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 730,
"mbpp_split": "train",
"prompt": "Write a function to remove consecutive duplicates of a given list.",
"test_list": [
"assert consecutive_duplicates([0, 0, 1, 2, 3, 4, 4, 5, 6, 6, 6, 7, 8, 9, 4, 4 ])==[0, 1, 2, 3, 4, 5, 6, 7, 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_730 | 48 |
98 | src/00098.py | pyc/00098.pyc | CODE <module>()
RESUME 0
LOAD_CONST 0
LOAD_CONST None
IMPORT_NAME math
STORE_NAME math
LOAD_CONST <code lateralsurface_cone>
MAKE_FUNCTION 0
STORE_NAME lateralsurface_cone
RETURN_CONST None
END
CODE lateralsurface_cone(r, h)
RESUME 0
LOAD_GLOBAL NULL + math
LOAD_ATTR sqrt
LOAD_FAST r
LOAD_FA... | import math
def lateralsurface_cone(r, h):
l = math.sqrt(r * r + h * h)
LSA = math.pi * r * l
return LSA | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 731,
"mbpp_split": "train",
"prompt": "Write a function to find the lateral surface area of a cone.",
"test_list": [
"assert lateralsurface_cone(5,12)==204.20352248333654",
"assert lateralsurface_cone(10,15)==566.3586699569488",
... | {
"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_731 | 33 |
99 | src/00099.py | pyc/00099.pyc | CODE <module>()
RESUME 0
LOAD_CONST <code find_first_occurrence>
MAKE_FUNCTION 0
STORE_NAME find_first_occurrence
RETURN_CONST None
END
CODE find_first_occurrence(A, x)
RESUME 0
LOAD_CONST 0
LOAD_GLOBAL NULL + len
LOAD_FAST A
CALL 1
LOAD_CONST 1
BINARY_OP -
STORE_FAST right
STORE_FAST left
... | def find_first_occurrence(A, x):
left, right = (0, len(A) - 1)
result = -1
while left <= right:
mid = (left + right) // 2
if x == A[mid]:
result = mid
right = mid - 1
elif x < A[mid]:
right = mid - 1
else:
left = mid + 1
ret... | {
"dataset": "google-research-datasets/mbpp (config 'full')",
"task_id": 733,
"mbpp_split": "train",
"prompt": "Write a function to find the index of the first occurrence of a given number in a sorted array.",
"test_list": [
"assert find_first_occurrence([2, 5, 5, 5, 6, 6, 8, 9, 9, 9], 5) == 1",
"asse... | {
"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_733 | 69 |
Data card — MBPP held-out decompilation benchmark
383 MBPP reference solutions compiled to Python 3.12 bytecode and paired with their source, with
the original task_id restored on every row. Built 2026-08-04 by tools/build_mbpp_ood.py.
Redistributable under CC-BY-4.0, provided NOTICES.md ships alongside.
The set
| Rows | 383 (400 candidates − 17 contaminated) |
| Source | google-research-datasets/mbpp, config full |
| Licence | CC-BY-4.0 |
task_id restored |
383 / 383 (all distinct, range 11–973) |
| Untraceable rows dropped | 0 |
| Contaminated rows dropped | 17 (see below) |
| Disassembly length | mean 47.5 lines, median 41, max 187 |
| Python | 3.12, optimize=0 |
In what sense this set is independent of training — stated precisely, not as an adjective
It is a different corpus (google-research-datasets/mbpp, not
codeparrot/github-code-clean) and a different kind of code: short, self-contained,
hand-written answers to stated problems, against the training trunk's real project code with its
framework coupling and helper chains. Both differences are verifiable from row provenance.
That matters because the pilot's failure mode was a model learning the source of the data rather than the task, and a test set drawn from the training source cannot detect it.
It is not described as out-of-distribution anywhere, and no divergence statistic was computed, so no distributional-shift claim is made. The defensible claim is exactly three things: different source, different task style, and the verified non-overlap below.
Contamination — the defect that cost 17 rows
This set was originally decontaminated against the wrong corpus. build_ood_mbpp.py checked
against the v1-era 10k training labels, but the shipping model (v3) trained on 48,196 rows.
Re-checked against the corpus v3 actually trained on:
| gate | result |
|---|---|
| exact canonical match vs v3 corpus | 0 / 400 |
| identifier-blind fingerprint vs v3 corpus | 17 / 400 (4.25%) |
Those 17 are dropped. They are structural collisions rather than copied code — the fingerprint
erases literals, so re.sub(' +', ' ', t) and re.sub('[- ()]', '', s) collide despite computing
different things. The gate is applied anyway: it is the same gate build_final.py and the CSN
builder apply, and arguing with it case by case is precisely how the earlier provenance defects
happened.
After rebuild: 0 / 383 contamination against the v3 corpus, by either gate.
Task ids restored
build_ood_mbpp.py wrote only {input, expected}, so no row could be traced to its task, prompt
or tests. Recovery is exact rather than approximate: expected == canonicalise(mbpp["code"]), a
deterministic transform, so rebuilding the map over all 974 MBPP rows (974 rows → 965 distinct
canonical forms) recovers the id by lookup. All 400 rows matched; the builder refuses to emit a
row it cannot trace.
Each row now carries provenance.task_id, mbpp_split, the task prompt, and the test_list.
The tests travel with the row, so a behavioural check is possible on this set without going back
to the dataset.
Decontamination
Two stages. At original build time, against the 10k training labels of that era, by exact canonical match and by identifier-blind fingerprint (which caught 15 items exact match missed). At rebuild, against the 48,196-row corpus the shipping model actually trained on, removing a further 17 rows as above. Rows not adjudicable by the differential-execution oracle were excluded at original build time, so every row here was labelled by running it.
Changes made to the original, as CC-BY-4.0 §3(a)(1)(B) requires be indicated
Each reference solution was rewritten through ast.unparse — normalising away formatting,
comments and redundant parentheses — then compiled to a .pyc at optimize=0 and paired with a
disassembly of the resulting code object. Task text and tests are unmodified.
That rewrite changes the compiled bytecode on 1 of the 383 rows. CPython 3.12 inlines
comprehensions (PEP 709) and emits a cleanup entry in the exception table for the inlined scope;
how the comprehension is line-wrapped changes that entry. In src/00117.py (MBPP task_id
757) the original solution wraps a nested comprehension across lines, so its bytecode differs
from the normalised form shipped here. The instruction stream co_code is identical on all 383
rows; this row differs only in that exception-table entry.
The row is a valid decompilation task and the benchmark remains sound: for all 383 rows the
reference source and the .pyc are compiled from the same normalised string, which is the
condition the oracle needs. What the row is not is byte-identical to upstream MBPP — hence this
note. Re-deriving it from the original would put that solution's tab continuations and trailing
whitespace into the reference and make the label an unstable target, so it is documented instead.
Measured with tools/measure_format_ceiling.py; the general limit is in
../../EVAL.md §6.
Harness soundness on this set
grade.py --self-test-only: pre-flight 383/383 = 100%, mutation kill rate 199/199 = 100%,
0 survivors. Note what pre-flight does and does not prove — see ../../ORACLE-LIMITS.md.
Read this before quoting any "OOD" figure
The published PyBytecode figures labelled OOD-MBPP — 91.04% strict greedy, 97.49% certified@32,
100% docstring recovery — were not measured on this set. They were measured on
the superseded held-out set (n=279), which despite its name contains no MBPP at all: it is
GitHub source from the held-out shards of the training corpus. Matching all 974 canonicalised
MBPP rows against it yields 0 hits, against 400/400 for this set. Evidence in
../../LICENSING-DETERMINATION.md §4.
Those numbers remain valid measurements of held-out generalisation. They are not out-of-distribution measurements, and the label should be corrected wherever it appears.
No scores have been measured on this benchmark. Doing so requires a generation run (GPU).
Limitations
- MBPP solutions are short and stylistically uniform. Success here says little about long or framework-coupled functions; the CSN set is the harder distribution.
- Rows are the first 400 adjudicable MBPP tasks in split order, minus the 17 contaminated ones. Not a random sample.
- Two MBPP tasks with identical canonical solutions collapse to one row; 974 rows yield 965
distinct canonical forms, and the first
task_idwins.
Attribution
MBPP (Mostly Basic Python Problems), Austin et al., 2021, Google Research. https://huggingface.co/datasets/google-research-datasets/mbpp — CC-BY-4.0 (https://creativecommons.org/licenses/by/4.0/).
- Downloads last month
- 14