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
200
src/00200.py
pyc/00200.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_list_range> MAKE_FUNCTION 0 STORE_NAME remove_list_range RETURN_CONST None END CODE remove_list_range(list1, leftrange, rigthrange) RESUME 0 LOAD_FAST list1 GET_ITER LOAD_FAST_AND_CLEAR i SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L7 STORE_FA...
def remove_list_range(list1, leftrange, rigthrange): result = [i for i in list1 if min(i) >= leftrange and max(i) <= rigthrange] return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 869, "mbpp_split": "train", "prompt": "Write a function to remove sublists from a given list of lists, which are outside a given range.", "test_list": [ "assert remove_list_range([[2], [0], [1, 2, 3], [0, 1, 2, 3, 6, 7], [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_869
56
201
src/00201.py
pyc/00201.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_positivenum> MAKE_FUNCTION 0 STORE_NAME sum_positivenum RETURN_CONST None END CODE sum_positivenum(nums) RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + filter LOAD_CONST <code sum_positivenum.<locals>.<lambda>> MAKE_FUNCTION 0 LOAD_FAST nums CAL...
def sum_positivenum(nums): sum_positivenum = list(filter(lambda nums: nums > 0, nums)) return sum(sum_positivenum)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 870, "mbpp_split": "train", "prompt": "Write a function to calculate the sum of the positive numbers of a given list of numbers using lambda function.", "test_list": [ "assert sum_positivenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==48"...
{ "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_870
28
202
src/00202.py
pyc/00202.pyc
CODE <module>() RESUME 0 LOAD_CONST <code are_Rotations> MAKE_FUNCTION 0 STORE_NAME are_Rotations RETURN_CONST None END CODE are_Rotations(string1, string2) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST string1 CALL 1 STORE_FAST size1 LOAD_GLOBAL NULL + len LOAD_FAST string2 CALL 1 STORE_FAST si...
def are_Rotations(string1, string2): size1 = len(string1) size2 = len(string2) temp = '' if size1 != size2: return False temp = string1 + string1 if temp.count(string2) > 0: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 871, "mbpp_split": "train", "prompt": "Write a python function to check whether the given strings are rotations of each other or not.", "test_list": [ "assert are_Rotations(\"abc\",\"cba\") == False", "assert are_Rotations(\"abcd...
{ "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_871
39
203
src/00203.py
pyc/00203.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_subset> MAKE_FUNCTION 0 STORE_NAME check_subset RETURN_CONST None END CODE check_subset(list1, list2) RESUME 0 LOAD_GLOBAL NULL + all LOAD_GLOBAL NULL + map LOAD_FAST list1 LOAD_ATTR __contains__ LOAD_FAST list2 CALL 2 CALL 1 RETURN_VALUE END
def check_subset(list1, list2): return all(map(list1.__contains__, list2))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 872, "mbpp_split": "train", "prompt": "Write a function to check if a nested list is a subset of another nested list.", "test_list": [ "assert check_subset([[1, 3], [5, 7], [9, 11], [13, 15, 17]] ,[[1, 3],[13,15,17]])==True", "as...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_872
17
204
src/00204.py
pyc/00204.pyc
CODE <module>() RESUME 0 LOAD_CONST <code fibonacci> MAKE_FUNCTION 0 STORE_NAME fibonacci RETURN_CONST None END CODE fibonacci(n) RESUME 0 LOAD_FAST n LOAD_CONST 1 COMPARE_OP == POP_JUMP_IF_TRUE L1 LOAD_FAST n LOAD_CONST 2 COMPARE_OP == POP_JUMP_IF_FALSE L2 L1: RETURN_CONST 1 L2: LOAD_GL...
def fibonacci(n): if n == 1 or n == 2: return 1 else: return fibonacci(n - 1) + fibonacci(n - 2)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 873, "mbpp_split": "train", "prompt": "Write a function to solve the fibonacci sequence using recursion.", "test_list": [ "assert fibonacci(7) == 13", "assert fibonacci(8) == 21", "assert fibonacci(9) == 34" ], "transform...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_873
32
205
src/00205.py
pyc/00205.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_Concat> MAKE_FUNCTION 0 STORE_NAME check_Concat RETURN_CONST None END CODE check_Concat(str1, str2) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST str1 CALL 1 STORE_FAST N LOAD_GLOBAL NULL + len LOAD_FAST str2 CALL 1 STORE_FAST M LOAD_FAST N LOA...
def check_Concat(str1, str2): N = len(str1) M = len(str2) if N % M != 0: return False for i in range(N): if str1[i] != str2[i % M]: return False return True
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 874, "mbpp_split": "train", "prompt": "Write a python function to check if the string is a concatenation of another string.", "test_list": [ "assert check_Concat(\"abcabcabc\",\"abc\") == True", "assert check_Concat(\"abcab\",\"a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_874
49
206
src/00206.py
pyc/00206.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sort_String> MAKE_FUNCTION 0 STORE_NAME sort_String RETURN_CONST None END CODE sort_String(str) RESUME 0 LOAD_CONST '' LOAD_ATTR NULL|self + join LOAD_GLOBAL NULL + sorted LOAD_FAST str CALL 1 CALL 1 STORE_FAST str LOAD_FAST str RETURN_VALUE END
def sort_String(str): str = ''.join(sorted(str)) return str
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 877, "mbpp_split": "train", "prompt": "Write a python function to sort the given string.", "test_list": [ "assert sort_String(\"cba\") == \"abc\"", "assert sort_String(\"data\") == \"aadt\"", "assert sort_String(\"zxy\") == \...
{ "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_877
18
207
src/00207.py
pyc/00207.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_tuples> MAKE_FUNCTION 0 STORE_NAME check_tuples RETURN_CONST None END CODE check_tuples(test_tuple, K) MAKE_CELL K RESUME 0 LOAD_GLOBAL NULL + all LOAD_CLOSURE K BUILD_TUPLE 1 LOAD_CONST <code check_tuples.<locals>.<genexpr>> MAKE_FUNCTION closure ...
def check_tuples(test_tuple, K): res = all((ele in K for ele in test_tuple)) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 878, "mbpp_split": "train", "prompt": "Write a function to check if the given tuple contains only k elements.", "test_list": [ "assert check_tuples((3, 5, 6, 5, 3, 6),[3, 6, 5]) == True", "assert check_tuples((4, 5, 6, 4, 6, 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_878
47
208
src/00208.py
pyc/00208.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_even_odd> MAKE_FUNCTION 0 STORE_NAME sum_even_odd RETURN_CONST None END CODE sum_even_odd(list1) RESUME 0 LOAD_GLOBAL NULL + next LOAD_CONST <code sum_even_odd.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_FAST list1 GET_ITER CALL 0 LOAD_CONST -1 CALL...
def sum_even_odd(list1): first_even = next((el for el in list1 if el % 2 == 0), -1) first_odd = next((el for el in list1 if el % 2 != 0), -1) return first_even + first_odd
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 881, "mbpp_split": "train", "prompt": "Write a function to find the sum of first even and odd number of a given list.", "test_list": [ "assert sum_even_odd([1,3,5,7,4,1,6,8])==5", "assert sum_even_odd([1,2,3,4,5,6,7,8,9,10])==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_881
95
209
src/00209.py
pyc/00209.pyc
CODE <module>() RESUME 0 LOAD_CONST <code parallelogram_perimeter> MAKE_FUNCTION 0 STORE_NAME parallelogram_perimeter RETURN_CONST None END CODE parallelogram_perimeter(b, h) RESUME 0 LOAD_CONST 2 LOAD_FAST b LOAD_FAST h BINARY_OP * BINARY_OP * STORE_FAST perimeter LOAD_FAST perimeter RETURN...
def parallelogram_perimeter(b, h): perimeter = 2 * (b * h) return perimeter
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 882, "mbpp_split": "train", "prompt": "Write a function to caluclate perimeter of a parallelogram.", "test_list": [ "assert parallelogram_perimeter(10,20)==400", "assert parallelogram_perimeter(15,20)==600", "assert parallelo...
{ "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_882
17
210
src/00210.py
pyc/00210.pyc
CODE <module>() RESUME 0 LOAD_CONST <code div_of_nums> MAKE_FUNCTION 0 STORE_NAME div_of_nums RETURN_CONST None END CODE div_of_nums(nums, m, n) MAKE_CELL m MAKE_CELL n RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + filter LOAD_CLOSURE m LOAD_CLOSURE n BUILD_TUPLE 2 LOAD_CONST <code div...
def div_of_nums(nums, m, n): result = list(filter(lambda x: x % m == 0 and x % n == 0, nums)) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 883, "mbpp_split": "train", "prompt": "Write a function to find numbers divisible by m and n from a list of numbers using lambda function.", "test_list": [ "assert div_of_nums([19, 65, 57, 39, 152, 639, 121, 44, 90, 190],2,4)==[ 152,...
{ "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_883
43
211
src/00211.py
pyc/00211.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_Isomorphic> MAKE_FUNCTION 0 STORE_NAME is_Isomorphic RETURN_CONST None END CODE is_Isomorphic(str1, str2) RESUME 0 BUILD_MAP 0 STORE_FAST dict_str1 BUILD_MAP 0 STORE_FAST dict_str2 LOAD_GLOBAL NULL + enumerate LOAD_FAST str1 CALL 1 GET_ITER L1: ...
def is_Isomorphic(str1, str2): dict_str1 = {} dict_str2 = {} for i, value in enumerate(str1): dict_str1[value] = dict_str1.get(value, []) + [i] for j, value in enumerate(str2): dict_str2[value] = dict_str2.get(value, []) + [j] if sorted(dict_str1.values()) == sorted(dict_str2.values(...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 885, "mbpp_split": "train", "prompt": "Write a python function to check whether the two given strings are isomorphic to each other or not.", "test_list": [ "assert is_Isomorphic(\"paper\",\"title\") == True", "assert is_Isomorphi...
{ "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_885
74
212
src/00212.py
pyc/00212.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_num> MAKE_FUNCTION 0 STORE_NAME sum_num RETURN_CONST None END CODE sum_num(numbers) RESUME 0 LOAD_CONST 0 STORE_FAST total LOAD_FAST numbers GET_ITER L1: FOR_ITER L2 STORE_FAST x LOAD_FAST total LOAD_FAST x BINARY_OP += STORE_FAST total JUM...
def sum_num(numbers): total = 0 for x in numbers: total += x return total / len(numbers)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 886, "mbpp_split": "train", "prompt": "Write a function to add all the numbers in a list and divide it with the length of the list.", "test_list": [ "assert sum_num((8, 2, 3, 0, 7))==4.0", "assert sum_num((-10,-20,-30))==-20.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_886
29
213
src/00213.py
pyc/00213.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_odd> MAKE_FUNCTION 0 STORE_NAME is_odd RETURN_CONST None END CODE is_odd(n) RESUME 0 LOAD_FAST n LOAD_CONST 1 BINARY_OP ^ LOAD_FAST n LOAD_CONST 1 BINARY_OP - COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST True L1: RETURN_CONST False END
def is_odd(n): if n ^ 1 == n - 1: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 887, "mbpp_split": "train", "prompt": "Write a python function to check whether the given number is odd or not using bitwise operator.", "test_list": [ "assert is_odd(5) == True", "assert is_odd(6) == False", "assert is_odd(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_887
20
214
src/00214.py
pyc/00214.pyc
CODE <module>() RESUME 0 LOAD_CONST <code substract_elements> MAKE_FUNCTION 0 STORE_NAME substract_elements RETURN_CONST None END CODE substract_elements(test_tup1, test_tup2) RESUME 0 LOAD_GLOBAL NULL + tuple LOAD_CONST <code substract_elements.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_GLOBAL NULL +...
def substract_elements(test_tup1, test_tup2): res = tuple((tuple((a - b for a, b in zip(tup1, tup2))) for tup1, tup2 in zip(test_tup1, test_tup2))) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 888, "mbpp_split": "train", "prompt": "Write a function to substract the elements of the given nested tuples.", "test_list": [ "assert substract_elements(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((-5, -...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_888
81
215
src/00215.py
pyc/00215.pyc
CODE <module>() RESUME 0 LOAD_CONST <code reverse_list_lists> MAKE_FUNCTION 0 STORE_NAME reverse_list_lists RETURN_CONST None END CODE reverse_list_lists(lists) RESUME 0 LOAD_FAST lists GET_ITER L1: FOR_ITER L2 STORE_FAST l LOAD_FAST l LOAD_ATTR NULL|self + sort LOAD_CONST True KW_NAMES ('re...
def reverse_list_lists(lists): for l in lists: l.sort(reverse=True) return lists
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 889, "mbpp_split": "train", "prompt": "Write a function to reverse each list in a given list of lists.", "test_list": [ "assert reverse_list_lists([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]])==[[4, 3, 2, 1], [8, 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_889
25
216
src/00216.py
pyc/00216.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_Extra> MAKE_FUNCTION 0 STORE_NAME find_Extra RETURN_CONST None END CODE find_Extra(arr1, arr2, n) RESUME 0 LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_FAST n CALL 2 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_FAST arr1 LOAD_FAST i BINARY_SUBSC...
def find_Extra(arr1, arr2, n): for i in range(0, n): if arr1[i] != arr2[i]: return i return n
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 890, "mbpp_split": "train", "prompt": "Write a python function to find the index of an extra element present in one sorted array.", "test_list": [ "assert find_Extra([1,2,3,4],[1,2,3],3) == 3", "assert find_Extra([2,4,6,8,10],[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_890
35
217
src/00217.py
pyc/00217.pyc
CODE <module>() RESUME 0 LOAD_CONST <code same_Length> MAKE_FUNCTION 0 STORE_NAME same_Length RETURN_CONST None END CODE same_Length(A, B) RESUME 0 LOAD_FAST A LOAD_CONST 0 COMPARE_OP > POP_JUMP_IF_FALSE L2 LOAD_FAST B LOAD_CONST 0 COMPARE_OP > POP_JUMP_IF_FALSE L2 L1: LOAD_FAST A LOAD_C...
def same_Length(A, B): while A > 0 and B > 0: A = A / 10 B = B / 10 if A == 0 and B == 0: return True return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 891, "mbpp_split": "train", "prompt": "Write a python function to check whether the given two numbers have same number of digits or not.", "test_list": [ "assert same_Length(12,1) == False", "assert same_Length(2,2) == 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_891
47
218
src/00218.py
pyc/00218.pyc
CODE <module>() RESUME 0 LOAD_CONST <code max_sum_subseq> MAKE_FUNCTION 0 STORE_NAME max_sum_subseq RETURN_CONST None END CODE max_sum_subseq(A) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST A CALL 1 STORE_FAST n LOAD_FAST n LOAD_CONST 1 COMPARE_OP == POP_JUMP_IF_FALSE L1 LOAD_FAST A LOAD_CO...
def max_sum_subseq(A): n = len(A) if n == 1: return A[0] look_up = [None] * n look_up[0] = A[0] look_up[1] = max(A[0], A[1]) for i in range(2, n): look_up[i] = max(look_up[i - 1], look_up[i - 2] + A[i]) look_up[i] = max(look_up[i], A[i]) return look_up[n - 1]
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 895, "mbpp_split": "train", "prompt": "Write a function to find the maximum sum of subsequences of given array with no adjacent elements.", "test_list": [ "assert max_sum_subseq([1, 2, 9, 4, 5, 0, 4, 11, 6]) == 26", "assert max_s...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_895
91
219
src/00219.py
pyc/00219.pyc
CODE <module>() RESUME 0 LOAD_CONST <code last> MAKE_FUNCTION 0 STORE_NAME last LOAD_CONST <code sort_list_last> MAKE_FUNCTION 0 STORE_NAME sort_list_last RETURN_CONST None END CODE last(n) RESUME 0 LOAD_FAST n LOAD_CONST -1 BINARY_SUBSCR RETURN_VALUE END CODE sort_list_last(tuples) RESUME 0...
def last(n): return n[-1] def sort_list_last(tuples): return sorted(tuples, key=last)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 896, "mbpp_split": "train", "prompt": "Write a function to sort a list in increasing order by the last element in each tuple from a given list of non-empty tuples.", "test_list": [ "assert sort_list_last([(2, 5), (1, 2), (4, 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_896
25
220
src/00220.py
pyc/00220.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_Word_Present> MAKE_FUNCTION 0 STORE_NAME is_Word_Present RETURN_CONST None END CODE is_Word_Present(sentence, word) RESUME 0 LOAD_FAST sentence LOAD_ATTR NULL|self + split LOAD_CONST ' ' CALL 1 STORE_FAST s LOAD_FAST s GET_ITER L1: FOR_ITER L3 S...
def is_Word_Present(sentence, word): s = sentence.split(' ') for i in s: if i == word: return True return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 897, "mbpp_split": "train", "prompt": "Write a python function to check whether the word is present in a given sentence or not.", "test_list": [ "assert is_Word_Present(\"machine learning\",\"machine\") == True", "assert is_Word_...
{ "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_897
30
221
src/00221.py
pyc/00221.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 extract_elements> MAKE_FUNCTION 0 STORE_NAME extract_elements RETURN_CONST None END CODE extract_elements(numbers, n) RESUME 0 LOAD_GLOBAL NULL + ...
from itertools import groupby def extract_elements(numbers, n): result = [i for i, j in groupby(numbers) if len(list(j)) == n] return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 898, "mbpp_split": "train", "prompt": "Write a function to extract specified number of elements from a given list, which follow each other continuously.", "test_list": [ "assert extract_elements([1, 1, 3, 4, 4, 5, 6, 7],2)==[1, 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_898
61
222
src/00222.py
pyc/00222.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check> MAKE_FUNCTION 0 STORE_NAME check RETURN_CONST None END CODE check(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST g LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_FAST n CALL 2 GET_ITER L1: FOR_ITER L4 STORE_FAST i LOAD_FAST arr LOAD_FAST i BINAR...
def check(arr, n): g = 0 for i in range(1, n): if arr[i] - arr[i - 1] > 0 and g == 1: return False if arr[i] - arr[i] < 0: g = 1 return True
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 899, "mbpp_split": "train", "prompt": "Write a python function to check whether an array can be sorted or not by picking only the corner elements.", "test_list": [ "assert check([3,2,1,2,3,4],6) == True", "assert check([2,1,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_899
56
223
src/00223.py
pyc/00223.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code match_num> MAKE_FUNCTION 0 STORE_NAME match_num RETURN_CONST None END CODE match_num(string) RESUME 0 LOAD_GLOBAL NULL + re LOAD_ATTR compile LOAD_CONST '^5' CALL 1 STORE_FAST text LOAD_FA...
import re def match_num(string): text = re.compile('^5') if text.match(string): return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 900, "mbpp_split": "train", "prompt": "Write a function where a string will start with a specific number.", "test_list": [ "assert match_num('5-2345861')==True", "assert match_num('6-2345861')==False", "assert match_num('7891...
{ "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_900
26
224
src/00224.py
pyc/00224.pyc
CODE <module>() RESUME 0 LOAD_CONST <code smallest_multiple> MAKE_FUNCTION 0 STORE_NAME smallest_multiple RETURN_CONST None END CODE smallest_multiple(n) RESUME 0 LOAD_FAST n LOAD_CONST 2 COMPARE_OP <= POP_JUMP_IF_FALSE L1 LOAD_FAST n RETURN_VALUE L1: LOAD_FAST n LOAD_CONST 2 BINARY_OP * ...
def smallest_multiple(n): if n <= 2: return n i = n * 2 factors = [number for number in range(n, 1, -1) if number * 2 > n] while True: for a in factors: if i % a != 0: i += n break if a == factors[-1] and i % a == 0: ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 901, "mbpp_split": "train", "prompt": "Write a function to find the smallest multiple of the first n numbers.", "test_list": [ "assert smallest_multiple(13)==360360", "assert smallest_multiple(2)==2", "assert smallest_multipl...
{ "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_901
103
225
src/00225.py
pyc/00225.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST <code add_dict> MAKE_FUNCTION 0 STORE_NAME add_dict RETURN_CONST None END CODE add_dict(d1, d2) RESUME 0 LOAD_GLOBAL NULL + Counter LOAD_FAST d1 C...
from collections import Counter def add_dict(d1, d2): add_dict = Counter(d1) + Counter(d2) return add_dict
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 902, "mbpp_split": "train", "prompt": "Write a function to combine two dictionaries by adding values for common keys.", "test_list": [ "assert add_dict({'a': 100, 'b': 200, 'c':300},{'a': 300, 'b': 200, 'd':400})==({'b': 400, 'd': 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_902
25
226
src/00226.py
pyc/00226.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_Unset_Bits> MAKE_FUNCTION 0 STORE_NAME count_Unset_Bits RETURN_CONST None END CODE count_Unset_Bits(n) RESUME 0 LOAD_CONST 0 STORE_FAST cnt LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_FAST n LOAD_CONST 1 BINARY_OP + CALL 2 GET_ITER L1: FOR_I...
def count_Unset_Bits(n): cnt = 0 for i in range(1, n + 1): temp = i while temp: if temp % 2 == 0: cnt += 1 temp = temp // 2 return cnt
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 903, "mbpp_split": "train", "prompt": "Write a python function to count the total unset bits from 1 to n.", "test_list": [ "assert count_Unset_Bits(2) == 1", "assert count_Unset_Bits(5) == 4", "assert count_Unset_Bits(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_903
51
227
src/00227.py
pyc/00227.pyc
CODE <module>() RESUME 0 LOAD_CONST <code even_num> MAKE_FUNCTION 0 STORE_NAME even_num RETURN_CONST None END CODE even_num(x) RESUME 0 LOAD_FAST x LOAD_CONST 2 BINARY_OP % LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST True L1: RETURN_CONST False END
def even_num(x): if x % 2 == 0: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 904, "mbpp_split": "train", "prompt": "Write a function to return true if the given number is even else return false.", "test_list": [ "assert even_num(13.5)==False", "assert even_num(0)==True", "assert even_num(-9)==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_904
18
228
src/00228.py
pyc/00228.pyc
CODE <module>() RESUME 0 LOAD_CONST <code factorial> MAKE_FUNCTION 0 STORE_NAME factorial LOAD_CONST <code sum_of_square> MAKE_FUNCTION 0 STORE_NAME sum_of_square RETURN_CONST None END CODE factorial(start, end) RESUME 0 LOAD_CONST 1 STORE_FAST res LOAD_GLOBAL NULL + range LOAD_FAST start LO...
def factorial(start, end): res = 1 for i in range(start, end + 1): res *= i return res def sum_of_square(n): return int(factorial(n + 1, 2 * n) / factorial(1, n))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 905, "mbpp_split": "train", "prompt": "Write a python function to find the sum of squares of binomial co-efficients.", "test_list": [ "assert sum_of_square(4) == 70", "assert sum_of_square(5) == 252", "assert sum_of_square(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_905
52
229
src/00229.py
pyc/00229.pyc
CODE <module>() RESUME 0 LOAD_CONST <code lucky_num> MAKE_FUNCTION 0 STORE_NAME lucky_num RETURN_CONST None END CODE lucky_num(n) RESUME 0 LOAD_GLOBAL NULL + range LOAD_CONST -1 LOAD_FAST n LOAD_FAST n BINARY_OP * LOAD_CONST 9 BINARY_OP + LOAD_CONST 2 CALL 3 STORE_FAST List LOAD_CONST ...
def lucky_num(n): List = range(-1, n * n + 9, 2) i = 2 while List[i:]: List = sorted(set(List) - set(List[List[i]::List[i]])) i += 1 return List[1:n + 1]
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 907, "mbpp_split": "train", "prompt": "Write a function to print the first n lucky numbers.", "test_list": [ "assert lucky_num(10)==[1, 3, 7, 9, 13, 15, 21, 25, 31, 33] ", "assert lucky_num(5)==[1, 3, 7, 9, 13]", "assert luck...
{ "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_907
64
230
src/00230.py
pyc/00230.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_fixed_point> MAKE_FUNCTION 0 STORE_NAME find_fixed_point RETURN_CONST None END CODE find_fixed_point(arr, n) RESUME 0 LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_FAST arr LOAD_FAST i BINARY_SUBSCR L...
def find_fixed_point(arr, n): for i in range(n): if arr[i] is i: return i return -1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 908, "mbpp_split": "train", "prompt": "Write a function to find the fixed point in the given array.", "test_list": [ "assert find_fixed_point([-10, -1, 0, 3, 10, 11, 30, 50, 100],9) == 3", "assert find_fixed_point([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_908
31
231
src/00231.py
pyc/00231.pyc
CODE <module>() RESUME 0 LOAD_CONST <code previous_palindrome> MAKE_FUNCTION 0 STORE_NAME previous_palindrome RETURN_CONST None END CODE previous_palindrome(num) RESUME 0 LOAD_GLOBAL NULL + range LOAD_FAST num LOAD_CONST 1 BINARY_OP - LOAD_CONST 0 LOAD_CONST -1 CALL 3 GET_ITER L1: FOR_ITER...
def previous_palindrome(num): for x in range(num - 1, 0, -1): if str(x) == str(x)[::-1]: return x
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 909, "mbpp_split": "train", "prompt": "Write a function to find the previous palindrome of a specified number.", "test_list": [ "assert previous_palindrome(99)==88", "assert previous_palindrome(1221)==1111", "assert previous_...
{ "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_909
42
232
src/00232.py
pyc/00232.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME datetime STORE_NAME datetime LOAD_CONST <code check_date> MAKE_FUNCTION 0 STORE_NAME check_date RETURN_CONST None END CODE check_date(m, d, y) RESUME 0 NOP L1: LOAD_GLOBAL NULL + map LOAD_GLOBAL int LOAD_FAST m LOAD_FAST d ...
import datetime def check_date(m, d, y): try: m, d, y = map(int, (m, d, y)) datetime.date(y, m, d) return True except ValueError: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 910, "mbpp_split": "train", "prompt": "Write a function to validate a gregorian date.", "test_list": [ "assert check_date(11,11,2002)==True", "assert check_date(13,11,2002)==False", "assert check_date('11','11','2002')==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_910
53
233
src/00233.py
pyc/00233.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code end_num> MAKE_FUNCTION 0 STORE_NAME end_num RETURN_CONST None END CODE end_num(string) RESUME 0 LOAD_GLOBAL NULL + re LOAD_ATTR compile LOAD_CONST '.*[0-9]$' CALL 1 STORE_FAST text LOAD_FA...
import re def end_num(string): text = re.compile('.*[0-9]$') if text.match(string): return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 913, "mbpp_split": "train", "prompt": "Write a function to check for a number at the end of a string.", "test_list": [ "assert end_num('abcdef')==False", "assert end_num('abcdef7')==True", "assert end_num('abc')==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_913
26
234
src/00234.py
pyc/00234.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_Two_Alter> MAKE_FUNCTION 0 STORE_NAME is_Two_Alter RETURN_CONST None END CODE is_Two_Alter(s) RESUME 0 LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST s CALL 1 LOAD_CONST 2 BINARY_OP - CALL 1 GET_ITER L1: FOR_ITER L3 STORE_FAST i L...
def is_Two_Alter(s): for i in range(len(s) - 2): if s[i] != s[i + 2]: return False if s[0] == s[1]: return False return True
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 914, "mbpp_split": "train", "prompt": "Write a python function to check whether the given string is made up of two alternating characters or not.", "test_list": [ "assert is_Two_Alter(\"abab\") == True", "assert is_Two_Alter(\"aa...
{ "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_914
47
235
src/00235.py
pyc/00235.pyc
CODE <module>() RESUME 0 LOAD_CONST <code rearrange_numbs> MAKE_FUNCTION 0 STORE_NAME rearrange_numbs RETURN_CONST None END CODE rearrange_numbs(array_nums) RESUME 0 LOAD_GLOBAL NULL + sorted LOAD_FAST array_nums LOAD_CONST <code rearrange_numbs.<locals>.<lambda>> MAKE_FUNCTION 0 KW_NAMES ('key',)...
def rearrange_numbs(array_nums): result = sorted(array_nums, key=lambda i: 0 if i == 0 else -1 / i) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 915, "mbpp_split": "train", "prompt": "Write a function to rearrange positive and negative numbers in a given array using lambda function.", "test_list": [ "assert rearrange_numbs([-1, 2, -3, 5, 7, 8, 9, -10])==[2, 5, 7, 8, 9, -10, -...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_915
32
236
src/00236.py
pyc/00236.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_triplet_array> MAKE_FUNCTION 0 STORE_NAME find_triplet_array RETURN_CONST None END CODE find_triplet_array(A, arr_size, sum) RESUME 0 LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_FAST arr_size LOAD_CONST 2 BINARY_OP - CALL 2 GET_ITER L1: FOR_ITER ...
def find_triplet_array(A, arr_size, sum): for i in range(0, arr_size - 2): for j in range(i + 1, arr_size - 1): for k in range(j + 1, arr_size): if A[i] + A[j] + A[k] == sum: return (A[i], A[j], A[k]) return True return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 916, "mbpp_split": "train", "prompt": "Write a function to find if there is a triplet in the array whose sum is equal to a given value.", "test_list": [ "assert find_triplet_array([1, 4, 45, 6, 10, 8], 6, 22) == (4, 10, 8)", "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_916
83
237
src/00237.py
pyc/00237.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code text_uppercase_lowercase> MAKE_FUNCTION 0 STORE_NAME text_uppercase_lowercase RETURN_CONST None END CODE text_uppercase_lowercase(text) RESUME 0 LOAD_CONST '[A-Z]+[a-z]+$' STORE_FAST patterns LO...
import re def text_uppercase_lowercase(text): patterns = '[A-Z]+[a-z]+$' if re.search(patterns, text): return 'Found a match!' else: return 'Not matched!'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 917, "mbpp_split": "train", "prompt": "Write a function to find the sequences of one upper case letter followed by lower case letters.", "test_list": [ "assert text_uppercase_lowercase(\"AaBbGg\")==('Found a match!')", "assert te...
{ "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_917
24
238
src/00238.py
pyc/00238.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_tuple> MAKE_FUNCTION 0 STORE_NAME remove_tuple RETURN_CONST None END CODE remove_tuple(test_list) RESUME 0 LOAD_FAST test_list GET_ITER LOAD_FAST_AND_CLEAR sub SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L5 STORE_FAST sub LOAD_GLOBAL NULL + ...
def remove_tuple(test_list): res = [sub for sub in test_list if not all((ele == None for ele in sub))] return str(res)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 920, "mbpp_split": "train", "prompt": "Write a function to remove all tuples with all none values in the given tuple list.", "test_list": [ "assert remove_tuple([(None, 2), (None, None), (3, 4), (12, 3), (None, )] ) == '[(None, 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_920
74
239
src/00239.py
pyc/00239.pyc
CODE <module>() RESUME 0 LOAD_CONST <code chunk_tuples> MAKE_FUNCTION 0 STORE_NAME chunk_tuples RETURN_CONST None END CODE chunk_tuples(test_tup, N) RESUME 0 LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_GLOBAL NULL + len LOAD_FAST test_tup CALL 1 LOAD_FAST N CALL 3 GET_ITER LOAD_FAST_AND_CLE...
def chunk_tuples(test_tup, N): res = [test_tup[i:i + N] for i in range(0, len(test_tup), N)] return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 921, "mbpp_split": "train", "prompt": "Write a function to perform chunking of tuples each of size n.", "test_list": [ "assert chunk_tuples((10, 4, 5, 6, 7, 6, 8, 3, 4), 3) == [(10, 4, 5), (6, 7, 6), (8, 3, 4)]", "assert chunk_tu...
{ "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_921
47
240
src/00240.py
pyc/00240.pyc
CODE <module>() RESUME 0 LOAD_CONST <code max_product> MAKE_FUNCTION 0 STORE_NAME max_product RETURN_CONST None END CODE max_product(arr) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST arr CALL 1 STORE_FAST arr_len LOAD_FAST arr_len LOAD_CONST 2 COMPARE_OP < POP_JUMP_IF_FALSE L1 RETURN_CONST No...
def max_product(arr): arr_len = len(arr) if arr_len < 2: return None x = arr[0] y = arr[1] for i in range(0, arr_len): for j in range(i + 1, arr_len): if arr[i] * arr[j] > x * y: x = arr[i] y = arr[j] return (x, y)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 922, "mbpp_split": "train", "prompt": "Write a function to find a pair with the highest product from a given array of integers.", "test_list": [ "assert max_product([1, 2, 3, 4, 7, 0, 8, 4])==(7, 8)", "assert max_product([0, -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_922
77
241
src/00241.py
pyc/00241.pyc
CODE <module>() RESUME 0 LOAD_CONST <code super_seq> MAKE_FUNCTION 0 STORE_NAME super_seq RETURN_CONST None END CODE super_seq(X, Y, m, n) RESUME 0 LOAD_FAST m POP_JUMP_IF_TRUE L1 LOAD_FAST n RETURN_VALUE L1: LOAD_FAST n POP_JUMP_IF_TRUE L2 LOAD_FAST m RETURN_VALUE L2: LOAD_FAST X LOAD_F...
def super_seq(X, Y, m, n): if not m: return n if not n: return m if X[m - 1] == Y[n - 1]: return 1 + super_seq(X, Y, m - 1, n - 1) return 1 + min(super_seq(X, Y, m - 1, n), super_seq(X, Y, m, n - 1))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 923, "mbpp_split": "train", "prompt": "Write a function to find the length of the shortest string that has both str1 and str2 as subsequences.", "test_list": [ "assert super_seq(\"AGGTAB\", \"GXTXAYB\", 6, 7) == 9", "assert super...
{ "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_923
66
242
src/00242.py
pyc/00242.pyc
CODE <module>() RESUME 0 LOAD_CONST <code max_of_two> MAKE_FUNCTION 0 STORE_NAME max_of_two RETURN_CONST None END CODE max_of_two(x, y) RESUME 0 LOAD_FAST x LOAD_FAST y COMPARE_OP > POP_JUMP_IF_FALSE L1 LOAD_FAST x RETURN_VALUE L1: LOAD_FAST y RETURN_VALUE END
def max_of_two(x, y): if x > y: return x return y
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 924, "mbpp_split": "train", "prompt": "Write a function to find maximum of two numbers.", "test_list": [ "assert max_of_two(10,20)==20", "assert max_of_two(19,15)==19", "assert max_of_two(-10,-20)==-10" ], "transform": "a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_924
18
243
src/00243.py
pyc/00243.pyc
CODE <module>() RESUME 0 LOAD_CONST <code mutiple_tuple> MAKE_FUNCTION 0 STORE_NAME mutiple_tuple RETURN_CONST None END CODE mutiple_tuple(nums) RESUME 0 LOAD_GLOBAL NULL + list LOAD_FAST nums CALL 1 STORE_FAST temp LOAD_CONST 1 STORE_FAST product LOAD_FAST temp GET_ITER L1: FOR_ITER L2 ...
def mutiple_tuple(nums): temp = list(nums) product = 1 for x in temp: product *= x return product
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 925, "mbpp_split": "train", "prompt": "Write a python function to calculate the product of all the numbers of a given tuple.", "test_list": [ "assert mutiple_tuple((4, 3, 2, 2, -1, 18)) == -864", "assert mutiple_tuple((1,2,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_925
29
244
src/00244.py
pyc/00244.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code change_date_format> MAKE_FUNCTION 0 STORE_NAME change_date_format RETURN_CONST None END CODE change_date_format(dt) RESUME 0 LOAD_GLOBAL NULL + re LOAD_ATTR sub LOAD_CONST '(\\d{4})-(\\d{1,2})-(...
import re def change_date_format(dt): return re.sub('(\\d{4})-(\\d{1,2})-(\\d{1,2})', '\\3-\\2-\\1', dt) return change_date_format(dt)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 928, "mbpp_split": "train", "prompt": "Write a function to convert a date of yyyy-mm-dd format to dd-mm-yyyy format.", "test_list": [ "assert change_date_format('2026-01-02')=='02-01-2026'", "assert change_date_format('2021-01-04...
{ "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_928
20
245
src/00245.py
pyc/00245.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code sum_series> MAKE_FUNCTION 0 STORE_NAME sum_series RETURN_CONST None END CODE sum_series(number) RESUME 0 LOAD_CONST 0 STORE_FAST total LOAD_GLOBAL NULL + math LOAD_ATTR pow LOAD_FAST num...
import math def sum_series(number): total = 0 total = math.pow(number * (number + 1) / 2, 2) return total
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 931, "mbpp_split": "train", "prompt": "Write a function to calculate the sum of series 1³+2³+3³+….+n³.", "test_list": [ "assert sum_series(7)==784", "assert sum_series(5)==225", "assert sum_series(15)==14400" ], "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_931
29
246
src/00246.py
pyc/00246.pyc
CODE <module>() RESUME 0 LOAD_CONST <code dealnnoy_num> MAKE_FUNCTION 0 STORE_NAME dealnnoy_num RETURN_CONST None END CODE dealnnoy_num(n, m) RESUME 0 LOAD_FAST m LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_TRUE L1 LOAD_FAST n LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L2 L1: RETURN_CONST 1 L...
def dealnnoy_num(n, m): if m == 0 or n == 0: return 1 return dealnnoy_num(m - 1, n) + dealnnoy_num(m - 1, n - 1) + dealnnoy_num(m, n - 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 934, "mbpp_split": "train", "prompt": "Write a function to find the nth delannoy number.", "test_list": [ "assert dealnnoy_num(3, 4) == 129", "assert dealnnoy_num(3, 3) == 63", "assert dealnnoy_num(4, 5) == 681" ], "trans...
{ "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_934
43
247
src/00247.py
pyc/00247.pyc
CODE <module>() RESUME 0 LOAD_CONST <code series_sum> MAKE_FUNCTION 0 STORE_NAME series_sum RETURN_CONST None END CODE series_sum(number) RESUME 0 LOAD_CONST 0 STORE_FAST total LOAD_FAST number LOAD_FAST number LOAD_CONST 1 BINARY_OP + BINARY_OP * LOAD_CONST 2 LOAD_FAST number BINARY_OP ...
def series_sum(number): total = 0 total = number * (number + 1) * (2 * number + 1) / 6 return total
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 935, "mbpp_split": "train", "prompt": "Write a function to calculate the sum of series 1²+2²+3²+….+n².", "test_list": [ "assert series_sum(6)==91", "assert series_sum(7)==140", "assert series_sum(12)==650" ], "transform":...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_935
27
248
src/00248.py
pyc/00248.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST <code max_char> MAKE_FUNCTION 0 STORE_NAME max_char RETURN_CONST None END CODE max_char(str1) RESUME 0 LOAD_GLOBAL NULL + Counter LOAD_FAST str1 C...
from collections import Counter def max_char(str1): temp = Counter(str1) max_char = max(temp, key=temp.get) return max_char
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 937, "mbpp_split": "train", "prompt": "Write a function to count the most common character in a given string.", "test_list": [ "assert max_char(\"hello world\")==('l')", "assert max_char(\"hello \")==('l')", "assert max_char(...
{ "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_937
28
249
src/00249.py
pyc/00249.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sorted_models> MAKE_FUNCTION 0 STORE_NAME sorted_models RETURN_CONST None END CODE sorted_models(models) RESUME 0 LOAD_GLOBAL NULL + sorted LOAD_FAST models LOAD_CONST <code sorted_models.<locals>.<lambda>> MAKE_FUNCTION 0 KW_NAMES ('key',) CALL 2 STOR...
def sorted_models(models): sorted_models = sorted(models, key=lambda x: x['color']) return sorted_models
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 939, "mbpp_split": "train", "prompt": "Write a function to sort a list of dictionaries using lambda function.", "test_list": [ "assert sorted_models([{'make':'Nokia', 'model':216, 'color':'Black'}, {'make':'Mi Max', 'model':2, 'color...
{ "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_939
25
250
src/00250.py
pyc/00250.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_elim> MAKE_FUNCTION 0 STORE_NAME count_elim RETURN_CONST None END CODE count_elim(num) RESUME 0 LOAD_CONST 0 STORE_FAST count_elim LOAD_FAST num GET_ITER L1: FOR_ITER L3 STORE_FAST n LOAD_GLOBAL NULL + isinstance LOAD_FAST n LOAD_GLOBAL tuple...
def count_elim(num): count_elim = 0 for n in num: if isinstance(n, tuple): break count_elim += 1 return count_elim
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 941, "mbpp_split": "train", "prompt": "Write a function to count the elements in a list until an element is a tuple.", "test_list": [ "assert count_elim([10,20,30,(10,20),40])==3", "assert count_elim([10,(20,30),(10,20),40])==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_941
34
251
src/00251.py
pyc/00251.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_element> MAKE_FUNCTION 0 STORE_NAME check_element RETURN_CONST None END CODE check_element(test_tup, check_list) RESUME 0 LOAD_CONST False STORE_FAST res LOAD_FAST check_list GET_ITER L1: FOR_ITER L3 STORE_FAST ele LOAD_FAST ele LOAD_FAST test_...
def check_element(test_tup, check_list): res = False for ele in check_list: if ele in test_tup: res = True break return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 942, "mbpp_split": "train", "prompt": "Write a function to check if any list element is present in the given list.", "test_list": [ "assert check_element((4, 5, 7, 9, 3), [6, 7, 10, 11]) == True", "assert check_element((1, 2, 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_942
31
252
src/00252.py
pyc/00252.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('merge',) IMPORT_NAME heapq IMPORT_FROM merge STORE_NAME merge POP_TOP LOAD_CONST <code combine_lists> MAKE_FUNCTION 0 STORE_NAME combine_lists RETURN_CONST None END CODE combine_lists(num1, num2) RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL ...
from heapq import merge def combine_lists(num1, num2): combine_lists = list(merge(num1, num2)) return combine_lists
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 943, "mbpp_split": "train", "prompt": "Write a function to combine two given sorted lists using heapq module.", "test_list": [ "assert combine_lists([1, 3, 5, 7, 9, 11],[0, 2, 4, 6, 8, 10])==[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 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_943
24
253
src/00253.py
pyc/00253.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code num_position> MAKE_FUNCTION 0 STORE_NAME num_position RETURN_CONST None END CODE num_position(text) RESUME 0 LOAD_GLOBAL NULL + re LOAD_ATTR finditer LOAD_CONST '\\d+' LOAD_FAST text CALL 2 ...
import re def num_position(text): for m in re.finditer('\\d+', text): return m.start()
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 944, "mbpp_split": "train", "prompt": "Write a function to separate and print the numbers and their position of a given string.", "test_list": [ "assert num_position(\"there are 70 flats in this apartment\")==10", "assert num_pos...
{ "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_944
30
254
src/00254.py
pyc/00254.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST <code most_common_elem> MAKE_FUNCTION 0 STORE_NAME most_common_elem RETURN_CONST None END CODE most_common_elem(s, a) RESUME 0 LOAD_GLOBAL NULL + Coun...
from collections import Counter def most_common_elem(s, a): most_common_elem = Counter(s).most_common(a) return most_common_elem
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 946, "mbpp_split": "train", "prompt": "Write a function to find the most common elements and their counts of a specified text.", "test_list": [ "assert most_common_elem('lkseropewdssafsdfafkpwe',3)==[('s', 4), ('e', 3), ('f', 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_946
24
255
src/00255.py
pyc/00255.pyc
CODE <module>() RESUME 0 LOAD_CONST <code len_log> MAKE_FUNCTION 0 STORE_NAME len_log RETURN_CONST None END CODE len_log(list1) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST list1 LOAD_CONST 0 BINARY_SUBSCR CALL 1 STORE_FAST min LOAD_FAST list1 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_GL...
def len_log(list1): min = len(list1[0]) for i in list1: if len(i) < min: min = len(i) return min
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 947, "mbpp_split": "train", "prompt": "Write a python function to find the length of the shortest word.", "test_list": [ "assert len_log([\"win\",\"lose\",\"great\"]) == 3", "assert len_log([\"a\",\"ab\",\"abc\"]) == 1", "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_947
37
256
src/00256.py
pyc/00256.pyc
CODE <module>() RESUME 0 LOAD_CONST <code get_item> MAKE_FUNCTION 0 STORE_NAME get_item RETURN_CONST None END CODE get_item(tup1, index) RESUME 0 LOAD_FAST tup1 LOAD_FAST index BINARY_SUBSCR STORE_FAST item LOAD_FAST item RETURN_VALUE END
def get_item(tup1, index): item = tup1[index] return item
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 948, "mbpp_split": "train", "prompt": "Write a function to get an item of a tuple.", "test_list": [ "assert get_item((\"w\", 3, \"r\", \"e\", \"s\", \"o\", \"u\", \"r\", \"c\", \"e\"),3)==('e')", "assert get_item((\"w\", 3, \"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_948
15
257
src/00257.py
pyc/00257.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_digs> MAKE_FUNCTION 0 STORE_NAME count_digs LOAD_CONST <code sort_list> MAKE_FUNCTION 0 STORE_NAME sort_list RETURN_CONST None END CODE count_digs(tup) RESUME 0 LOAD_GLOBAL NULL + sum LOAD_FAST tup GET_ITER LOAD_FAST_AND_CLEAR ele SWAP 2 L1: ...
def count_digs(tup): return sum([len(str(ele)) for ele in tup]) def sort_list(test_list): test_list.sort(key=count_digs) return str(test_list)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 949, "mbpp_split": "train", "prompt": "Write a function to sort the given tuple list basis the total digits in tuple.", "test_list": [ "assert sort_list([(3, 4, 6, 723), (1, 2), (12345,), (134, 234, 34)] ) == '[(1, 2), (12345,), (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_949
57
258
src/00258.py
pyc/00258.pyc
CODE <module>() RESUME 0 LOAD_CONST <code chinese_zodiac> MAKE_FUNCTION 0 STORE_NAME chinese_zodiac RETURN_CONST None END CODE chinese_zodiac(year) RESUME 0 LOAD_FAST year LOAD_CONST 2000 BINARY_OP - LOAD_CONST 12 BINARY_OP % LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 LOAD_CONST 'Drag...
def chinese_zodiac(year): if (year - 2000) % 12 == 0: sign = 'Dragon' elif (year - 2000) % 12 == 1: sign = 'Snake' elif (year - 2000) % 12 == 2: sign = 'Horse' elif (year - 2000) % 12 == 3: sign = 'sheep' elif (year - 2000) % 12 == 4: sign = 'Monkey' elif ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 950, "mbpp_split": "train", "prompt": "Write a function to display sign of the chinese zodiac for given year.", "test_list": [ "assert chinese_zodiac(1997)==('Ox')", "assert chinese_zodiac(1998)==('Tiger')", "assert chinese_z...
{ "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_950
156
259
src/00259.py
pyc/00259.pyc
CODE <module>() RESUME 0 LOAD_CONST <code max_similar_indices> MAKE_FUNCTION 0 STORE_NAME max_similar_indices RETURN_CONST None END CODE max_similar_indices(test_list1, test_list2) RESUME 0 LOAD_GLOBAL NULL + zip LOAD_FAST test_list1 LOAD_FAST test_list2 CALL 2 GET_ITER LOAD_FAST_AND_CLEAR x L...
def max_similar_indices(test_list1, test_list2): res = [(max(x[0], y[0]), max(x[1], y[1])) for x, y in zip(test_list1, test_list2)] return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 951, "mbpp_split": "train", "prompt": "Write a function to find the maximum of similar indices in two lists of tuples.", "test_list": [ "assert max_similar_indices([(2, 4), (6, 7), (5, 1)],[(5, 4), (8, 10), (8, 14)]) == [(5, 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_951
60
260
src/00260.py
pyc/00260.pyc
CODE <module>() RESUME 0 LOAD_CONST <code profit_amount> MAKE_FUNCTION 0 STORE_NAME profit_amount RETURN_CONST None END CODE profit_amount(actual_cost, sale_amount) RESUME 0 LOAD_FAST actual_cost LOAD_FAST sale_amount COMPARE_OP > POP_JUMP_IF_FALSE L1 LOAD_FAST actual_cost LOAD_FAST sale_amount ...
def profit_amount(actual_cost, sale_amount): if actual_cost > sale_amount: amount = actual_cost - sale_amount return amount else: return None
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 954, "mbpp_split": "train", "prompt": "Write a function that gives profit amount if the given amount has profit else return none.", "test_list": [ "assert profit_amount(1500,1200)==300", "assert profit_amount(100,200)==None", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_954
21
261
src/00261.py
pyc/00261.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_abundant> MAKE_FUNCTION 0 STORE_NAME is_abundant RETURN_CONST None END CODE is_abundant(n) RESUME 0 LOAD_GLOBAL NULL + sum LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_FAST n CALL 2 GET_ITER LOAD_FAST_AND_CLEAR fctr SWAP 2 L1: BUILD_LIST 0 SWAP ...
def is_abundant(n): fctrsum = sum([fctr for fctr in range(1, n) if n % fctr == 0]) return fctrsum > n
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 955, "mbpp_split": "train", "prompt": "Write a function to find out, if the given number is abundant.", "test_list": [ "assert is_abundant(12)==True", "assert is_abundant(13)==False", "assert is_abundant(9)==False" ], "tr...
{ "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_955
54
262
src/00262.py
pyc/00262.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code get_First_Set_Bit_Pos> MAKE_FUNCTION 0 STORE_NAME get_First_Set_Bit_Pos RETURN_CONST None END CODE get_First_Set_Bit_Pos(n) RESUME 0 LOAD_GLOBAL NULL + math LOAD_ATTR log2 LOAD_FAST n LOAD...
import math def get_First_Set_Bit_Pos(n): return math.log2(n & -n) + 1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 957, "mbpp_split": "train", "prompt": "Write a python function to get the position of rightmost set bit.", "test_list": [ "assert get_First_Set_Bit_Pos(12) == 3", "assert get_First_Set_Bit_Pos(18) == 2", "assert get_First_Set...
{ "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_957
23
263
src/00263.py
pyc/00263.pyc
CODE <module>() RESUME 0 LOAD_CONST <code int_to_roman> MAKE_FUNCTION 0 STORE_NAME int_to_roman RETURN_CONST None END CODE int_to_roman(num) RESUME 0 BUILD_LIST 0 LOAD_CONST (1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1) LIST_EXTEND 1 STORE_FAST val BUILD_LIST 0 LOAD_CONST ('M', 'CM', 'D...
def int_to_roman(num): val = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] syb = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I'] roman_num = '' i = 0 while num > 0: for _ in range(num // val[i]): roman_num += syb[i] num -= val[i] ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 958, "mbpp_split": "train", "prompt": "Write a function to convert an integer into a roman numeral.", "test_list": [ "assert int_to_roman(1)==(\"I\")", "assert int_to_roman(50)==(\"L\")", "assert int_to_roman(4)==(\"IV\")" ...
{ "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_958
64
264
src/00264.py
pyc/00264.pyc
CODE <module>() RESUME 0 LOAD_CONST <code get_noOfways> MAKE_FUNCTION 0 STORE_NAME get_noOfways RETURN_CONST None END CODE get_noOfways(n) RESUME 0 LOAD_FAST n LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST 0 L1: LOAD_FAST n LOAD_CONST 1 COMPARE_OP == POP_JUMP_IF_FALSE L2 R...
def get_noOfways(n): if n == 0: return 0 if n == 1: return 1 return get_noOfways(n - 1) + get_noOfways(n - 2)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 960, "mbpp_split": "train", "prompt": "Write a function to solve tiling problem.", "test_list": [ "assert get_noOfways(4)==3", "assert get_noOfways(3)==2", "assert get_noOfways(5)==5" ], "transform": "ast.unparse via scri...
{ "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_960
33
265
src/00265.py
pyc/00265.pyc
CODE <module>() RESUME 0 LOAD_CONST <code roman_to_int> MAKE_FUNCTION 0 STORE_NAME roman_to_int RETURN_CONST None END CODE roman_to_int(s) RESUME 0 LOAD_CONST 1 LOAD_CONST 5 LOAD_CONST 10 LOAD_CONST 50 LOAD_CONST 100 LOAD_CONST 500 LOAD_CONST 1000 LOAD_CONST ('I', 'V', 'X', 'L', 'C', 'D', 'M...
def roman_to_int(s): rom_val = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} int_val = 0 for i in range(len(s)): if i > 0 and rom_val[s[i]] > rom_val[s[i - 1]]: int_val += rom_val[s[i]] - 2 * rom_val[s[i - 1]] else: int_val += rom_val[s[i]] ret...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 961, "mbpp_split": "train", "prompt": "Write a function to convert a roman numeral to an integer.", "test_list": [ "assert roman_to_int('MMMCMLXXXVI')==3986", "assert roman_to_int('MMMM')==4000", "assert roman_to_int('C')==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_961
81
266
src/00266.py
pyc/00266.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_Natural> MAKE_FUNCTION 0 STORE_NAME sum_Natural LOAD_CONST <code sum_Even> MAKE_FUNCTION 0 STORE_NAME sum_Even RETURN_CONST None END CODE sum_Natural(n) RESUME 0 LOAD_FAST n LOAD_FAST n LOAD_CONST 1 BINARY_OP + BINARY_OP * STORE_FAST sum LOAD...
def sum_Natural(n): sum = n * (n + 1) return int(sum) def sum_Even(l, r): return sum_Natural(int(r / 2)) - sum_Natural(int((l - 1) / 2))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 962, "mbpp_split": "train", "prompt": "Write a python function to find the sum of all even natural numbers within the range l and r.", "test_list": [ "assert sum_Even(2,5) == 6", "assert sum_Even(3,8) == 18", "assert sum_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_962
43
267
src/00267.py
pyc/00267.pyc
CODE <module>() RESUME 0 LOAD_CONST <code word_len> MAKE_FUNCTION 0 STORE_NAME word_len RETURN_CONST None END CODE word_len(s) RESUME 0 LOAD_FAST s LOAD_ATTR NULL|self + split LOAD_CONST ' ' CALL 1 STORE_FAST s LOAD_FAST s GET_ITER FOR_ITER L2 STORE_FAST word LOAD_GLOBAL NULL + len LOA...
def word_len(s): s = s.split(' ') for word in s: if len(word) % 2 == 0: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 964, "mbpp_split": "train", "prompt": "Write a python function to check whether the length of the word is even or not.", "test_list": [ "assert word_len(\"program\") == False", "assert word_len(\"solution\") == 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_964
34
268
src/00268.py
pyc/00268.pyc
CODE <module>() RESUME 0 LOAD_CONST <code camel_to_snake> MAKE_FUNCTION 0 STORE_NAME camel_to_snake RETURN_CONST None END CODE camel_to_snake(text) RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_FAST re LOAD_FAST re LOAD_ATTR NULL|self + sub LOAD_CONST '(.)([A-Z][a-z]+)' LOAD_CON...
def camel_to_snake(text): import re str1 = re.sub('(.)([A-Z][a-z]+)', '\\1_\\2', text) return re.sub('([a-z0-9])([A-Z])', '\\1_\\2', str1).lower()
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 965, "mbpp_split": "train", "prompt": "Write a function to convert camel case string to snake case string.", "test_list": [ "assert camel_to_snake('PythonProgram')==('python_program')", "assert camel_to_snake('pythonLanguage')==(...
{ "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_965
29
269
src/00269.py
pyc/00269.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_empty> MAKE_FUNCTION 0 STORE_NAME remove_empty RETURN_CONST None END CODE remove_empty(tuple1) RESUME 0 LOAD_FAST tuple1 GET_ITER LOAD_FAST_AND_CLEAR t SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L5 STORE_FAST t LOAD_FAST t POP_JUMP_IF_TRU...
def remove_empty(tuple1): tuple1 = [t for t in tuple1 if t] return tuple1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 966, "mbpp_split": "train", "prompt": "Write a function to remove an empty tuple from a list of tuples.", "test_list": [ "assert remove_empty([(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')])==[('',), ('a', 'b'), ('a', 'b', '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_966
42
270
src/00270.py
pyc/00270.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check> MAKE_FUNCTION 0 STORE_NAME check RETURN_CONST None END CODE check(string) RESUME 0 LOAD_GLOBAL NULL + len LOAD_GLOBAL NULL + set LOAD_FAST string CALL 1 LOAD_ATTR NULL|self + intersection LOAD_CONST 'AEIOUaeiou' CALL 1 CALL 1 LOAD_CONST 5 ...
def check(string): if len(set(string).intersection('AEIOUaeiou')) >= 5: return 'accepted' else: return 'not accepted'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 967, "mbpp_split": "train", "prompt": "Write a python function to accept the strings which contains all vowels.", "test_list": [ "assert check(\"SEEquoiaL\") == 'accepted'", "assert check('program') == \"not accepted\"", "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_967
23
271
src/00271.py
pyc/00271.pyc
CODE <module>() RESUME 0 LOAD_CONST <code join_tuples> MAKE_FUNCTION 0 STORE_NAME join_tuples RETURN_CONST None END CODE join_tuples(test_list) RESUME 0 BUILD_LIST 0 STORE_FAST res LOAD_FAST test_list GET_ITER L1: FOR_ITER L7 STORE_FAST sub LOAD_FAST res POP_JUMP_IF_FALSE L2 LOAD_FAST res ...
def join_tuples(test_list): res = [] for sub in test_list: if res and res[-1][0] == sub[0]: res[-1].extend(sub[1:]) else: res.append([ele for ele in sub]) res = list(map(tuple, res)) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 969, "mbpp_split": "train", "prompt": "Write a function to join the tuples if they have similar initial elements.", "test_list": [ "assert join_tuples([(5, 6), (5, 7), (6, 8), (6, 10), (7, 13)] ) == [(5, 6, 7), (6, 8, 10), (7, 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_969
81
272
src/00272.py
pyc/00272.pyc
CODE <module>() RESUME 0 LOAD_CONST <code min_of_two> MAKE_FUNCTION 0 STORE_NAME min_of_two RETURN_CONST None END CODE min_of_two(x, y) RESUME 0 LOAD_FAST x LOAD_FAST y COMPARE_OP < POP_JUMP_IF_FALSE L1 LOAD_FAST x RETURN_VALUE L1: LOAD_FAST y RETURN_VALUE END
def min_of_two(x, y): if x < y: return x return y
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 970, "mbpp_split": "train", "prompt": "Write a function to find minimum of two numbers.", "test_list": [ "assert min_of_two(10,20)==10", "assert min_of_two(19,15)==15", "assert min_of_two(-10,-20)==-20" ], "transform": "a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_970
18
273
src/00273.py
pyc/00273.pyc
CODE <module>() RESUME 0 LOAD_CONST <code maximum_segments> MAKE_FUNCTION 0 STORE_NAME maximum_segments RETURN_CONST None END CODE maximum_segments(n, a, b, c) RESUME 0 LOAD_CONST -1 BUILD_LIST 1 LOAD_FAST n LOAD_CONST 10 BINARY_OP + BINARY_OP * STORE_FAST dp LOAD_CONST 0 LOAD_FAST dp LO...
def maximum_segments(n, a, b, c): dp = [-1] * (n + 10) dp[0] = 0 for i in range(0, n): if dp[i] != -1: if i + a <= n: dp[i + a] = max(dp[i] + 1, dp[i + a]) if i + b <= n: dp[i + b] = max(dp[i] + 1, dp[i + b]) if i + c <= n: ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 971, "mbpp_split": "train", "prompt": "Write a function to find the maximum number of segments of lengths a, b and c that can be formed from n.", "test_list": [ "assert maximum_segments(7, 5, 2, 5) == 2", "assert maximum_segments...
{ "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_971
116
274
src/00274.py
pyc/00274.pyc
CODE <module>() RESUME 0 LOAD_CONST <code concatenate_nested> MAKE_FUNCTION 0 STORE_NAME concatenate_nested RETURN_CONST None END CODE concatenate_nested(test_tup1, test_tup2) RESUME 0 LOAD_FAST test_tup1 LOAD_FAST test_tup2 BINARY_OP + STORE_FAST res LOAD_FAST res RETURN_VALUE END
def concatenate_nested(test_tup1, test_tup2): res = test_tup1 + test_tup2 return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 972, "mbpp_split": "train", "prompt": "Write a function to concatenate the given two tuples to a nested tuple.", "test_list": [ "assert concatenate_nested((3, 4), (5, 6)) == (3, 4, 5, 6)", "assert concatenate_nested((1, 2), (3, 4...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_972
15
275
src/00275.py
pyc/00275.pyc
CODE <module>() RESUME 0 LOAD_CONST <code left_rotate> MAKE_FUNCTION 0 STORE_NAME left_rotate RETURN_CONST None END CODE left_rotate(s, d) RESUME 0 LOAD_FAST s LOAD_FAST d LOAD_CONST None BINARY_SLICE LOAD_FAST s LOAD_CONST 0 LOAD_FAST d BINARY_SLICE BINARY_OP + STORE_FAST tmp LOAD_FAS...
def left_rotate(s, d): tmp = s[d:] + s[0:d] return tmp
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 973, "mbpp_split": "train", "prompt": "Write a python function to left rotate the string.", "test_list": [ "assert left_rotate(\"python\",2) == \"thonpy\" ", "assert left_rotate(\"bigdata\",3 ) == \"databig\" ", "assert lef...
{ "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_973
21
276
src/00276.py
pyc/00276.pyc
CODE <module>() RESUME 0 LOAD_CONST <code remove_Occ> MAKE_FUNCTION 0 STORE_NAME remove_Occ RETURN_CONST None END CODE remove_Occ(s, ch) RESUME 0 LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST s CALL 1 CALL 1 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_FAST s LOAD_FAST i BINA...
def remove_Occ(s, ch): for i in range(len(s)): if s[i] == ch: s = s[0:i] + s[i + 1:] break for i in range(len(s) - 1, -1, -1): if s[i] == ch: s = s[0:i] + s[i + 1:] break return s
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 11, "mbpp_split": "test", "prompt": "Write a python function to remove first and last occurrence of a given character from the string.", "test_list": [ "assert remove_Occ(\"hello\",\"l\") == \"heo\"", "assert remove_Occ(\"abcda\"...
{ "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_11
83
277
src/00277.py
pyc/00277.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sort_matrix> MAKE_FUNCTION 0 STORE_NAME sort_matrix RETURN_CONST None END CODE sort_matrix(M) RESUME 0 LOAD_GLOBAL NULL + sorted LOAD_FAST M LOAD_GLOBAL sum KW_NAMES ('key',) CALL 2 STORE_FAST result LOAD_FAST result RETURN_VALUE END
def sort_matrix(M): result = sorted(M, key=sum) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 12, "mbpp_split": "test", "prompt": "Write a function to sort a given matrix in ascending order according to the sum of its rows.", "test_list": [ "assert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_12
17
278
src/00278.py
pyc/00278.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST <code count_common> MAKE_FUNCTION 0 STORE_NAME count_common RETURN_CONST None END CODE count_common(words) RESUME 0 LOAD_GLOBAL NULL + Counter LOAD_...
from collections import Counter def count_common(words): word_counts = Counter(words) top_four = word_counts.most_common(4) return top_four
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 13, "mbpp_split": "test", "prompt": "Write a function to count the most common words in a dictionary.", "test_list": [ "assert count_common(['red','green','black','pink','black','white','black','eyes','white','black','orange','pink',...
{ "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_13
26
279
src/00279.py
pyc/00279.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code text_lowercase_underscore> MAKE_FUNCTION 0 STORE_NAME text_lowercase_underscore RETURN_CONST None END CODE text_lowercase_underscore(text) RESUME 0 LOAD_CONST '^[a-z]+_[a-z]+$' STORE_FAST patterns...
import re def text_lowercase_underscore(text): patterns = '^[a-z]+_[a-z]+$' if re.search(patterns, text): return 'Found a match!' else: return 'Not matched!'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 16, "mbpp_split": "test", "prompt": "Write a function to find sequences of lowercase letters joined with an underscore.", "test_list": [ "assert text_lowercase_underscore(\"aab_cbbbc\")==('Found a match!')", "assert text_lowercas...
{ "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_16
24
280
src/00280.py
pyc/00280.pyc
CODE <module>() RESUME 0 LOAD_CONST 256 STORE_NAME NO_OF_CHARS LOAD_CONST <code str_to_list> MAKE_FUNCTION 0 STORE_NAME str_to_list LOAD_CONST <code lst_to_string> MAKE_FUNCTION 0 STORE_NAME lst_to_string LOAD_CONST <code get_char_count_array> MAKE_FUNCTION 0 STORE_NAME get_char_count_array LO...
NO_OF_CHARS = 256 def str_to_list(string): temp = [] for x in string: temp.append(x) return temp def lst_to_string(List): return ''.join(List) def get_char_count_array(string): count = [0] * NO_OF_CHARS for i in string: count[ord(i)] += 1 return count def remove_dirty_cha...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 18, "mbpp_split": "test", "prompt": "Write a function to remove characters from the first string which are present in the second string.", "test_list": [ "assert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'", "asser...
{ "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_18
141
281
src/00281.py
pyc/00281.pyc
CODE <module>() RESUME 0 LOAD_CONST <code test_duplicate> MAKE_FUNCTION 0 STORE_NAME test_duplicate RETURN_CONST None END CODE test_duplicate(arraynums) RESUME 0 LOAD_GLOBAL NULL + set LOAD_FAST arraynums CALL 1 STORE_FAST nums_set LOAD_GLOBAL NULL + len LOAD_FAST arraynums CALL 1 LOAD_GLOBA...
def test_duplicate(arraynums): nums_set = set(arraynums) return len(arraynums) != len(nums_set)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 19, "mbpp_split": "test", "prompt": "Write a function to find whether a given array of integers contains any duplicate element.", "test_list": [ "assert test_duplicate(([1,2,3,4,5]))==False", "assert test_duplicate(([1,2,3,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_19
21
282
src/00282.py
pyc/00282.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_woodall> MAKE_FUNCTION 0 STORE_NAME is_woodall RETURN_CONST None END CODE is_woodall(x) RESUME 0 LOAD_FAST x LOAD_CONST 2 BINARY_OP % LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST False L1: LOAD_FAST x LOAD_CONST 1 COMPARE_OP ==...
def is_woodall(x): if x % 2 == 0: return False if x == 1: return True x = x + 1 p = 0 while x % 2 == 0: x = x / 2 p = p + 1 if p == x: return True return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 20, "mbpp_split": "test", "prompt": "Write a function to check if the given number is woodball or not.", "test_list": [ "assert is_woodall(383) == True", "assert is_woodall(254) == False", "assert is_woodall(200) == 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_20
59
283
src/00283.py
pyc/00283.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_first_duplicate> MAKE_FUNCTION 0 STORE_NAME find_first_duplicate RETURN_CONST None END CODE find_first_duplicate(nums) RESUME 0 LOAD_GLOBAL NULL + set CALL 0 STORE_FAST num_set LOAD_CONST -1 STORE_FAST no_duplicate LOAD_GLOBAL NULL + range LOAD_GL...
def find_first_duplicate(nums): num_set = set() no_duplicate = -1 for i in range(len(nums)): if nums[i] in num_set: return nums[i] else: num_set.add(nums[i]) return no_duplicate
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 22, "mbpp_split": "test", "prompt": "Write a function to find the first duplicate element in a given array of integers.", "test_list": [ "assert find_first_duplicate(([1, 2, 3, 4, 4, 5]))==4", "assert find_first_duplicate([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_22
48
284
src/00284.py
pyc/00284.pyc
CODE <module>() RESUME 0 LOAD_CONST <code maximum_Sum> MAKE_FUNCTION 0 STORE_NAME maximum_Sum RETURN_CONST None END CODE maximum_Sum(list1) RESUME 0 LOAD_CONST -100000 STORE_FAST maxi LOAD_FAST list1 GET_ITER L1: FOR_ITER L4 STORE_FAST x LOAD_CONST 0 STORE_FAST sum LOAD_FAST x GET_ITER L...
def maximum_Sum(list1): maxi = -100000 for x in list1: sum = 0 for y in x: sum += y maxi = max(sum, maxi) return maxi
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 23, "mbpp_split": "test", "prompt": "Write a python function to find the maximum sum of elements of list in a list of lists.", "test_list": [ "assert maximum_Sum([[1,2,3],[4,5,6],[10,11,12],[7,8,9]]) == 33", "assert maximum_Sum([...
{ "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_23
40
285
src/00285.py
pyc/00285.pyc
CODE <module>() RESUME 0 LOAD_CONST <code binary_to_decimal> MAKE_FUNCTION 0 STORE_NAME binary_to_decimal RETURN_CONST None END CODE binary_to_decimal(binary) RESUME 0 LOAD_FAST binary STORE_FAST binary1 LOAD_CONST (0, 0, 0) UNPACK_SEQUENCE 3 STORE_FAST decimal STORE_FAST i STORE_FAST n LOAD...
def binary_to_decimal(binary): binary1 = binary decimal, i, n = (0, 0, 0) while binary != 0: dec = binary % 10 decimal = decimal + dec * pow(2, i) binary = binary // 10 i += 1 return decimal
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 24, "mbpp_split": "test", "prompt": "Write a function to convert the given binary number to its decimal equivalent.", "test_list": [ "assert binary_to_decimal(100) == 4", "assert binary_to_decimal(1011) == 11", "assert binary...
{ "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_24
50
286
src/00286.py
pyc/00286.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_k_elements> MAKE_FUNCTION 0 STORE_NAME check_k_elements RETURN_CONST None END CODE check_k_elements(test_list, K) RESUME 0 LOAD_CONST True STORE_FAST res LOAD_FAST test_list GET_ITER L1: FOR_ITER L5 STORE_FAST tup LOAD_FAST tup GET_ITER L2: F...
def check_k_elements(test_list, K): res = True for tup in test_list: for ele in tup: if ele != K: res = False return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 26, "mbpp_split": "test", "prompt": "Write a function to check if the given tuple list has all k elements.", "test_list": [ "assert check_k_elements([(4, 4), (4, 4, 4), (4, 4), (4, 4, 4, 4), (4, )], 4) == True", "assert check_k_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_26
37
287
src/00287.py
pyc/00287.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code remove> MAKE_FUNCTION 0 STORE_NAME remove RETURN_CONST None END CODE remove(list) RESUME 0 LOAD_CONST '[0-9]' STORE_FAST pattern LOAD_FAST list GET_ITER LOAD_FAST_AND_CLEAR i SWAP 2 L1: ...
import re def remove(list): pattern = '[0-9]' list = [re.sub(pattern, '', i) for i in list] return list
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 27, "mbpp_split": "test", "prompt": "Write a python function to remove all digits from a list of strings.", "test_list": [ "assert remove(['4words', '3letters', '4digits']) == ['words', 'letters', 'digits']", "assert remove(['28J...
{ "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_27
47
288
src/00288.py
pyc/00288.pyc
CODE <module>() RESUME 0 LOAD_CONST <code binomial_Coeff> MAKE_FUNCTION 0 STORE_NAME binomial_Coeff RETURN_CONST None END CODE binomial_Coeff(n, k) RESUME 0 LOAD_FAST k LOAD_FAST n COMPARE_OP > POP_JUMP_IF_FALSE L1 RETURN_CONST 0 L1: LOAD_FAST k LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_TRUE ...
def binomial_Coeff(n, k): if k > n: return 0 if k == 0 or k == n: return 1 return binomial_Coeff(n - 1, k - 1) + binomial_Coeff(n - 1, k)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 28, "mbpp_split": "test", "prompt": "Write a python function to find binomial co-efficient.", "test_list": [ "assert binomial_Coeff(5,2) == 10", "assert binomial_Coeff(4,3) == 4", "assert binomial_Coeff(3,2) == 3" ], "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_28
42
289
src/00289.py
pyc/00289.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_Equality> MAKE_FUNCTION 0 STORE_NAME check_Equality LOAD_CONST <code count_Substring_With_Equal_Ends> MAKE_FUNCTION 0 STORE_NAME count_Substring_With_Equal_Ends RETURN_CONST None END CODE check_Equality(s) RESUME 0 LOAD_GLOBAL NULL + ord LOAD_FAST s ...
def check_Equality(s): return ord(s[0]) == ord(s[len(s) - 1]) def count_Substring_With_Equal_Ends(s): result = 0 n = len(s) for i in range(n): for j in range(1, n - i + 1): if check_Equality(s[i:i + j]): result += 1 return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 30, "mbpp_split": "test", "prompt": "Write a python function to count all the substrings starting and ending with same characters.", "test_list": [ "assert count_Substring_With_Equal_Ends(\"abc\") == 3", "assert count_Substring_W...
{ "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_30
79
290
src/00290.py
pyc/00290.pyc
CODE <module>() RESUME 0 LOAD_CONST <code func> MAKE_FUNCTION 0 STORE_NAME func RETURN_CONST None END CODE func(nums, k) RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME collections STORE_FAST collections LOAD_FAST collections LOAD_ATTR NULL|self + defaultdict LOAD_GLOBAL int CALL 1 STORE...
def func(nums, k): import collections d = collections.defaultdict(int) for row in nums: for i in row: d[i] += 1 temp = [] import heapq for key, v in d.items(): if len(temp) < k: temp.append((v, key)) if len(temp) == k: heapq.hea...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 31, "mbpp_split": "test", "prompt": "Write a function to find the top k integers that occur most frequently from given lists of sorted and distinct integers using heap queue algorithm.", "test_list": [ "assert func([[1, 2, 6], [1, 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_31
136
291
src/00291.py
pyc/00291.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code max_Prime_Factors> MAKE_FUNCTION 0 STORE_NAME max_Prime_Factors RETURN_CONST None END CODE max_Prime_Factors(n) RESUME 0 LOAD_CONST -1 STORE_FAST maxPrime LOAD_FAST n LOAD_CONST 2 BINARY...
import math def max_Prime_Factors(n): maxPrime = -1 while n % 2 == 0: maxPrime = 2 n >>= 1 for i in range(3, int(math.sqrt(n)) + 1, 2): while n % i == 0: maxPrime = i n = n / i if n > 2: maxPrime = n return int(maxPrime)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 32, "mbpp_split": "test", "prompt": "Write a python function to find the largest prime factor of a given number.", "test_list": [ "assert max_Prime_Factors(15) == 5", "assert max_Prime_Factors(6) == 3", "assert max_Prime_Fact...
{ "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_32
88
292
src/00292.py
pyc/00292.pyc
CODE <module>() RESUME 0 LOAD_CONST <code decimal_To_Binary> MAKE_FUNCTION 0 STORE_NAME decimal_To_Binary RETURN_CONST None END CODE decimal_To_Binary(N) RESUME 0 LOAD_CONST 0 STORE_FAST B_Number LOAD_CONST 0 STORE_FAST cnt LOAD_FAST N LOAD_CONST 0 COMPARE_OP != POP_JUMP_IF_FALSE L2 L1: LO...
def decimal_To_Binary(N): B_Number = 0 cnt = 0 while N != 0: rem = N % 2 c = pow(10, cnt) B_Number += rem * c N //= 2 cnt += 1 return B_Number
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 33, "mbpp_split": "test", "prompt": "Write a python function to convert a decimal number to binary number.", "test_list": [ "assert decimal_To_Binary(10) == 1010", "assert decimal_To_Binary(1) == 1", "assert decimal_To_Binary...
{ "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_33
49
293
src/00293.py
pyc/00293.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_missing> MAKE_FUNCTION 0 STORE_NAME find_missing RETURN_CONST None END CODE find_missing(ar, N) RESUME 0 LOAD_CONST 0 STORE_FAST l LOAD_FAST N LOAD_CONST 1 BINARY_OP - STORE_FAST r LOAD_FAST l LOAD_FAST r COMPARE_OP <= POP_JUMP_IF_FALSE L5 L...
def find_missing(ar, N): l = 0 r = N - 1 while l <= r: mid = (l + r) / 2 mid = int(mid) if ar[mid] != mid + 1 and ar[mid - 1] == mid: return mid + 1 elif ar[mid] != mid + 1: r = mid - 1 else: l = mid + 1 return -1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 34, "mbpp_split": "test", "prompt": "Write a python function to find the missing number in a sorted array.", "test_list": [ "assert find_missing([1,2,3,5],4) == 4", "assert find_missing([1,3,4,5],4) == 2", "assert find_missin...
{ "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_34
77
294
src/00294.py
pyc/00294.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_rect_num> MAKE_FUNCTION 0 STORE_NAME find_rect_num RETURN_CONST None END CODE find_rect_num(n) RESUME 0 LOAD_FAST n LOAD_FAST n LOAD_CONST 1 BINARY_OP + BINARY_OP * RETURN_VALUE END
def find_rect_num(n): return n * (n + 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 35, "mbpp_split": "test", "prompt": "Write a function to find the n-th rectangular number.", "test_list": [ "assert find_rect_num(4) == 20", "assert find_rect_num(5) == 30", "assert find_rect_num(6) == 42" ], "transform":...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_35
15
295
src/00295.py
pyc/00295.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sort_mixed_list> MAKE_FUNCTION 0 STORE_NAME sort_mixed_list RETURN_CONST None END CODE sort_mixed_list(mixed_list) RESUME 0 LOAD_GLOBAL NULL + sorted LOAD_FAST mixed_list GET_ITER LOAD_FAST_AND_CLEAR i SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L5 ...
def sort_mixed_list(mixed_list): int_part = sorted([i for i in mixed_list if type(i) is int]) str_part = sorted([i for i in mixed_list if type(i) is str]) return int_part + str_part
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 37, "mbpp_split": "test", "prompt": "Write a function to sort a given mixed list of integers and strings.", "test_list": [ "assert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', ...
{ "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_37
89
296
src/00296.py
pyc/00296.pyc
CODE <module>() RESUME 0 LOAD_CONST <code div_even_odd> MAKE_FUNCTION 0 STORE_NAME div_even_odd RETURN_CONST None END CODE div_even_odd(list1) RESUME 0 LOAD_GLOBAL NULL + next LOAD_CONST <code div_even_odd.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_FAST list1 GET_ITER CALL 0 LOAD_CONST -1 CALL...
def div_even_odd(list1): first_even = next((el for el in list1 if el % 2 == 0), -1) first_odd = next((el for el in list1 if el % 2 != 0), -1) return first_even / first_odd
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 38, "mbpp_split": "test", "prompt": "Write a function to find the division of first even and odd number of a given list.", "test_list": [ "assert div_even_odd([1,3,5,7,4,1,6,8])==4", "assert div_even_odd([1,2,3,4,5,6,7,8,9,10])==...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_38
95
297
src/00297.py
pyc/00297.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME heapq STORE_NAME heapq LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST <code rearange_string> MAKE_FUNCTION 0 STORE_NAME rearange_string RETURN_CONST Non...
import heapq from collections import Counter def rearange_string(S): ctr = Counter(S) heap = [(-value, key) for key, value in ctr.items()] heapq.heapify(heap) if -heap[0][0] * 2 > len(S) + 1: return '' ans = [] while len(heap) >= 2: nct1, char1 = heapq.heappop(heap) nct2...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 39, "mbpp_split": "test", "prompt": "Write a function to check if the letters of a given string can be rearranged so that two characters that are adjacent to each other are different.", "test_list": [ "assert rearange_string(\"aab\")...
{ "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_39
165
298
src/00298.py
pyc/00298.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('Counter',) IMPORT_NAME collections IMPORT_FROM Counter STORE_NAME Counter POP_TOP LOAD_CONST 0 LOAD_CONST ('chain',) IMPORT_NAME itertools IMPORT_FROM chain STORE_NAME chain POP_TOP LOAD_CONST <code freq_element> MAKE_FUNCTION 0 STORE_NA...
from collections import Counter from itertools import chain def freq_element(nums): result = Counter(chain.from_iterable(nums)) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 40, "mbpp_split": "test", "prompt": "Write a function to find frequency of the elements in a given list of lists using collections module.", "test_list": [ "assert freq_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]])==({2: 3, 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_40
30
299
src/00299.py
pyc/00299.pyc
CODE <module>() RESUME 0 LOAD_CONST <code filter_evennumbers> MAKE_FUNCTION 0 STORE_NAME filter_evennumbers RETURN_CONST None END CODE filter_evennumbers(nums) RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + filter LOAD_CONST <code filter_evennumbers.<locals>.<lambda>> MAKE_FUNCTION 0 LOAD_FAS...
def filter_evennumbers(nums): even_nums = list(filter(lambda x: x % 2 == 0, nums)) return even_nums
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 41, "mbpp_split": "test", "prompt": "Write a function to filter even numbers using lambda function.", "test_list": [ "assert filter_evennumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[2, 4, 6, 8, 10]", "assert filter_evennumbers([10,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_41
28