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
300
src/00300.py
pyc/00300.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_Sum> MAKE_FUNCTION 0 STORE_NAME find_Sum RETURN_CONST None END CODE find_Sum(arr, n) RESUME 0 LOAD_GLOBAL NULL + sum LOAD_FAST arr GET_ITER LOAD_FAST_AND_CLEAR x SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L5 STORE_FAST x LOAD_FAST arr LOA...
def find_Sum(arr, n): return sum([x for x in arr if arr.count(x) > 1])
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 42, "mbpp_split": "test", "prompt": "Write a python function to find the sum of repeated elements in a given array.", "test_list": [ "assert find_Sum([1,2,3,1,1,4,5,6],8) == 3", "assert find_Sum([1,2,3,1,1],5) == 3", "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_42
48
301
src/00301.py
pyc/00301.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_NAME re LOAD_CONST <code text_match_string> MAKE_FUNCTION 0 STORE_NAME text_match_string RETURN_CONST None END CODE text_match_string(text) RESUME 0 LOAD_CONST '^\\w+' STORE_FAST patterns LOAD_GLOBAL NULL + re LOAD_AT...
import re def text_match_string(text): patterns = '^\\w+' if re.search(patterns, text): return 'Found a match!' else: return 'Not matched!'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 44, "mbpp_split": "test", "prompt": "Write a function that matches a word at the beginning of a string.", "test_list": [ "assert text_match_string(\" python\")==('Not matched!')", "assert text_match_string(\"python\")==('Found 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_44
24
302
src/00302.py
pyc/00302.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_gcd> MAKE_FUNCTION 0 STORE_NAME find_gcd LOAD_CONST <code get_gcd> MAKE_FUNCTION 0 STORE_NAME get_gcd RETURN_CONST None END CODE find_gcd(x, y) RESUME 0 LOAD_FAST y POP_JUMP_IF_FALSE L2 L1: LOAD_FAST y LOAD_FAST x LOAD_FAST y BINARY_OP % STO...
def find_gcd(x, y): while y: x, y = (y, x % y) return x def get_gcd(l): num1 = l[0] num2 = l[1] gcd = find_gcd(num1, num2) for i in range(2, len(l)): gcd = find_gcd(gcd, l[i]) return gcd
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 45, "mbpp_split": "test", "prompt": "Write a function to find the gcd of the given array elements.", "test_list": [ "assert get_gcd([2, 4, 6, 8, 16]) == 2", "assert get_gcd([1, 2, 3]) == 1", "assert get_gcd([2, 4, 6, 8]) == 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_45
65
303
src/00303.py
pyc/00303.pyc
CODE <module>() RESUME 0 LOAD_CONST <code test_distinct> MAKE_FUNCTION 0 STORE_NAME test_distinct RETURN_CONST None END CODE test_distinct(data) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST data CALL 1 LOAD_GLOBAL NULL + len LOAD_GLOBAL NULL + set LOAD_FAST data CALL 1 CALL 1 COMPARE_OP == ...
def test_distinct(data): if len(data) == len(set(data)): return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 46, "mbpp_split": "test", "prompt": "Write a python function to determine whether all the numbers are different from each other are not.", "test_list": [ "assert test_distinct([1,5,7,9]) == True", "assert test_distinct([2,4,5,5,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_46
22
304
src/00304.py
pyc/00304.pyc
CODE <module>() RESUME 0 LOAD_CONST <code odd_bit_set_number> MAKE_FUNCTION 0 STORE_NAME odd_bit_set_number RETURN_CONST None END CODE odd_bit_set_number(n) RESUME 0 LOAD_CONST 0 STORE_FAST count LOAD_CONST 0 STORE_FAST res LOAD_FAST n STORE_FAST temp LOAD_FAST temp LOAD_CONST 0 COMPARE_OP...
def odd_bit_set_number(n): count = 0 res = 0 temp = n while temp > 0: if count % 2 == 0: res |= 1 << count count += 1 temp >>= 1 return n | res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 48, "mbpp_split": "test", "prompt": "Write a python function to set all odd bits of a given number.", "test_list": [ "assert odd_bit_set_number(10) == 15", "assert odd_bit_set_number(20) == 21", "assert odd_bit_set_number(30)...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_48
51
305
src/00305.py
pyc/00305.pyc
CODE <module>() RESUME 0 LOAD_CONST <code min_length_list> MAKE_FUNCTION 0 STORE_NAME min_length_list RETURN_CONST None END CODE min_length_list(input_list) RESUME 0 LOAD_GLOBAL NULL + min LOAD_CONST <code min_length_list.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_FAST input_list GET_ITER CALL 0 ...
def min_length_list(input_list): min_length = min((len(x) for x in input_list)) min_list = min(input_list, key=lambda i: len(i)) return (min_length, min_list)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 50, "mbpp_split": "test", "prompt": "Write a function to find the list with minimum length using lambda function.", "test_list": [ "assert min_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(1, [0])", "assert min_leng...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_50
59
306
src/00306.py
pyc/00306.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_equilateral> MAKE_FUNCTION 0 STORE_NAME check_equilateral RETURN_CONST None END CODE check_equilateral(x, y, z) RESUME 0 LOAD_FAST x LOAD_FAST y SWAP 2 COPY 2 COMPARE_OP == POP_JUMP_IF_FALSE L1 LOAD_FAST z COMPARE_OP == POP_JUMP_IF_FALSE L2 ...
def check_equilateral(x, y, z): if x == y == z: return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 51, "mbpp_split": "test", "prompt": "Write a function to print check if the triangle is equilateral or not.", "test_list": [ "assert check_equilateral(6,8,12)==False ", "assert check_equilateral(6,6,12)==False", "assert check...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_51
24
307
src/00307.py
pyc/00307.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_Equality> MAKE_FUNCTION 0 STORE_NAME check_Equality RETURN_CONST None END CODE check_Equality(str) RESUME 0 LOAD_FAST str LOAD_CONST 0 BINARY_SUBSCR LOAD_FAST str LOAD_CONST -1 BINARY_SUBSCR COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST 'Eq...
def check_Equality(str): if str[0] == str[-1]: return 'Equal' else: return 'Not Equal'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 53, "mbpp_split": "test", "prompt": "Write a python function to check whether the first and last characters of a given string are equal or not.", "test_list": [ "assert check_Equality(\"abcda\") == \"Equal\"", "assert check_Equal...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_53
20
308
src/00308.py
pyc/00308.pyc
CODE <module>() RESUME 0 LOAD_CONST <code counting_sort> MAKE_FUNCTION 0 STORE_NAME counting_sort RETURN_CONST None END CODE counting_sort(my_list) RESUME 0 LOAD_CONST 0 STORE_FAST max_value LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST my_list CALL 1 CALL 1 GET_ITER L1: FOR_IT...
def counting_sort(my_list): max_value = 0 for i in range(len(my_list)): if my_list[i] > max_value: max_value = my_list[i] buckets = [0] * (max_value + 1) for i in my_list: buckets[i] += 1 i = 0 for j in range(max_value + 1): for a in range(buckets[j]): ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 54, "mbpp_split": "test", "prompt": "Write a function to sort the given array by using counting sort.", "test_list": [ "assert counting_sort([1,23,4,5,6,7,8]) == [1, 4, 5, 6, 7, 8, 23]", "assert counting_sort([12, 9, 28, 33, 69, ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_54
96
309
src/00309.py
pyc/00309.pyc
CODE <module>() RESUME 0 LOAD_CONST <code rev> MAKE_FUNCTION 0 STORE_NAME rev LOAD_CONST <code check> MAKE_FUNCTION 0 STORE_NAME check RETURN_CONST None END CODE rev(num) RESUME 0 LOAD_CONST 0 STORE_FAST rev_num LOAD_FAST num LOAD_CONST 0 COMPARE_OP > POP_JUMP_IF_FALSE L2 L1: LOAD_FAST r...
def rev(num): rev_num = 0 while num > 0: rev_num = rev_num * 10 + num % 10 num = num // 10 return rev_num def check(n): return 2 * rev(n) == n + 1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 56, "mbpp_split": "test", "prompt": "Write a python function to check if a given number is one less than twice its reverse.", "test_list": [ "assert check(70) == False", "assert check(23) == False", "assert check(73) == 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_56
52
310
src/00310.py
pyc/00310.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_octagonal> MAKE_FUNCTION 0 STORE_NAME is_octagonal RETURN_CONST None END CODE is_octagonal(n) RESUME 0 LOAD_CONST 3 LOAD_FAST n BINARY_OP * LOAD_FAST n BINARY_OP * LOAD_CONST 2 LOAD_FAST n BINARY_OP * BINARY_OP - RETURN_VALUE END
def is_octagonal(n): return 3 * n * n - 2 * n
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 59, "mbpp_split": "test", "prompt": "Write a function to find the nth octagonal number.", "test_list": [ "assert is_octagonal(5) == 65", "assert is_octagonal(10) == 280", "assert is_octagonal(15) == 645" ], "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_59
19
311
src/00311.py
pyc/00311.pyc
CODE <module>() RESUME 0 LOAD_CONST <code max_len_sub> MAKE_FUNCTION 0 STORE_NAME max_len_sub RETURN_CONST None END CODE max_len_sub(arr, n) RESUME 0 BUILD_LIST 0 STORE_FAST mls LOAD_CONST 0 STORE_FAST max LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L2 STORE_FAST i ...
def max_len_sub(arr, n): mls = [] max = 0 for i in range(n): mls.append(1) for i in range(n): for j in range(i): if abs(arr[i] - arr[j]) <= 1 and mls[i] < mls[j] + 1: mls[i] = mls[j] + 1 for i in range(n): if max < mls[i]: max = mls[i] ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 60, "mbpp_split": "test", "prompt": "Write a function to find the maximum length of the subsequence with difference between adjacent elements for the given array.", "test_list": [ "assert max_len_sub([2, 5, 6, 3, 7, 6, 5, 8], 8) == 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_60
106
312
src/00312.py
pyc/00312.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('defaultdict',) IMPORT_NAME collections IMPORT_FROM defaultdict STORE_NAME defaultdict POP_TOP LOAD_CONST <code count_Substrings> MAKE_FUNCTION 0 STORE_NAME count_Substrings RETURN_CONST None END CODE count_Substrings(s, n) RESUME 0 LOAD_CONST ...
from collections import defaultdict def count_Substrings(s, n): count, sum = (0, 0) mp = defaultdict(lambda: 0) mp[0] += 1 for i in range(n): sum += ord(s[i]) - ord('0') count += mp[sum - (i + 1)] mp[sum - (i + 1)] += 1 return count
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 61, "mbpp_split": "test", "prompt": "Write a python function to count number of substrings with the sum of digits equal to their length.", "test_list": [ "assert count_Substrings('112112',6) == 6", "assert count_Substrings('111',...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_61
86
313
src/00313.py
pyc/00313.pyc
CODE <module>() RESUME 0 LOAD_CONST <code recursive_list_sum> MAKE_FUNCTION 0 STORE_NAME recursive_list_sum RETURN_CONST None END CODE recursive_list_sum(data_list) RESUME 0 LOAD_CONST 0 STORE_FAST total LOAD_FAST data_list GET_ITER L1: FOR_ITER L3 STORE_FAST element LOAD_GLOBAL NULL + type ...
def recursive_list_sum(data_list): total = 0 for element in data_list: if type(element) == type([]): total = total + recursive_list_sum(element) else: total = total + element return total
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 65, "mbpp_split": "test", "prompt": "Write a function of recursion list sum.", "test_list": [ "assert recursive_list_sum(([1, 2, [3,4],[5,6]]))==21", "assert recursive_list_sum(([7, 10, [15,14],[19,41]]))==106", "assert recur...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_65
41
314
src/00314.py
pyc/00314.pyc
CODE <module>() RESUME 0 LOAD_CONST <code pos_count> MAKE_FUNCTION 0 STORE_NAME pos_count RETURN_CONST None END CODE pos_count(list) RESUME 0 LOAD_CONST 0 STORE_FAST pos_count LOAD_FAST list GET_ITER L1: FOR_ITER L3 STORE_FAST num LOAD_FAST num LOAD_CONST 0 COMPARE_OP >= POP_JUMP_IF_TRUE...
def pos_count(list): pos_count = 0 for num in list: if num >= 0: pos_count += 1 return pos_count
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 66, "mbpp_split": "test", "prompt": "Write a python function to count positive numbers in a list.", "test_list": [ "assert pos_count([1,-2,3,-4]) == 2", "assert pos_count([3,4,5,-1]) == 3", "assert pos_count([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_66
31
315
src/00315.py
pyc/00315.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_Monotonic> MAKE_FUNCTION 0 STORE_NAME is_Monotonic RETURN_CONST None END CODE is_Monotonic(A) MAKE_CELL A RESUME 0 LOAD_GLOBAL NULL + all LOAD_CLOSURE A BUILD_TUPLE 1 LOAD_CONST <code is_Monotonic.<locals>.<genexpr>> MAKE_FUNCTION closure LOAD_GLOBA...
def is_Monotonic(A): return all((A[i] <= A[i + 1] for i in range(len(A) - 1))) or all((A[i] >= A[i + 1] for i in range(len(A) - 1)))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 68, "mbpp_split": "test", "prompt": "Write a python function to check whether the given array is monotonic or not.", "test_list": [ "assert is_Monotonic([6, 5, 4, 4]) == True", "assert is_Monotonic([1, 2, 2, 3]) == 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_68
107
316
src/00316.py
pyc/00316.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_sublist> MAKE_FUNCTION 0 STORE_NAME is_sublist RETURN_CONST None END CODE is_sublist(l, s) RESUME 0 LOAD_CONST False STORE_FAST sub_set LOAD_FAST s BUILD_LIST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 LOAD_CONST True STORE_FAST sub_set LOAD_FAST sub_...
def is_sublist(l, s): sub_set = False if s == []: sub_set = True elif s == l: sub_set = True elif len(s) > len(l): sub_set = False else: for i in range(len(l)): if l[i] == s[0]: n = 1 while n < len(s) and l[i + n] == s[n]: ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 69, "mbpp_split": "test", "prompt": "Write a function to check whether a list contains the given sublist or not.", "test_list": [ "assert is_sublist([2,4,3,5,7],[3,7])==False", "assert is_sublist([2,4,3,5,7],[4,3])==True", "a...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_69
117
317
src/00317.py
pyc/00317.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_equal_tuple> MAKE_FUNCTION 0 STORE_NAME find_equal_tuple LOAD_CONST <code get_equal> MAKE_FUNCTION 0 STORE_NAME get_equal RETURN_CONST None END CODE find_equal_tuple(Input, k) RESUME 0 LOAD_CONST 1 STORE_FAST flag LOAD_FAST Input GET_ITER L1: FO...
def find_equal_tuple(Input, k): flag = 1 for tuple in Input: if len(tuple) != k: flag = 0 break return flag def get_equal(Input, k): if find_equal_tuple(Input, k) == 1: return 'All tuples have same length' else: return 'All tuples do not have same len...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 70, "mbpp_split": "test", "prompt": "Write a function to find whether all the given tuples have equal length or not.", "test_list": [ "assert get_equal([(11, 22, 33), (44, 55, 66)], 3) == 'All tuples have same length'", "assert g...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_70
49
318
src/00318.py
pyc/00318.pyc
CODE <module>() RESUME 0 LOAD_CONST <code comb_sort> MAKE_FUNCTION 0 STORE_NAME comb_sort RETURN_CONST None END CODE comb_sort(nums) RESUME 0 LOAD_CONST 1.3 STORE_FAST shrink_fact LOAD_GLOBAL NULL + len LOAD_FAST nums CALL 1 STORE_FAST gaps LOAD_CONST True STORE_FAST swapped LOAD_CONST 0 ...
def comb_sort(nums): shrink_fact = 1.3 gaps = len(nums) swapped = True i = 0 while gaps > 1 or swapped: gaps = int(float(gaps) / shrink_fact) swapped = False i = 0 while gaps + i < len(nums): if nums[i] > nums[i + gaps]: nums[i], nums[i + g...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 71, "mbpp_split": "test", "prompt": "Write a function to sort a list of elements using comb sort.", "test_list": [ "assert comb_sort([5, 15, 37, 25, 79]) == [5, 15, 25, 37, 79]", "assert comb_sort([41, 32, 15, 19, 22]) == [15, 19...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_71
103
319
src/00319.py
pyc/00319.pyc
CODE <module>() RESUME 0 LOAD_CONST <code dif_Square> MAKE_FUNCTION 0 STORE_NAME dif_Square RETURN_CONST None END CODE dif_Square(n) RESUME 0 LOAD_FAST n LOAD_CONST 4 BINARY_OP % LOAD_CONST 2 COMPARE_OP != POP_JUMP_IF_FALSE L1 RETURN_CONST True L1: RETURN_CONST False END
def dif_Square(n): if n % 4 != 2: return True return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 72, "mbpp_split": "test", "prompt": "Write a python function to check whether the given number can be represented as difference of two squares or not.", "test_list": [ "assert dif_Square(5) == True", "assert dif_Square(10) == Fal...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_72
18
320
src/00320.py
pyc/00320.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_samepatterns> MAKE_FUNCTION 0 STORE_NAME is_samepatterns RETURN_CONST None END CODE is_samepatterns(colors, patterns) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST colors CALL 1 LOAD_GLOBAL NULL + len LOAD_FAST patterns CALL 1 COMPARE_OP != POP_JUMP_I...
def is_samepatterns(colors, patterns): if len(colors) != len(patterns): return False sdict = {} pset = set() sset = set() for i in range(len(patterns)): pset.add(patterns[i]) sset.add(colors[i]) if patterns[i] not in sdict.keys(): sdict[patterns[i]] = [] ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 74, "mbpp_split": "test", "prompt": "Write a function to check whether it follows the sequence given in the patterns array.", "test_list": [ "assert is_samepatterns([\"red\",\"green\",\"green\"], [\"a\", \"b\", \"b\"])==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_74
136
321
src/00321.py
pyc/00321.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_tuples> MAKE_FUNCTION 0 STORE_NAME find_tuples RETURN_CONST None END CODE find_tuples(test_list, K) MAKE_CELL K 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_...
def find_tuples(test_list, K): res = [sub for sub in test_list if all((ele % K == 0 for ele in sub))] return str(res)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 75, "mbpp_split": "test", "prompt": "Write a function to find tuples which have all elements divisible by k from the given list of tuples.", "test_list": [ "assert find_tuples([(6, 24, 12), (7, 9, 6), (12, 18, 21)], 6) == '[(6, 24, 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_75
80
322
src/00322.py
pyc/00322.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_Squares> MAKE_FUNCTION 0 STORE_NAME count_Squares RETURN_CONST None END CODE count_Squares(m, n) RESUME 0 LOAD_FAST n LOAD_FAST m COMPARE_OP < POP_JUMP_IF_FALSE L1 LOAD_FAST m STORE_FAST temp LOAD_FAST n STORE_FAST m LOAD_FAST temp STORE_FA...
def count_Squares(m, n): if n < m: temp = m m = n n = temp return m * (m + 1) * (2 * m + 1) / 6 + (n - m) * m * (m + 1) / 2
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 76, "mbpp_split": "test", "prompt": "Write a python function to count the number of squares in a rectangle.", "test_list": [ "assert count_Squares(4,3) == 20", "assert count_Squares(2,2) == 5", "assert count_Squares(1,1) == 1...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_76
46
323
src/00323.py
pyc/00323.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_With_Odd_SetBits> MAKE_FUNCTION 0 STORE_NAME count_With_Odd_SetBits RETURN_CONST None END CODE count_With_Odd_SetBits(n) RESUME 0 LOAD_FAST n LOAD_CONST 2 BINARY_OP % LOAD_CONST 0 COMPARE_OP != POP_JUMP_IF_FALSE L1 LOAD_FAST n LOAD_CONST 1 BI...
def count_With_Odd_SetBits(n): if n % 2 != 0: return (n + 1) / 2 count = bin(n).count('1') ans = n / 2 if count % 2 != 0: ans += 1 return ans
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 78, "mbpp_split": "test", "prompt": "Write a python function to find number of integers with odd number of set bits.", "test_list": [ "assert count_With_Odd_SetBits(5) == 3", "assert count_With_Odd_SetBits(10) == 5", "assert ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_78
46
324
src/00324.py
pyc/00324.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": 79, "mbpp_split": "test", "prompt": "Write a python function to check whether the length of the word is odd or not.", "test_list": [ "assert word_len(\"Hadoop\") == False", "assert word_len(\"great\") == True", "assert word_l...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_79
34
325
src/00325.py
pyc/00325.pyc
CODE <module>() RESUME 0 LOAD_CONST <code tetrahedral_number> MAKE_FUNCTION 0 STORE_NAME tetrahedral_number RETURN_CONST None END CODE tetrahedral_number(n) RESUME 0 LOAD_FAST n LOAD_FAST n LOAD_CONST 1 BINARY_OP + BINARY_OP * LOAD_FAST n LOAD_CONST 2 BINARY_OP + BINARY_OP * LOAD_CONST 6...
def tetrahedral_number(n): return n * (n + 1) * (n + 2) / 6
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 80, "mbpp_split": "test", "prompt": "Write a function to find the nth tetrahedral number.", "test_list": [ "assert tetrahedral_number(5) == 35.0", "assert tetrahedral_number(6) == 56.0", "assert tetrahedral_number(7) == 84.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_80
21
326
src/00326.py
pyc/00326.pyc
CODE <module>() RESUME 0 LOAD_CONST <code zip_tuples> MAKE_FUNCTION 0 STORE_NAME zip_tuples RETURN_CONST None END CODE zip_tuples(test_tup1, test_tup2) RESUME 0 BUILD_LIST 0 STORE_FAST res LOAD_GLOBAL NULL + enumerate LOAD_FAST test_tup1 CALL 1 GET_ITER L1: FOR_ITER L2 UNPACK_SEQUENCE 2 ST...
def zip_tuples(test_tup1, test_tup2): res = [] for i, j in enumerate(test_tup1): res.append((j, test_tup2[i % len(test_tup2)])) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 81, "mbpp_split": "test", "prompt": "Write a function to zip the two given tuples.", "test_list": [ "assert zip_tuples((7, 8, 4, 5, 9, 10),(1, 5, 6) ) == [(7, 1), (8, 5), (4, 6), (5, 1), (9, 5), (10, 6)]", "assert zip_tuples((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_81
38
327
src/00327.py
pyc/00327.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code volume_sphere> MAKE_FUNCTION 0 STORE_NAME volume_sphere RETURN_CONST None END CODE volume_sphere(r) RESUME 0 LOAD_CONST 1.3333333333333333 LOAD_GLOBAL math LOAD_ATTR pi BINARY_OP * LOAD_...
import math def volume_sphere(r): volume = 4 / 3 * math.pi * r * r * r return volume
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 82, "mbpp_split": "test", "prompt": "Write a function to find the volume of a sphere.", "test_list": [ "assert volume_sphere(10)==4188.790204786391", "assert volume_sphere(25)==65449.84694978735", "assert volume_sphere(20)==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_82
26
328
src/00328.py
pyc/00328.pyc
CODE <module>() RESUME 0 LOAD_CONST <code get_Char> MAKE_FUNCTION 0 STORE_NAME get_Char RETURN_CONST None END CODE get_Char(strr) RESUME 0 LOAD_CONST 0 STORE_FAST summ LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST strr CALL 1 CALL 1 GET_ITER L1: FOR_ITER L2 STORE_FAST i LOA...
def get_Char(strr): summ = 0 for i in range(len(strr)): summ += ord(strr[i]) - ord('a') + 1 if summ % 26 == 0: return ord('z') else: summ = summ % 26 return chr(ord('a') + summ - 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 83, "mbpp_split": "test", "prompt": "Write a python function to find the character made by adding all the characters of the given string.", "test_list": [ "assert get_Char(\"abc\") == \"f\"", "assert get_Char(\"gfg\") == \"t\"", ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_83
62
329
src/00329.py
pyc/00329.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sequence> MAKE_FUNCTION 0 STORE_NAME sequence RETURN_CONST None END CODE sequence(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_GLOBA...
def sequence(n): if n == 1 or n == 2: return 1 else: return sequence(sequence(n - 1)) + sequence(n - sequence(n - 1))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 84, "mbpp_split": "test", "prompt": "Write a function to find the n-th number in newman conway sequence.", "test_list": [ "assert sequence(10) == 6", "assert sequence(2) == 1", "assert sequence(3) == 2" ], "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_84
38
330
src/00330.py
pyc/00330.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME math STORE_NAME math LOAD_CONST <code surfacearea_sphere> MAKE_FUNCTION 0 STORE_NAME surfacearea_sphere RETURN_CONST None END CODE surfacearea_sphere(r) RESUME 0 LOAD_CONST 4 LOAD_GLOBAL math LOAD_ATTR pi BINARY_OP * LOAD_FA...
import math def surfacearea_sphere(r): surfacearea = 4 * math.pi * r * r return surfacearea
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 85, "mbpp_split": "test", "prompt": "Write a function to find the surface area of a sphere.", "test_list": [ "assert surfacearea_sphere(10)==1256.6370614359173", "assert surfacearea_sphere(15)==2827.4333882308138", "assert su...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_85
24
331
src/00331.py
pyc/00331.pyc
CODE <module>() RESUME 0 LOAD_CONST <code centered_hexagonal_number> MAKE_FUNCTION 0 STORE_NAME centered_hexagonal_number RETURN_CONST None END CODE centered_hexagonal_number(n) RESUME 0 LOAD_CONST 3 LOAD_FAST n BINARY_OP * LOAD_FAST n LOAD_CONST 1 BINARY_OP - BINARY_OP * LOAD_CONST 1 BINA...
def centered_hexagonal_number(n): return 3 * n * (n - 1) + 1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 86, "mbpp_split": "test", "prompt": "Write a function to find nth centered hexagonal number.", "test_list": [ "assert centered_hexagonal_number(10) == 271", "assert centered_hexagonal_number(2) == 7", "assert centered_hexagon...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_86
19
332
src/00332.py
pyc/00332.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME collections STORE_NAME collections LOAD_CONST <code freq_count> MAKE_FUNCTION 0 STORE_NAME freq_count RETURN_CONST None END CODE freq_count(list1) RESUME 0 LOAD_GLOBAL NULL + collections LOAD_ATTR Counter LOAD_FAST list1 CALL ...
import collections def freq_count(list1): freq_count = collections.Counter(list1) return freq_count
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 88, "mbpp_split": "test", "prompt": "Write a function to get the frequency of the elements in a list.", "test_list": [ "assert freq_count([10,10,10,10,20,20,20,20,40,40,50,50,30])==({10: 4, 20: 4, 40: 2, 50: 2, 30: 1}) ", "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_88
20
333
src/00333.py
pyc/00333.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 max LOAD_FAST list1 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_GL...
def len_log(list1): max = len(list1[0]) for i in list1: if len(i) > max: max = len(i) return max
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 90, "mbpp_split": "test", "prompt": "Write a python function to find the length of the longest word.", "test_list": [ "assert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7", "assert len_log([\"a\",\"ab\",\"abc\"]) == 3", "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_90
37
334
src/00334.py
pyc/00334.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_substring> MAKE_FUNCTION 0 STORE_NAME find_substring RETURN_CONST None END CODE find_substring(str1, sub_str) MAKE_CELL sub_str RESUME 0 LOAD_GLOBAL NULL + any LOAD_CLOSURE sub_str BUILD_TUPLE 1 LOAD_CONST <code find_substring.<locals>.<genexpr>> MA...
def find_substring(str1, sub_str): if any((sub_str in s for s in str1)): return True return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 91, "mbpp_split": "test", "prompt": "Write a function to check if a substring is present in a given list of string values.", "test_list": [ "assert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ack\")==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_91
48
335
src/00335.py
pyc/00335.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_undulating> MAKE_FUNCTION 0 STORE_NAME is_undulating RETURN_CONST None END CODE is_undulating(n) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST n CALL 1 LOAD_CONST 2 COMPARE_OP <= POP_JUMP_IF_FALSE L1 RETURN_CONST False L1: LOAD_GLOBAL NULL + range L...
def is_undulating(n): if len(n) <= 2: return False for i in range(2, len(n)): if n[i - 2] != n[i]: return False return True
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 92, "mbpp_split": "test", "prompt": "Write a function to check whether the given number is undulating or not.", "test_list": [ "assert is_undulating(\"1212121\") == True", "assert is_undulating(\"1991\") == False", "assert is...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_92
44
336
src/00336.py
pyc/00336.pyc
CODE <module>() RESUME 0 LOAD_CONST <code power> MAKE_FUNCTION 0 STORE_NAME power RETURN_CONST None END CODE power(a, b) RESUME 0 LOAD_FAST b LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST 1 L1: LOAD_FAST a LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L2 RETURN_CONST 0 L2: ...
def power(a, b): if b == 0: return 1 elif a == 0: return 0 elif b == 1: return a else: return a * power(a, b - 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 93, "mbpp_split": "test", "prompt": "Write a function to calculate the value of 'a' to the power 'b'.", "test_list": [ "assert power(3,4) == 81", "assert power(2,3) == 8", "assert power(5,5) == 3125" ], "transform": "ast....
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_93
37
337
src/00337.py
pyc/00337.pyc
CODE <module>() RESUME 0 LOAD_CONST <code Find_Min_Length> MAKE_FUNCTION 0 STORE_NAME Find_Min_Length RETURN_CONST None END CODE Find_Min_Length(lst) RESUME 0 LOAD_GLOBAL NULL + min LOAD_CONST <code Find_Min_Length.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_FAST lst GET_ITER CALL 0 CALL 1 STOR...
def Find_Min_Length(lst): minLength = min((len(x) for x in lst)) return minLength
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 95, "mbpp_split": "test", "prompt": "Write a python function to find the minimum length of sublist.", "test_list": [ "assert Find_Min_Length([[1],[1,2]]) == 1", "assert Find_Min_Length([[1,2],[1,2,3],[1,2,3,4]]) == 2", "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_95
43
338
src/00338.py
pyc/00338.pyc
CODE <module>() RESUME 0 LOAD_CONST <code divisor> MAKE_FUNCTION 0 STORE_NAME divisor RETURN_CONST None END CODE divisor(n) RESUME 0 LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L8 STORE_FAST i LOAD_GLOBAL NULL + len LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_FAST n ...
def divisor(n): for i in range(n): x = len([i for i in range(1, n + 1) if not n % i]) return x
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 96, "mbpp_split": "test", "prompt": "Write a python function to find the number of divisors of a given integer.", "test_list": [ "assert divisor(15) == 4 ", "assert divisor(12) == 6", "assert divisor(9) == 3" ], "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_96
62
339
src/00339.py
pyc/00339.pyc
CODE <module>() RESUME 0 LOAD_CONST <code frequency_lists> MAKE_FUNCTION 0 STORE_NAME frequency_lists RETURN_CONST None END CODE frequency_lists(list1) RESUME 0 LOAD_FAST list1 GET_ITER LOAD_FAST_AND_CLEAR sublist LOAD_FAST_AND_CLEAR item SWAP 3 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L5 STOR...
def frequency_lists(list1): list1 = [item for sublist in list1 for item in sublist] dic_data = {} for num in list1: if num in dic_data.keys(): dic_data[num] += 1 else: key = num value = 1 dic_data[key] = value return dic_data
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 97, "mbpp_split": "test", "prompt": "Write a function to find frequency count of list of lists.", "test_list": [ "assert frequency_lists([[1, 2, 3, 2], [4, 5, 6, 2], [7, 8, 9, 5]])=={1: 1, 2: 3, 3: 1, 4: 1, 5: 2, 6: 1, 7: 1, 8: 1, 9:...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_97
83
340
src/00340.py
pyc/00340.pyc
CODE <module>() RESUME 0 LOAD_CONST <code multiply_num> MAKE_FUNCTION 0 STORE_NAME multiply_num RETURN_CONST None END CODE multiply_num(numbers) RESUME 0 LOAD_CONST 1 STORE_FAST total LOAD_FAST numbers GET_ITER L1: FOR_ITER L2 STORE_FAST x LOAD_FAST total LOAD_FAST x BINARY_OP *= STORE_F...
def multiply_num(numbers): total = 1 for x in numbers: total *= x return total / len(numbers)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 98, "mbpp_split": "test", "prompt": "Write a function to multiply all the numbers in a list and divide with the length of the list.", "test_list": [ "assert multiply_num((8, 2, 3, -1, 7))==-67.2", "assert multiply_num((-10,-20,-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_98
29
341
src/00341.py
pyc/00341.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_GLOBAL NULL + bin LOAD_FAST n CALL 1 LOAD_ATTR NULL|self + replace LOAD_CONST '0b' LOAD_CONST '' CALL 2 RETURN_VALUE END
def decimal_to_binary(n): return bin(n).replace('0b', '')
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 99, "mbpp_split": "test", "prompt": "Write a function to convert the given decimal number to its binary equivalent.", "test_list": [ "assert decimal_to_binary(8) == '1000'", "assert decimal_to_binary(18) == '10010'", "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_99
17
342
src/00342.py
pyc/00342.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME sys STORE_NAME sys LOAD_CONST <code next_smallest_palindrome> MAKE_FUNCTION 0 STORE_NAME next_smallest_palindrome RETURN_CONST None END CODE next_smallest_palindrome(num) RESUME 0 LOAD_GLOBAL NULL + str LOAD_FAST num CALL 1 ST...
import sys def next_smallest_palindrome(num): numstr = str(num) for i in range(num + 1, sys.maxsize): if str(i) == str(i)[::-1]: return i
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 100, "mbpp_split": "test", "prompt": "Write a function to find the next smallest palindrome of a specified number.", "test_list": [ "assert next_smallest_palindrome(99)==101", "assert next_smallest_palindrome(1221)==1331", "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_100
50
343
src/00343.py
pyc/00343.pyc
CODE <module>() RESUME 0 LOAD_CONST <code snake_to_camel> MAKE_FUNCTION 0 STORE_NAME snake_to_camel RETURN_CONST None END CODE snake_to_camel(word) RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME re STORE_FAST re LOAD_CONST '' LOAD_ATTR NULL|self + join LOAD_CONST <code snake_to_camel.<local...
def snake_to_camel(word): import re return ''.join((x.capitalize() or '_' for x in word.split('_')))
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 102, "mbpp_split": "test", "prompt": "Write a function to convert snake case string to camel case string.", "test_list": [ "assert snake_to_camel('python_program')=='PythonProgram'", "assert snake_to_camel('python_language')==('P...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_102
55
344
src/00344.py
pyc/00344.pyc
CODE <module>() RESUME 0 LOAD_CONST <code eulerian_num> MAKE_FUNCTION 0 STORE_NAME eulerian_num RETURN_CONST None END CODE eulerian_num(n, m) RESUME 0 LOAD_FAST m LOAD_FAST n COMPARE_OP >= POP_JUMP_IF_TRUE L1 LOAD_FAST n LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L2 L1: RETURN_CONST 0 L2...
def eulerian_num(n, m): if m >= n or n == 0: return 0 if m == 0: return 1 return (n - m) * eulerian_num(n - 1, m - 1) + (m + 1) * eulerian_num(n - 1, m)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 103, "mbpp_split": "test", "prompt": "Write a function to find eulerian number a(n, m).", "test_list": [ "assert eulerian_num(3, 1) == 4", "assert eulerian_num(4, 1) == 11", "assert eulerian_num(5, 3) == 26" ], "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_103
50
345
src/00345.py
pyc/00345.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sort_sublists> MAKE_FUNCTION 0 STORE_NAME sort_sublists RETURN_CONST None END CODE sort_sublists(input_list) RESUME 0 LOAD_FAST input_list GET_ITER LOAD_FAST_AND_CLEAR x SWAP 2 L1: BUILD_LIST 0 SWAP 2 L2: FOR_ITER L3 STORE_FAST x LOAD_GLOBAL NULL +...
def sort_sublists(input_list): result = [sorted(x, key=lambda x: x[0]) for x in input_list] return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 104, "mbpp_split": "test", "prompt": "Write a function to sort each sublist of strings in a given list of lists using lambda function.", "test_list": [ "assert sort_sublists(([\"green\", \"orange\"], [\"black\", \"white\"], [\"white\...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_104
48
346
src/00346.py
pyc/00346.pyc
CODE <module>() RESUME 0 LOAD_CONST <code add_lists> MAKE_FUNCTION 0 STORE_NAME add_lists RETURN_CONST None END CODE add_lists(test_list, test_tup) RESUME 0 LOAD_GLOBAL NULL + tuple LOAD_GLOBAL NULL + list LOAD_FAST test_tup CALL 1 LOAD_FAST test_list BINARY_OP + CALL 1 STORE_FAST res LOAD...
def add_lists(test_list, test_tup): res = tuple(list(test_tup) + test_list) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 106, "mbpp_split": "test", "prompt": "Write a function to add the given list to the given tuples.", "test_list": [ "assert add_lists([5, 6, 7], (9, 10)) == (9, 10, 5, 6, 7)", "assert add_lists([6, 7, 8], (10, 11)) == (10, 11, 6, ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_106
19
347
src/00347.py
pyc/00347.pyc
CODE <module>() RESUME 0 LOAD_CONST <code odd_Equivalent> MAKE_FUNCTION 0 STORE_NAME odd_Equivalent RETURN_CONST None END CODE odd_Equivalent(s, n) RESUME 0 LOAD_CONST 0 STORE_FAST count LOAD_GLOBAL NULL + range LOAD_CONST 0 LOAD_FAST n CALL 2 GET_ITER L1: FOR_ITER L3 STORE_FAST i LOAD_F...
def odd_Equivalent(s, n): count = 0 for i in range(0, n): if s[i] == '1': count = count + 1 return count
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 109, "mbpp_split": "test", "prompt": "Write a python function to find the count of rotations of a binary string with odd value.", "test_list": [ "assert odd_Equivalent(\"011001\",6) == 3", "assert odd_Equivalent(\"11011\",5) == 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_109
36
348
src/00348.py
pyc/00348.pyc
CODE <module>() RESUME 0 LOAD_CONST <code extract_missing> MAKE_FUNCTION 0 STORE_NAME extract_missing RETURN_CONST None END CODE extract_missing(test_list, strt_val, stop_val) RESUME 0 BUILD_LIST 0 STORE_FAST res LOAD_FAST test_list GET_ITER L1: FOR_ITER L4 STORE_FAST sub LOAD_FAST sub LOAD_...
def extract_missing(test_list, strt_val, stop_val): res = [] for sub in test_list: if sub[0] > strt_val: res.append((strt_val, sub[0])) strt_val = sub[1] if strt_val < stop_val: res.append((strt_val, stop_val)) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 110, "mbpp_split": "test", "prompt": "Write a function to extract the ranges that are missing from the given list with the given start range and end range values.", "test_list": [ "assert extract_missing([(6, 9), (15, 34), (48, 70)],...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_110
54
349
src/00349.py
pyc/00349.pyc
CODE <module>() RESUME 0 LOAD_CONST <code common_in_nested_lists> MAKE_FUNCTION 0 STORE_NAME common_in_nested_lists RETURN_CONST None END CODE common_in_nested_lists(nestedlist) RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + set LOAD_ATTR intersection LOAD_GLOBAL NULL + map LOAD_GLOBAL set ...
def common_in_nested_lists(nestedlist): result = list(set.intersection(*map(set, nestedlist))) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 111, "mbpp_split": "test", "prompt": "Write a function to find common elements in given nested lists. * list item * list item * list item * list item", "test_list": [ "assert common_in_nested_lists([[12, 18, 23, 25, 45], [7, 12, 18, ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_111
21
350
src/00350.py
pyc/00350.pyc
CODE <module>() RESUME 0 LOAD_CONST <code perimeter> MAKE_FUNCTION 0 STORE_NAME perimeter RETURN_CONST None END CODE perimeter(diameter, height) RESUME 0 LOAD_CONST 2 LOAD_FAST diameter LOAD_FAST height BINARY_OP + BINARY_OP * RETURN_VALUE END
def perimeter(diameter, height): return 2 * (diameter + height)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 112, "mbpp_split": "test", "prompt": "Write a python function to find the perimeter of a cylinder.", "test_list": [ "assert perimeter(2,4) == 12", "assert perimeter(1,2) == 6", "assert perimeter(3,1) == 8" ], "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_112
15
351
src/00351.py
pyc/00351.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_integer> MAKE_FUNCTION 0 STORE_NAME check_integer RETURN_CONST None END CODE check_integer(text) MAKE_CELL text RESUME 0 LOAD_DEREF text LOAD_ATTR NULL|self + strip CALL 0 STORE_DEREF text LOAD_GLOBAL NULL + len LOAD_DEREF text CALL 1 LOAD_CO...
def check_integer(text): text = text.strip() if len(text) < 1: return None elif all((text[i] in '0123456789' for i in range(len(text)))): return True elif text[0] in '+-' and all((text[i] in '0123456789' for i in range(1, len(text)))): return True else: return False
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 113, "mbpp_split": "test", "prompt": "Write a function to check if a string represents an integer or not.", "test_list": [ "assert check_integer(\"python\")==False", "assert check_integer(\"1\")==True", "assert check_integer(...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_113
118
352
src/00352.py
pyc/00352.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 assign_freq> MAKE_FUNCTION 0 STORE_NAME assign_freq RETURN_CONST None END CODE assign_freq(test_list) RESUME 0 LOAD_GLOBAL NULL + Counter LOAD...
from collections import Counter def assign_freq(test_list): res = [(*key, val) for key, val in Counter(test_list).items()] return str(res)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 114, "mbpp_split": "test", "prompt": "Write a function to assign frequency to each tuple in the given tuple list.", "test_list": [ "assert assign_freq([(6, 5, 8), (2, 7), (6, 5, 8), (6, 5, 8), (9, ), (2, 7)] ) == '[(6, 5, 8, 3), (2, ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_114
58
353
src/00353.py
pyc/00353.pyc
CODE <module>() RESUME 0 LOAD_CONST <code empty_dit> MAKE_FUNCTION 0 STORE_NAME empty_dit RETURN_CONST None END CODE empty_dit(list1) RESUME 0 LOAD_GLOBAL NULL + all LOAD_CONST <code empty_dit.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_FAST list1 GET_ITER CALL 0 CALL 1 STORE_FAST empty_dit L...
def empty_dit(list1): empty_dit = all((not d for d in list1)) return empty_dit
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 115, "mbpp_split": "test", "prompt": "Write a function to check whether all dictionaries in a list are empty or not.", "test_list": [ "assert empty_dit([{},{},{}])==True", "assert empty_dit([{1,2},{},{}])==False", "assert emp...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_115
42
354
src/00354.py
pyc/00354.pyc
CODE <module>() RESUME 0 LOAD_CONST <code tuple_to_int> MAKE_FUNCTION 0 STORE_NAME tuple_to_int RETURN_CONST None END CODE tuple_to_int(nums) RESUME 0 LOAD_GLOBAL NULL + int LOAD_CONST '' LOAD_ATTR NULL|self + join LOAD_GLOBAL NULL + map LOAD_GLOBAL str LOAD_FAST nums CALL 2 CALL 1 CALL 1 ...
def tuple_to_int(nums): result = int(''.join(map(str, nums))) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 116, "mbpp_split": "test", "prompt": "Write a function to convert a given tuple of positive integers into an integer.", "test_list": [ "assert tuple_to_int((1,2,3))==123", "assert tuple_to_int((4,5,6))==456", "assert tuple_to...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_116
21
355
src/00355.py
pyc/00355.pyc
CODE <module>() RESUME 0 LOAD_CONST <code list_to_float> MAKE_FUNCTION 0 STORE_NAME list_to_float RETURN_CONST None END CODE list_to_float(test_list) RESUME 0 BUILD_LIST 0 STORE_FAST res LOAD_FAST test_list GET_ITER L1: FOR_ITER L5 STORE_FAST tup BUILD_LIST 0 STORE_FAST temp LOAD_FAST tup ...
def list_to_float(test_list): res = [] for tup in test_list: temp = [] for ele in tup: if ele.isalpha(): temp.append(ele) else: temp.append(float(ele)) res.append((temp[0], temp[1])) return str(res)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 117, "mbpp_split": "test", "prompt": "Write a function to convert all possible convertible elements in the list to float.", "test_list": [ "assert list_to_float( [(\"3\", \"4\"), (\"1\", \"26.45\"), (\"7.32\", \"8\"), (\"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_117
62
356
src/00356.py
pyc/00356.pyc
CODE <module>() RESUME 0 LOAD_CONST <code search> MAKE_FUNCTION 0 STORE_NAME search RETURN_CONST None END CODE search(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST XOR LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L2 STORE_FAST i LOAD_FAST XOR LOAD_FAST arr LOAD_FAST i ...
def search(arr, n): XOR = 0 for i in range(n): XOR = XOR ^ arr[i] return XOR
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 119, "mbpp_split": "test", "prompt": "Write a python function to find the element that appears only once in a sorted array.", "test_list": [ "assert search([1,1,2,2,3],5) == 3", "assert search([1,1,3,3,4,4,5,5,7,7,8],11) == 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_119
29
357
src/00357.py
pyc/00357.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_triplet> MAKE_FUNCTION 0 STORE_NAME check_triplet RETURN_CONST None END CODE check_triplet(A, n, sum, count) RESUME 0 LOAD_FAST count LOAD_CONST 3 COMPARE_OP == POP_JUMP_IF_FALSE L1 LOAD_FAST sum LOAD_CONST 0 COMPARE_OP == POP_JUMP_IF_FALSE L1 ...
def check_triplet(A, n, sum, count): if count == 3 and sum == 0: return True if count == 3 or n == 0 or sum < 0: return False return check_triplet(A, n - 1, sum - A[n - 1], count + 1) or check_triplet(A, n - 1, sum, count)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 121, "mbpp_split": "test", "prompt": "Write a function to find the triplet with sum of the given array", "test_list": [ "assert check_triplet([2, 7, 4, 0, 9, 5, 1, 3], 8, 6, 0) == True", "assert check_triplet([1, 4, 5, 6, 7, 8, 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_121
63
358
src/00358.py
pyc/00358.pyc
CODE <module>() RESUME 0 LOAD_CONST 3000 STORE_NAME MAX LOAD_CONST <code smartNumber> MAKE_FUNCTION 0 STORE_NAME smartNumber RETURN_CONST None END CODE smartNumber(n) RESUME 0 LOAD_CONST 0 BUILD_LIST 1 LOAD_GLOBAL MAX BINARY_OP * STORE_FAST primes BUILD_LIST 0 STORE_FAST result LOAD_GLOB...
MAX = 3000 def smartNumber(n): primes = [0] * MAX result = [] for i in range(2, MAX): if primes[i] == 0: primes[i] = 1 j = i * 2 while j < MAX: primes[j] -= 1 if primes[j] + 3 == 0: result.append(j) ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 122, "mbpp_split": "test", "prompt": "Write a function to find n’th smart number.", "test_list": [ "assert smartNumber(1) == 30", "assert smartNumber(50) == 273", "assert smartNumber(1000) == 2664" ], "transform": "ast.un...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_122
95
359
src/00359.py
pyc/00359.pyc
CODE <module>() RESUME 0 LOAD_CONST <code amicable_numbers_sum> MAKE_FUNCTION 0 STORE_NAME amicable_numbers_sum RETURN_CONST None END CODE amicable_numbers_sum(limit) RESUME 0 LOAD_GLOBAL NULL + isinstance LOAD_FAST limit LOAD_GLOBAL int CALL 2 POP_JUMP_IF_TRUE L1 RETURN_CONST 'Input is not an i...
def amicable_numbers_sum(limit): if not isinstance(limit, int): return 'Input is not an integer!' if limit < 1: return 'Input must be bigger than 0!' amicables = set() for num in range(2, limit + 1): if num in amicables: continue sum_fact = sum([fact for fact ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 123, "mbpp_split": "test", "prompt": "Write a function to sum all amicable numbers from 1 to a specified number.", "test_list": [ "assert amicable_numbers_sum(999)==504", "assert amicable_numbers_sum(9999)==31626", "assert am...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_123
152
360
src/00360.py
pyc/00360.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST None IMPORT_NAME cmath STORE_NAME cmath LOAD_CONST <code angle_complex> MAKE_FUNCTION 0 STORE_NAME angle_complex RETURN_CONST None END CODE angle_complex(a, b) RESUME 0 LOAD_GLOBAL NULL + complex LOAD_FAST a LOAD_FAST b CALL 2 STORE_FAST cn ...
import cmath def angle_complex(a, b): cn = complex(a, b) angle = cmath.phase(a + b) return angle
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 124, "mbpp_split": "test", "prompt": "Write a function to get the angle of a complex number.", "test_list": [ "assert angle_complex(0,1j)==1.5707963267948966 ", "assert angle_complex(2,1j)==0.4636476090008061", "assert angle_...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_124
27
361
src/00361.py
pyc/00361.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_length> MAKE_FUNCTION 0 STORE_NAME find_length RETURN_CONST None END CODE find_length(string, n) RESUME 0 LOAD_CONST 0 STORE_FAST current_sum LOAD_CONST 0 STORE_FAST max_sum LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L5 ...
def find_length(string, n): current_sum = 0 max_sum = 0 for i in range(n): current_sum += 1 if string[i] == '0' else -1 if current_sum < 0: current_sum = 0 max_sum = max(current_sum, max_sum) return max_sum if max_sum else 0
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 125, "mbpp_split": "test", "prompt": "Write a function to find the maximum difference between the number of 0s and number of 1s in any sub-string of the given binary string.", "test_list": [ "assert find_length(\"11000010001\", 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_125
56
362
src/00362.py
pyc/00362.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum> MAKE_FUNCTION 0 STORE_NAME sum RETURN_CONST None END CODE sum(a, b) RESUME 0 LOAD_CONST 0 STORE_FAST sum LOAD_GLOBAL NULL + range LOAD_CONST 1 LOAD_GLOBAL NULL + min LOAD_FAST a LOAD_FAST b CALL 2 CALL 2 GET_ITER L1: FOR_ITER L4 STORE_FA...
def sum(a, b): sum = 0 for i in range(1, min(a, b)): if a % i == 0 and b % i == 0: sum += i return sum
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 126, "mbpp_split": "test", "prompt": "Write a python function to find the sum of common divisors of two given numbers.", "test_list": [ "assert sum(10,15) == 6", "assert sum(100,150) == 93", "assert sum(4,6) == 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_126
47
363
src/00363.py
pyc/00363.pyc
CODE <module>() RESUME 0 LOAD_CONST <code multiply_int> MAKE_FUNCTION 0 STORE_NAME multiply_int RETURN_CONST None END CODE multiply_int(x, y) RESUME 0 LOAD_FAST y LOAD_CONST 0 COMPARE_OP < POP_JUMP_IF_FALSE L1 LOAD_GLOBAL NULL + multiply_int LOAD_FAST x LOAD_FAST y UNARY_NEGATIVE CALL 2 ...
def multiply_int(x, y): if y < 0: return -multiply_int(x, -y) elif y == 0: return 0 elif y == 1: return x else: return x + multiply_int(x, y - 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 127, "mbpp_split": "test", "prompt": "Write a function to multiply two integers without using the * operator in python.", "test_list": [ "assert multiply_int(10,20)==200", "assert multiply_int(5,10)==50", "assert multiply_int...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_127
43
364
src/00364.py
pyc/00364.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('defaultdict',) IMPORT_NAME collections IMPORT_FROM defaultdict STORE_NAME defaultdict POP_TOP LOAD_CONST <code max_occurrences> MAKE_FUNCTION 0 STORE_NAME max_occurrences RETURN_CONST None END CODE max_occurrences(nums) RESUME 0 LOAD_GLOBAL NU...
from collections import defaultdict def max_occurrences(nums): dict = defaultdict(int) for i in nums: dict[i] += 1 result = max(dict.items(), key=lambda x: x[1]) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 130, "mbpp_split": "test", "prompt": "Write a function to find the item with maximum frequency in a given list.", "test_list": [ "assert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,2,4,6,9,1,2])==(2, 5)", "assert max_occurrenc...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_130
55
365
src/00365.py
pyc/00365.pyc
CODE <module>() RESUME 0 LOAD_CONST <code reverse_vowels> MAKE_FUNCTION 0 STORE_NAME reverse_vowels RETURN_CONST None END CODE reverse_vowels(str1) RESUME 0 LOAD_CONST '' STORE_FAST vowels LOAD_FAST str1 GET_ITER L1: FOR_ITER L3 STORE_FAST char LOAD_FAST char LOAD_CONST 'aeiouAEIOU' CONTAI...
def reverse_vowels(str1): vowels = '' for char in str1: if char in 'aeiouAEIOU': vowels += char result_string = '' for char in str1: if char in 'aeiouAEIOU': result_string += vowels[-1] vowels = vowels[:-1] else: result_string += ch...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 131, "mbpp_split": "test", "prompt": "Write a python function to reverse only the vowels of a given string.", "test_list": [ "assert reverse_vowels(\"Python\") == \"Python\"", "assert reverse_vowels(\"USA\") == \"ASU\"", "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_131
62
366
src/00366.py
pyc/00366.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_negativenum> MAKE_FUNCTION 0 STORE_NAME sum_negativenum RETURN_CONST None END CODE sum_negativenum(nums) RESUME 0 LOAD_GLOBAL NULL + list LOAD_GLOBAL NULL + filter LOAD_CONST <code sum_negativenum.<locals>.<lambda>> MAKE_FUNCTION 0 LOAD_FAST nums CAL...
def sum_negativenum(nums): sum_negativenum = list(filter(lambda nums: nums < 0, nums)) return sum(sum_negativenum)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 133, "mbpp_split": "test", "prompt": "Write a function to calculate the sum of the negative numbers of a given list of numbers using lambda function.", "test_list": [ "assert sum_negativenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==-32"...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_133
28
367
src/00367.py
pyc/00367.pyc
CODE <module>() RESUME 0 LOAD_CONST <code check_last> MAKE_FUNCTION 0 STORE_NAME check_last RETURN_CONST None END CODE check_last(arr, n, p) RESUME 0 LOAD_CONST 0 STORE_FAST _sum LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER L1: FOR_ITER L2 STORE_FAST i LOAD_FAST _sum LOAD_FAST ar...
def check_last(arr, n, p): _sum = 0 for i in range(n): _sum = _sum + arr[i] if p == 1: if _sum % 2 == 0: return 'ODD' else: return 'EVEN' return 'EVEN'
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 134, "mbpp_split": "test", "prompt": "Write a python function to check whether the last element of given array is even or odd after performing an operation p times.", "test_list": [ "assert check_last([5,7,10],3,1) == \"ODD\"", "...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_134
42
368
src/00368.py
pyc/00368.pyc
CODE <module>() RESUME 0 LOAD_CONST <code hexagonal_num> MAKE_FUNCTION 0 STORE_NAME hexagonal_num RETURN_CONST None END CODE hexagonal_num(n) RESUME 0 LOAD_FAST n LOAD_CONST 2 LOAD_FAST n BINARY_OP * LOAD_CONST 1 BINARY_OP - BINARY_OP * RETURN_VALUE END
def hexagonal_num(n): return n * (2 * n - 1)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 135, "mbpp_split": "test", "prompt": "Write a function to find the nth hexagonal number.", "test_list": [ "assert hexagonal_num(10) == 190", "assert hexagonal_num(5) == 45", "assert hexagonal_num(7) == 91" ], "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_135
17
369
src/00369.py
pyc/00369.pyc
CODE <module>() RESUME 0 LOAD_CONST <code cal_electbill> MAKE_FUNCTION 0 STORE_NAME cal_electbill RETURN_CONST None END CODE cal_electbill(units) RESUME 0 LOAD_FAST units LOAD_CONST 50 COMPARE_OP < POP_JUMP_IF_FALSE L1 LOAD_FAST units LOAD_CONST 2.6 BINARY_OP * STORE_FAST amount LOAD_CONST...
def cal_electbill(units): if units < 50: amount = units * 2.6 surcharge = 25 elif units <= 100: amount = 130 + (units - 50) * 3.25 surcharge = 35 elif units <= 200: amount = 130 + 162.5 + (units - 100) * 5.26 surcharge = 45 else: amount = 130 + 162...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 136, "mbpp_split": "test", "prompt": "Write a function to calculate electricity bill.", "test_list": [ "assert cal_electbill(75)==246.25", "assert cal_electbill(265)==1442.75", "assert cal_electbill(100)==327.5" ], "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_136
70
370
src/00370.py
pyc/00370.pyc
CODE <module>() RESUME 0 LOAD_CONST 0 LOAD_CONST ('array',) IMPORT_NAME array IMPORT_FROM array STORE_NAME array POP_TOP LOAD_CONST <code zero_count> MAKE_FUNCTION 0 STORE_NAME zero_count RETURN_CONST None END CODE zero_count(nums) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST nums CALL 1 ST...
from array import array def zero_count(nums): n = len(nums) n1 = 0 for x in nums: if x == 0: n1 += 1 else: None return round(n1 / n, 2)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 137, "mbpp_split": "test", "prompt": "Write a function to find the ration of zeroes in an array of integers.", "test_list": [ "assert zero_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8])==0.15", "assert zero_count([2, 1, 2, -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_137
46
371
src/00371.py
pyc/00371.pyc
CODE <module>() RESUME 0 LOAD_CONST <code is_Sum_Of_Powers_Of_Two> MAKE_FUNCTION 0 STORE_NAME is_Sum_Of_Powers_Of_Two RETURN_CONST None END CODE is_Sum_Of_Powers_Of_Two(n) RESUME 0 LOAD_FAST n LOAD_CONST 2 BINARY_OP % LOAD_CONST 1 COMPARE_OP == POP_JUMP_IF_FALSE L1 RETURN_CONST False L1: RET...
def is_Sum_Of_Powers_Of_Two(n): if n % 2 == 1: return False else: return True
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 138, "mbpp_split": "test", "prompt": "Write a python function to check whether the given number can be represented as sum of non-zero powers of 2 or not.", "test_list": [ "assert is_Sum_Of_Powers_Of_Two(10) == True", "assert is_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_138
18
372
src/00372.py
pyc/00372.pyc
CODE <module>() RESUME 0 LOAD_CONST <code circle_circumference> MAKE_FUNCTION 0 STORE_NAME circle_circumference RETURN_CONST None END CODE circle_circumference(r) RESUME 0 LOAD_CONST 6.283 LOAD_FAST r BINARY_OP * STORE_FAST perimeter LOAD_FAST perimeter RETURN_VALUE END
def circle_circumference(r): perimeter = 2 * 3.1415 * r return perimeter
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 139, "mbpp_split": "test", "prompt": "Write a function to find the circumference of a circle.", "test_list": [ "assert circle_circumference(10)==62.830000000000005", "assert circle_circumference(5)==31.415000000000003", "asse...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_139
15
373
src/00373.py
pyc/00373.pyc
CODE <module>() RESUME 0 LOAD_CONST <code extract_singly> MAKE_FUNCTION 0 STORE_NAME extract_singly RETURN_CONST None END CODE extract_singly(test_list) RESUME 0 BUILD_LIST 0 STORE_FAST res LOAD_GLOBAL NULL + set CALL 0 STORE_FAST temp LOAD_FAST test_list GET_ITER L1: FOR_ITER L5 STORE_FAS...
def extract_singly(test_list): res = [] temp = set() for inner in test_list: for ele in inner: if not ele in temp: temp.add(ele) res.append(ele) return res
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 140, "mbpp_split": "test", "prompt": "Write a function to extract elements that occur singly in the given tuple list.", "test_list": [ "assert extract_singly([(3, 4, 5), (4, 5, 7), (1, 4)]) == [3, 4, 5, 7, 1]", "assert extract_si...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_140
48
374
src/00374.py
pyc/00374.pyc
CODE <module>() RESUME 0 LOAD_CONST <code pancake_sort> MAKE_FUNCTION 0 STORE_NAME pancake_sort RETURN_CONST None END CODE pancake_sort(nums) RESUME 0 LOAD_GLOBAL NULL + len LOAD_FAST nums CALL 1 STORE_FAST arr_len LOAD_FAST arr_len LOAD_CONST 1 COMPARE_OP > POP_JUMP_IF_FALSE L2 L1: LOAD_F...
def pancake_sort(nums): arr_len = len(nums) while arr_len > 1: mi = nums.index(max(nums[0:arr_len])) nums = nums[mi::-1] + nums[mi + 1:len(nums)] nums = nums[arr_len - 1::-1] + nums[arr_len:len(nums)] arr_len -= 1 return nums
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 141, "mbpp_split": "test", "prompt": "Write a function to sort a list of elements using pancake sort.", "test_list": [ "assert pancake_sort([15, 79, 25, 38, 69]) == [15, 25, 38, 69, 79]", "assert pancake_sort([98, 12, 54, 36, 85]...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_141
72
375
src/00375.py
pyc/00375.pyc
CODE <module>() RESUME 0 LOAD_CONST <code count_samepair> MAKE_FUNCTION 0 STORE_NAME count_samepair RETURN_CONST None END CODE count_samepair(list1, list2, list3) RESUME 0 LOAD_GLOBAL NULL + sum LOAD_CONST <code count_samepair.<locals>.<genexpr>> MAKE_FUNCTION 0 LOAD_GLOBAL NULL + zip LOAD_FAST li...
def count_samepair(list1, list2, list3): result = sum((m == n == o for m, n, o in zip(list1, list2, list3))) return result
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 142, "mbpp_split": "test", "prompt": "Write a function to count the same pair in three given lists.", "test_list": [ "assert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,9],[2,1,3,1,2,6,7,9])==3", "assert count_samepair([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_142
62
376
src/00376.py
pyc/00376.pyc
CODE <module>() RESUME 0 LOAD_CONST <code find_lists> MAKE_FUNCTION 0 STORE_NAME find_lists RETURN_CONST None END CODE find_lists(Input) RESUME 0 LOAD_GLOBAL NULL + isinstance LOAD_FAST Input LOAD_GLOBAL list CALL 2 POP_JUMP_IF_FALSE L1 RETURN_CONST 1 L1: LOAD_GLOBAL NULL + len LOAD_FAST Inp...
def find_lists(Input): if isinstance(Input, list): return 1 else: return len(Input)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 143, "mbpp_split": "test", "prompt": "Write a function to find number of lists present in the given tuple.", "test_list": [ "assert find_lists(([1, 2, 3, 4], [5, 6, 7, 8])) == 2", "assert find_lists(([1, 2], [3, 4], [5, 6])) == ...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_143
20
377
src/00377.py
pyc/00377.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_Pairs> MAKE_FUNCTION 0 STORE_NAME sum_Pairs RETURN_CONST None END CODE sum_Pairs(arr, n) RESUME 0 LOAD_CONST 0 STORE_FAST sum LOAD_GLOBAL NULL + range LOAD_FAST n LOAD_CONST 1 BINARY_OP - LOAD_CONST -1 LOAD_CONST -1 CALL 3 GET_ITER L1: FOR_...
def sum_Pairs(arr, n): sum = 0 for i in range(n - 1, -1, -1): sum += i * arr[i] - (n - 1 - i) * arr[i] return sum
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 144, "mbpp_split": "test", "prompt": "Write a python function to find the sum of absolute differences in all pairs of the given array.", "test_list": [ "assert sum_Pairs([1,8,9,15,16],5) == 74", "assert sum_Pairs([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_144
45
378
src/00378.py
pyc/00378.pyc
CODE <module>() RESUME 0 LOAD_CONST <code ascii_value_string> MAKE_FUNCTION 0 STORE_NAME ascii_value_string RETURN_CONST None END CODE ascii_value_string(str1) RESUME 0 LOAD_GLOBAL NULL + range LOAD_GLOBAL NULL + len LOAD_FAST str1 CALL 1 CALL 1 GET_ITER FOR_ITER L1 STORE_FAST i LOAD_GLOBA...
def ascii_value_string(str1): for i in range(len(str1)): return ord(str1[i])
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 146, "mbpp_split": "test", "prompt": "Write a function to find the ascii value of total characters in a string.", "test_list": [ "assert ascii_value_string(\"python\")==112", "assert ascii_value_string(\"Program\")==80", "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_146
28
379
src/00379.py
pyc/00379.pyc
CODE <module>() RESUME 0 LOAD_CONST <code sum_digits_single> MAKE_FUNCTION 0 STORE_NAME sum_digits_single LOAD_CONST <code closest> MAKE_FUNCTION 0 STORE_NAME closest LOAD_CONST <code sum_digits_twoparts> MAKE_FUNCTION 0 STORE_NAME sum_digits_twoparts RETURN_CONST None END CODE sum_digits_single(x...
def sum_digits_single(x): ans = 0 while x: ans += x % 10 x //= 10 return ans def closest(x): ans = 0 while ans * 10 + 9 <= x: ans = ans * 10 + 9 return ans def sum_digits_twoparts(N): A = closest(N) return sum_digits_single(A) + sum_digits_single(N - A)
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 148, "mbpp_split": "test", "prompt": "Write a function to divide a number into two parts such that the sum of digits is maximum.", "test_list": [ "assert sum_digits_twoparts(35)==17", "assert sum_digits_twoparts(7)==7", "asse...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_148
85
380
src/00380.py
pyc/00380.pyc
CODE <module>() RESUME 0 LOAD_CONST <code longest_subseq_with_diff_one> MAKE_FUNCTION 0 STORE_NAME longest_subseq_with_diff_one RETURN_CONST None END CODE longest_subseq_with_diff_one(arr, n) RESUME 0 LOAD_GLOBAL NULL + range LOAD_FAST n CALL 1 GET_ITER LOAD_FAST_AND_CLEAR i SWAP 2 L1: BUILD_L...
def longest_subseq_with_diff_one(arr, n): dp = [1 for i in range(n)] for i in range(n): for j in range(i): if arr[i] == arr[j] + 1 or arr[i] == arr[j] - 1: dp[i] = max(dp[i], dp[j] + 1) result = 1 for i in range(n): if result < dp[i]: result = dp[i...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 149, "mbpp_split": "test", "prompt": "Write a function to find the longest subsequence such that the difference between adjacents is one for the given array.", "test_list": [ "assert longest_subseq_with_diff_one([1, 2, 3, 4, 5, 3, 2]...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_149
117
381
src/00381.py
pyc/00381.pyc
CODE <module>() RESUME 0 LOAD_CONST <code gcd> MAKE_FUNCTION 0 STORE_NAME gcd LOAD_CONST <code is_coprime> MAKE_FUNCTION 0 STORE_NAME is_coprime RETURN_CONST None END CODE gcd(p, q) RESUME 0 LOAD_FAST q LOAD_CONST 0 COMPARE_OP != POP_JUMP_IF_FALSE L2 L1: LOAD_FAST q LOAD_FAST p LOAD_FAST...
def gcd(p, q): while q != 0: p, q = (q, p % q) return p def is_coprime(x, y): return gcd(x, y) == 1
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 151, "mbpp_split": "test", "prompt": "Write a python function to check whether the given number is co-prime or not.", "test_list": [ "assert is_coprime(17,13) == True", "assert is_coprime(15,21) == False", "assert is_coprime(...
{ "spdx": "CC-BY-4.0", "name": "Creative Commons Attribution 4.0 International", "attribution": "MBPP (Mostly Basic Python Problems), Austin et al. 2021, Google Research", "source_url": "https://huggingface.co/datasets/google-research-datasets/mbpp" }
mbpp
mbpp_151
41
382
src/00382.py
pyc/00382.pyc
CODE <module>() RESUME 0 LOAD_CONST <code merge> MAKE_FUNCTION 0 STORE_NAME merge LOAD_CONST <code merge_sort> MAKE_FUNCTION 0 STORE_NAME merge_sort RETURN_CONST None END CODE merge(a, b) RESUME 0 BUILD_LIST 0 STORE_FAST c LOAD_GLOBAL NULL + len LOAD_FAST a CALL 1 LOAD_CONST 0 COMPARE_OP...
def merge(a, b): c = [] while len(a) != 0 and len(b) != 0: if a[0] < b[0]: c.append(a[0]) a.remove(a[0]) else: c.append(b[0]) b.remove(b[0]) if len(a) == 0: c += b else: c += a return c def merge_sort(x): if len(x) ...
{ "dataset": "google-research-datasets/mbpp (config 'full')", "task_id": 152, "mbpp_split": "test", "prompt": "Write a function to sort the given array by using merge sort.", "test_list": [ "assert merge_sort([3, 4, 2, 6, 5, 7, 1, 9]) == [1, 2, 3, 4, 5, 6, 7, 9]", "assert merge_sort([7, 25, 45, 78, 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_152
143