Dataset Viewer
Auto-converted to Parquet Duplicate
task_id
int64
601
974
text
stringlengths
38
249
code
stringlengths
30
908
test_list
listlengths
3
3
test_setup_code
stringclasses
2 values
challenge_test_list
listlengths
0
0
629
Write a function to remove similar rows from the given tuple matrix.
def multiply_elements(test_tup): res = tuple(i * j for i, j in zip(test_tup, test_tup[1:])) return (res)
[ "assert re_arrange_tuples([(4, 3), (1, 9), (2, 10), (3, 2)], [1, 4, 2, 3]) == [(1, 9), (4, 3), (2, 10), (3, 2)]", "assert re_arrange_tuples([(5, 4), (2, 10), (3, 11), (4, 3)], [3, 4, 2, 3]) == [(3, 11), (4, 3), (2, 10), (3, 11)]", "assert re_arrange_tuples([(6, 3), (3, 8), (5, 7), (2, 4)], [2, 5, 3, 6]) == [(2, 4), (5, 7), (3, 8), (6, 3)]" ]
[]
902
Write a function to count the pairs of reverse strings in the given string list.
from collections import Counter def max_char(str1): temp = Counter(str1) max_char = max(temp, key = temp.get) return max_char
[ "assert fibonacci(7) == 13", "assert fibonacci(8) == 21", "assert fibonacci(9) == 34" ]
[]
945
Write a python function to find nth bell number.
def even_num(x): if x%2==0: return True else: return False
[ "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", "assert sum_even_odd([1,5,7,9,10])==11" ]
[]
962
Write a function to re-arrange the given tuples based on the given ordered list.
import re def extract_date(url): return re.findall(r'/(\d{4})/(\d{1,2})/(\d{1,2})/', url)
[ "assert get_unique([(3, 4), (1, 2), (2, 4), (8, 2), (7, 2), (8, 1), (9, 1), (8, 4), (10, 4)] ) == '{4: 4, 2: 3, 1: 2}'", "assert get_unique([(4, 5), (2, 3), (3, 5), (9, 3), (8, 3), (9, 2), (10, 2), (9, 5), (11, 5)] ) == '{5: 4, 3: 3, 2: 2}'", "assert get_unique([(6, 5), (3, 4), (2, 6), (11, 1), (8, 22), (8, 11), (4, 3), (14, 3), (11, 6)] ) == '{5: 1, 4: 1, 6: 2, 1: 1, 22: 1, 11: 1, 3: 2}'" ]
[]
812
Write a python function to print duplicants from a list of integers.
def min_of_two( x, y ): if x < y: return x return y
[ "assert div_of_nums([19, 65, 57, 39, 152, 639, 121, 44, 90, 190],2,4)==[ 152,44]", "assert div_of_nums([1, 2, 3, 5, 7, 8, 10],2,5)==[10]", "assert div_of_nums([10,15,14,13,18,12,20],10,5)==[10,20]" ]
[]
808
Write a function to find the minimum number of elements that should be removed such that amax-amin<=k.
def find_First_Missing(array,start,end): if (start > end): return end + 1 if (start != array[start]): return start; mid = int((start + end) / 2) if (array[mid] == mid): return find_First_Missing(array,mid+1,end) return find_First_Missing(array,start,mid)
[ "assert split_list(\"LearnToBuildAnythingWithGoogle\") == ['Learn', 'To', 'Build', 'Anything', 'With', 'Google']", "assert split_list(\"ApmlifyingTheBlack+DeveloperCommunity\") == ['Apmlifying', 'The', 'Black+', 'Developer', 'Community']", "assert split_list(\"UpdateInTheGoEcoSystem\") == ['Update', 'In', 'The', 'Go', 'Eco', 'System']" ]
[]
644
Write a python function to access multiple elements of specified index from a given list.
def remove_spaces(str1): str1 = str1.replace(' ','') return str1
[ "assert sort_tuple([(\"Amana\", 28), (\"Zenat\", 30), (\"Abhishek\", 29),(\"Nikhil\", 21), (\"B\", \"C\")]) == [('Abhishek', 29), ('Amana', 28), ('B', 'C'), ('Nikhil', 21), ('Zenat', 30)]", "assert sort_tuple([(\"aaaa\", 28), (\"aa\", 30), (\"bab\", 29), (\"bb\", 21), (\"csa\", \"C\")]) == [('aa', 30), ('aaaa', 28), ('bab', 29), ('bb', 21), ('csa', 'C')]", "assert sort_tuple([(\"Sarala\", 28), (\"Ayesha\", 30), (\"Suman\", 29),(\"Sai\", 21), (\"G\", \"H\")]) == [('Ayesha', 30), ('G', 'H'), ('Sai', 21), ('Sarala', 28), ('Suman', 29)]" ]
[]
698
Write a function to find number of even elements in the given list using lambda function.
def count_vowels(test_str): res = 0 vow_list = ['a', 'e', 'i', 'o', 'u'] for idx in range(1, len(test_str) - 1): if test_str[idx] not in vow_list and (test_str[idx - 1] in vow_list or test_str[idx + 1] in vow_list): res += 1 if test_str[0] not in vow_list and test_str[1] in vow_list: res += 1 if test_str[-1] not in vow_list and test_str[-2] in vow_list: res += 1 return (res)
[ "assert max_sum_subseq([1, 2, 9, 4, 5, 0, 4, 11, 6]) == 26", "assert max_sum_subseq([1, 2, 9, 5, 6, 0, 5, 12, 7]) == 28", "assert max_sum_subseq([1, 3, 10, 5, 6, 0, 6, 14, 21]) == 44" ]
[]
728
Write a function to count the number of unique lists within a list.
import re def text_match(text): patterns = 'ab*?' if re.search(patterns, text): return 'Found a match!' else: return('Not matched!')
[ "assert increasing_trend([1,2,3,4]) == True", "assert increasing_trend([4,3,2,1]) == False", "assert increasing_trend([0,1,4,9]) == True" ]
[]
862
Write a python function to count the number of rotations required to generate a sorted array.
def Average(lst): return sum(lst) / len(lst)
[ "assert is_Two_Alter(\"abab\") == True", "assert is_Two_Alter(\"aaaa\") == False", "assert is_Two_Alter(\"xyz\") == False" ]
[]
928
Write a function to check if the triangle is valid or not.
from heapq import merge def combine_lists(num1,num2): combine_lists=list(merge(num1, num2)) return combine_lists
[ "assert check_subset((10, 4, 5, 6), (5, 10)) == True", "assert check_subset((1, 2, 3, 4), (5, 6)) == False", "assert check_subset((7, 8, 9, 10), (10, 8)) == True" ]
[]
883
Write a function to calculate the sum of the positive numbers of a given list of numbers using lambda function.
def maximum_product(nums): import heapq a, b = heapq.nlargest(3, nums), heapq.nsmallest(2, nums) return max(a[0] * a[1] * a[2], a[0] * b[0] * b[1])
[ "assert find_Min_Diff((1,5,3,19,18,25),6) == 1", "assert find_Min_Diff((4,3,2,6),4) == 1", "assert find_Min_Diff((30,5,20,9),4) == 4" ]
[]
705
Write a python function to check whether the product of numbers is even or not.
import re def text_match_wordz_middle(text): patterns = '\Bz\B' if re.search(patterns, text): return 'Found a match!' else: return('Not matched!')
[ "assert grouping_dictionary([('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)])== ({'yellow': [1, 3], 'blue': [2, 4], 'red': [1]})", "assert grouping_dictionary([('yellow', 10), ('blue', 20), ('yellow', 30), ('blue', 40), ('red', 10)])== ({'yellow': [10, 30], 'blue': [20, 40], 'red': [10]})", "assert grouping_dictionary([('yellow', 15), ('blue', 25), ('yellow', 35), ('blue', 45), ('red', 15)])== ({'yellow': [15, 35], 'blue': [25, 45], 'red': [15]})" ]
[]
825
Write a python function to get the position of rightmost set bit.
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 ): dp[i + c] = max(dp[i] + 1, dp[i + c]) return dp[n]
[ "assert extract_quotation('Cortex \"A53\" Based \"multi\" tasking \"Processor\"') == ['A53', 'multi', 'Processor']", "assert extract_quotation('Cast your \"favorite\" entertainment \"apps\"') == ['favorite', 'apps']", "assert extract_quotation('Watch content \"4k Ultra HD\" resolution with \"HDR 10\" Support') == ['4k Ultra HD', 'HDR 10']" ]
[]
934
Write a function to extract specified number of elements from a given list, which follow each other continuously.
from collections import Counter def add_dict(d1,d2): add_dict = Counter(d1) + Counter(d2) return add_dict
[ "assert count_tuplex((2, 4, 5, 6, 2, 3, 4, 4, 7),4)==3", "assert count_tuplex((2, 4, 5, 6, 2, 3, 4, 4, 7),2)==2", "assert count_tuplex((2, 4, 7, 7, 7, 3, 4, 4, 7),7)==4" ]
[]
890
Write a function to add two lists using map and lambda function.
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;
[ "assert check_valid((True, True, True, True) ) == True", "assert check_valid((True, False, True, True) ) == False", "assert check_valid((True, True, True, True) ) == True" ]
[]
787
Write a python function to check whether the given number is odd or not using bitwise operator.
def camel_to_snake(text): import re str1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', text) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', str1).lower()
[ "assert str_to_tuple(\"1, -5, 4, 6, 7\") == (1, -5, 4, 6, 7)", "assert str_to_tuple(\"1, 2, 3, 4, 5\") == (1, 2, 3, 4, 5)", "assert str_to_tuple(\"4, 6, 9, 11, 13, 14\") == (4, 6, 9, 11, 13, 14)" ]
[]
748
Write a function to sort a list of dictionaries using lambda function.
def Check_Solution(a,b,c): if b == 0: return ("Yes") else: return ("No")
[ "assert geometric_sum(7) == 1.9921875", "assert geometric_sum(4) == 1.9375", "assert geometric_sum(8) == 1.99609375" ]
[]
783
Write a function to find the product of it’s kth index in the given tuples.
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]
[ "assert are_Rotations(\"abc\",\"cba\") == False", "assert are_Rotations(\"abcd\",\"cdba\") == False", "assert are_Rotations(\"abacd\",\"cdaba\") == True" ]
[]
892
Write a python function to find the length of the last word in a given string.
import math def first_Digit(n) : fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
[ "assert num_position(\"there are 70 flats in this apartment\")==10", "assert num_position(\"every adult have 32 teeth\")==17", "assert num_position(\"isha has 79 chocolates in her bag\")==9" ]
[]
624
Write a function to extract all the adjacent coordinates of the given coordinate tuple.
import math def wind_chill(v,t): windchill = 13.12 + 0.6215*t - 11.37*math.pow(v, 0.16) + 0.3965*t*math.pow(v, 0.16) return int(round(windchill, 0))
[ "assert parallelogram_perimeter(10,20)==400", "assert parallelogram_perimeter(15,20)==600", "assert parallelogram_perimeter(8,9)==144" ]
[]
898
Write a python function to find the minimum number of swaps required to convert one binary string to another.
import re def remove_extra_char(text1): pattern = re.compile('[\W_]+') return (pattern.sub('', text1))
[ "assert discriminant_value(4,8,2)==(\"Two solutions\",32)", "assert discriminant_value(5,7,9)==(\"no real solution\",-131)", "assert discriminant_value(0,0,9)==(\"one solution\",0)" ]
[]
946
Write a function to find three closest elements from three sorted arrays.
def coin_change(S, m, n): table = [[0 for x in range(m)] for x in range(n+1)] for i in range(m): table[0][i] = 1 for i in range(1, n+1): for j in range(m): x = table[i - S[j]][j] if i-S[j] >= 0 else 0 y = table[i][j-1] if j >= 1 else 0 table[i][j] = x + y return table[n][m-1]
[ "assert remove_tuple([(None, 2), (None, None), (3, 4), (12, 3), (None, )] ) == '[(None, 2), (3, 4), (12, 3)]'", "assert remove_tuple([(None, None), (None, None), (3, 6), (17, 3), (None,1 )] ) == '[(3, 6), (17, 3), (None, 1)]'", "assert remove_tuple([(1, 2), (2, None), (3, None), (24, 3), (None, None )] ) == '[(1, 2), (2, None), (3, None), (24, 3)]'" ]
[]
820
Write a function to find the nth nonagonal number.
def geometric_sum(n): if n < 0: return 0 else: return 1 / (pow(2, n)) + geometric_sum(n - 1)
[ "assert max_chain_length([Pair(5, 24), Pair(15, 25),Pair(27, 40), Pair(50, 60)], 4) == 3", "assert max_chain_length([Pair(1, 2), Pair(3, 4),Pair(5, 6), Pair(7, 8)], 4) == 4", "assert max_chain_length([Pair(19, 10), Pair(11, 12),Pair(13, 14), Pair(15, 16), Pair(31, 54)], 5) == 5" ]
[]
651
Write a python function to check whether the given number is a perfect square or not.
def Extract(lst): return [item[-1] for item in lst]
[ "assert maximum_value([('key1', [3, 4, 5]), ('key2', [1, 4, 2]), ('key3', [9, 3])]) == [('key1', 5), ('key2', 4), ('key3', 9)]", "assert maximum_value([('key1', [4, 5, 6]), ('key2', [2, 5, 3]), ('key3', [10, 4])]) == [('key1', 6), ('key2', 5), ('key3', 10)]", "assert maximum_value([('key1', [5, 6, 7]), ('key2', [3, 6, 4]), ('key3', [11, 5])]) == [('key1', 7), ('key2', 6), ('key3', 11)]" ]
[]
830
Write a function to check if the given tuple contains all valid values or not.
def remove_duplic_list(l): temp = [] for x in l: if x not in temp: temp.append(x) return temp
[ "assert smallest_Divisor(10) == 2", "assert smallest_Divisor(25) == 5", "assert smallest_Divisor(31) == 31" ]
[]
634
Write a function to filter the height and width of students which are stored in a dictionary.
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
[ "assert sum_num((8, 2, 3, 0, 7))==4.0", "assert sum_num((-10,-20,-30))==-20.0", "assert sum_num((19,15,18))==17.333333333333332" ]
[]
695
Write a function to check if the given integer is a prime number.
def recur_gcd(a, b): low = min(a, b) high = max(a, b) if low == 0: return high elif low == 1: return 1 else: return recur_gcd(low, high%low)
[ "assert recur_gcd(12,14) == 2", "assert recur_gcd(13,17) == 1", "assert recur_gcd(9, 3) == 3" ]
[]
844
Write a function to join the tuples if they have similar initial elements.
def get_inv_count(arr, n): inv_count = 0 for i in range(n): for j in range(i + 1, n): if (arr[i] > arr[j]): inv_count += 1 return inv_count
[ "assert check_email(\"ankitrai326@gmail.com\") == 'Valid Email'", "assert check_email(\"my.ownsite@ourearth.org\") == 'Valid Email'", "assert check_email(\"ankitaoie326.com\") == 'Invalid Email'" ]
[]
915
Write a function to convert an integer into a roman numeral.
def merge(lst): return [list(ele) for ele in list(zip(*lst))]
[ "assert check_Even_Parity(10) == True", "assert check_Even_Parity(11) == False", "assert check_Even_Parity(18) == True" ]
[]
773
Write a python function to find minimum number swaps required to make two binary strings equal.
def min_Swaps(str1,str2) : count = 0 for i in range(len(str1)) : if str1[i] != str2[i] : count += 1 if count % 2 == 0 : return (count // 2) else : return ("Not Possible")
[ "assert count_char(\"Python\",'o')==1", "assert count_char(\"little\",'t')==2", "assert count_char(\"assert\",'s')==2" ]
[]
881
Write a function to remove multiple spaces in a string by using regex.
import heapq as hq def heap_sort(iterable): h = [] for value in iterable: hq.heappush(h, value) return [hq.heappop(h) for i in range(len(h))]
[ "assert check([3,2,1,2,3,4],6) == True", "assert check([2,1,4,5,1],5) == True", "assert check([1,2,2,1,2,3],6) == True" ]
[]
828
Write a python function to find the index of an extra element present in one sorted array.
def mutiple_tuple(nums): temp = list(nums) product = 1 for x in temp: product *= x return product
[ "assert arc_length(9,45)==3.5357142857142856", "assert arc_length(9,480)==None", "assert arc_length(5,270)==11.785714285714285" ]
[]
717
Write a function to check whether the given ip address is valid or not using regex.
def sort_sublists(list1): list1.sort() list1.sort(key=len) return list1
[ "assert sum_of_square(4) == 70", "assert sum_of_square(5) == 252", "assert sum_of_square(2) == 6" ]
[]
617
Write a function to count repeated items of a tuple.
def check_monthnumb(monthname2): if(monthname2=="January" or monthname2=="March"or monthname2=="May" or monthname2=="July" or monthname2=="Augest" or monthname2=="October" or monthname2=="December"): return True else: return False
[ "assert is_Product_Even([1,2,3],3) == True", "assert is_Product_Even([1,2,1,4],4) == True", "assert is_Product_Even([1,1],2) == False" ]
[]
682
Write a python function to check whether every odd index contains odd numbers of a given list.
def check_element(test_tup, check_list): res = False for ele in check_list: if ele in test_tup: res = True break return (res)
[ "assert find_First_Missing([0,1,2,3],0,3) == 4", "assert find_First_Missing([0,1,2,6,9],0,4) == 3", "assert find_First_Missing([2,3,5,8,9],0,4) == 0" ]
[]
697
Write a function to find the area of a rombus.
def ntimes_list(nums,n): result = map(lambda x:n*x, nums) return list(result)
[ "assert max_run_uppercase('GeMKSForGERksISBESt') == 5", "assert max_run_uppercase('PrECIOusMOVemENTSYT') == 6", "assert max_run_uppercase('GooGLEFluTTER') == 4" ]
[]
758
Write a python function to toggle bits of the number except the first and the last bit.
def rectangle_perimeter(l,b): perimeter=2*(l+b) return perimeter
[ "assert sorted_dict({'n1': [2, 3, 1], 'n2': [5, 1, 2], 'n3': [3, 2, 4]})=={'n1': [1, 2, 3], 'n2': [1, 2, 5], 'n3': [2, 3, 4]}", "assert sorted_dict({'n1': [25,37,41], 'n2': [41,54,63], 'n3': [29,38,93]})=={'n1': [25, 37, 41], 'n2': [41, 54, 63], 'n3': [29, 38, 93]}", "assert sorted_dict({'n1': [58,44,56], 'n2': [91,34,58], 'n3': [100,200,300]})=={'n1': [44, 56, 58], 'n2': [34, 58, 91], 'n3': [100, 200, 300]}" ]
[]
790
Write a function to check whether the given amount has no profit and no loss
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]
[ "assert previous_palindrome(99)==88", "assert previous_palindrome(1221)==1111", "assert previous_palindrome(120)==111" ]
[]
650
Write a python function to find the smallest prime divisor of a number.
def move_last(num_list): a = [num_list[0] for i in range(num_list.count(num_list[0]))] x = [ i for i in num_list if i != num_list[0]] x.extend(a) return (x)
[ "assert count_variable(4,2,0,-2)==['p', 'p', 'p', 'p', 'q', 'q'] ", "assert count_variable(0,1,2,3)==['q', 'r', 'r', 's', 's', 's'] ", "assert count_variable(11,15,12,23)==['p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'p', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'q', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 'r', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's', 's']" ]
[]
691
Write a function that matches a string that has an a followed by three 'b'.
def pair_wise(l1): temp = [] for i in range(len(l1) - 1): current_element, next_element = l1[i], l1[i + 1] x = (current_element, next_element) temp.append(x) return temp
[ "assert tuple_to_set(('x', 'y', 'z') ) == {'y', 'x', 'z'}", "assert tuple_to_set(('a', 'b', 'c') ) == {'c', 'a', 'b'}", "assert tuple_to_set(('z', 'd', 'e') ) == {'d', 'e', 'z'}" ]
[]
762
Write a python function to count the total unset bits from 1 to n.
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def max_height(node): if node is None: return 0 ; else : left_height = max_height(node.left) right_height = max_height(node.right) if (left_height > right_height): return left_height+1 else: return right_height+1
[ "assert second_smallest([1, 2, -8, -2, 0, -2])==-2", "assert second_smallest([1, 1, -0.5, 0, 2, -2, -2])==-0.5", "assert second_smallest([2,2])==None" ]
[]
614
Write a function to return true if the password is valid.
def min_sum_path(A): memo = [None] * len(A) n = len(A) - 1 for i in range(len(A[n])): memo[i] = A[n][i] for i in range(len(A) - 2, -1,-1): for j in range( len(A[i])): memo[j] = A[i][j] + min(memo[j], memo[j + 1]) return memo[0]
[ "assert add_dict({'a': 100, 'b': 200, 'c':300},{'a': 300, 'b': 200, 'd':400})==({'b': 400, 'd': 400, 'a': 400, 'c': 300}) ", "assert add_dict({'a': 500, 'b': 700, 'c':900},{'a': 500, 'b': 600, 'd':900})==({'b': 1300, 'd': 900, 'a': 1000, 'c': 900}) ", "assert add_dict({'a':900,'b':900,'d':900},{'a':900,'b':900,'d':900})==({'b': 1800, 'd': 1800, 'a': 1800})" ]
[]
865
Write a python function to find sum of odd factors of a number.
def min_Jumps(a, b, d): temp = a a = min(a, b) b = max(temp, b) if (d >= b): return (d + b - 1) / b if (d == 0): return 0 if (d == a): return 1 else: return 2
[ "assert max_occurrences([2,3,8,4,7,9,8,2,6,5,1,6,1,2,3,4,6,9,1,2])==2", "assert max_occurrences([1, 3,5, 7,1, 3,13, 15, 17,5, 7,9,1, 11])==1", "assert max_occurrences([1, 2, 3,2, 4, 5,1, 1, 1])==1" ]
[]
631
Write a function to find the smallest multiple of the first n numbers.
def max_of_three(num1,num2,num3): if (num1 >= num2) and (num1 >= num3): lnum = num1 elif (num2 >= num1) and (num2 >= num3): lnum = num2 else: lnum = num3 return lnum
[ "assert area_trapezium(6,9,4)==30", "assert area_trapezium(10,20,30)==450", "assert area_trapezium(15,25,35)==700" ]
[]
745
Write a function to check if any list element is present in the given list.
def area_trapezium(base1,base2,height): area = 0.5 * (base1 + base2) * height return area
[ "assert sum_nums(2,10,11,20)==20", "assert sum_nums(15,17,1,10)==32", "assert sum_nums(10,15,5,30)==20" ]
[]
797
Write a function to compute the value of ncr mod p.
def subset(ar, n): res = 0 ar.sort() for i in range(0, n) : count = 1 for i in range(n - 1): if ar[i] == ar[i + 1]: count+=1 else: break res = max(res, count) return res
[ "assert set_Right_most_Unset_Bit(21) == 23", "assert set_Right_most_Unset_Bit(11) == 15", "assert set_Right_most_Unset_Bit(15) == 15" ]
[]
834
Write a function to extract year, month and date from a url by using regex.
import itertools def remove_duplicate(list1): list.sort(list1) remove_duplicate = list(list1 for list1,_ in itertools.groupby(list1)) return remove_duplicate
[ "assert join_tuples([(5, 6), (5, 7), (6, 8), (6, 10), (7, 13)] ) == [(5, 6, 7), (6, 8, 10), (7, 13)]", "assert join_tuples([(6, 7), (6, 8), (7, 9), (7, 11), (8, 14)] ) == [(6, 7, 8), (7, 9, 11), (8, 14)]", "assert join_tuples([(7, 8), (7, 9), (8, 10), (8, 12), (9, 15)] ) == [(7, 8, 9), (8, 10, 12), (9, 15)]" ]
[]
755
Write a function to calculate the geometric sum of n-1.
def find_ind(key, i, n, k, arr): ind = -1 start = i + 1 end = n - 1; while (start < end): mid = int(start + (end - start) / 2) if (arr[mid] - key <= k): ind = mid start = mid + 1 else: end = mid return ind def removals(arr, n, k): ans = n - 1 arr.sort() for i in range(0, n): j = find_ind(arr[i], i, n, k, arr) if (j != -1): ans = min(ans, n - (j - i + 1)) return ans
[ "assert extract_max('100klh564abc365bg') == 564", "assert extract_max('hello300how546mer231') == 546", "assert extract_max('its233beenalong343journey234') == 343" ]
[]
771
Write a function to find the lateral surface area of a cone.
def find_fixed_point(arr, n): for i in range(n): if arr[i] is i: return i return -1
[ "assert increment_numerics([\"MSM\", \"234\", \"is\", \"98\", \"123\", \"best\", \"4\"] , 6) == ['MSM', '240', 'is', '104', '129', 'best', '10']", "assert increment_numerics([\"Dart\", \"356\", \"is\", \"88\", \"169\", \"Super\", \"6\"] , 12) == ['Dart', '368', 'is', '100', '181', 'Super', '18']", "assert increment_numerics([\"Flutter\", \"451\", \"is\", \"44\", \"96\", \"Magnificent\", \"12\"] , 33) == ['Flutter', '484', 'is', '77', '129', 'Magnificent', '45']" ]
[]
775
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.
def Sum(N): SumOfPrimeDivisors = [0]*(N + 1) for i in range(2,N + 1) : if (SumOfPrimeDivisors[i] == 0) : for j in range(i,N + 1,i) : SumOfPrimeDivisors[j] += i return SumOfPrimeDivisors[N]
[ "assert check_smaller((1, 2, 3), (2, 3, 4)) == False", "assert check_smaller((4, 5, 6), (3, 4, 5)) == True", "assert check_smaller((11, 12, 13), (10, 11, 12)) == True" ]
[]
673
Write a python function to find sum of inverse of divisors.
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)
[ "assert first_repeated_char(\"abcabc\") == \"a\"", "assert first_repeated_char(\"abc\") == \"None\"", "assert first_repeated_char(\"123123\") == \"1\"" ]
[]
850
Write a function to find the length of the longest sub-sequence such that elements in the subsequences are consecutive integers.
import re regex = '^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$' def check_email(email): if(re.search(regex,email)): return ("Valid Email") else: return ("Invalid Email")
[ "assert check_substring(\"dreams for dreams makes life fun\", \"makes\") == 'string doesnt start with the given substring'", "assert check_substring(\"Hi there how are you Hi alex\", \"Hi\") == 'string starts with the given substring'", "assert check_substring(\"Its been a long day\", \"been\") == 'string doesnt start with the given substring'" ]
[]
815
Write a python function to merge the first and last elements separately in a list of lists.
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
[ "assert first_Digit(5) == 1", "assert first_Digit(10) == 3", "assert first_Digit(7) == 5" ]
[]
952
Write a function to exchange the position of every n-th value with (n+1)th value and (n+1)th value with n-th value in a given list.
def count_list(input_list): return len(input_list)
[ "assert count_elim([10,20,30,(10,20),40])==3", "assert count_elim([10,(20,30),(10,20),40])==1", "assert count_elim([(10,(20,30,(10,20),40))])==0" ]
[]
826
Write a function to check if the given array represents min heap or not.
import re pattern = 'fox' text = 'The quick brown fox jumps over the lazy dog.' def find_literals(text, pattern): match = re.search(pattern, text) s = match.start() e = match.end() return (match.re.pattern, s, e)
[ "assert find_Sum([1,2,3,1,1,4,5,6],8) == 21", "assert find_Sum([1,10,9,4,2,10,10,45,4],9) == 71", "assert find_Sum([12,10,9,45,2,10,10,45,10],9) == 78" ]
[]
931
Write a function to find if there is a triplet in the array whose sum is equal to a given value.
def discriminant_value(x,y,z): discriminant = (y**2) - (4*x*z) if discriminant > 0: return ("Two solutions",discriminant) elif discriminant == 0: return ("one solution",discriminant) elif discriminant < 0: return ("no real solution",discriminant)
[ "assert tuple_modulo((10, 4, 5, 6), (5, 6, 7, 5)) == (0, 4, 5, 1)", "assert tuple_modulo((11, 5, 6, 7), (6, 7, 8, 6)) == (5, 5, 6, 1)", "assert tuple_modulo((12, 6, 7, 8), (7, 8, 9, 7)) == (5, 6, 7, 1)" ]
[]
777
Write a python function to count number of vowels in the string.
import re def replace(string, char): pattern = char + '{2,}' string = re.sub(pattern, char, string) return string
[ "assert rectangle_perimeter(10,20)==60", "assert rectangle_perimeter(10,5)==30", "assert rectangle_perimeter(4,2)==12" ]
[]
733
Write a function to replace all spaces in the given string with character * list item * list item * list item * list item '%20'.
def fibonacci(n): if n == 1 or n == 2: return 1 else: return (fibonacci(n - 1) + (fibonacci(n - 2)))
[ "assert pair_wise([1,1,2,3,3,4,4,5])==[(1, 1), (1, 2), (2, 3), (3, 3), (3, 4), (4, 4), (4, 5)]", "assert pair_wise([1,5,7,9,10])==[(1, 5), (5, 7), (7, 9), (9, 10)]", "assert pair_wise([1,2,3,4,5,6,7,8,9,10])==[(1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8), (8, 9), (9, 10)]" ]
[]
659
Write a python function to shift first element to the end of given list.
def get_key(dict): list = [] for key in dict.keys(): list.append(key) return list
[ "assert swap_List([1,2,3]) == [3,2,1]", "assert swap_List([1,2,3,4,4]) == [4,2,3,4,1]", "assert swap_List([4,5,6]) == [6,5,4]" ]
[]
714
Write a function to check whether the given month number contains 28 days or not.
def unique_Element(arr,n): s = set(arr) if (len(s) == 1): return ('YES') else: return ('NO')
[ "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, 6, 5], [12, 11, 10, 9], [16, 15, 14, 13]]", "assert reverse_list_lists([[1,2],[2,3],[3,4]])==[[2,1],[3,2],[4,3]]", "assert reverse_list_lists([[10,20],[30,40]])==[[20,10],[40,30]]" ]
[]
884
Write a function to check for the number of jumps required of given length to reach a point of form (d, 0) from origin in a 2d plane.
import re def remove_all_spaces(text): return (re.sub(r'\s+', '',text))
[ "assert multiply_elements((1, 5, 7, 8, 10)) == (5, 35, 56, 80)", "assert multiply_elements((2, 4, 5, 6, 7)) == (8, 20, 30, 42)", "assert multiply_elements((12, 13, 14, 9, 15)) == (156, 182, 126, 135)" ]
[]
610
Write a function to convert the given tuple to a key-value dictionary using adjacent elements.
import re def extract_max(input): numbers = re.findall('\d+',input) numbers = map(int,numbers) return max(numbers)
[ "assert raw_heap([25, 44, 68, 21, 39, 23, 89])==[21, 25, 23, 44, 39, 68, 89]", "assert raw_heap([25, 35, 22, 85, 14, 65, 75, 25, 58])== [14, 25, 22, 25, 35, 65, 75, 85, 58]", "assert raw_heap([4, 5, 6, 2])==[2, 4, 6, 5]" ]
[]
639
Write a function to rotate a given list by specified number of items to the right direction.
def sum_positivenum(nums): sum_positivenum = list(filter(lambda nums:nums>0,nums)) return sum(sum_positivenum)
[ "assert mul_even_odd([1,3,5,7,4,1,6,8])==4", "assert mul_even_odd([1,2,3,4,5,6,7,8,9,10])==2", "assert mul_even_odd([1,5,7,9,10])==10" ]
[]
843
Write a function to multiply two lists using map and lambda function.
def sort_tuple(tup): n = len(tup) for i in range(n): for j in range(n-i-1): if tup[j][0] > tup[j + 1][0]: tup[j], tup[j + 1] = tup[j + 1], tup[j] return tup
[ "assert triangle_area(0) == 0", "assert triangle_area(-1) == -1", "assert triangle_area(2) == 4" ]
[]
760
Write a function to sort the given tuple list basis the total digits in tuple.
def Check_Solution(a,b,c) : if ((b*b) - (4*a*c)) > 0 : return ("2 solutions") elif ((b*b) - (4*a*c)) == 0 : return ("1 solution") else : return ("No solutions")
[ "assert floor_Max(11,10,9) == 9", "assert floor_Max(5,7,4) == 2", "assert floor_Max(2,2,1) == 1" ]
[]
951
Write a python function to move all zeroes to the end of the given list.
def Odd_Length_Sum(arr): Sum = 0 l = len(arr) for i in range(l): Sum += ((((i + 1) *(l - i) + 1) // 2) * arr[i]) return Sum
[ "assert extract_date(\"https://www.washingtonpost.com/news/football-insider/wp/2016/09/02/odell-beckhams-fame-rests-on-one-stupid-little-ball-josh-norman-tells-author/\") == [('2016', '09', '02')]", "assert extract_date(\"https://www.indiatoday.in/movies/celebrities/story/wp/2020/11/03/odeof-sushant-singh-rajput-s-death-his-brother-in-law-shares-advice-for-fans-1749646/\") == [('2020', '11', '03')]", "assert extract_date(\"https://economictimes.indiatimes.com/news/economy/2020/12/29/finance/pension-assets-under-pfrda-touch-rs-5-32-lakh-crore/articleshow/79736619.cms\") == [('2020', '12', '29')]" ]
[]
807
Write a function to find the item with maximum occurrences in a given list.
def _sum(arr): sum=0 for i in arr: sum = sum + i return(sum)
[ "assert check_identical([(10, 4), (2, 5)], [(10, 4), (2, 5)]) == True", "assert check_identical([(1, 2), (3, 7)], [(12, 14), (12, 45)]) == False", "assert check_identical([(2, 14), (12, 25)], [(2, 14), (12, 25)]) == True" ]
[]
953
Write a function to solve the fibonacci sequence using recursion.
from collections import Counter def anagram_lambda(texts,str): result = list(filter(lambda x: (Counter(str) == Counter(x)), texts)) return result
[ "assert add_dict_to_tuple((4, 5, 6), {\"MSAM\" : 1, \"is\" : 2, \"best\" : 3} ) == (4, 5, 6, {'MSAM': 1, 'is': 2, 'best': 3})", "assert add_dict_to_tuple((1, 2, 3), {\"UTS\" : 2, \"is\" : 3, \"Worst\" : 4} ) == (1, 2, 3, {'UTS': 2, 'is': 3, 'Worst': 4})", "assert add_dict_to_tuple((8, 9, 10), {\"POS\" : 3, \"is\" : 4, \"Okay\" : 5} ) == (8, 9, 10, {'POS': 3, 'is': 4, 'Okay': 5})" ]
[]
782
Write a python function to find the index of smallest triangular number with n digits.
def rearrange_numbs(array_nums): result = sorted(array_nums, key = lambda i: 0 if i == 0 else -1 / i) return result
[ "assert Check_Vow('corner','AaEeIiOoUu') == 2", "assert Check_Vow('valid','AaEeIiOoUu') == 2", "assert Check_Vow('true','AaEeIiOoUu') ==2" ]
[]
867
Write a function to search a literals string in a string and also find the location within the original string where the pattern occurs by using regex.
def max_of_nth(test_list, N): res = max([sub[N] for sub in test_list]) return (res)
[ "assert check_subset([[1, 3], [5, 7], [9, 11], [13, 15, 17]] ,[[1, 3],[13,15,17]])==True", "assert check_subset([[1, 2], [2, 3], [3, 4], [5, 6]],[[3, 4], [5, 6]])==True", "assert check_subset([[[1, 2], [2, 3]], [[3, 4], [5, 7]]],[[[3, 4], [5, 6]]])==False" ]
[]
730
Write a function that gives profit amount if the given amount has profit else return none.
import collections as ct def merge_dictionaries(dict1,dict2): merged_dict = dict(ct.ChainMap({}, dict1, dict2)) return merged_dict
[ "assert text_starta_endb(\"aabbbb\")==('Found a match!')", "assert text_starta_endb(\"aabAbbbc\")==('Not matched!')", "assert text_starta_endb(\"accddbbjjj\")==('Not matched!')" ]
[]
908
Write a function to print the first n lucky numbers.
def get_median(arr1, arr2, n): i = 0 j = 0 m1 = -1 m2 = -1 count = 0 while count < n + 1: count += 1 if i == n: m1 = m2 m2 = arr2[0] break elif j == n: m1 = m2 m2 = arr1[0] break if arr1[i] <= arr2[j]: m1 = m2 m2 = arr1[i] i += 1 else: m1 = m2 m2 = arr2[j] j += 1 return (m1 + m2)/2
[ "assert remove_even([1,3,5,2]) == [1,3,5]", "assert remove_even([5,6,7]) == [5,7]", "assert remove_even([1,2,3,4]) == [1,3]" ]
[]
675
Write a function to sum elements in two lists.
from collections import OrderedDict def remove_duplicate(string): result = ' '.join(OrderedDict((w,w) for w in string.split()).keys()) return result
[ "assert remove_all_spaces('python program')==('pythonprogram')", "assert remove_all_spaces('python programming language')==('pythonprogramminglanguage')", "assert remove_all_spaces('python program')==('pythonprogram')" ]
[]
774
Write a python function to find the slope of a line.
def second_smallest(numbers): if (len(numbers)<2): return if ((len(numbers)==2) and (numbers[0] == numbers[1]) ): return dup_items = set() uniq_items = [] for x in numbers: if x not in dup_items: uniq_items.append(x) dup_items.add(x) uniq_items.sort() return uniq_items[1]
[ "assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},5)==True", "assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},6)==True", "assert is_key_present({1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60},10)==False" ]
[]
974
Write a function to count unique keys for each value present in the tuple.
def count_range_in_list(li, min, max): ctr = 0 for x in li: if min <= x <= max: ctr += 1 return ctr
[ "assert return_sum({'a': 100, 'b':200, 'c':300}) == 600", "assert return_sum({'a': 25, 'b':18, 'c':45}) == 88", "assert return_sum({'a': 36, 'b':39, 'c':49}) == 124" ]
[]
842
Write a function to sort a list in a dictionary.
import bisect def right_insertion(a, x): i = bisect.bisect_right(a, x) return i
[ "assert power_base_sum(2,100)==115", "assert power_base_sum(8,10)==37", "assert power_base_sum(8,15)==62" ]
[]
872
Write a function to display sign of the chinese zodiac for given year.
def get_Pairs_Count(arr,n,sum): count = 0 for i in range(0,n): for j in range(i + 1,n): if arr[i] + arr[j] == sum: count += 1 return count
[ "assert mul_consecutive_nums([1, 1, 3, 4, 4, 5, 6, 7])==[1, 3, 12, 16, 20, 30, 42]", "assert mul_consecutive_nums([4, 5, 8, 9, 6, 10])==[20, 40, 72, 54, 60]", "assert mul_consecutive_nums([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[2, 6, 12, 20, 30, 42, 56, 72, 90]" ]
[]
764
Write a function to remove everything except alphanumeric characters from the given string by using regex.
def number_ctr(str): number_ctr= 0 for i in range(len(str)): if str[i] >= '0' and str[i] <= '9': number_ctr += 1 return number_ctr
[ "assert tuple_to_dict((1, 5, 7, 10, 13, 5)) == {1: 5, 7: 10, 13: 5}", "assert tuple_to_dict((1, 2, 3, 4, 5, 6)) == {1: 2, 3: 4, 5: 6}", "assert tuple_to_dict((7, 8, 9, 10, 11, 12)) == {7: 8, 9: 10, 11: 12}" ]
[]
875
Write a python function to check whether all the characters are same or not.
import math def count_Divisors(n) : count = 0 for i in range(1, (int)(math.sqrt(n)) + 2) : if (n % i == 0) : if( n // i == i) : count = count + 1 else : count = count + 2 if (count % 2 == 0) : return ("Even") else : return ("Odd")
[ "assert exchange_elements([0,1,2,3,4,5])==[1, 0, 3, 2, 5, 4] ", "assert exchange_elements([5,6,7,8,9,10])==[6,5,8,7,10,9] ", "assert exchange_elements([25,35,45,55,75,95])==[35,25,55,45,95,75] " ]
[]
796
Write a function to sum the length of the names of a given list of names after removing the names that start with a lowercase letter.
def is_Word_Present(sentence,word): s = sentence.split(" ") for i in s: if (i == word): return True return False
[ "assert Check_Solution(2,0,2) == \"Yes\"", "assert Check_Solution(2,-5,2) == \"Yes\"", "assert Check_Solution(1,2,3) == \"No\"" ]
[]
772
Write a python function to find minimum adjacent swaps required to sort binary array.
def unique_sublists(list1): result ={} for l in list1: result.setdefault(tuple(l), list()).append(1) for a, b in result.items(): result[a] = sum(b) return result
[ "assert remove_empty([(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')])==[('',), ('a', 'b'), ('a', 'b', 'c'), 'd'] ", "assert remove_empty([(), (), ('',), (\"python\"), (\"program\")])==[('',), (\"python\"), (\"program\")] ", "assert remove_empty([(), (), ('',), (\"java\")])==[('',),(\"java\") ] " ]
[]
939
Write a function to merge two dictionaries into a single expression.
def remove_similar_row(test_list): res = set(sorted([tuple(sorted(set(sub))) for sub in test_list])) return (res)
[ "assert area_tetrahedron(3)==15.588457268119894", "assert area_tetrahedron(20)==692.8203230275509", "assert area_tetrahedron(10)==173.20508075688772" ]
[]
686
Write a function to clear the values of the given tuples.
import re def text_match_zero_one(text): patterns = 'ab?' if re.search(patterns, text): return 'Found a match!' else: return('Not matched!')
[ "assert radian_degree(90)==1.5707963267948966", "assert radian_degree(60)==1.0471975511965976", "assert radian_degree(120)==2.0943951023931953" ]
[]
645
Write a python function to left rotate the string.
def average_tuple(nums): result = [sum(x) / len(x) for x in zip(*nums)] return result
[ "assert Split([1,2,3,4,5]) == [2,4]", "assert Split([4,5,6,7,8,0,1]) == [4,6,8,0]", "assert Split ([8,12,15,19]) == [8,12]" ]
[]
929
Write a function to pack consecutive duplicates of a given list elements into sublists.
def left_rotate(s,d): tmp = s[d : ] + s[0 : d] return tmp
[ "assert max_similar_indices([(2, 4), (6, 7), (5, 1)],[(5, 4), (8, 10), (8, 14)]) == [(5, 4), (8, 10), (8, 14)]", "assert max_similar_indices([(3, 5), (7, 8), (6, 2)],[(6, 5), (9, 11), (9, 15)]) == [(6, 5), (9, 11), (9, 15)]", "assert max_similar_indices([(4, 6), (8, 9), (7, 3)],[(7, 6), (10, 12), (10, 16)]) == [(7, 6), (10, 12), (10, 16)]" ]
[]
885
Write a function to reverse each list in a given list of lists.
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)
[ "assert sorted_models([{'make':'Nokia', 'model':216, 'color':'Black'}, {'make':'Mi Max', 'model':2, 'color':'Gold'}, {'make':'Samsung', 'model': 7, 'color':'Blue'}])==[{'make': 'Nokia', 'model': 216, 'color': 'Black'}, {'make': 'Samsung', 'model': 7, 'color': 'Blue'}, {'make': 'Mi Max', 'model': 2, 'color': 'Gold'}]", "assert sorted_models([{'make':'Vivo', 'model':20,'color':'Blue'},{'make': 'oppo','model':17,'color':'Gold'},{'make':'Apple','model':11,'color':'red'}])==([{'make':'Vivo', 'model':20,'color':'Blue'},{'make': 'oppo','model':17,'color':'Gold'},{'make':'Apple','model':11,'color':'red'}])", "assert sorted_models([{'make':'micromax','model':40,'color':'grey'},{'make':'poco','model':60,'color':'blue'}])==([{'make':'poco','model':60,'color':'blue'},{'make':'micromax','model':40,'color':'grey'}])" ]
root = Node(1) root.left = Node(2) root.right = Node(3) root.left.left = Node(4) root.left.right = Node(5) root1 = Node(1); root1.left = Node(2); root1.right = Node(3); root1.left.left = Node(4); root1.right.left = Node(5); root1.right.right = Node(6); root1.right.right.right= Node(7); root1.right.right.right.right = Node(8) root2 = Node(1) root2.left = Node(2) root2.right = Node(3) root2.left.left = Node(4) root2.left.right = Node(5) root2.left.left.left = Node(6) root2.left.left.right = Node(7)
[]
716
Write a python function to reverse an array upto a given position.
def sum_Square(n) : i = 1 while i*i <= n : j = 1 while (j*j <= n) : if (i*i+j*j == n) : return True j = j+1 i = i+1 return False
[ "assert get_First_Set_Bit_Pos(12) == 3", "assert get_First_Set_Bit_Pos(18) == 2", "assert get_First_Set_Bit_Pos(16) == 5" ]
[]
604
Write a function to find the longest common subsequence for the given three string sequence.
def Convert(string): li = list(string.split(" ")) return li
[ "assert remove_spaces(\"a b c\") == \"abc\"", "assert remove_spaces(\"1 2 3\") == \"123\"", "assert remove_spaces(\" b c\") == \"bc\"" ]
[]
889
Write a python function to check whether an array contains only one distinct element or not.
def reverse_words(s): return ' '.join(reversed(s.split()))
[ "assert count_Fac(24) == 3", "assert count_Fac(12) == 2", "assert count_Fac(4) == 1" ]
[]
724
Write a function that matches a string that has an a followed by zero or more b's.
from math import tan, pi def perimeter_polygon(s,l): perimeter = s*l return perimeter
[ "assert cummulative_sum([(1, 3), (5, 6, 7), (2, 6)]) == 30", "assert cummulative_sum([(2, 4), (6, 7, 8), (3, 7)]) == 37", "assert cummulative_sum([(3, 5), (7, 8, 9), (4, 8)]) == 44" ]
[]
960
Write a python function to count number of cubes of size k in a cube of size n.
def find_Extra(arr1,arr2,n) : for i in range(0, n) : if (arr1[i] != arr2[i]) : return i return n
[ "assert pair_OR_Sum([5,9,7,6],4) == 47", "assert pair_OR_Sum([7,3,5],3) == 12", "assert pair_OR_Sum([7,3],2) == 4" ]
[]
685
Write a function to convert the given tuples into set.
def previous_palindrome(num): for x in range(num-1,0,-1): if str(x) == str(x)[::-1]: return x
[ "assert find_k_product([(5, 6, 7), (1, 3, 5), (8, 9, 19)], 2) == 665", "assert find_k_product([(6, 7, 8), (2, 4, 6), (9, 10, 20)], 1) == 280", "assert find_k_product([(7, 8, 9), (3, 5, 7), (10, 11, 21)], 0) == 210" ]
[]
813
Write a python function to count equal element pairs from the given array.
def zip_list(list1,list2): result = list(map(list.__add__, list1, list2)) return result
[ "assert check_monthnum_number(2)==True", "assert check_monthnum_number(1)==False", "assert check_monthnum_number(3)==False" ]
[]
870
Write a python function to check for even parity of a given number.
def string_length(str1): count = 0 for char in str1: count += 1 return count
[ "assert multiply_list([1,-2,3]) == -6", "assert multiply_list([1,2,3,4]) == 24", "assert multiply_list([3,1,2,3]) == 18" ]
[]
669
Write a python function to choose points from two ranges such that no point lies in both the ranges.
def check_Type_Of_Triangle(a,b,c): sqa = pow(a,2) sqb = pow(b,2) sqc = pow(c,2) if (sqa == sqa + sqb or sqb == sqa + sqc or sqc == sqa + sqb): return ("Right-angled Triangle") elif (sqa > sqc + sqb or sqb > sqa + sqc or sqc > sqa + sqb): return ("Obtuse-angled Triangle") else: return ("Acute-angled Triangle")
[ "assert zip_list([[1, 3], [5, 7], [9, 11]] ,[[2, 4], [6, 8], [10, 12, 14]] )==[[1, 3, 2, 4], [5, 7, 6, 8], [9, 11, 10, 12, 14]]", "assert zip_list([[1, 2], [3, 4], [5, 6]] ,[[7, 8], [9, 10], [11, 12]] )==[[1, 2, 7, 8], [3, 4, 9, 10], [5, 6, 11, 12]]", "assert zip_list([['a','b'],['c','d']] , [['e','f'],['g','h']] )==[['a','b','e','f'],['c','d','g','h']]" ]
[]
955
Write a python function to check whether a sequence of numbers has a decreasing trend or not.
def sum_Odd(n): terms = (n + 1)//2 sum1 = terms * terms return sum1 def sum_in_Range(l,r): return sum_Odd(r) - sum_Odd(l - 1)
[ "assert get_inv_count([1, 20, 6, 4, 5], 5) == 5", "assert get_inv_count([8, 4, 2, 1], 4) == 6", "assert get_inv_count([3, 1, 2], 3) == 2" ]
[]
742
Write a function to flatten the given tuple matrix into the tuple list with each tuple representing each column.
def remove_nested(test_tup): res = tuple() for count, ele in enumerate(test_tup): if not isinstance(ele, tuple): res = res + (ele, ) return (res)
[ "assert sum_Of_Subarray_Prod([1,2,3],3) == 20", "assert sum_Of_Subarray_Prod([1,2],2) == 5", "assert sum_Of_Subarray_Prod([1,2,3,4],4) == 84" ]
[]
719
Write a function to find the perimeter of a rombus.
def Check_Vow(string, vowels): final = [each for each in string if each in vowels] return(len(final))
[ "assert is_upper(\"person\") ==\"PERSON\"", "assert is_upper(\"final\") == \"FINAL\"", "assert is_upper(\"Valid\") == \"VALID\"" ]
[]
954
Write a function to find the greatest common divisor (gcd) of two integers by using recursion.
def binomial_coeff(n, k): C = [[0 for j in range(k + 1)] for i in range(n + 1)] for i in range(0, n + 1): for j in range(0, min(i, k) + 1): if (j == 0 or j == i): C[i][j] = 1 else: C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) return C[n][k] def lobb_num(n, m): return (((2 * m + 1) * binomial_coeff(2 * n, m + n)) / (m + n + 1))
[ "assert find_fixed_point([-10, -1, 0, 3, 10, 11, 30, 50, 100],9) == 3", "assert find_fixed_point([1, 2, 3, 4, 5, 6, 7, 8],8) == -1", "assert find_fixed_point([0, 2, 5, 8, 17],5) == 0" ]
[]
End of preview. Expand in Data Studio

edition_1902_google-research-datasets-mbpp-readymade

A Readymade by TheFactoryX

Original Dataset

google-research-datasets/mbpp

Process

This dataset is a "readymade" - inspired by Marcel Duchamp's concept of taking everyday objects and recontextualizing them as art.

What we did:

  1. Selected the original dataset from Hugging Face
  2. Shuffled each column independently
  3. Destroyed all row-wise relationships
  4. Preserved structure, removed meaning

The result: Same data. Wrong order. New meaning. No meaning.

Purpose

This is art. This is not useful. This is the point.

Column relationships have been completely destroyed. The data maintains its types and values, but all semantic meaning has been removed.


Part of the Readymades project by TheFactoryX.

"I am a machine." — Andy Warhol

Downloads last month
21