{"task_id": "0", "problem": "Write a python function to remove first and last occurrence of a given character from the string.", "completion": "\ndef remove_Occ(s, c):\n    return s.replace(c, \"\", 1).replace(c, \"\", 1)\n\nassert remove_Occ(\"hello\",\"l\") == \"heo\"\nassert remove_Occ(\"abcda\",\"a\") == \"bcd\"\nassert remove_Occ(\"PHP\",\"P\") == \"H\"", "passed": true, "fail_reason": "[]"}
{"task_id": "1", "problem": "Write a function to sort a given matrix in ascending order according to the sum of its rows.", "completion": "\ndef sort_matrix(arr):\n    # Calculate the sum of each row\n    row_sums = [sum(row) for row in arr]\n\n    # Create a list of tuples containing the row sums and their corresponding rows\n    rows_with_sums = [(row_sum, row) for row_sum, row in zip(row_sums, arr) if not any(num < 0 for num in row)]\n\n    # Sort the rows in ascending order based on the row sums\n    sorted_rows = sorted(rows_with_sums, key=lambda x: x[0])\n\n    # Extract the sorted rows\n    sorted_arr = [row for _, row in sorted_rows]\n\n    return sorted_arr\nassert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]\nassert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]\nassert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]\n\nassert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]\nassert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]\nassert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "2", "problem": "Write a function to count the most common words in a dictionary.", "completion": "\ndef count_common(lst):\n    words = {}\n    for word in lst:\n        if word in words:\n            words[word] += 1\n        else:\n            words[word] = 1\n    return sorted(words.items(), key=lambda x: x[1], reverse=True)\n\nassert count_common(['red','green','black','pink','black','white','black','eyes','white','black','orange','pink','pink','red','red','white','orange','white',\"black\",'pink','green','green','pink','green','pink','white','orange',\"orange\",'red']) == [('pink', 6), ('black', 5), ('white', 5), ('red', 4)]\nassert count_common(['one', 'two', 'three', 'four', 'five', 'one', 'two', 'one', 'three', 'one']) == [('one', 4), ('two', 2), ('three', 2), ('four', 1)]\nassert count_common(['Facebook', 'Apple', 'Amazon', 'Netflix', 'Google', 'Apple', 'Netflix', 'Amazon']) == [('Apple', 2), ('Amazon', 2), ('Netflix', 2), ('Facebook', 1)]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "3", "problem": "Write a python function to find the volume of a triangular prism.", "completion": "\ndef find_Volume(a, b, c):\n    return a * b * c\n\nassert find_Volume(10,8,6) == 240\nassert find_Volume(3,2,2) == 6\nassert find_Volume(1,2,1) == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "4", "problem": "Write a function to split a string at lowercase letters.", "completion": "\ndef split_lowerstring(s):\n    return [char for i, char in enumerate(s) if char.islower()]\n\nassert split_lowerstring(\"AbCd\")==['bC','d']\nassert split_lowerstring(\"Python\")==['y', 't', 'h', 'o', 'n']\nassert split_lowerstring(\"Programming\")==['r', 'o', 'g', 'r', 'a', 'm', 'm', 'i', 'n', 'g']", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "5", "problem": "Write a function to find sequences of lowercase letters joined with an underscore.", "completion": "\ndef text_lowercase_underscore(text):\n    if \"_\" in text and text.islower():\n        return 'Found a match!'\n    else:\n        return 'Not matched!'\n\nassert text_lowercase_underscore(\"aab_cbbbc\")==('Found a match!')\nassert text_lowercase_underscore(\"aab_Abbbc\")==('Not matched!')\nassert text_lowercase_underscore(\"Aaab_abbbc\")==('Not matched!')", "passed": true, "fail_reason": "[]"}
{"task_id": "6", "problem": "Write a function to find the perimeter of a square.", "completion": "\ndef square_perimeter(side):\n    return 4 * side\n\nassert square_perimeter(10)==40\nassert square_perimeter(5)==20\nassert square_perimeter(4)==16", "passed": true, "fail_reason": "[]"}
{"task_id": "7", "problem": "Write a function to remove characters from the first string which are present in the second string.", "completion": "\ndef remove_dirty_chars(s, t):\n    \"\"\"\n    Remove characters from string s that are present in string t.\n    :param s: (str) first string\n    :param t: (str) second string\n    :return: (str) string after removing characters\n    \"\"\"\n    t_set = set(t)  # Convert t to a set for constant time look-ups\n    result = [char for char in s if char not in t_set]  # List comprehension\n    return ''.join(result)  # Convert list back to string\n\nassert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'\nassert remove_dirty_chars(\"digitalindia\", \"talent\") == 'digiidi'\nassert remove_dirty_chars(\"exoticmiles\", \"toxic\") == 'emles'\n\nassert remove_dirty_chars(\"probasscurve\", \"pros\") == 'bacuve'\nassert remove_dirty_chars(\"digitalindia\", \"talent\") == 'digiidi'\nassert remove_dirty_chars(\"exoticmiles\", \"toxic\") == 'emles' ", "passed": true, "fail_reason": "[]"}
{"task_id": "8", "problem": "Write a function to find whether a given array of integers contains any duplicate element.", "completion": "\ndef test_duplicate(arr):\n    mySet = set()\n    for item in arr:\n        if item in mySet:\n            return True\n        else:\n            mySet.add(item)\n    return False\nassert test_duplicate(([1,2,3,4,5])==False\nassert test_duplicate(([1,2,3,4, 4])==True\nassert test_duplicate([1,1,2,2,3,3,4,4,5])==True\n\nassert test_duplicate(([1,2,3,4,5]))==False\nassert test_duplicate(([1,2,3,4, 4]))==True\nassert test_duplicate([1,1,2,2,3,3,4,4,5])==True", "passed": false, "fail_reason": "[SyntaxError('invalid syntax', ('<string>', 11, 1, 'assert test_duplicate(([1,2,3,4, 4])==True\\n', 11, 7))]"}
{"task_id": "9", "problem": "Write a function to check if the given number is woodball or not.", "completion": "\ndef is_woodall(n):\n    return n % 7 == 0 and n % 3 == 0 and n % 5 == 0\n\nassert is_woodall(383) == True\nassert is_woodall(254) == False\nassert is_woodall(200) == False", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "10", "problem": "Write a function to find m number of multiples of n.", "completion": "\ndef multiples_of_num(n, multiple):\n    i = 0\n    multiples_list = []\n    while i <= n:\n        i += multiple\n        if i <= n:\n            multiples_list.append(i)\n    return multiples_list\n\nassert multiples_of_num(4,3)== [3,6,9,12]\nassert multiples_of_num(2,5)== [5,10]\nassert multiples_of_num(9,2)== [2,4,6,8,10,12,14,16,18]\n\nassert multiples_of_num(4,3)== [3,6,9,12]\nassert multiples_of_num(2,5)== [5,10]\nassert multiples_of_num(9,2)== [2,4,6,8,10,12,14,16,18]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "11", "problem": "Write a function to find the first duplicate element in a given array of integers.", "completion": "\ndef find_first_duplicate(arr):\n    \"\"\"\n    Find the first duplicate in a given array of integers.\n    \"\"\"\n    elements_seen = set()\n    for element in arr:\n        if element in elements_seen:\n            return element\n        else:\n            elements_seen.add(element)\n    return -1\n\nassert find_first_duplicate([1, 2, 3, 4, 4, 5])==4\nassert find_first_duplicate([1, 2, 3, 4])==-1\nassert find_first_duplicate([1, 1, 2, 3, 3, 2, 2])==1\n\nassert find_first_duplicate(([1, 2, 3, 4, 4, 5]))==4\nassert find_first_duplicate([1, 2, 3, 4])==-1\nassert find_first_duplicate([1, 1, 2, 3, 3, 2, 2])==1", "passed": true, "fail_reason": "[]"}
{"task_id": "12", "problem": "Write a python function to find the maximum sum of elements of list in a list of lists.", "completion": "\ndef maximum_Sum(lists):\n    max_sum = None\n    max_list = None\n    for lst in lists:\n        if max_sum is None or sum(lst) > max_sum:\n            max_sum = sum(lst)\n            max_list = lst\n    return max_sum\n\nassert maximum_Sum([[1,2,3],[4,5,6],[10,11,12],[7,8,9]]) == 33\nassert maximum_Sum([[0,1,1],[1,1,2],[3,2,1]]) == 6\nassert maximum_Sum([[0,1,3],[1,2,1],[9,8,2],[0,1,0],[6,4,8]]) == 19", "passed": true, "fail_reason": "[]"}
{"task_id": "13", "problem": "Write a function to convert the given binary number to its decimal equivalent.", "completion": "\ndef binary_to_decimal(binary):\n    return int(str(binary), 2)\n\nassert binary_to_decimal(100) == 4\nassert binary_to_decimal(1011) == 11\nassert binary_to_decimal(1101101) == 109", "passed": true, "fail_reason": "[]"}
{"task_id": "14", "problem": "Write a python function to find the product of non-repeated elements in a given array.", "completion": "\ndef find_Product(arr, n):\n    count = {}\n    product = 1\n    for num in arr:\n        if num not in count:\n            count[num] = 1\n        else:\n            count[num] += 1\n    for num in arr:\n        if count[num] == 1:\n            product *= num\n    return product\n\nassert find_Product([1,1,2,3],4) == 6\nassert find_Product([1,2,3,1,1],5) == 6\nassert find_Product([1,1,4,5,6],5) == 120", "passed": true, "fail_reason": "[]"}
{"task_id": "15", "problem": "Write a function to check if the given tuple list has all k elements.", "completion": "\ndef check_k_elements(tuples, k):\n    return all(len(t) >= k for t in tuples)\n\nassert check_k_elements([(4, 4), (4, 4, 4), (4, 4), (4, 4, 4, 4), (4, )], 4) == True\nassert check_k_elements([(7, 7, 7), (7, 7)], 7) == True\nassert check_k_elements([(9, 9), (9, 9, 9, 9)], 7) == False", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "16", "problem": "Write a python function to remove all digits from a list of strings.", "completion": "\ndef remove(lst):\n    return [s.replace('1', '').replace('2', '').replace('3', '').replace('4', '').replace('5', '').replace('6', '').replace('7', '').replace('8', '').replace('9', '') for s in lst]\n\nassert remove(['4words', '3letters', '4digits']) == ['words', 'letters', 'digits']\nassert remove(['28Jan','12Jan','11Jan']) == ['Jan','Jan','Jan']\nassert remove(['wonder1','wonder2','wonder3']) == ['wonder','wonder','wonder']", "passed": true, "fail_reason": "[]"}
{"task_id": "17", "problem": "Write a python function to find binomial co-efficient.", "completion": "\ndef binomial_Coeff(n, k):\n    def factorial(x):\n        if x == 0:\n            return 1\n        else:\n            return x * factorial(x-1)\n    return factorial(n) / (factorial(k) * factorial(n-k))\n\nassert binomial_Coeff(5,2) == 10\nassert binomial_Coeff(4,3) == 4\nassert binomial_Coeff(3,2) == 3", "passed": true, "fail_reason": "[]"}
{"task_id": "18", "problem": "Write a python function to find the element occurring odd number of times.", "completion": "\ndef get_Odd_Occurrence(arr,n):\n    freq = {}\n    for num in arr:\n        freq[num] = freq.get(num, 0) + 1 \n    for num in arr:\n        if freq[num] % 2!= 0: \n            return num\n    return None\nassert get_Odd_Occurrence([1,2,3,1,2,3,1],7) == 1\nassert get_Odd_Occurrence([1,2,3,2,3,1,3],7) == 3\nassert get_Odd_Occurrence([2,3,5,4,5,2,4,3,5,2,4,4,2],13) == 5\n\nassert get_Odd_Occurrence([1,2,3,1,2,3,1],7) == 1\nassert get_Odd_Occurrence([1,2,3,2,3,1,3],7) == 3\nassert get_Odd_Occurrence([2,3,5,4,5,2,4,3,5,2,4,4,2],13) == 5", "passed": true, "fail_reason": "[]"}
{"task_id": "19", "problem": "Write a python function to count all the substrings starting and ending with same characters.", "completion": "\ndef count_Substring_With_Equal_Ends(s):\n    count = 0\n    for i in range(len(s)):\n        for j in range(i + 1, len(s) + 1):\n            substring = s[i:j]\n            if substring[0] == substring[-1]:\n                count += 1\n    return count\n\nassert count_Substring_With_Equal_Ends(\"abc\") == 3\nassert count_Substring_With_Equal_Ends(\"abcda\") == 6\nassert count_Substring_With_Equal_Ends(\"ab\") == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "20", "problem": "Write a function to find the top k integers that occur most frequently from given lists of sorted and distinct integers using heap queue algorithm.", "completion": "\nimport heapq\nfrom collections import Counter\n\ndef func(lists, k):\n    counter = Counter()\n    for lst in lists:\n        counter.update(lst)\n\n    heap = []\n    for num, count in counter.items():\n        heapq.heappush(heap, (-count, num))\n        if len(heap) > k:\n            heapq.heappop(heap)\n\n    return [num for count, num in heap]\n\nassert func([[1, 2, 6], [1, 3, 4, 5, 7, 8], [1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12]],3)==[5, 7, 1]\nassert func([[1, 2, 6], [1, 3, 4, 5, 7, 8], [1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12]],1)==[1]\nassert func([[1, 2, 6], [1, 3, 4, 5, 7, 8], [1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12]],5)==[6, 5, 7, 8, 1]", "passed": false, "fail_reason": "[NameError(\"name 'Counter' is not defined\")]"}
{"task_id": "21", "problem": "Write a python function to find the largest prime factor of a given number.", "completion": "\ndef max_Prime_Factors(n):\n    i = 2\n    max_factor = 1\n    while i * i <= n:\n        if n % i:\n            i += 1\n        else:\n            n //= i\n            max_factor = i\n    return max_factor if n > 1 else max_factor\n\nassert max_Prime_Factors(15) == 5\nassert max_Prime_Factors(6) == 3\nassert max_Prime_Factors(2) == 2", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "22", "problem": "Write a python function to convert a decimal number to binary number.", "completion": "\ndef decimal_to_binary(num):\n    if num == 0:\n        return \"0\"\n    elif num == 1:\n        return \"1\"\n    else:\n        return decimal_to_binary(num // 2) + str(num % 2)\n\nassert decimal_to_binary(10) == \"1010\"\nassert decimal_to_binary(1) == \"1\"\nassert decimal_to_binary(20) == \"10100\"\n\nassert decimal_To_Binary(10) == 1010\nassert decimal_To_Binary(1) == 1\nassert decimal_To_Binary(20) == 10100", "passed": false, "fail_reason": "[NameError(\"name 'decimal_to_binary' is not defined\")]"}
{"task_id": "23", "problem": "Write a python function to find the missing number in a sorted array.", "completion": "\ndef find_missing(arr, n):\n    arr.sort()\n    for i in range(len(arr)):\n        if (arr[i+1] - arr[i]!= 1):\n            return arr[i] + 1\n    return n\n\nassert find_missing([1,2,3,5],4) == 4\nassert find_missing([1,3,4,5],4) == 2\nassert find_missing([1,2,3,5,6,7],5) == 4", "passed": true, "fail_reason": "[]"}
{"task_id": "24", "problem": "Write a function to find the n-th rectangular number.", "completion": "\ndef find_rect_num(n):\n    return n * (n + 1) * (2 * n + 1) // 6\n\nassert find_rect_num(4) == 20\nassert find_rect_num(5) == 30\nassert find_rect_num(6) == 42", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "25", "problem": "Write a python function to find the nth digit in the proper fraction of two given numbers.", "completion": "\ndef find_Nth_Digit(num1, num2, n):\n    from fractions import Fraction\n    fraction = Fraction(num1, num2)\n    return int(str(fraction)[n-1])\n\nassert find_Nth_Digit(1,2,1) == 5\nassert find_Nth_Digit(3,5,1) == 6\nassert find_Nth_Digit(5,6,5) == 3", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "26", "problem": "Write a function to sort a given mixed list of integers and strings.", "completion": "\ndef sort_mixed_list(lst):\n    return sorted(lst, key=lambda x: (isinstance(x, int), str(x) if isinstance(x, str) else x))\n    \nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green','red', 'white']\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green','red', 'white']\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green','red', 'white']\n\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']\nassert sort_mixed_list([19,'red',12,'green','blue', 10,'white','green',1])==[1, 10, 12, 19, 'blue', 'green', 'green', 'red', 'white']", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "27", "problem": "Write a function to find the division of first even and odd number of a given list.", "completion": "\ndef div_even_odd(lst):\n    even_list = [num for num in lst if num % 2 == 0]\n    odd_list = [num for num in lst if num % 2!= 0]\n    return even_list[0] // odd_list[0] if even_list and odd_list else 0\n\nassert div_even_odd([1,3,5,7,4,1,6,8])==4\nassert div_even_odd([1,2,3,4,5,6,7,8,9,10])==2\nassert div_even_odd([1,5,7,9,10])==10", "passed": true, "fail_reason": "[]"}
{"task_id": "28", "problem": "Write a function to check if the letters of a given string can be rearranged so that two characters that are adjacent to each other are different.", "completion": "\ndef rearange_string(s):\n    char_count = {}\n    for char in s:\n        if char in char_count:\n            char_count[char] += 1\n        else:\n            char_count[char] = 1\n    odd_count = 0\n    for count in char_count.values():\n        if count % 2 == 1:\n            odd_count += 1\n    if odd_count > 1:\n        return ''\n    result = ''\n    odd_chars = []\n    for char, count in char_count.items():\n        if count % 2 == 1:\n            odd_chars.append(char)\n    for char in sorted(char_count.keys()):\n        if char in odd_chars:\n            result += char\n            odd_chars.remove(char)\n        result += char * (char_count[char] // 2)\n    if odd_chars:\n        result += odd_chars[0]\n    return result\n\nassert rearange_string(\"aab\")==('aba')\nassert rearange_string(\"aabb\")==('abab')\nassert rearange_string(\"abccdd\")==('cdabcd')", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "29", "problem": "Write a function to find frequency of the elements in a given list of lists using collections module.", "completion": "\nfrom collections import Counter\n\ndef freq_element(lists):\n    flat_list = [item for sublist in lists for item in sublist]\n    return dict(Counter(flat_list))\n\nassert freq_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]])==({2: 3, 1: 2, 5: 2, 3: 1, 4: 1, 6: 1, 7: 1, 9: 1})\nassert freq_element([[1,2,3,4],[5,6,7,8],[9,10,11,12]])==({1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1, 11: 1, 12: 1})\nassert freq_element([[15,20,30,40],[80,90,100,110],[30,30,80,90]])==({30: 3, 80: 2, 90: 2, 15: 1, 20: 1, 40: 1, 100: 1, 110: 1})", "passed": false, "fail_reason": "[NameError(\"name 'Counter' is not defined\")]"}
{"task_id": "30", "problem": "Write a function to filter even numbers using lambda function.", "completion": "\ndef filter_evennumbers(lst):\n    return list(filter(lambda x: x%2==0, lst))\n\nassert filter_evennumbers([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])==[2, 4, 6, 8, 10]\nassert filter_evennumbers([10,20,45,67,84,93])==[10,20,84]\nassert filter_evennumbers([5,7,9,8,6,4,3])==[8,6,4]", "passed": true, "fail_reason": "[]"}
{"task_id": "31", "problem": "Write a python function to find the sum of repeated elements in a given array.", "completion": "\ndef find_Sum(arr, n):\n    count_dict = {}\n    for num in arr:\n        if num in count_dict:\n            count_dict[num] += 1\n        else:\n            count_dict[num] = 1\n    sum = 0\n    for num in count_dict:\n        if count_dict[num] > 1:\n            sum += num\n    return sum\n\nassert find_Sum([1,2,3,1,1,4,5,6],8) == 3\nassert find_Sum([1,2,3,1,1],5) == 3\nassert find_Sum([1,1,2],3) == 2", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "32", "problem": "Write a function to find sequences of lowercase letters joined with an underscore using regex.", "completion": "\nimport re\n\ndef text_match(text):\n    pattern = r\"[a-z]+_[a-z]+\"\n    if re.search(pattern, text):\n        return 'Found a match!'\n    else:\n        return 'Not matched!'\n\nassert text_match(\"aab_cbbbc\") == 'Found a match!'\nassert text_match(\"aab_Abbbc\") == 'Not matched!'\nassert text_match(\"Aaab_abbbc\") == 'Not matched!'", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "33", "problem": "Write a function that matches a word at the beginning of a string.", "completion": "\ndef text_match_string(text):\n    if text.startswith('python'):\n        return 'Found a match!'\n    else:\n        return 'Not matched!'\n\nassert text_match_string(\" python\")==('Not matched!')\nassert text_match_string(\"python\")==('Found a match!')\nassert text_match_string(\"  lang\")==('Not matched!')", "passed": true, "fail_reason": "[]"}
{"task_id": "34", "problem": "Write a function to find the gcd of the given array elements.", "completion": "\ndef get_gcd(arr):\n    def gcd_recursion(a, b):\n        if b == 0:\n            return a\n        return gcd_recursion(b, a % b)\n    result = arr[0]\n    for i in range(1, len(arr)):\n        result = gcd_recursion(result, arr[i])\n    return result\n\nassert get_gcd([2, 4, 6, 8, 16]) == 2\nassert get_gcd([1, 2, 3]) == 1\nassert get_gcd([2, 4, 6, 8]) == 2 ", "passed": true, "fail_reason": "[]"}
{"task_id": "35", "problem": "Write a python function to determine whether all the numbers are different from each other are not.", "completion": "\ndef test_distinct(lst):\n    return len(lst) == len(set(lst))\n\nassert test_distinct([1,5,7,9]) == True\nassert test_distinct([2,4,5,5,7,9]) == False\nassert test_distinct([1,2,3]) == True", "passed": true, "fail_reason": "[]"}
{"task_id": "36", "problem": "Write a python function to find the last digit when factorial of a divides factorial of b.", "completion": "\ndef compute_Last_Digit(a, b):\n    def factorial(x):\n        if x == 0:\n            return 1\n        else:\n            return x * factorial(x-1)\n\n    a_fact = factorial(a)\n    b_fact = factorial(b)\n    result = a_fact % 10\n    return result\n\nassert compute_Last_Digit(2,4) == 2\nassert compute_Last_Digit(6,8) == 6\nassert compute_Last_Digit(1,2) == 2", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "37", "problem": "Write a python function to set all odd bits of a given number.", "completion": "\ndef odd_bit_set_number(n):\n    return n | (n - 1)\n\nassert odd_bit_set_number(10) == 15\nassert odd_bit_set_number(20) == 21\nassert odd_bit_set_number(30) == 31", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "38", "problem": "Write a function to extract every first or specified element from a given two-dimensional list.", "completion": "\ndef specified_element(lst, index):\n    return [sublist[index] for sublist in lst]\n\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],0)==[1, 4, 7]\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],2)==[3, 6, 9]\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],1)==[2,5,1]", "passed": true, "fail_reason": "[]"}
{"task_id": "39", "problem": "Write a function to find the list with minimum length using lambda function.", "completion": "\nassert min_length_list([[0], [1, 3], [5, 7], [9, 11], [13, 15, 17]])==(1, [0])\nassert min_length_list([[1,2,3,4,5],[1,2,3,4],[1,2,3],[1,2],[1]])==(1,[1])\nassert min_length_list([[3,4,5],[6,7,8,9],[10,11,12],[1,2]])==(2,[1,2])", "passed": false, "fail_reason": "[NameError(\"name 'min_length_list' is not defined\")]"}
{"task_id": "40", "problem": "Write a function to print check if the triangle is equilateral or not.", "completion": "\ndef check_equilateral(a, b, c):\n    return a == b == c\n\nassert check_equilateral(6,8,12)==False \nassert check_equilateral(6,6,12)==False\nassert check_equilateral(6,6,6)==True", "passed": true, "fail_reason": "[]"}
{"task_id": "41", "problem": "Write a function to caluclate area of a parallelogram.", "completion": "\ndef parallelogram_area(base, height):\n    \"\"\"\n    Calculate the area of a parallelogram.\n    \n    :param base: The base of the parallelogram.\n    :param height: The height of the parallelogram.\n    :return: The area of the parallelogram.\n    \"\"\"\n    area = base * height\n    return area\nassert parallelogram_area(10,20)==200\nassert parallelogram_area(15,20)==300\nassert parallelogram_area(8,9)==72\n\nassert parallelogram_area(10,20)==200\nassert parallelogram_area(15,20)==300\nassert parallelogram_area(8,9)==72", "passed": true, "fail_reason": "[]"}
{"task_id": "42", "problem": "Write a python function to check whether the first and last characters of a given string are equal or not.", "completion": "\ndef check_Equality(string):\n    if len(string) < 2:\n        return \"Not Equal\"\n    else:\n        if string[0] == string[-1]:\n            return \"Equal\"\n        else:\n            return \"Not Equal\"\n\nassert check_Equality(\"abcda\") == \"Equal\"\nassert check_Equality(\"ab\") == \"Not Equal\"\nassert check_Equality(\"mad\") == \"Not Equal\"", "passed": true, "fail_reason": "[]"}
{"task_id": "43", "problem": "Write a function to sort the given array by using counting sort.", "completion": "\ndef counting_sort(arr):\n    max_val = max(arr)\n    count = [0] * (max_val + 1)\n    for num in arr:\n        count[num] += 1\n    sorted_arr = []\n    for i in range(len(count)):\n        sorted_arr.extend([i] * count[i])\n    return sorted_arr\n\nassert counting_sort([1,23,4,5,6,7,8]) == [1, 4, 5, 6, 7, 8, 23]\nassert counting_sort([12, 9, 28, 33, 69, 45]) == [9, 12, 28, 33, 45, 69]\nassert counting_sort([8, 4, 14, 3, 2, 1]) == [1, 2, 3, 4, 8, 14]", "passed": true, "fail_reason": "[]"}
{"task_id": "44", "problem": "Write a function to find t-nth term of geometric series.", "completion": "\ndef tn_gp(a, r, n):\n   \"\"\"\n   Returns the nth term of a geometric sequence.\n   \n   Args:\n   a: the first term of the sequence\n   r: the common ratio of the sequence\n   n: the index of the term to return\n   \n   Returns:\n   The nth term of the sequence.\n   \"\"\"\n   return a * (r ** (n - 1))\n\nassert tn_gp(1,5,2)==16\nassert tn_gp(1,5,4)==256\nassert tn_gp(2,6,3)==486", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "45", "problem": "Write a python function to check if a given number is one less than twice its reverse.", "completion": "\ndef check(n):\n    return n == 2 * int(str(n)[::-1]) - 1\n\nassert check(70) == False\nassert check(23) == False\nassert check(73) == True", "passed": true, "fail_reason": "[]"}
{"task_id": "46", "problem": "Write a python function to find the largest number that can be formed with the given digits.", "completion": "\ndef find_Max_Num(digits, n):\n    digits.sort(reverse=True)\n    return int(''.join(map(str, digits[:n])))\n\nassert find_Max_Num([1,2,3],3) == 321\nassert find_Max_Num([4,5,6,1],4) == 6541\nassert find_Max_Num([1,2,3,9],4) == 9321", "passed": true, "fail_reason": "[]"}
{"task_id": "47", "problem": "Write a python function to check whether the given two integers have opposite sign or not.", "completion": "\ndef opposite_Signs(a, b):\n    return (a * b) < 0\n\nassert opposite_Signs(1,-2) == True\nassert opposite_Signs(3,2) == False\nassert opposite_Signs(-10,-10) == False", "passed": true, "fail_reason": "[]"}
{"task_id": "48", "problem": "Write a function to find the nth octagonal number.", "completion": "\nassert is_octagonal(5) == 65\nassert is_octagonal(10) == 280\nassert is_octagonal(15) == 645", "passed": false, "fail_reason": "[NameError(\"name 'is_octagonal' is not defined\")]"}
{"task_id": "49", "problem": "Write a function to find the maximum length of the subsequence with difference between adjacent elements for the given array.", "completion": "\ndef max_len_sub(arr, n):\n    \"\"\"\n    :param arr: given array\n    :param n: size of array\n    :return: return the length of longest subsequence\n    \"\"\"\n    # Stores the length of longest \n    # subsequence with difference arr[i]\n    mp = {}\n \n    # Initialize result\n    max_len = 1\n \n    # Traverse elements from left\n    for i in range(n - 1):\n        for j in range(i + 1, n):\n            diff = arr[j] - arr[i]\n \n            # If this difference is not seen before,\n            # then this difference forms a new sequence \n            # of length 2\n            if diff not in mp.keys():\n                mp[diff] = 2\n \n            # Else, increment length of old sequence\n            else:\n                mp[diff] += 1\n \n            # Update max_len\n            max_len = max(max_len, mp[diff])\n \n    return max_len\n\nassert max_len_sub([2, 5, 6, 3, 7, 6, 5, 8], 8) == 5\nassert max_len_sub([-2, -1, 5, -1, 4, 0, 3], 7) == 4\nassert max_len_sub([9, 11, 13, 15, 18], 5) == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "50", "problem": "Write a python function to count number of substrings with the sum of digits equal to their length.", "completion": "\ndef count_Substrings(s, n):\n    count = 0\n    for i in range(len(s)):\n        for j in range(i+1, len(s)+1):\n            substring = s[i:j]\n            if sum(int(digit) for digit in substring) == len(substring):\n                count += 1\n    return count\n\nassert count_Substrings('112112',6) == 6\nassert count_Substrings('111',3) == 6\nassert count_Substrings('1101112',7) == 12", "passed": true, "fail_reason": "[]"}
{"task_id": "51", "problem": "Write a python function to find smallest number in a list.", "completion": "\ndef smallest_num(lst):\n    return min(lst)\n\nassert smallest_num([10, 20, 1, 45, 99]) == 1\nassert smallest_num([1, 2, 3]) == 1\nassert smallest_num([45, 46, 50, 60]) == 45", "passed": true, "fail_reason": "[]"}
{"task_id": "52", "problem": "Write a function to find the maximum difference between available pairs in the given tuple list.", "completion": "\ndef max_difference(tup_list):\n    max_diff = 0\n    for tup in tup_list:\n        max_1, max_2 = tup[0], tup[0]\n        for num in tup[1:]:\n            if num > max_1:\n                max_2 = max_1\n                max_1 = num\n            elif num > max_2:\n                max_2 = num\n        max_diff = max(max_diff, max_1 - max_2)\n    return max_diff\nassert max_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7\nassert max_difference([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15\nassert max_difference([(12, 35), (21, 27), (13, 23), (41, 22)]) == 23\n\nassert max_difference([(3, 5), (1, 7), (10, 3), (1, 2)]) == 7\nassert max_difference([(4, 6), (2, 17), (9, 13), (11, 12)]) == 15\nassert max_difference([(12, 35), (21, 27), (13, 23), (41, 22)]) == 23", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "53", "problem": "Write a function to sort a list of tuples using lambda.", "completion": "\ndef subject_marks(marks):\n    return sorted(marks, key=lambda x: x[1])\n\nassert subject_marks([('English', 88), ('Science', 90), ('Maths', 97), ('Social sciences', 82)])==[('Social sciences', 82), ('English', 88), ('Science', 90), ('Maths', 97)]\nassert subject_marks([('Telugu',49),('Hindhi',54),('Social',33)])==([('Social',33),('Telugu',49),('Hindhi',54)])\nassert subject_marks([('Physics',96),('Chemistry',97),('Biology',45)])==([('Biology',45),('Physics',96),('Chemistry',97)])", "passed": true, "fail_reason": "[]"}
{"task_id": "54", "problem": "Write a function of recursion list sum.", "completion": "\ndef recursive_list_sum(lst):\n    total = 0\n    for i in lst:\n        if isinstance(i, list):\n            total += recursive_list_sum(i)\n        else:\n            total += i\n    return total\n\nassert recursive_list_sum(([1, 2, [3,4],[5,6]]))==21\nassert recursive_list_sum(([7, 10, [15,14],[19,41]]))==106\nassert recursive_list_sum(([10, 20, [30,40],[50,60]]))==210", "passed": false, "fail_reason": "[NameError(\"name 'recursive_list_sum' is not defined\")]"}
{"task_id": "55", "problem": "Write a python function to count positive numbers in a list.", "completion": "\ndef pos_count(nums):\n    \"\"\"\n    Count the number of positive numbers in a list.\n    \n    Args:\n        nums (list): A list of integers.\n    \n    Returns:\n        int: The number of positive numbers in the list.\n    \"\"\"\n    count = 0\n    for num in nums:\n        if num > 0:\n            count += 1\n    return count\n\nassert pos_count([1,-2,3,-4]) == 2\nassert pos_count([3,4,5,-1]) == 3\nassert pos_count([1,2,3,4]) == 4", "passed": true, "fail_reason": "[]"}
{"task_id": "56", "problem": "Write a function to find the number of ways to partition a set of bell numbers.", "completion": "\ndef bell_number(n):\n    bell = [0] * (n + 1)\n    bell[1] = 1\n    for i in range(2, n + 1):\n        bell[i] = 0\n        for j in range(i - 1):\n            bell[i] += bell[j] * bell[i - j - 1]\n    return bell[n]\n\nassert bell_number(2)==2\nassert bell_number(10)==115975\nassert bell_number(56)==6775685320645824322581483068371419745979053216268760300", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "57", "problem": "Write a python function to check whether the given array is monotonic or not.", "completion": "\ndef is_Monotonic(A):\n    return (all(A[i] < A[i+1] for i in range(len(A) - 1)) or\n            all(A[i] > A[i+1] for i in range(len(A) - 1)))\nassert is_Monotonic([6, 5, 4, 4])\nassert is_Monotonic([1, 2, 2, 3])\nassert not is_Monotonic([1, 3, 2])\n\nassert is_Monotonic([6, 5, 4, 4]) == True\nassert is_Monotonic([1, 2, 2, 3]) == True\nassert is_Monotonic([1, 3, 2]) == False", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "58", "problem": "Write a function to check whether a list contains the given sublist or not.", "completion": "\nassert is_sublist([2,4,3,5,7],[3,7])==False\nassert is_sublist([2,4,3,5,7],[4,3])==True\nassert is_sublist([2,4,3,5,7],[1,6])==False", "passed": false, "fail_reason": "[NameError(\"name 'is_sublist' is not defined\")]"}
{"task_id": "59", "problem": "Write a function to find whether all the given tuples have equal length or not.", "completion": "\ndef get_equal(tuples, length):\n    return 'All tuples have same length' if all(len(t) == length for t in tuples) else 'All tuples do not have same length'\n\nassert get_equal([(11, 22, 33), (44, 55, 66)], 3) == 'All tuples have same length'\nassert get_equal([(1, 2, 3), (4, 5, 6, 7)], 3) == 'All tuples do not have same length'\nassert get_equal([(1, 2), (3, 4)], 2) == 'All tuples have same length'", "passed": true, "fail_reason": "[]"}
{"task_id": "60", "problem": "Write a function to sort a list of elements using comb sort.", "completion": "\ndef comb_sort(lst):\n    def get_next_gap(gap):\n        gap = (gap * 10) // 13\n        if gap < 1:\n            return 1\n        return gap\n\n    n = len(lst)\n    gap = n\n    swapped = True\n\n    while gap!= 1 or swapped:\n        gap = get_next_gap(gap)\n        swapped = False\n\n        for i in range(0, n - gap):\n            j = i\n            while (j + gap < n and lst[j] > lst[j + gap]):\n                lst[j], lst[j + gap] = lst[j + gap], lst[j]\n                j += 1\n            if swapped == False:\n                swapped = True\n\n    return lst\n\nassert comb_sort([5, 15, 37, 25, 79]) == [5, 15, 25, 37, 79]\nassert comb_sort([41, 32, 15, 19, 22]) == [15, 19, 22, 32, 41]\nassert comb_sort([99, 15, 13, 47]) == [13, 15, 47, 99]", "passed": false, "fail_reason": "[]"}
{"task_id": "61", "problem": "Write a python function to check whether the given number can be represented as difference of two squares or not.", "completion": "\ndef dif_Square(n):\n    for i in range(1, int(n/2) + 1):\n        if (n - i ** 2) ** 0.5 % 1 == 0:\n            return True\n    return False\n\nassert dif_Square(5) == True\nassert dif_Square(10) == False\nassert dif_Square(15) == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "62", "problem": "Write a function to split the given string with multiple delimiters by using regex.", "completion": "\nimport re\n\ndef multiple_split(s):\n    delimiters = ['\\n', '*']\n    for delimiter in delimiters:\n        s = re.sub(delimiter, '|', s)\n    return re.split('\\|', s)\n\nassert multiple_split('Forces of the \\ndarkness*are coming into the play.') == ['Forces of the ', 'darkness', 'are coming into the play.']\nassert multiple_split('Mi Box runs on the \\n Latest android*which has google assistance and chromecast.') == ['Mi Box runs on the ', ' Latest android', 'which has google assistance and chromecast.']\nassert multiple_split('Certain services\\nare subjected to change*over the seperate subscriptions.') == ['Certain services', 'are subjected to change', 'over the seperate subscriptions.']", "passed": false, "fail_reason": "[error('nothing to repeat at position 0')]"}
{"task_id": "63", "problem": "Write a function to check whether it follows the sequence given in the patterns array.", "completion": "\ndef is_samepatterns(patterns, sequence):\n    return all([patterns[i] == sequence[i] for i in range(len(patterns))]) and all([patterns[i] == patterns[i+1] for i in range(len(patterns)-1)])\n\nassert is_samepatterns([\"red\",\"green\",\"green\"], [\"a\", \"b\", \"b\"])==True \nassert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\",\"b\"])==False \nassert is_samepatterns([\"red\",\"green\",\"greenn\"], [\"a\",\"b\"])==False ", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "64", "problem": "Write a function to find tuples which have all elements divisible by k from the given list of tuples.", "completion": "\ndef find_tuples(tuples_list, k):\n    result = []\n    for t in tuples_list:\n        if all(i % k == 0 for i in t):\n            result.append(t)\n    return str(result)\n\nassert find_tuples([(6, 24, 12), (7, 9, 6), (12, 18, 21)], 6) == '[(6, 24, 12)]'\nassert find_tuples([(5, 25, 30), (4, 2, 3), (7, 8, 9)], 5) == '[(5, 25, 30)]'\nassert find_tuples([(7, 9, 16), (8, 16, 4), (19, 17, 18)], 4) == '[(8, 16, 4)]'", "passed": true, "fail_reason": "[]"}
{"task_id": "65", "problem": "Write a python function to count the number of squares in a rectangle.", "completion": "\ndef count_Squares(width, height):\n    return width * height\n\nassert count_Squares(4,3) == 20\nassert count_Squares(2,2) == 5\nassert count_Squares(1,1) == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "66", "problem": "Write a python function to find the difference between sum of even and odd digits.", "completion": "\ndef is_Diff(n):\n    even_sum = sum(int(digit) for digit in str(n) if int(digit) % 2 == 0)\n    odd_sum = sum(int(digit) for digit in str(n) if int(digit) % 2!= 0)\n    return even_sum!= odd_sum\n\nassert is_Diff (12345) == False\nassert is_Diff(1212112) == True\nassert is_Diff(1212) == False", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "67", "problem": "Write a python function to find number of integers with odd number of set bits.", "completion": "\ndef count_With_Odd_SetBits(n):\n    count = 0\n    while n:\n        count += n & 1\n        n >>= 1\n    return count\n\nassert count_With_Odd_SetBits(5) == 3\nassert count_With_Odd_SetBits(10) == 5\nassert count_With_Odd_SetBits(15) == 8", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "68", "problem": "Write a python function to check whether the length of the word is odd or not.", "completion": "\ndef word_len(word):\n    return len(word) % 2!= 0\n\nassert word_len(\"Hadoop\") == False\nassert word_len(\"great\") == True\nassert word_len(\"structure\") == True", "passed": true, "fail_reason": "[]"}
{"task_id": "69", "problem": "Write a function to find the nth tetrahedral number.", "completion": "\ndef tetrahedral_number(n):\n    \"\"\"\n    Compute the nth tetrahedral number.\n    \n    Parameters\n    ----------\n    n : int\n        The index of the tetrahedral number to compute.\n        \n    Returns\n    -------\n    tetra : float\n        The nth tetrahedral number.\n    \"\"\"\n    if n < 0:\n        return \"Input must be a non-negative integer.\"\n    \n    # Base cases\n    if n == 1:\n        return 1.0\n    \n    tetra_list = [1, 4, 2, 6]\n  \n    # Compute tetra(i) for i from 4 to n\n    for i in range(4, n + 1):\n        if i % 2 == 0:\n            tetra_list.append(1 + i//2)\n        elif i % 3 == 0:\n            tetra_list.append(tetra_list[i-1] + tetra_list[i-2])\n        else:\n            tetra_list.append(tetra_list[i-1] + tetra_list[i-2] + tetra_list[i-3])\n              \n    return tetra_list[n]\n\nassert tetrahedral_number(5) == 35.0\nassert tetrahedral_number(6) == 56.0\nassert tetrahedral_number(7) == 84.0", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "70", "problem": "Write a function to zip the two given tuples.", "completion": "\ndef zip_tuples(tup1, tup2):\n    result = []\n    for i in range(max(len(tup1), len(tup2))):\n        if i < len(tup1):\n            result.append((tup1[i],))\n        if i < len(tup2):\n            result.append((tup2[i],))\n    return [x for x in result if x]\n\nassert zip_tuples((7, 8, 4, 5, 9, 10),(1, 5, 6) ) == [(7, 1), (8, 5), (4, 6), (5, 1), (9, 5), (10, 6)]\nassert zip_tuples((8, 9, 5, 6, 10, 11),(2, 6, 7) ) == [(8, 2), (9, 6), (5, 7), (6, 2), (10, 6), (11, 7)]\nassert zip_tuples((9, 10, 6, 7, 11, 12),(3, 7, 8) ) == [(9, 3), (10, 7), (6, 8), (7, 3), (11, 7), (12, 8)]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "71", "problem": "Write a function to find the volume of a sphere.", "completion": "\nimport math\n\ndef volume_sphere(r):\n    return (4/3) * math.pi * r**3\n\nassert volume_sphere(10)==4188.790204786391\nassert volume_sphere(25)==65449.84694978735\nassert volume_sphere(20)==33510.32163829113", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "72", "problem": "Write a python function to find the character made by adding all the characters of the given string.", "completion": "\ndef get_Char(s):\n    return chr(sum(ord(c) for c in s))\n\nassert get_Char(\"abc\") == \"f\"\nassert get_Char(\"gfg\") == \"t\"\nassert get_Char(\"ab\") == \"c\"", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "73", "problem": "Write a function to find the n-th number in newman conway sequence.", "completion": "\ndef sequence(n):\n    a, b = 0, 1\n    for _ in range(n):\n        a, b = b, a + b\n    return a\n\nassert sequence(10) == 6\nassert sequence(2) == 1\nassert sequence(3) == 2", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "74", "problem": "Write a function to find the surface area of a sphere.", "completion": "\nimport math\n\ndef surfacearea_sphere(radius):\n    \"\"\"\n    Calculate the surface area of a sphere.\n    \n    Parameters:\n    radius (float): The radius of the sphere.\n    \n    Returns:\n    float: The surface area of the sphere.\n    \"\"\"\n    surface_area = 4 * math.pi * radius * radius\n    return surface_area \n\nassert surfacearea_sphere(10)==1256.6370614359173\nassert surfacearea_sphere(15)==2827.4333882308138\nassert surfacearea_sphere(20)==5026.548245743669\n\nassert surfacearea_sphere(10)==1256.6370614359173\nassert surfacearea_sphere(15)==2827.4333882308138\nassert surfacearea_sphere(20)==5026.548245743669", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "75", "problem": "Write a function to find nth centered hexagonal number.", "completion": "\ndef centered_hexagonal_number(n):\n    return (6 * n**2) - 6 * n + 1\n\nassert centered_hexagonal_number(10) == 271\nassert centered_hexagonal_number(2) == 7\nassert centered_hexagonal_number(9) == 217", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "76", "problem": "Write a function to merge three dictionaries into a single expression.", "completion": "\ndef merge_dictionaries_three(dict1, dict2, dict3):\n    return {**dict1, **dict2, **dict3}\n\nassert merge_dictionaries_three({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" }, { \"G\": \"Green\", \"W\": \"White\" },{ \"O\": \"Orange\", \"W\": \"White\", \"B\": \"Black\" })=={'B': 'Black', 'R': 'Red', 'P': 'Pink', 'G': 'Green', 'W': 'White', 'O': 'Orange'}\nassert merge_dictionaries_three({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" }, { \"G\": \"Green\", \"W\": \"White\" },{\"L\":\"lavender\",\"B\":\"Blue\"})=={'W': 'White', 'P': 'Pink', 'B': 'Black', 'R': 'Red', 'G': 'Green', 'L': 'lavender'}\nassert merge_dictionaries_three({ \"R\": \"Red\", \"B\": \"Black\", \"P\": \"Pink\" },{\"L\":\"lavender\",\"B\":\"Blue\"},{ \"G\": \"Green\", \"W\": \"White\" })=={'B': 'Black', 'P': 'Pink', 'R': 'Red', 'G': 'Green', 'L': 'lavender', 'W': 'White'}", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "77", "problem": "Write a function to get the frequency of the elements in a list.", "completion": "\ndef freq_count(lst):\n    freq_dict = {}\n    for item in lst:\n        if item in freq_dict:\n            freq_dict[item] += 1\n        else:\n            freq_dict[item] = 1\n    return freq_dict\n\nassert 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}) \nassert freq_count([1,2,3,4,3,2,4,1,3,1,4])==({1:3, 2:2,3:3,4:3}) \nassert freq_count([5,6,7,4,9,10,4,5,6,7,9,5])==({10:1,5:3,6:2,7:2,4:2,9:2}) ", "passed": true, "fail_reason": "[]"}
{"task_id": "78", "problem": "Write a function to find the closest smaller number than n.", "completion": "\ndef closest_num(n):\n    return n - 1\n\nassert closest_num(11) == 10\nassert closest_num(7) == 6\nassert closest_num(12) == 11", "passed": true, "fail_reason": "[]"}
{"task_id": "79", "problem": "Write a python function to find the length of the longest word.", "completion": "\ndef len_log(sentence):\n    \"\"\"\n    Find the length of the longest word in a sentence\n    \"\"\"\n    words = sentence.split()\n    max_len = len(words[0])\n    for word in words[1:]:\n        if len(word) > max_len:\n            max_len = len(word)\n    return max_len\nassert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7\nassert len_log([\"a\",\"ab\",\"abc\"]) == 3\nassert len_log([\"small\",\"big\",\"tall\"]) == 5\n\nassert len_log([\"python\",\"PHP\",\"bigdata\"]) == 7\nassert len_log([\"a\",\"ab\",\"abc\"]) == 3\nassert len_log([\"small\",\"big\",\"tall\"]) == 5", "passed": false, "fail_reason": "[AttributeError(\"'list' object has no attribute 'split'\")]"}
{"task_id": "80", "problem": "Write a function to check if a substring is present in a given list of string values.", "completion": "\ndef find_substring(lst, sub):\n    for string in lst:\n        if sub in string:\n            return True\n    return False\n\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ack\")==True\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"abc\")==False\nassert find_substring([\"red\", \"black\", \"white\", \"green\", \"orange\"],\"ange\")==True", "passed": true, "fail_reason": "[]"}
{"task_id": "81", "problem": "Write a function to check whether the given number is undulating or not.", "completion": "\ndef is_undulating(s):\n    return len(set(s)) == 2\n\nassert is_undulating(\"1212121\") == True\nassert is_undulating(\"1991\") == False\nassert is_undulating(\"121\") == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "82", "problem": "Write a function to calculate the value of 'a' to the power 'b'.", "completion": "\ndef power(a, b):\n    \"\"\"\n    Calculate a to the power of b\n    :param a: base\n    :param b: exponent\n    :return: a to the power of b\n    \"\"\"\n    result = 1\n    for i in range(b):\n        result = result * a\n    return result\nassert power(3,4) == 81\nassert power(2,3) == 8\nassert power(5,5) == 3125\n\nassert power(3,4) == 81\nassert power(2,3) == 8\nassert power(5,5) == 3125", "passed": true, "fail_reason": "[]"}
{"task_id": "83", "problem": "Write a function to extract the index minimum value record from the given tuples.", "completion": "\ndef index_minimum(tuples):\n    return min(tuples, key=lambda x: x[1])[0]\n\nassert index_minimum([('Rash', 143), ('Manjeet', 200), ('Varsha', 100)]) == 'Varsha'\nassert index_minimum([('Yash', 185), ('Dawood', 125), ('Sanya', 175)]) == 'Dawood'\nassert index_minimum([('Sai', 345), ('Salman', 145), ('Ayesha', 96)]) == 'Ayesha'", "passed": true, "fail_reason": "[]"}
{"task_id": "84", "problem": "Write a python function to find the minimum length of sublist.", "completion": "\ndef Find_Min_Length(lists):\n    return min(len(lst) for lst in lists)\n\nassert Find_Min_Length([[1],[1,2]]) == 1\nassert Find_Min_Length([[1,2],[1,2,3],[1,2,3,4]]) == 2\nassert Find_Min_Length([[3,3,3],[4,4,4,4]]) == 3", "passed": true, "fail_reason": "[]"}
{"task_id": "85", "problem": "Write a python function to find the number of divisors of a given integer.", "completion": "\ndef divisor(n):\n    count = 2  #1 and n are always divisors\n    i = 2 \n    while i * i <= n: \n        if n % i: \n            i += 1\n        else: \n            if n == i * i: \n                count += 1 \n            else: \n                count += 2\n            n /= i\n    return count\nassert divisor(15) == 4 \nassert divisor(12) == 6\nassert divisor(9) == 3\n\nassert divisor(15) == 4 \nassert divisor(12) == 6\nassert divisor(9) == 3", "passed": true, "fail_reason": "[]"}
{"task_id": "86", "problem": "Write a function to find frequency count of list of lists.", "completion": "\ndef frequency_lists(lst):\n    # Flatten all lists in lst and convert them into tuples\n    flat_list = [item for sublist in lst for item in sublist]\n    \n    # Get the counts of each tuple\n    return {item: flat_list.count(item) for item in set(flat_list)}\n\nassert 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: 1}\nassert frequency_lists([[1,2,3,4],[5,6,7,8],[9,10,11,12]])=={1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1, 9: 1,10:1,11:1,12:1}\nassert frequency_lists([[20,30,40,17],[18,16,14,13],[10,20,30,40]])=={20:2,30:2,40:2,17: 1,18:1, 16: 1,14: 1,13: 1, 10: 1}", "passed": true, "fail_reason": "[]"}
{"task_id": "87", "problem": "Write a function to multiply all the numbers in a list and divide with the length of the list.", "completion": "\ndef multiply_num(numbers):\n    product = 1\n    for num in numbers:\n        product *= num\n    return product / len(numbers)\n\nassert multiply_num((8, 2, 3, -1, 7))==-67.2\nassert multiply_num((-10,-20,-30))==-2000.0\nassert multiply_num((19,15,18))==1710.0", "passed": true, "fail_reason": "[]"}
{"task_id": "88", "problem": "Write a function to convert the given decimal number to its binary equivalent.", "completion": "\ndef decimal_to_binary(num):\n    if num > 1:\n        decimal_to_binary(num//2)\n    print(num % 2, end='')\n    if num > 1:\n        decimal_to_binary(num//2)\n\ndecimal_to_binary(8)\nprint()  # Output: 1000\ndecimal_to_binary(18)\nprint()  # Output: 10010\ndecimal_to_binary(7)\nprint()  # Output: 111\nassert decimal_to_binary(8) == '1000'\nassert decimal_to_binary(18) == '10010'\nassert decimal_to_binary(7) == '111'\n\nassert decimal_to_binary(8) == '1000'\nassert decimal_to_binary(18) == '10010'\nassert decimal_to_binary(7) == '111' ", "passed": false, "fail_reason": "[NameError(\"name 'decimal_to_binary' is not defined\")]"}
{"task_id": "89", "problem": "Write a function to find the next smallest palindrome of a specified number.", "completion": "\ndef next_smallest_palindrome(num):\n    num += 1\n    while not is_palindrome(str(num)):\n        num += 1\n    return num\n\ndef is_palindrome(s):\n    return s == s[::-1]\n\nassert next_smallest_palindrome(99)==101\nassert next_smallest_palindrome(1221)==1331\nassert next_smallest_palindrome(120)==121\n\nassert next_smallest_palindrome(99)==101\nassert next_smallest_palindrome(1221)==1331\nassert next_smallest_palindrome(120)==121", "passed": false, "fail_reason": "[NameError(\"name 'is_palindrome' is not defined\")]"}
{"task_id": "90", "problem": "Write a function to find the kth element in the given array.", "completion": "\nassert kth_element([12,3,5,7,19], 5, 2) == 3\nassert kth_element([17,24,8,23], 4, 3) == 8\nassert kth_element([16,21,25,36,4], 5, 4) == 36", "passed": false, "fail_reason": "[NameError(\"name 'kth_element' is not defined\")]"}
{"task_id": "91", "problem": "Write a function to convert snake case string to camel case string.", "completion": "\ndef snake_to_camel(s):\n    words = s.split('_')\n    return words[0] + ''.join(word.capitalize() for word in words[1:])\n\nassert snake_to_camel('python_program')=='PythonProgram'\nassert snake_to_camel('python_language')==('PythonLanguage')\nassert snake_to_camel('programming_language')==('ProgrammingLanguage')", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "92", "problem": "Write a function to find eulerian number a(n, m).", "completion": "\ndef eulerian_num(n, m):\n    return sum(range(1, n + 1)) * m\n\nassert eulerian_num(3, 1) == 4\nassert eulerian_num(4, 1) == 11\nassert eulerian_num(5, 3) == 26", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "93", "problem": "Write a function to sort each sublist of strings in a given list of lists using lambda function.", "completion": "\ndef sort_sublists(list_of_lists):\n    return [sorted(sublist) for sublist in list_of_lists]\n\nassert sort_sublists(([\"green\", \"orange\"], [\"black\", \"white\"], [\"white\", \"black\", \"orange\"]))==[['green', 'orange'], ['black', 'white'], ['black', 'orange', 'white']]\nassert sort_sublists(([\" red \",\"green\" ],[\"blue \",\" black\"],[\" orange\",\"brown\"]))==[[' red ', 'green'], [' black', 'blue '], [' orange', 'brown']]\nassert sort_sublists(([\"zilver\",\"gold\"], [\"magnesium\",\"aluminium\"], [\"steel\", \"bronze\"]))==[['gold', 'zilver'],['aluminium', 'magnesium'], ['bronze', 'steel']]", "passed": true, "fail_reason": "[]"}
{"task_id": "94", "problem": "Write a python function to count true booleans in the given list.", "completion": "\ndef count(lst):\n    return lst.count(True)\n\nassert count([True,False,True]) == 2\nassert count([False,False]) == 0\nassert count([True,True,True]) == 3", "passed": true, "fail_reason": "[]"}
{"task_id": "95", "problem": "Write a function to add the given list to the given tuples.", "completion": "\ndef add_lists(list1, tup):\n    return tup + tuple(list1)\n\nassert add_lists([5, 6, 7], (9, 10)) == (9, 10, 5, 6, 7)\nassert add_lists([6, 7, 8], (10, 11)) == (10, 11, 6, 7, 8)\nassert add_lists([7, 8, 9], (11, 12)) == (11, 12, 7, 8, 9)", "passed": true, "fail_reason": "[]"}
{"task_id": "96", "problem": "Write a python function to count hexadecimal numbers for a given range.", "completion": "\ndef count_Hexadecimal(start, end):\n    count = 0\n    for i in range(start, end):\n        if str(i).startswith('0') and len(str(i)) > 1:\n            continue\n        try:\n            int(str(i), 16)\n            count += 1\n        except ValueError:\n            pass\n    return count\n\nassert count_Hexadecimal(10,15) == 6\nassert count_Hexadecimal(2,4) == 0\nassert count_Hexadecimal(15,16) == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "97", "problem": "Write a function to merge multiple sorted inputs into a single sorted iterator using heap queue algorithm.", "completion": "\nimport heapq\n\ndef merge_sorted_list(*lists):\n    heap = []\n    for lst in lists:\n        for item in lst:\n            heapq.heappush(heap, item)\n    return [heapq.heappop(heap) for _ in range(len(heap))]\n\nassert merge_sorted_list([25, 24, 15, 4, 5, 29, 110],[19, 20, 11, 56, 25, 233, 154],[24, 26, 54, 48])==[4, 5, 11, 15, 19, 20, 24, 24, 25, 25, 26, 29, 48, 54, 56, 110, 154, 233]\nassert merge_sorted_list([1, 3, 5, 6, 8, 9], [2, 5, 7, 11], [1, 4, 7, 8, 12])==[1, 1, 2, 3, 4, 5, 5, 6, 7, 7, 8, 8, 9, 11, 12]\nassert merge_sorted_list([18, 14, 10, 9, 8, 7, 9, 3, 2, 4, 1],[25, 35, 22, 85, 14, 65, 75, 25, 58],[12, 74, 9, 50, 61, 41])==[1, 2, 3, 4, 7, 8, 9, 9, 9, 10, 12, 14, 14, 18, 22, 25, 25, 35, 41, 50, 58, 61, 65, 74, 75, 85]", "passed": false, "fail_reason": "[NameError(\"name 'heapq' is not defined\")]"}
{"task_id": "98", "problem": "Write a python function to find the count of rotations of a binary string with odd value.", "completion": "\ndef odd_Equivalent(s, n):\n    return sum(1 for i in range(n) if int(s[i:i+1],2) % 2!= 0)\n\nassert odd_Equivalent(\"011001\",6) == 3\nassert odd_Equivalent(\"11011\",5) == 4\nassert odd_Equivalent(\"1010\",4) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "99", "problem": "Write a function to extract the ranges that are missing from the given list with the given start range and end range values.", "completion": "\ndef extract_missing(ranges, start, end):\n    missing = []\n    for i in range(start, end + 1):\n        found = False\n        for r in ranges:\n            if r[0] <= i <= r[1]:\n                found = True\n                break\n        if not found:\n            missing.append((i, end))\n    return missing\n\nassert extract_missing([(6, 9), (15, 34), (48, 70)], 2, 100) == [(2, 6), (9, 100), (9, 15), (34, 100), (34, 48), (70, 100)]\nassert extract_missing([(7, 2), (15, 19), (38, 50)], 5, 60) == [(5, 7), (2, 60), (2, 15), (19, 60), (19, 38), (50, 60)]\nassert extract_missing([(7, 2), (15, 19), (38, 50)], 1, 52) == [(1, 7), (2, 52), (2, 15), (19, 52), (19, 38), (50, 52)]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "100", "problem": "Write a function to find common elements in given nested lists. * list item * list item * list item * list item", "completion": "\ndef flatten(lst):\n    \"\"\"Helper function to flatten a list.\"\"\"\n    return [item for sublist in lst for item in sublist]\n\ndef common_in_nested_lists(lists):\n    \"\"\"Function to find common elements in given nested lists.\"\"\"\n    flat_list = flatten(lists)\n    return list(set(flat_list))\n\nassert common_in_nested_lists([[12, 18, 23, 25, 45], [7, 12, 18, 24, 28], [1, 5, 8, 12, 15, 16, 18]])==[18, 12]\nassert common_in_nested_lists([[12, 5, 23, 25, 45], [7, 11, 5, 23, 28], [1, 5, 8, 18, 23, 16]])==[5,23]\nassert common_in_nested_lists([[2, 3,4, 1], [4, 5], [6,4, 8],[4, 5], [6, 8,4]])==[4]\n\nassert common_in_nested_lists([[12, 18, 23, 25, 45], [7, 12, 18, 24, 28], [1, 5, 8, 12, 15, 16, 18]])==[18, 12]\nassert common_in_nested_lists([[12, 5, 23, 25, 45], [7, 11, 5, 23, 28], [1, 5, 8, 18, 23, 16]])==[5,23]\nassert common_in_nested_lists([[2, 3,4, 1], [4, 5], [6,4, 8],[4, 5], [6, 8,4]])==[4]", "passed": false, "fail_reason": "[NameError(\"name 'flatten' is not defined\")]"}
{"task_id": "101", "problem": "Write a python function to find the perimeter of a cylinder.", "completion": "\ndef perimeter(r, h):\n    return 2 * 3.14 * (r + h)\n\nassert perimeter(2,4) == 12\nassert perimeter(1,2) == 6\nassert perimeter(3,1) == 8", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "102", "problem": "Write a function to check if a string represents an integer or not.", "completion": "\ndef check_integer(s):\n    \"\"\"\n    Check if a string is a valid integer.\n    :param s: string\n    :return: bool\n    \"\"\"\n    if len(s) > 1000:\n        return False\n    if len(s) == 0 or s[0] == '0':\n        return False\n    for char in s:\n        if char not in '1234567890':\n            return False\n    return True\n\nassert check_integer(\"python\")==False\nassert check_integer(\"1\")==True\nassert check_integer(\"12345\")==True\n\nassert check_integer(\"python\")==False\nassert check_integer(\"1\")==True\nassert check_integer(\"12345\")==True", "passed": true, "fail_reason": "[]"}
{"task_id": "103", "problem": "Write a function to assign frequency to each tuple in the given tuple list.", "completion": "\ndef assign_freq(tup_list):\n    freq_dict = {}\n    for tup in tup_list:\n        for i in tup:\n            if i in freq_dict:\n                freq_dict[i] += 1\n            else:\n                freq_dict[i] = 1\n    result = []\n    for tup in tup_list:\n        temp = []\n        for i in tup:\n            temp.append((i, freq_dict[i]))\n        result.append(tuple(temp))\n    return str(result)\n\nassert assign_freq([(6, 5, 8), (2, 7), (6, 5, 8), (6, 5, 8), (9, ), (2, 7)] ) == '[(6, 5, 8, 3), (2, 7, 2), (9, 1)]'\nassert assign_freq([(4, 2, 4), (7, 1), (4, 8), (4, 2, 4), (9, 2), (7, 1)] ) == '[(4, 2, 4, 2), (7, 1, 2), (4, 8, 1), (9, 2, 1)]'\nassert assign_freq([(11, 13, 10), (17, 21), (4, 2, 3), (17, 21), (9, 2), (4, 2, 3)] ) == '[(11, 13, 10, 1), (17, 21, 2), (4, 2, 3, 2), (9, 2, 1)]'", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "104", "problem": "Write a function to check whether all dictionaries in a list are empty or not.", "completion": "\ndef empty_dit(dicts):\n    return all(not d for d in dicts)\n\nassert empty_dit([{},{},{}])==True\nassert empty_dit([{1,2},{},{}])==False\nassert empty_dit({})==True", "passed": true, "fail_reason": "[]"}
{"task_id": "105", "problem": "Write a function to convert a given tuple of positive integers into an integer.", "completion": "\ndef tuple_to_int(t):\n    return int(''.join(map(str, t)))\n\nassert tuple_to_int((1,2,3))==123\nassert tuple_to_int((4,5,6))==456\nassert tuple_to_int((5,6,7))==567", "passed": true, "fail_reason": "[]"}
{"task_id": "106", "problem": "Write a function to convert all possible convertible elements in the list to float.", "completion": "\ndef list_to_float(lst):\n    return [tuple(float(i) if isinstance(i, str) else i for i in pair) for pair in lst]\n\nassert list_to_float( [(\"3\", \"4\"), (\"1\", \"26.45\"), (\"7.32\", \"8\"), (\"4\", \"8\")] ) == '[(3.0, 4.0), (1.0, 26.45), (7.32, 8.0), (4.0, 8.0)]'\nassert list_to_float( [(\"4\", \"4\"), (\"2\", \"27\"), (\"4.12\", \"9\"), (\"7\", \"11\")] ) == '[(4.0, 4.0), (2.0, 27.0), (4.12, 9.0), (7.0, 11.0)]'\nassert list_to_float( [(\"6\", \"78\"), (\"5\", \"26.45\"), (\"1.33\", \"4\"), (\"82\", \"13\")] ) == '[(6.0, 78.0), (5.0, 26.45), (1.33, 4.0), (82.0, 13.0)]'", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "107", "problem": "[link text](https:// [link text](https:// [link text](https://)))write a function to convert a string to a list.", "completion": "\ndef string_to_list(s):\n    return s.split()\n\nassert string_to_list(\"python programming\")==['python','programming']\nassert string_to_list(\"lists tuples strings\")==['lists','tuples','strings']\nassert string_to_list(\"write a program\")==['write','a','program']", "passed": true, "fail_reason": "[]"}
{"task_id": "108", "problem": "Write a python function to find the element that appears only once in a sorted array.", "completion": "\nassert search([1,1,2,2,3],5) == 3\nassert search([1,1,3,3,4,4,5,5,7,7,8],11) == 8\nassert search([1,2,2,3,3,4,4],7) == 1", "passed": false, "fail_reason": "[NameError(\"name 'search' is not defined\")]"}
{"task_id": "109", "problem": "Write a function to find the maximum product from the pairs of tuples within a given list.", "completion": "\ndef max_product_tuple(lst):\n    max_product = float('-inf')\n    for i in range(len(lst)):\n        for j in range(i+1, len(lst)):\n            if lst[i][0]*lst[j][1] > max_product:\n                max_product = lst[i][0]*lst[j][1]\n                pair = (lst[i], lst[j])\n    return max_product\nassert max_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36\nassert max_product_tuple([(10,20), (15,2), (5,10)] )==200\nassert max_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==484\n\nassert max_product_tuple([(2, 7), (2, 6), (1, 8), (4, 9)] )==36\nassert max_product_tuple([(10,20), (15,2), (5,10)] )==200\nassert max_product_tuple([(11,44), (10,15), (20,5), (12, 9)] )==484", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "110", "problem": "Write a function to find the triplet with sum of the given array", "completion": "\ndef check_triplet(arr, sum1, sum2, sum3):\n    n = len(arr)\n    arr.sort()\n    for i in range(0, n - 2):\n        left, right = i + 1, n - 1\n        while left < right:\n            current_sum = arr[i] + arr[left] + arr[right]\n            if current_sum == sum1:\n                return True\n            elif current_sum < sum1:\n                left += 1\n            else:\n                right -= 1\n    return False\n\nassert check_triplet([2, 7, 4, 0, 9, 5, 1, 3], 8, 6, 0) == True\nassert check_triplet([1, 4, 5, 6, 7, 8, 5, 9], 8, 6, 0) == False\nassert check_triplet([10, 4, 2, 3, 5], 5, 15, 0) == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "111", "problem": "Write a function to find n\u2019th smart number.", "completion": "\ndef smartNumber(n):\n    total = 0\n    i = 1\n    while True:\n        total += i\n        if total >= n:\n            return total\n        i += 1\n\nassert smartNumber(1) == 30\nassert smartNumber(50) == 273\nassert smartNumber(1000) == 2664", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "112", "problem": "Write a function to sum all amicable numbers from 1 to a specified number.", "completion": "\ndef amicable_numbers_sum(n):\n    def sum_of_divisors(num):\n        return sum(i for i in range(1, num) if num % i == 0)\n\n    def is_amicable(a, b):\n        return sum_of_divisors(a) == b and sum_of_divisors(b) == a\n\n    amicable_pairs = [(i, j) for i in range(1, n) for j in range(i+1, n) if is_amicable(i, j)]\n    return sum(sum(pair) for pair in amicable_pairs)\n\nassert amicable_numbers_sum(999)==504\nassert amicable_numbers_sum(9999)==31626\nassert amicable_numbers_sum(99)==0", "passed": false, "fail_reason": "[]"}
{"task_id": "113", "problem": "Write a function to get the angle of a complex number.", "completion": "\nimport math\nimport cmath\n\ndef angle_complex(real, imag):\n    return math.atan2(imag, real)\n\nassert angle_complex(0,1j)==1.5707963267948966 \nassert angle_complex(2,1j)==0.4636476090008061\nassert angle_complex(0,2j)==1.5707963267948966", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "114", "problem": "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.", "completion": "\ndef find_length(s, n):\n    max_diff = 0\n    current_diff = 0\n    for i in range(n):\n        if s[i] == '0':\n            current_diff += 1\n        else:\n            current_diff -= 1\n        max_diff = max(max_diff, abs(current_diff))\n    return max_diff\n\nassert find_length(\"11000010001\", 11) == 6\nassert find_length(\"10111\", 5) == 1\nassert find_length(\"11011101100101\", 14) == 2 ", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "115", "problem": "Write a python function to find the sum of common divisors of two given numbers.", "completion": "\ndef sum(n, m):\n    def gcd(a, b):\n        while b!= 0:\n            a, b = b, a % b\n        return a\n    return gcd(n, m)\n\nassert sum(10,15) == 6\nassert sum(100,150) == 93\nassert sum(4,6) == 3", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "116", "problem": "Write a function to multiply two integers without using the * operator in python.", "completion": "\ndef multiply_int(a, b):\n    def subtract(x, y):\n        return x - y\n\n    def multiply(a, b):\n        if b == 1:\n            return a\n        return a + multiply(a, subtract(b, 1))\n    return multiply(a, b)\nassert multiply_int(10,20)==200\nassert multiply_int(5,10)==50\nassert multiply_int(4,8)==32\n\nassert multiply_int(10,20)==200\nassert multiply_int(5,10)==50\nassert multiply_int(4,8)==32", "passed": true, "fail_reason": "[]"}
{"task_id": "117", "problem": "Write a function to shortlist words that are longer than n from a given list of words.", "completion": "\ndef long_words(n, word_list):\n  return [w for w in word_list if len(w) > n]\n\nassert long_words(3,\"python is a programming language\")==['python','programming','language']\nassert long_words(2,\"writing a program\")==['writing','program']\nassert long_words(5,\"sorting list\")==['sorting']", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "118", "problem": "Write a function to calculate magic square.", "completion": "\ndef magic_square_test(square):\n    target = sum(square[0])\n    for row in square:\n        if sum(row)!= target:\n            return False\n    for col in range(len(square[0])):\n        if sum(square[row][col] for row in range(len(square)))!= target:\n            return False\n    return True\n\nassert magic_square_test([[7, 12, 1, 14], [2, 13, 8, 11], [16, 3, 10, 5], [9, 6, 15, 4]])==True\nassert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 8]])==True\nassert magic_square_test([[2, 7, 6], [9, 5, 1], [4, 3, 7]])==False", "passed": true, "fail_reason": "[]"}
{"task_id": "119", "problem": "Write a function to find the item with maximum frequency in a given list.", "completion": "\ndef max_occurrences(input_list):\n    frequency_dict = {}\n    for item in input_list:\n        if item in frequency_dict:\n            frequency_dict[item] += 1\n        else:\n            frequency_dict[item] = 1\n\n    most_frequent_item = max(frequency_dict, key=frequency_dict.get)\n    max_count = frequency_dict[most_frequent_item]\n\n    return most_frequent_item, max_count\nassert 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)\nassert max_occurrences([2,3,8,4,7,9,8,7,9,15,14,10,12,13,16,16,18])==(8, 2)\nassert max_occurrences([10,20,20,30,40,90,80,50,30,20,50,10])==(20, 3)\n\nassert 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)\nassert max_occurrences([2,3,8,4,7,9,8,7,9,15,14,10,12,13,16,16,18])==(8, 2)\nassert max_occurrences([10,20,20,30,40,90,80,50,30,20,50,10])==(20, 3)", "passed": true, "fail_reason": "[]"}
{"task_id": "120", "problem": "Write a python function to reverse only the vowels of a given string.", "completion": "\ndef reverse_vowels(s):\n    vowels = 'aeiouAEIOU'\n    s = list(s)\n    left, right = 0, len(s) - 1\n    while left < right:\n        if s[left] not in vowels:\n            left += 1\n        elif s[right] not in vowels:\n            right -= 1\n        else:\n            s[left], s[right] = s[right], s[left]\n            left += 1\n            right -= 1\n    return ''.join(s)\n\nassert reverse_vowels(\"Python\") == \"Python\"\nassert reverse_vowels(\"USA\") == \"ASU\"\nassert reverse_vowels(\"ab\") == \"ab\"", "passed": true, "fail_reason": "[]"}
{"task_id": "121", "problem": "Write a function to convert tuple to a string.", "completion": "\ndef tup_string(tup):\n    return ''.join(tup)\n\nassert tup_string(('e', 'x', 'e', 'r', 'c', 'i', 's', 'e', 's'))==(\"exercises\")\nassert tup_string(('p','y','t','h','o','n'))==(\"python\")\nassert tup_string(('p','r','o','g','r','a','m'))==(\"program\")", "passed": true, "fail_reason": "[]"}
{"task_id": "122", "problem": "Write a function to calculate the sum of the negative numbers of a given list of numbers using lambda function.", "completion": "\ndef sum_negativenum(numbers):\n    return sum(filter(lambda x: x < 0, numbers))\n\nassert sum_negativenum([2, 4, -6, -9, 11, -12, 14, -5, 17])==-32\nassert sum_negativenum([10,15,-14,13,-18,12,-20])==-52\nassert sum_negativenum([19, -65, 57, 39, 152,-639, 121, 44, 90, -190])==-894", "passed": true, "fail_reason": "[]"}
{"task_id": "123", "problem": "Write a python function to check whether the last element of given array is even or odd after performing an operation p times.", "completion": "\ndef check_last(arr, p, n):\n    for _ in range(p):\n        arr[-1] = arr[-1] * arr[-1]\n    return \"EVEN\" if arr[-1] % 2 == 0 else \"ODD\"\n\nassert check_last([5,7,10],3,1) == \"ODD\"\nassert check_last([2,3],2,3) == \"EVEN\"\nassert check_last([1,2,3],3,1) == \"ODD\"", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "124", "problem": "Write a function to find the nth hexagonal number.", "completion": "\ndef hexagonal_num(n):\n    return n * (2*n - 1)\n\nassert hexagonal_num(10) == 190\nassert hexagonal_num(5) == 45\nassert hexagonal_num(7) == 91", "passed": true, "fail_reason": "[]"}
{"task_id": "125", "problem": "Write a function to calculate electricity bill.", "completion": "\ndef cal_electbill(kw_usage):\n  \"\"\"\n  Calculates the electric bill for a given number of kilowatt hours (kWh) used.\n  \n  Args:\n    kw_usage: The number of kWh used.\n  \n  Returns:\n    The electric bill in dollars.\n  \"\"\"\n  rate = 0.15\n  bill = kw_usage * rate\n  return bill\n\nassert cal_electbill(75)==246.25\nassert cal_electbill(265)==1442.75\nassert cal_electbill(100)==327.5", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "126", "problem": "Write a function to find the ration of zeroes in an array of integers.", "completion": "\ndef zero_count(arr):\n    return arr.count(0) / len(arr)\n\nassert zero_count([0, 1, 2, -1, -5, 6, 0, -3, -2, 3, 4, 6, 8])==0.15\nassert zero_count([2, 1, 2, -1, -5, 6, 4, -3, -2, 3, 4, 6, 8])==0.00\nassert zero_count([2, 4, -6, -9, 11, -12, 14, -5, 17])==0.00", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "127", "problem": "Write a python function to check whether the given number can be represented as sum of non-zero powers of 2 or not.", "completion": "\ndef is_Sum_Of_Powers_Of_Two(n):\n    if n == 0:\n        return False\n    while n!= 0:\n        if (n & 1)!= 0:\n            return False\n        n = n >> 1\n    return True\n\nassert is_Sum_Of_Powers_Of_Two(10) == True\nassert is_Sum_Of_Powers_Of_Two(7) == False\nassert is_Sum_Of_Powers_Of_Two(14) == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "128", "problem": "Write a function to find the circumference of a circle.", "completion": "\ndef circle_circumference(r):\n    PI = 3.14159\n    return 2 * PI * r\nassert circle_circumference(10)==62.830000000000005\nassert circle_circumference(5)==31.415000000000003\nassert circle_circumference(4)==25.132\n\nassert circle_circumference(10)==62.830000000000005\nassert circle_circumference(5)==31.415000000000003\nassert circle_circumference(4)==25.132", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "129", "problem": "Write a function to extract elements that occur singly in the given tuple list.", "completion": "\ndef extract_singly(tuples):\n    elements = set()\n    singly_occurred = set()\n    for tup in tuples:\n        for element in tup:\n            if element in elements:\n                elements.remove(element)\n            else:\n                elements.add(element)\n                singly_occurred.add(element)\n    return list(singly_occurred)\n\nassert extract_singly([(3, 4, 5), (4, 5, 7), (1, 4)]) == [3, 4, 5, 7, 1]\nassert extract_singly([(1, 2, 3), (4, 2, 3), (7, 8)]) == [1, 2, 3, 4, 7, 8]\nassert extract_singly([(7, 8, 9), (10, 11, 12), (10, 11)]) == [7, 8, 9, 10, 11, 12]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "130", "problem": "Write a function to sort a list of elements using pancake sort.", "completion": "\ndef pancake_sort(arr):\n    n = len(arr)\n    for i in range(n, 0, -1):\n        # Find index of the maximum element in unsorted part of the array\n        max_index = arr.index(max(arr[:i]))\n        \n        # Flip the sub-array maximum element from the start\n        arr[:max_index+1] = arr[:max_index+1][::-1]\n        \n        # Flip the sub-array maximum element from the start of the whole array\n        arr[:i+1] = arr[:i+1][::-1]\n    return arr\n\nassert pancake_sort([15, 79, 25, 38, 69]) == [15, 25, 38, 69, 79]\nassert pancake_sort([98, 12, 54, 36, 85]) == [12, 36, 54, 85, 98]\nassert pancake_sort([41, 42, 32, 12, 23]) == [12, 23, 32, 41, 42]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "131", "problem": "Write a function to count the same pair in three given lists.", "completion": "\ndef count_samepair(list1, list2, list3):\n    return sum(1 for a, b, c in zip(list1, list2, list3) if a == b == c)\n\nassert 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\nassert count_samepair([1,2,3,4,5,6,7,8],[2,2,3,1,2,6,7,8],[2,1,3,1,2,6,7,8])==4\nassert count_samepair([1,2,3,4,2,6,7,8],[2,2,3,1,2,6,7,8],[2,1,3,1,2,6,7,8])==5", "passed": true, "fail_reason": "[]"}
{"task_id": "132", "problem": "Write a function to find number of lists present in the given tuple.", "completion": "\ndef find_lists(lst):\n    count = 0\n    for item in lst:\n        if isinstance(item, list):\n            count += 1\n    return count\n\nassert find_lists(([1, 2, 3, 4], [5, 6, 7, 8])) == 2\nassert find_lists(([1, 2], [3, 4], [5, 6]))  == 3\nassert find_lists(([9, 8, 7, 6, 5, 4, 3, 2, 1])) == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "133", "problem": "Write a python function to find the sum of absolute differences in all pairs of the given array.", "completion": "\ndef sum_Pairs(ints, target):\n    n = len(ints)\n    sum = 0\n    for i in range(n):\n        for j in range(i + 1, n):\n            sum += abs(ints[i] - ints[j])\n    return sum\n\nassert sum_Pairs([1,8,9,15,16],5) == 74\nassert sum_Pairs([1,2,3,4],4) == 10\nassert sum_Pairs([1,2,3,4,5,7,9,11,14],9) == 188", "passed": true, "fail_reason": "[]"}
{"task_id": "134", "problem": "Write a python function to find the maximum difference between any two elements in a given array.", "completion": "\ndef max_Abs_Diff(arr, target):\n    if len(arr) < 2:\n        return 0\n\n    min_value = arr[0]\n    max_value = arr[0]\n    max_diff = 0\n\n    for i in range(1, len(arr)):\n        if arr[i] < min_value:\n            min_value = arr[i]\n        elif arr[i] > max_value:\n            max_value = arr[i]\n\n        diff = max_value - min_value\n        if diff > max_diff:\n            max_diff = diff\n\n    return max_diff\n\nassert max_Abs_Diff((2,1,5,3),4) == 4\nassert max_Abs_Diff((9,3,2,5,1),5) == 8\nassert max_Abs_Diff((3,2,1),3) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "135", "problem": "Write a function to find the ascii value of total characters in a string.", "completion": "\ndef ascii_value_string(s):\n    \"\"\"\n    Returns the sum of the ASCII values of all characters in a string.\n    \"\"\"\n    total = 0\n    for char in s:\n        total += ord(char)\n    return total\n\nassert ascii_value_string(\"python\")==112\nassert ascii_value_string(\"Program\")==80\nassert ascii_value_string(\"Language\")==76\n\nassert ascii_value_string(\"python\")==112\nassert ascii_value_string(\"Program\")==80\nassert ascii_value_string(\"Language\")==76", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "136", "problem": "Write a function to find the maximum total path sum in the given triangle.", "completion": "\ndef max_path_sum(triangle, n, m):\n    for i in range(n - 2, -1, -1):\n        for j in range(i + 1):\n            triangle[i][j] += max(triangle[i + 1][j], triangle[i + 1][j + 1])\n    return triangle[0][0]\n\nassert max_path_sum([[1, 0, 0], [4, 8, 0], [1, 5, 3]], 2, 2) == 14\nassert max_path_sum([[13, 0, 0], [7, 4, 0], [2, 4, 6]], 2, 2) == 24 \nassert max_path_sum([[2, 0, 0], [11, 18, 0], [21, 25, 33]], 2, 2) == 53", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "137", "problem": "Write a function to divide a number into two parts such that the sum of digits is maximum.", "completion": "\ndef sum_digits_twoparts(n):\n    max_sum = 0\n    for i in range(1, n+1):\n        if n >= i:\n            sum1 = sum(int(digit) for digit in str(i))\n            sum2 = sum(int(digit) for digit in str(n-i))\n            max_sum = max(max_sum, sum1 + sum2)\n    return max_sum\n\nassert sum_digits_twoparts(35)==17\nassert sum_digits_twoparts(7)==7\nassert sum_digits_twoparts(100)==19", "passed": true, "fail_reason": "[]"}
{"task_id": "138", "problem": "Write a function to find the longest subsequence such that the difference between adjacents is one for the given array.", "completion": "\ndef longest_subseq_with_diff_one(arr, n):\n    \"\"\"\n    Find the length of the longest subarray where the difference between adjacent elements is 1.\n    \n    Args:\n        arr (list): List of integers.\n        n (int): The target length of the subarray.\n    \n    Returns:\n        int: Length of the longest subarray.\n    \"\"\"\n    cur_length = 1\n    max_length = 1\n    for i in range(1, len(arr)):\n        if arr[i] - arr[i-1] == 1:\n            cur_length += 1\n        else:\n            if cur_length > max_length:\n                max_length = cur_length\n            cur_length = 1\n    if cur_length > max_length:\n        max_length = cur_length\n    return max_length\nassert longest_subseq_with_diff_one([1, 2, 3, 4, 5, 3, 2], 7) == 6\nassert longest_subseq_with_diff_one([10, 9, 4, 5, 4, 8, 6], 7) == 3\nassert longest_subseq_with_diff_one([1, 2, 3, 2, 3, 7, 2, 1], 8) == 7\n\nassert longest_subseq_with_diff_one([1, 2, 3, 4, 5, 3, 2], 7) == 6\nassert longest_subseq_with_diff_one([10, 9, 4, 5, 4, 8, 6], 7) == 3\nassert longest_subseq_with_diff_one([1, 2, 3, 2, 3, 7, 2, 1], 8) == 7", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "139", "problem": "Write a python function to find whether the given number is present in the infinite sequence or not.", "completion": "\ndef does_Contain_B(a, b, n):\n    if a > b:\n        return False\n    elif a == b:\n        return True\n    else:\n        for i in range(1, n):\n            a = a * 2\n            if a == b:\n                return True\n        return False\n\nassert does_Contain_B(1,7,3) == True\nassert does_Contain_B(1,-3,5) == False\nassert does_Contain_B(3,2,5) == False", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "140", "problem": "Write a python function to check whether the given number is co-prime or not.", "completion": "\ndef euclidean_algorithm(a, b):\n    while b!= 0:\n        a, b = b, a % b\n    return a\n\ndef is_coprime(a, b):\n    \"\"\"\n    Check if two numbers are coprimes\n    \"\"\"\n    # Calculate the gcd of given numbers \n    gcd = euclidean_algorithm(a, b) \n      \n    # return true if gcd is 1 \n    return gcd == 1\n\nassert is_coprime(17,13) == True\nassert is_coprime(15,21) == False\nassert is_coprime(25,45) == False\n\nassert is_coprime(17,13) == True\nassert is_coprime(15,21) == False\nassert is_coprime(25,45) == False", "passed": false, "fail_reason": "[NameError(\"name 'euclidean_algorithm' is not defined\")]"}
{"task_id": "141", "problem": "Write a function to sort the given array by using merge sort.", "completion": "\ndef merge_sort(arr):\n    if len(arr) <= 1:\n        return arr\n    mid = len(arr) // 2\n    left_half = merge_sort(arr[:mid])\n    right_half = merge_sort(arr[mid:])\n    return merge(left_half, right_half)\n\ndef merge(left, right):\n    merged = []\n    left_index = 0\n    right_index = 0\n    while left_index < len(left) and right_index < len(right):\n        if left[left_index] <= right[right_index]:\n            merged.append(left[left_index])\n            left_index += 1\n        else:\n            merged.append(right[right_index])\n            right_index += 1\n    merged += left[left_index:]\n    merged += right[right_index:]\n    return merged\n\nassert merge_sort([3, 4, 2, 6, 5, 7, 1, 9]) == [1, 2, 3, 4, 5, 6, 7, 9]\nassert merge_sort([7, 25, 45, 78, 11, 33, 19]) == [7, 11, 19, 25, 33, 45, 78]\nassert merge_sort([3, 1, 4, 9, 8]) == [1, 3, 4, 8, 9]", "passed": false, "fail_reason": "[NameError(\"name 'merge_sort' is not defined\")]"}
{"task_id": "142", "problem": "Write a function to find the vertex of a parabola.", "completion": "\ndef parabola_vertex(a, b, c):\n    if a == 0:\n        return \"Error: a cannot be zero\"\n    x = -b / (2 * a)\n    y = a * x**2 + b * x + c\n    return (x, y)\n\nassert parabola_vertex(5,3,2)==(-0.3, 1.55)\nassert parabola_vertex(9,8,4)==(-0.4444444444444444, 2.2222222222222223)\nassert parabola_vertex(2,4,6)==(-1.0, 4.0)", "passed": true, "fail_reason": "[]"}
{"task_id": "143", "problem": "Write a function to extract every specified element from a given two dimensional list.", "completion": "\ndef specified_element(lst, col):\n    return [row[col] for row in lst]\n\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],0)==[1, 4, 7]\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],2)==[3, 6, 9]\nassert specified_element([[1, 2, 3, 2], [4, 5, 6, 2], [7, 1, 9, 5]],3)==[2,2,5]", "passed": true, "fail_reason": "[]"}
{"task_id": "144", "problem": "Write a python function to toggle all even bits of a given number.", "completion": "\ndef even_bit_toggle_number(n):\n    return n ^ (n & -n)\n\nassert even_bit_toggle_number(10) == 0\nassert even_bit_toggle_number(20) == 30\nassert even_bit_toggle_number(30) == 20", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "145", "problem": "Write a function to convert a tuple of string values to a tuple of integer values.", "completion": "\ndef tuple_int_str(tup):\n    return tuple(int(x) for x in tup)\n\nassert tuple_int_str((('333', '33'), ('1416', '55')))==((333, 33), (1416, 55))\nassert tuple_int_str((('999', '99'), ('1000', '500')))==((999, 99), (1000, 500))\nassert tuple_int_str((('666', '66'), ('1500', '555')))==((666, 66), (1500, 555))", "passed": false, "fail_reason": "[TypeError(\"int() argument must be a string, a bytes-like object or a real number, not 'tuple'\")]"}
{"task_id": "146", "problem": "Write a function to reflect the run-length encoding from a list.", "completion": "\ndef encode_list(input_list):\n    encoded_list = []\n    count = 1\n    for i in range(1, len(input_list)):\n        if input_list[i] == input_list[i-1]:\n            count += 1\n        else:\n            encoded_list.append([count, input_list[i-1]])\n            count = 1\n    encoded_list.append([count, input_list[-1]])\n    return encoded_list\n\nassert encode_list([1,1,2,3,4,4.3,5,1])==[[2, 1], [1, 2], [1, 3], [1, 4], [1, 4.3], [1, 5], [1, 1]]\nassert encode_list('automatically')==[[1, 'a'], [1, 'u'], [1, 't'], [1, 'o'], [1, 'm'], [1, 'a'], [1, 't'], [1, 'i'], [1, 'c'], [1, 'a'], [2, 'l'], [1, 'y']]\nassert encode_list('python')==[[1, 'p'], [1, 'y'], [1, 't'], [1, 'h'], [1, 'o'], [1, 'n']]", "passed": true, "fail_reason": "[]"}
{"task_id": "147", "problem": "Write a python function to find k number of operations required to make all elements equal.", "completion": "\ndef min_Ops(arr, target, k):\n    if len(set(arr)) < k:\n        return -1\n    ops = 0\n    for num in arr:\n        ops += (num - target) ** 2\n    return ops // k\n\nassert min_Ops([2,2,2,2],4,3) == 0\nassert min_Ops([4,2,6,8],4,3) == -1\nassert min_Ops([21,33,9,45,63],5,6) == 24", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "148", "problem": "Write a function to print the season for the given month and day.", "completion": "\ndef month_season(month, day):\n    month_to_season = {\n        'January': 'winter',\n        'February': 'winter',\n        'March':'spring',\n        'April':'spring',\n        'May':'spring',\n        'June':'summer',\n        'July':'summer',\n        'August':'summer',\n        'September': 'autumn',\n        'October': 'autumn',\n        'November': 'autumn',\n        'December': 'winter'\n    }\n    return month_to_season[month]\n\nassert month_season('January',4)==('winter')\nassert month_season('October',28)==('autumn')\nassert month_season('June',6)==('spring')", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "149", "problem": "Write a function to find x and y that satisfies ax + by = n.", "completion": "\ndef solution(a, b, n):\n    def extended_gcd(a, b):\n        if a == 0:\n            return b, 0, 1\n        else:\n            gcd, x, y = extended_gcd(b % a, a)\n            return gcd, y - (b // a) * x, x\n\n    gcd, x, y = extended_gcd(a, b)\n    if n % gcd!= 0:\n        return 'No solution'\n    else:\n        x *= n // gcd\n        y *= n // gcd\n        return ('x = ', x, ', y = ', y)\n\nassert solution(2, 3, 7) == ('x = ', 2, ', y = ', 1)\nassert solution(4, 2, 7) == 'No solution'\nassert solution(1, 13, 17) == ('x = ', 4, ', y = ', 1)", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "150", "problem": "Write a function to remove all elements from a given list present in another list.", "completion": "\ndef remove_elements(list1, list2):\n    for item in list2:\n        while item in list1:\n            list1.remove(item)\n    return list1\n\nassert remove_elements([1,2,3,4,5,6,7,8,9,10],[2,4,6,8])==[1, 3, 5, 7, 9, 10]\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 3, 5, 7])==[2, 4, 6, 8, 9, 10]\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[5,7])==[1, 2, 3, 4, 6, 8, 9, 10]\n\nassert remove_elements([1,2,3,4,5,6,7,8,9,10],[2,4,6,8])==[1, 3, 5, 7, 9, 10]\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[1, 3, 5, 7])==[2, 4, 6, 8, 9, 10]\nassert remove_elements([1, 2, 3, 4, 5, 6, 7, 8, 9, 10],[5,7])==[1, 2, 3, 4, 6, 8, 9, 10]", "passed": true, "fail_reason": "[]"}
{"task_id": "151", "problem": "Write a function to calculate the sum of the positive integers of n+(n-2)+(n-4)... (until n-x =< 0).", "completion": "\ndef sum_series(n):\n    total = 0\n    i = n\n    while i >= 0:\n        total += i\n        i -= 2\n    return total\n\nassert sum_series(6)==12\nassert sum_series(10)==30\nassert sum_series(9)==25", "passed": true, "fail_reason": "[]"}
{"task_id": "152", "problem": "Write a function to calculate the area of a regular polygon.", "completion": "\nimport math\n\ndef area_polygon(n, s):\n    \"\"\"\n    Return the area of a regular polygon.\n    \"\"\"\n    return (n * s ** 2) / (4 * math.tan(math.pi / n))\nassert area_polygon(4,20)==400.00000000000006\nassert area_polygon(10,15)==1731.1969896610804\nassert area_polygon(9,7)==302.90938549487214\n\nassert area_polygon(4,20)==400.00000000000006\nassert area_polygon(10,15)==1731.1969896610804\nassert area_polygon(9,7)==302.90938549487214", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "153", "problem": "Write a python function to check whether the sum of divisors are same or not.", "completion": "\ndef areEquivalent(a, b):\n    def sum_of_divisors(n):\n        return sum(i for i in range(1, n + 1) if n % i == 0)\n\n    return sum_of_divisors(a) == sum_of_divisors(b)\n\nassert areEquivalent(36,57) == False\nassert areEquivalent(2,4) == False\nassert areEquivalent(23,47) == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "154", "problem": "Write a python function to count characters at same position in a given string (lower and uppercase characters) as in english alphabet.", "completion": "\ndef count_char_position(s):\n    s = s.lower()\n    return sum(1 for i in range(26) if chr(97 + i) in s)\n\nassert count_char_position(\"xbcefg\") == 2\nassert count_char_position(\"ABcED\") == 3\nassert count_char_position(\"AbgdeF\") == 5", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "155", "problem": "Write a python function to count the pairs with xor as an even number.", "completion": "\ndef find_even_Pair(arr, n):\n    count = 0\n    for i in range(n):\n        for j in range(i+1, n):\n            if (arr[i] ^ arr[j]) % 2 == 0:\n                count += 1\n    return count\n\nassert find_even_Pair([5,4,7,2,1],5) == 4\nassert find_even_Pair([7,2,8,1,0,5,11],7) == 9\nassert find_even_Pair([1,2,3],3) == 1", "passed": true, "fail_reason": "[]"}
{"task_id": "156", "problem": "Write a python function to find smallest power of 2 greater than or equal to n.", "completion": "\ndef next_Power_Of_2(n):\n    result = 1\n    base = 2\n\n    while n > 0:\n        if n % 2 == 1:\n            result *= base\n        base *= base\n        n //= 2\n\n    return result\nassert next_Power_Of_2(0) == 1\nassert next_Power_Of_2(5) == 8\nassert next_Power_Of_2(17) == 32\n\nassert next_Power_Of_2(0) == 1\nassert next_Power_Of_2(5) == 8\nassert next_Power_Of_2(17) == 32", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "157", "problem": "Write a python function to find the frequency of a number in a given array.", "completion": "\ndef frequency(arr, num):\n    \"\"\"\n    Return the frequency of num in the given array.\n    \"\"\"\n    return arr.count(num)\n    \nassert frequency([1,2,3],4) == 0\nassert frequency([1,2,2,3,3,3,4],3) == 3\nassert frequency([0,1,2,3,1,2],1) == 2\n\nassert frequency([1,2,3],4) == 0\nassert frequency([1,2,2,3,3,3,4],3) == 3\nassert frequency([0,1,2,3,1,2],1) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "158", "problem": "Write a function to calculate the nth pell number.", "completion": "\ndef get_pell(n):\n    \"\"\"\n    Return the nth term of the Pell sequence.\n    \"\"\"\n    # create a dictionary to store computed values\n    pell_dict = {0: 0, 1: 1}\n    # check if the value is already computed\n    if n not in pell_dict:\n        # calculate the nth term of the sequence\n        pell_dict[n] = 2 * get_pell(n-1) + get_pell(n-2)\n    return pell_dict[n]\n\nassert get_pell(4) == 12\nassert get_pell(7) == 169\nassert get_pell(8) == 408\n\nassert get_pell(4) == 12\nassert get_pell(7) == 169\nassert get_pell(8) == 408", "passed": false, "fail_reason": "[NameError(\"name 'get_pell' is not defined\")]"}
{"task_id": "159", "problem": "Write a function to find sum of the numbers in a list between the indices of a specified range.", "completion": "\nassert sum_range_list( [2,1,5,6,8,3,4,9,10,11,8,12],8,10)==29\nassert sum_range_list( [2,1,5,6,8,3,4,9,10,11,8,12],5,7)==16\nassert sum_range_list( [2,1,5,6,8,3,4,9,10,11,8,12],7,10)==38", "passed": false, "fail_reason": "[NameError(\"name 'sum_range_list' is not defined\")]"}
{"task_id": "160", "problem": "Write a function to find the perimeter of a pentagon.", "completion": "\ndef perimeter_pentagon(n):\n    return n * 5\n\nassert perimeter_pentagon(5)==25\nassert perimeter_pentagon(10)==50\nassert perimeter_pentagon(15)==75", "passed": true, "fail_reason": "[]"}
{"task_id": "161", "problem": "Write a function to find the occurence of characters 'std' in the given string 1. list item 1. list item 1. list item 2. list item 2. list item 2. list item", "completion": "\ndef count_occurance(s):\n    return s.count('std')\n\nassert count_occurance(\"letstdlenstdporstd\") == 3\nassert count_occurance(\"truststdsolensporsd\") == 1\nassert count_occurance(\"makestdsostdworthit\") == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "162", "problem": "Write a function to remove everything except alphanumeric characters from a string.", "completion": "\ndef remove_splchar(s):\n    return ''.join([i for i in s if i.isalnum()])\n\nassert remove_splchar('python  @#&^%$*program123')==('pythonprogram123')\nassert remove_splchar('python %^$@!^&*()  programming24%$^^()    language')==('pythonprogramming24language')\nassert remove_splchar('python   ^%&^()(+_)(_^&67)                  program')==('python67program')", "passed": true, "fail_reason": "[]"}
{"task_id": "163", "problem": "Write a function to group a sequence of key-value pairs into a dictionary of lists.", "completion": "\ndef group_keyvalue(pairs):\n    result = {}\n    for key, value in pairs:\n        if key in result:\n            result[key].append(value)\n        else:\n            result[key] = [value]\n    return result\n\nassert group_keyvalue([('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)])=={'yellow': [1, 3], 'blue': [2, 4], 'red': [1]}\nassert group_keyvalue([('python', 1), ('python', 2), ('python', 3), ('python', 4), ('python', 5)])=={'python': [1,2,3,4,5]}\nassert group_keyvalue([('yellow',100), ('blue', 200), ('yellow', 300), ('blue', 400), ('red', 100)])=={'yellow': [100, 300], 'blue': [200, 400], 'red': [100]}", "passed": true, "fail_reason": "[]"}
{"task_id": "164", "problem": "Write a function to verify validity of a string of parentheses.", "completion": "\ndef is_valid_parenthese(s):\n    stack = []\n    bracket_map = {\")\": \"(\", \"}\": \"{\", \"]\": \"[\"}\n    for char in s:\n        if char in bracket_map.values():\n            stack.append(char)\n        elif char in bracket_map.keys():\n            if not stack or stack.pop()!= bracket_map[char]:\n                return False\n    return not stack\n\nassert is_valid_parenthese(\"(){}[]\")==True\nassert is_valid_parenthese(\"()[{)}\")==False\nassert is_valid_parenthese(\"()\")==True", "passed": true, "fail_reason": "[]"}
{"task_id": "165", "problem": "Write a function to find the perimeter of a triangle.", "completion": "\ndef perimeter_triangle(side1, side2, side3):\n    \"\"\"\n    Calculate the perimeter of a triangle.\n    \n    Parameters:\n    side1 (float): Length of the first side.\n    side2 (float): Length of the second side.\n    side3 (float): Length of the third side.\n    \n    Returns:\n    float: The perimeter of the triangle.\n    \"\"\"\n    # Check if the input sides can form a valid triangle\n    if side1 + side2 <= side3 or side2 + side3 <= side1 or side1 + side3 <= side2:\n        raise ValueError(\"The input sides cannot form a valid triangle.\")\n    \n    # Calculate the perimeter of the triangle\n    perimeter = side1 + side2 + side3\n    return perimeter\n\nassert perimeter_triangle(10,20,30)==60\nassert perimeter_triangle(3,4,5)==12\nassert perimeter_triangle(25,35,45)==105", "passed": false, "fail_reason": "[ValueError('The input sides cannot form a valid triangle.')]"}
{"task_id": "166", "problem": "Write a python function to find two distinct numbers such that their lcm lies within the given range.", "completion": "\ndef answer(a, b):\n    def gcd(a, b):\n        while b:\n            a, b = b, a % b\n        return a\n\n    def lcm(a, b):\n        return a * b // gcd(a, b)\n\n    for i in range(a, b + 1):\n        for j in range(i + 1, b + 1):\n            if lcm(i, j) <= b and lcm(i, j) >= a:\n                return (i, j)\n    return None\n\nassert answer(3,8) == (3,6)\nassert answer(2,6) == (2,4)\nassert answer(1,3) == (1,2)", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "167", "problem": "Write a function to search some literals strings in a string.", "completion": "\ndef string_literals(literals, string):\n    for literal in literals:\n        if literal in string:\n            return 'Matched!'\n    return 'Not Matched!'\n\nassert string_literals(['language'],'python language')==('Matched!')\nassert string_literals(['program'],'python language')==('Not Matched!')\nassert string_literals(['python'],'programming language')==('Not Matched!')", "passed": true, "fail_reason": "[]"}
{"task_id": "168", "problem": "Write a function to find if the given number is a keith number or not.", "completion": "\ndef is_num_keith(n):\n    def is_prime(x):\n        if x < 2:\n            return False\n        for i in range(2, int(x**0.5) + 1):\n            if x % i == 0:\n                return False\n        return True\n\n    def sum_of_digits(n):\n        return sum(int(digit) for digit in str(n))\n\n    i = 1\n    while True:\n        if is_prime(i) and sum_of_digits(i) == n:\n            return True\n        elif i > n:\n            return False\n        i += 1\n\nassert is_num_keith(14) == True\nassert is_num_keith(12) == False\nassert is_num_keith(197) == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "169", "problem": "Write a function to calculate distance between two points using latitude and longitude.", "completion": "\nimport math\n\ndef distance_lat_long(lat1, long1, lat2, long2):\n    # Radius of the earth in km\n    R = 6373.0\n\n    lat1 = math.radians(lat1)\n    long1 = math.radians(long1)\n    lat2 = math.radians(lat2)\n    long2 = math.radians(long2)\n\n    dlat = lat2 - lat1\n    dlong = long2 - long1\n\n    a = math.sin(dlat / 2)**2 + math.cos(lat1) * math.cos(lat2) * math.sin(dlong / 2)**2\n    c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))\n\n    return R * c\n\nassert distance_lat_long(23.5,67.5,25.5,69.5)==12179.372041317429\nassert distance_lat_long(10.5,20.5,30.5,40.5)==6069.397933300514\nassert distance_lat_long(10,20,30,40)==6783.751974994595", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "170", "problem": "Write a function to find the longest common prefix in the given set of strings.", "completion": "\ndef common_prefix(strings, length):\n    if not strings:\n        return \"\"\n    min_length = min(len(string) for string in strings)\n    for i in range(min_length):\n        if any(string[i]!= strings[0][i] for string in strings):\n            return strings[0][:i]\n    return strings[0][:min_length]\nassert common_prefix([\"tablets\", \"tables\", \"taxi\", \"tamarind\"], 4) == 'ta'\nassert common_prefix([\"apples\", \"ape\", \"april\"], 3) == 'ap'\nassert common_prefix([\"teens\", \"teenager\", \"teenmar\"], 3) == 'teen'\n\nassert common_prefix([\"tablets\", \"tables\", \"taxi\", \"tamarind\"], 4) == 'ta'\nassert common_prefix([\"apples\", \"ape\", \"april\"], 3) == 'ap'\nassert common_prefix([\"teens\", \"teenager\", \"teenmar\"], 3) == 'teen'", "passed": true, "fail_reason": "[]"}
{"task_id": "171", "problem": "Write a function to find uppercase, lowercase, special character and numeric values using regex.", "completion": "\ndef find_character(s):\n    import re\n    uppercase = re.findall(r'[A-Z]', s)\n    lowercase = re.findall(r'[a-z]', s)\n    special = re.findall(r'[^A-Za-z0-9]', s)\n    numeric = re.findall(r'[0-9]', s)\n    return uppercase, lowercase, special, numeric\n\nassert find_character(\"ThisIsGeeksforGeeks\") == (['T', 'I', 'G', 'G'], ['h', 'i', 's', 's', 'e', 'e', 'k', 's', 'f', 'o', 'r', 'e', 'e', 'k', 's'], [], [])\nassert find_character(\"Hithere2\") == (['H'], ['i', 't', 'h', 'e', 'r', 'e'], ['2'], [])\nassert find_character(\"HeyFolks32\") == (['H', 'F'], ['e', 'y', 'o', 'l', 'k', 's'], ['3', '2'], [])", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "172", "problem": "Write a function to count all the distinct pairs having a difference of k in any array.", "completion": "\ndef count_pairs(nums, k, window_size):\n    count = 0\n    freq_map = {}\n    for i in range(len(nums)):\n        for j in range(i + 1, min(i + window_size, len(nums))):\n            if abs(nums[j] - nums[i]) == k:\n                count += 1\n    return count\n\nassert count_pairs([1, 5, 3, 4, 2], 5, 3) == 2\nassert count_pairs([8, 12, 16, 4, 0, 20], 6, 4) == 5\nassert count_pairs([2, 4, 1, 3, 4], 5, 2) == 3", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "173", "problem": "Write a function to find all the values in a list that are greater than a specified number.", "completion": "\ndef greater_specificnum(arr, x):\n  return any(num > x for num in arr)\n\nassert greater_specificnum([220, 330, 500],200)==True\nassert greater_specificnum([12, 17, 21],20)==False\nassert greater_specificnum([1,2,3,4],10)==False", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "174", "problem": "Write a function to find the focus of a parabola.", "completion": "\ndef parabola_focus(a, b, c):\n    if a == 0:\n        return \"Not a parabola\"\n    focus_x = -b / (2 * a)\n    focus_y = c - (1 / (4 * a))\n    return (focus_x, focus_y)\n\nassert parabola_focus(5,3,2)==(-0.3, 1.6)\nassert parabola_focus(9,8,4)==(-0.4444444444444444, 2.25)\nassert parabola_focus(2,4,6)==(-1.0, 4.125)", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "175", "problem": "Write a function to search some literals strings in a string by using regex.", "completion": "\nimport re\n\ndef check_literals(string, literals):\n    for literal in literals:\n        if re.search(literal, string):\n            return 'Matched!'\n    return 'Not Matched!'\n\nassert check_literals('The quick brown fox jumps over the lazy dog.',['fox']) == 'Matched!'\nassert check_literals('The quick brown fox jumps over the lazy dog.',['horse']) == 'Not Matched!'\nassert check_literals('The quick brown fox jumps over the lazy dog.',['lazy']) == 'Matched!'", "passed": true, "fail_reason": "[]"}
{"task_id": "176", "problem": "Write a function to find the longest common subsequence for the given two sequences.", "completion": "\ndef longest_common_subsequence(str1, str2, m, n):\n    \"\"\"\n    Find the length of longest common subsequence (LCS) of two given sequences.\n    str1, str2: input strings\n    m, n: lengths of input strings\n    return: length of LCS\n    \"\"\"\n    C = [[0] * (n + 1) for i in range(m + 1)]\n\n    for i in range(1, m + 1):\n        for j in range(1, n + 1):\n            if str1[i-1] == str2[j-1]:\n                C[i][j] = C[i-1][j-1] + 1\n            else:\n                C[i][j] = max(C[i-1][j], C[i][j-1])\n    return C[m][n]\nassert longest_common_subsequence(\"AGGTAB\", \"GXTXAYB\", 6, 7) == 4\nassert longest_common_subsequence(\"ABCDGH\", \"AEDFHR\", 6, 6) == 3\nassert longest_common_subsequence(\"AXYT\", \"AYZX\", 4, 4) == 2\n\nassert longest_common_subsequence(\"AGGTAB\" , \"GXTXAYB\", 6, 7) == 4\nassert longest_common_subsequence(\"ABCDGH\" , \"AEDFHR\", 6, 6) == 3\nassert longest_common_subsequence(\"AXYT\" , \"AYZX\", 4, 4) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "177", "problem": "Write a python function to check whether the given number can be represented by product of two squares or not.", "completion": "\ndef prod_Square(n):\n    for i in range(1, int(n**0.5) + 1):\n        if n % i == 0:\n            if i % 2 == 0 and n // i % 2 == 0:\n                return True\n            elif i % 2 == 0:\n                return True\n            elif n // i % 2 == 0:\n                return True\n    return False\n\nassert prod_Square(25) == False\nassert prod_Square(30) == False\nassert prod_Square(16) == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "178", "problem": "Write a python function to find the first missing positive number.", "completion": "\ndef first_Missing_Positive(arr, n):\n    arr = [x for x in arr if x > 0]\n    arr.sort()\n    for i in range(len(arr) - 1):\n        if arr[i + 1] - arr[i] > 1:\n            return arr[i] + 1\n    return arr[-1] + 1 if arr else 1\nassert first_Missing_Positive([1,2,3,-1,5],5) == 4\nassert first_Missing_Positive([0,-1,-2,1,5,8],6) == 2\nassert first_Missing_Positive([0,1,2,5,-8],5) == 3\n\nassert first_Missing_Positive([1,2,3,-1,5],5) == 4\nassert first_Missing_Positive([0,-1,-2,1,5,8],6) == 2\nassert first_Missing_Positive([0,1,2,5,-8],5) == 3", "passed": true, "fail_reason": "[]"}
{"task_id": "179", "problem": "Write a python function to count the number of integral co-ordinates that lie inside a square.", "completion": "\ndef count_Intgral_Points(x1, y1, x2, y2):\n    return (x2 - x1) * (y2 - y1)\n\nassert count_Intgral_Points(1,1,4,4) == 4\nassert count_Intgral_Points(1,2,1,2) == 1\nassert count_Intgral_Points(4,2,6,4) == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "180", "problem": "Write a function to check whether the given month name contains 30 days or not.", "completion": "\ndef check_monthnumber(month):\n    months_with_30_days = [\"April\", \"June\", \"September\", \"November\"]\n    return month in months_with_30_days\n\nassert check_monthnumber(\"February\")==False\nassert check_monthnumber(\"June\")==True\nassert check_monthnumber(\"April\")==True", "passed": true, "fail_reason": "[]"}
{"task_id": "181", "problem": "Write a python function to check whether a string has atleast one letter and one number.", "completion": "\ndef check_String(s):\n    has_letter = False\n    has_digit = False\n    for char in s:\n        if char.isalpha():\n            has_letter = True\n        elif char.isdigit():\n            has_digit = True\n        if has_letter and has_digit:\n            return True\n    return False\n\nassert check_String('thishasboth29') == True\nassert check_String('python') == False\nassert check_String ('string') == False", "passed": true, "fail_reason": "[]"}
{"task_id": "182", "problem": "Write a function to remove the duplicates from the given tuple.", "completion": "\ndef remove_tuple(tup):\n    return tuple(set(tup))\n\nassert remove_tuple((1, 3, 5, 2, 3, 5, 1, 1, 3)) == (1, 2, 3, 5)\nassert remove_tuple((2, 3, 4, 4, 5, 6, 6, 7, 8, 8)) == (2, 3, 4, 5, 6, 7, 8)\nassert remove_tuple((11, 12, 13, 11, 11, 12, 14, 13)) == (11, 12, 13, 14)", "passed": true, "fail_reason": "[]"}
{"task_id": "183", "problem": "Write a python function to convert octal number to decimal number.", "completion": "\ndef octal_To_Decimal(num):\n    \"\"\"\n    This function converts an octal number to decimal\n    \"\"\"\n    oct_num = int(str(num), 8)\n    return oct_num\n\nassert octal_To_Decimal(25) == 21\nassert octal_To_Decimal(30) == 24\nassert octal_To_Decimal(40) == 32\n\nassert octal_To_Decimal(25) == 21\nassert octal_To_Decimal(30) == 24\nassert octal_To_Decimal(40) == 32", "passed": true, "fail_reason": "[]"}
{"task_id": "184", "problem": "Write a python function to find the first position of an element in a sorted array.", "completion": "\ndef first(arr, val, n):\n    for i in range(n):\n        if arr[i] == val:\n            return i\n    return -1\n\nassert first([1,2,3,4,5,6,6],6,6) == 5\nassert first([1,2,2,2,3,2,2,4,2],2,9) == 1\nassert first([1,2,3],1,3) == 0", "passed": true, "fail_reason": "[]"}
{"task_id": "185", "problem": "Write a function to remove all the tuples with length k.", "completion": "\nassert remove_tuples([(4, 5), (4, ), (8, 6, 7), (1, ), (3, 4, 6, 7)] , 1) == [(4, 5), (8, 6, 7), (3, 4, 6, 7)]\nassert remove_tuples([(4, 5), (4,5), (6, 7), (1, 2, 3), (3, 4, 6, 7)] ,2) == [(1, 2, 3), (3, 4, 6, 7)]\nassert remove_tuples([(1, 4, 4), (4, 3), (8, 6, 7), (1, ), (3, 6, 7)] , 3) == [(4, 3), (1,)]", "passed": false, "fail_reason": "[NameError(\"name 'remove_tuples' is not defined\")]"}
{"task_id": "186", "problem": "Write a function to perform the exponentiation of the given two tuples.", "completion": "\ndef find_exponentio(tuple1, tuple2):\n    return tuple(a ** b for a, b in zip(tuple1, tuple2))\n\nassert find_exponentio((10, 4, 5, 6), (5, 6, 7, 5)) == (100000, 4096, 78125, 7776)\nassert find_exponentio((11, 5, 6, 7), (6, 7, 8, 6)) == (1771561, 78125, 1679616, 117649)\nassert find_exponentio((12, 6, 7, 8), (7, 8, 9, 7)) == (35831808, 1679616, 40353607, 2097152)", "passed": true, "fail_reason": "[]"}
{"task_id": "187", "problem": "Write a function to find the largest triangle that can be inscribed in an ellipse.", "completion": "\ndef largest_triangle(radius, h=0, k=0, a=None, b=None):\n    if (not isinstance(radius, (int, float))) or (radius <= 0):\n        return \"Error: Radius must be a positive number.\"\n    if (not isinstance(h, (int, float))) or (not isinstance(k, (int, float))):\n        return \"Error: Center coordinates must be numbers.\"\n    if a is not None and b is not None:\n        if (not isinstance(a, (int, float))) or (not isinstance(b, (int, float))):\n            return \"Error: Major and minor axes must be numbers.\"\n        if a <= 0 or b <= 0:\n            return \"Error: Lengths of axes must be positive numbers.\"\n        # For ellipse, triangle is a right isosceles triangle with hypotenuse as major axis\n        # Area of triangle = 1/2 * base * height\n        # Base and height will be equal in this case (b=b/(2^0.5) because it's side of major axis's isosceles traingle)\n        area = 0.5 * a * a * b/(2**0.5) * b/(2**0.5);\n        vertices = [(h,h), (k-a/(2**0.5), k-b/(2**0.5)), (k+a/(2**0.5), k+b/(2**0.5))]\n    else:\n        # For circle, triangle is a right isosceles triangle with hypotenuse as diameter\n        # Area of triangle = 1/2 * base * height\n        area = 0.5 * radius * radius\n        vertices = [(h-radius, k), (h+radius, k), (h, k+radius)]\n    return area\nassert largest_triangle(4,2)==10.392304845413264\nassert largest_triangle(5,7)==4.639421805988064\nassert largest_triangle(9,1)==105.2220865598093\n\nassert largest_triangle(4,2)==10.392304845413264\nassert largest_triangle(5,7)==4.639421805988064\nassert largest_triangle(9,1)==105.2220865598093", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "188", "problem": "Write a python function to find highest power of 2 less than or equal to given number.", "completion": "\ndef highest_Power_of_2(n):\n    \"\"\"\n    This function finds the highest power of 2 less than or equal to the given number.\n    \n    Parameters:\n    n (int): The given number.\n    \n    Returns:\n    int: The highest power of 2 less than or equal to the given number.\n    \"\"\"\n    p = 0\n    while ((1 << (p + 1)) <= n): p += 1\n    return 1 << p - 1\n\nassert highest_Power_of_2(10) == 8\nassert highest_Power_of_2(19) == 16\nassert highest_Power_of_2(32) == 32", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "189", "problem": "Write a function to find all index positions of the maximum values in a given list.", "completion": "\nassert position_max([12,33,23,10,67,89,45,667,23,12,11,10,54])==[7]\nassert position_max([1,2,2,2,4,4,4,5,5,5,5])==[7,8,9,10]\nassert position_max([2,1,5,6,8,3,4,9,10,11,8,12])==[11]", "passed": false, "fail_reason": "[NameError(\"name 'position_max' is not defined\")]"}
{"task_id": "190", "problem": "Write a python function to check whether the elements in a list are same or not.", "completion": "\ndef chkList(lst):\n  for i in range(len(lst)):\n    for j in range(i + 1, len(lst)):\n      if lst[i]!= lst[j]:\n        return False\n  return True\n\nassert chkList(['one','one','one']) == True\nassert chkList(['one','Two','Three']) == False\nassert chkList(['bigdata','python','Django']) == False", "passed": true, "fail_reason": "[]"}
{"task_id": "191", "problem": "Write a function to remove even characters in a string.", "completion": "\ndef remove_even(string):\n    \"\"\"\n    Remove all even occuring characters from a string\n    \"\"\"\n    result = \"\"\n    count = {}\n\n    for char in string:\n        if char in count:\n            count[char] += 1\n        else:\n            count[char] = 1\n\n    for ch, val in count.items():\n        if val % 2!= 0:\n            result += ch\n    return result\nassert remove_even(\"python\")==(\"pto\")\nassert remove_even(\"program\")==(\"porm\")\nassert remove_even(\"language\")==(\"lnug\")\n\nassert remove_even(\"python\")==(\"pto\")\nassert remove_even(\"program\")==(\"porm\")\nassert remove_even(\"language\")==(\"lnug\")", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "192", "problem": "Write a python function to find the hamming distance between given two integers.", "completion": "\ndef hamming_Distance(x, y):\n    xor = x ^ y  # XOR operation\n    count = 0\n    while xor:   # loop until xor equals zero\n        count += xor & 1  # count the last bit if it is 1\n        xor >>= 1  # right shift by 1 bit\n    return count\nassert hamming_Distance(4,8) == 2\nassert hamming_Distance(2,4) == 2\nassert hamming_Distance(1,2) == 2\n\nassert hamming_Distance(4,8) == 2\nassert hamming_Distance(2,4) == 2\nassert hamming_Distance(1,2) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "193", "problem": "Write a python function to count the occurrence of a given character in a string.", "completion": "\ndef count(s, char):\n    return s.count(char)\n\nassert count(\"abcc\",\"c\") == 2\nassert count(\"ababca\",\"a\") == 3\nassert count(\"mnmm0pm\",\"m\") == 4", "passed": true, "fail_reason": "[]"}
{"task_id": "194", "problem": "Write a function to find the inversions of tuple elements in the given tuple list.", "completion": "\ndef inversion_elements(tup):\n    return tuple(-i for i in tup)\n\nassert inversion_elements((7, 8, 9, 1, 10, 7)) == (-8, -9, -10, -2, -11, -8)\nassert inversion_elements((2, 4, 5, 6, 1, 7)) == (-3, -5, -6, -7, -2, -8)\nassert inversion_elements((8, 9, 11, 14, 12, 13)) == (-9, -10, -12, -15, -13, -14)", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "195", "problem": "Write a function to perform the adjacent element concatenation in the given tuples.", "completion": "\ndef concatenate_elements(tup):\n    return tuple(''.join([tup[i], tup[i+1]]) for i in range(len(tup)-1))\n\nassert concatenate_elements((\"DSP \", \"IS \", \"BEST \", \"FOR \", \"ALL \", \"UTS\")) == ('DSP IS ', 'IS BEST ', 'BEST FOR ', 'FOR ALL ', 'ALL UTS')\nassert concatenate_elements((\"RES \", \"IS \", \"BEST \", \"FOR \", \"ALL \", \"QESR\")) == ('RES IS ', 'IS BEST ', 'BEST FOR ', 'FOR ALL ', 'ALL QESR')\nassert concatenate_elements((\"MSAM\", \"IS \", \"BEST \", \"FOR \", \"ALL \", \"SKD\")) == ('MSAMIS ', 'IS BEST ', 'BEST FOR ', 'FOR ALL ', 'ALL SKD')", "passed": true, "fail_reason": "[]"}
{"task_id": "196", "problem": "Write a function to count the longest repeating subsequences such that the two subsequences don\u2019t have same string characters at same positions.", "completion": "\ndef find_longest_repeating_subseq(s):\n    n = len(s)\n    longest = 0\n    for i in range(n):\n        for j in range(i + 1, n):\n            k = 0\n            while i + k < n and j + k < n and s[i + k] == s[j + k] and s[i + k]!= s[i]:\n                k += 1\n            longest = max(longest, k)\n    return longest\n\nassert find_longest_repeating_subseq(\"AABEBCDD\") == 3\nassert find_longest_repeating_subseq(\"aabb\") == 2\nassert find_longest_repeating_subseq(\"aab\") == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "197", "problem": "Write a function to check the given decimal with a precision of 2 by using regex.", "completion": "\ndef is_decimal(s):\n    import re\n    return bool(re.match(r'^[0-9]+(\\.[0-9]{1,2})?$', s))\n\nassert is_decimal('123.11') == True\nassert is_decimal('0.21') == True\nassert is_decimal('123.1214') == False", "passed": true, "fail_reason": "[]"}
{"task_id": "198", "problem": "Write a function to delete the smallest element from the given heap and then insert a new item.", "completion": "\ndef heap_replace(heap, item):\n    import heapq\n    heapq.heapify(heap)\n    smallest = heapq.heappop(heap)\n    heapq.heappush(heap, item)\n    return heap\n\nassert heap_replace( [25, 44, 68, 21, 39, 23, 89],21)==[21, 25, 23, 44, 39, 68, 89]\nassert heap_replace([25, 44, 68, 21, 39, 23, 89],110)== [23, 25, 68, 44, 39, 110, 89]\nassert heap_replace([25, 44, 68, 21, 39, 23, 89],500)==[23, 25, 68, 44, 39, 500, 89]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "199", "problem": "Write a function to check that the given string contains only a certain set of characters(in this case a-z, a-z and 0-9) by using regex.", "completion": "\nimport re\n\ndef is_allowed_specific_char(s):\n    pattern = re.compile('^[a-zA-Z0-9]+$')\n    return bool(pattern.match(s))\n\nassert is_allowed_specific_char(\"ABCDEFabcdef123450\") == True\nassert is_allowed_specific_char(\"*&%@#!}{\") == False\nassert is_allowed_specific_char(\"HELLOhowareyou98765\") == True", "passed": true, "fail_reason": "[]"}
{"task_id": "200", "problem": "Write a python function to count numbers whose oth and nth bits are set.", "completion": "\ndef count_Num(n):\n    count = 0\n    for i in range(1, n+1):\n        if (i & (1 << (n-1))) and (i & 1):\n            count += 1\n    return count\n\nassert count_Num(2) == 1\nassert count_Num(3) == 2\nassert count_Num(1) == 1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "201", "problem": "Write a python function to find the sum of fourth power of n natural numbers.", "completion": "\ndef fourth_Power_Sum(n):\n    if n == 1:\n        return 1\n    else:\n        return ((2*n-1)**4 + fourth_Power_Sum(n-1))\n\nassert fourth_Power_Sum(2) == 17\nassert fourth_Power_Sum(4) == 354\nassert fourth_Power_Sum(6) == 2275", "passed": false, "fail_reason": "[NameError(\"name 'fourth_Power_Sum' is not defined\")]"}
{"task_id": "202", "problem": "Write a function to perform the concatenation of two string tuples.", "completion": "\ndef concatenate_strings(tuple1, tuple2):\n    return tuple(a + b for a, b in zip(tuple1, tuple2))\n\nassert concatenate_strings((\"Manjeet\", \"Nikhil\", \"Akshat\"), (\" Singh\", \" Meherwal\", \" Garg\")) == ('Manjeet Singh', 'Nikhil Meherwal', 'Akshat Garg')\nassert concatenate_strings((\"Shaik\", \"Ayesha\", \"Sanya\"), (\" Dawood\", \" Begum\", \" Singh\")) == ('Shaik Dawood', 'Ayesha Begum', 'Sanya Singh')\nassert concatenate_strings((\"Harpreet\", \"Priyanka\", \"Muskan\"), (\"Kour\", \" Agarwal\", \"Sethi\")) == ('HarpreetKour', 'Priyanka Agarwal', 'MuskanSethi')", "passed": true, "fail_reason": "[]"}
{"task_id": "203", "problem": "Write a function to convert radians to degrees.", "completion": "\ndef degree_radian(degrees):\n    pi = 3.14159\n    radians = (degrees * pi) / 180\n    return int(radians * 1000000)\n\nassert degree_radian(90)==5156.620156177409\nassert degree_radian(60)==3437.746770784939\nassert degree_radian(120)==6875.493541569878", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "204", "problem": "Write a function to decode a run-length encoded given list.", "completion": "\ndef decode_list(lst):\n    result = []\n    i = 0\n    while i < len(lst):\n        if isinstance(lst[i], list):\n            result.extend([lst[i][1]] * lst[i][0])\n        else:\n            result.append(lst[i])\n        i += 1\n    return result\n\nassert decode_list([[2, 1], 2, 3, [2, 4], 5,1])==[1,1,2,3,4,4,5,1]\nassert decode_list(['a', 'u', 't', 'o', 'm', 'a', 't', 'i', 'c', 'a', [2, 'l'], 'y'])==['a', 'u', 't', 'o', 'm', 'a', 't', 'i', 'c', 'a', 'l', 'l', 'y']\nassert decode_list(['p', 'y', 't', 'h', 'o', 'n'])==['p', 'y', 't', 'h', 'o', 'n']", "passed": true, "fail_reason": "[]"}
{"task_id": "205", "problem": "Write a function to check if a nested list is a subset of another nested list.", "completion": "\nassert check_subset_list([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],[[12, 18, 23, 25, 45], [7, 11, 19, 24, 28], [1, 5, 8, 18, 15, 16]])==False\nassert check_subset_list([[2, 3, 1], [4, 5], [6, 8]],[[4, 5], [6, 8]])==True\nassert check_subset_list([['a', 'b'], ['e'], ['c', 'd']],[['g']])==False", "passed": false, "fail_reason": "[NameError(\"name 'check_subset_list' is not defined\")]"}
{"task_id": "206", "problem": "Write a python function to find the first repeated character in a given string.", "completion": "\ndef first_Repeated_Char(string):\n    \"\"\"\n    Given a string, find the first repeated letter in the string.\n    \n    Args:\n        string (str): The string to search.\n    \n    Returns:\n        str: The first repeated letter, or '\\0' if no repeated letter is found.\n    \"\"\"\n    # Create an empty dictionary to store the count of each letter\n    letter_count = {}\n    \n    # Iterate through the string\n    for i, letter in enumerate(string):\n        # Check if the letter is already in the dictionary\n        if letter in letter_count:\n            # If it is, return the letter\n            return letter\n        else:\n            # If it is not, add it to the dictionary with a count of 1\n            letter_count[letter] = 1\n    \n    # If no repeated letter is found, return '\\0'\n    return '\\0'\n\nassert first_Repeated_Char(\"Google\") == \"o\"\nassert first_Repeated_Char(\"data\") == \"a\"\nassert first_Repeated_Char(\"python\") == '\\0'\n\nassert first_Repeated_Char(\"Google\") == \"o\"\nassert first_Repeated_Char(\"data\") == \"a\"\nassert first_Repeated_Char(\"python\") == '\\0'", "passed": true, "fail_reason": "[]"}
{"task_id": "207", "problem": "Write a python function to find the minimum operations required to make two numbers equal.", "completion": "\ndef min_Operations(num1, num2):\n    return abs(num1 - num2)\n\nassert min_Operations(2,4) == 1\nassert min_Operations(4,10) == 4\nassert min_Operations(1,4) == 3", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "208", "problem": "Write a function to extract maximum and minimum k elements in the given tuple.", "completion": "\ndef extract_min_max(tup, k):\n    sorted_tup = sorted(tup)\n    return sorted_tup[:k] + sorted_tup[-k:]\n\nassert extract_min_max((5, 20, 3, 7, 6, 8), 2) == (3, 5, 8, 20)\nassert extract_min_max((4, 5, 6, 1, 2, 7), 3) == (1, 2, 4, 5, 6, 7)\nassert extract_min_max((2, 3, 4, 8, 9, 11, 7), 4) == (2, 3, 4, 7, 8, 9, 11)", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "209", "problem": "Write a function to replace maximum n occurrences of spaces, commas, or dots with a colon.", "completion": "\ndef replace_max_specialchar(s, n):\n    special_chars = [' ', ',', '.']\n    for char in special_chars:\n        s = s.replace(char, ':', n)\n    return s\n\nassert replace_max_specialchar('Python language, Programming language.',2)==('Python:language: Programming language.')\nassert replace_max_specialchar('a b c,d e f',3)==('a:b:c:d e f')\nassert replace_max_specialchar('ram reshma,ram rahim',1)==('ram:reshma,ram rahim')", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "210", "problem": "Write a python function to find the first even number in a given list of numbers.", "completion": "\ndef first_even(numbers):\n    for n in numbers:\n        if n % 2 == 0:\n            return n\n    return None\nassert first_even ([1, 3, 5, 7, 4, 1, 6, 8]) == 4\nassert first_even([2, 3, 4]) == 2\nassert first_even([5, 6, 7]) == 6\n\nassert first_even ([1, 3, 5, 7, 4, 1, 6, 8]) == 4\nassert first_even([2, 3, 4]) == 2\nassert first_even([5, 6, 7]) == 6", "passed": true, "fail_reason": "[]"}
{"task_id": "211", "problem": "Write a function to check if all the elements in tuple have same data type or not.", "completion": "\ndef check_type(t):\n    return len(set(type(x) for x in t)) == 1\n\nassert check_type((5, 6, 7, 3, 5, 6) ) == True\nassert check_type((1, 2, \"4\") ) == False\nassert check_type((3, 2, 1, 4, 5) ) == True", "passed": true, "fail_reason": "[]"}
{"task_id": "212", "problem": "Write a function to check for majority element in the given sorted array.", "completion": "\ndef is_majority(arr, k, num):\n    if len(arr) <= 1:\n        return False\n    if len(arr) == 2:\n        return arr[0] == num or arr[1] == num\n    if arr[0] == num and arr[-1] == num:\n        return True\n    for i in range(1, len(arr) - 1):\n        if arr[i]!= arr[i-1] and arr[i]!= arr[i+1]:\n            return False\n    return True\n\nassert is_majority([1, 2, 3, 3, 3, 3, 10], 7, 3) == True\nassert is_majority([1, 1, 2, 4, 4, 4, 6, 6], 8, 4) == False\nassert is_majority([1, 1, 1, 2, 2], 5, 1) == True", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "213", "problem": "Write a python function to count set bits of a given number.", "completion": "\ndef count_Set_Bits(n):\n    count = 0\n    while n: \n        count += n & 1\n        n >>= 1\n    return count\nassert count_Set_Bits(2) == 1\nassert count_Set_Bits(4) == 1\nassert count_Set_Bits(6) == 2\n\nassert count_Set_Bits(2) == 1\nassert count_Set_Bits(4) == 1\nassert count_Set_Bits(6) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "214", "problem": "Write a python function to find the minimum element in a sorted and rotated array.", "completion": "\ndef find_Min(arr, left, right):\n    while left < right:\n        mid = (left + right) // 2\n\n        if arr[mid] > arr[right]:\n            # Minimum value is in the right half\n            left = mid + 1\n        else:\n            # Minimum value is in the left half or at mid\n            right = mid\n\n    return arr[left]\nassert find_Min([1,2,3,4,5],0,4) == 1\nassert find_Min([4,6,8],0,2) == 4\nassert find_Min([2,3,5,7,9],0,4) == 2\n\nassert find_Min([1,2,3,4,5],0,4) == 1\nassert find_Min([4,6,8],0,2) == 4\nassert find_Min([2,3,5,7,9],0,4) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "215", "problem": "Write a python function to remove the characters which have odd index values of a given string.", "completion": "\ndef odd_values_string(s):\n    return ''.join([c for i, c in enumerate(s) if i % 2 == 0])\n\nassert odd_values_string('abcdef') == 'ace'\nassert odd_values_string('python') == 'pto'\nassert odd_values_string('data') == 'dt'", "passed": true, "fail_reason": "[]"}
{"task_id": "216", "problem": "Write a function to find minimum of three numbers.", "completion": "\ndef min_of_three(a, b, c):\n    \"\"\"Function which finds the minimum of three numbers\"\"\"\n    return min(a, b, c)\n\nassert min_of_three(10,20,0)==0\nassert min_of_three(19,15,18)==15\nassert min_of_three(-10,-20,-30)==-30", "passed": true, "fail_reason": "[]"}
{"task_id": "217", "problem": "Write a python function to check whether all the bits are unset in the given range or not.", "completion": "\ndef all_Bits_Set_In_The_Given_Range(n, start, end):\n    # Convert the number to binary and remove the '0b' prefix\n    binary = bin(n)[2:]\n    # Check if all characters in the binary string from start to end are '1'\n    return all(binary[start:end] == '1' * (end - start))\n\nassert all_Bits_Set_In_The_Given_Range(4,1,2) == True\nassert all_Bits_Set_In_The_Given_Range(17,2,4) == True\nassert all_Bits_Set_In_The_Given_Range(39,4,6) == False", "passed": false, "fail_reason": "[TypeError(\"'bool' object is not iterable\")]"}
{"task_id": "218", "problem": "Write a function to re-arrange the elements of the given array so that all negative elements appear before positive ones.", "completion": "\ndef re_arrange_array(arr, n):\n    left = 0\n    right = n - 1\n\n    while left < right:\n        while arr[left] < 0 and left < right:\n            left += 1\n        while arr[right] >= 0 and left < right:\n            right -= 1\n\n        if left < right:\n            arr[left], arr[right] = arr[right], arr[left]\n\n    return arr\nassert re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]\nassert re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]\nassert re_arrange_array([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85]\n\nassert re_arrange_array([-1, 2, -3, 4, 5, 6, -7, 8, 9], 9) == [-1, -3, -7, 4, 5, 6, 2, 8, 9]\nassert re_arrange_array([12, -14, -26, 13, 15], 5) == [-14, -26, 12, 13, 15]\nassert re_arrange_array([10, 24, 36, -42, -39, -78, 85], 7) == [-42, -39, -78, 10, 24, 36, 85]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "219", "problem": "Write a function to replace blank spaces with any character in a string.", "completion": "\ndef replace_blank(string, character):\n    \"\"\"\n    Replace all blank spaces in a string with a given character.\n    \n    Args:\n        string (str): The string to be modified.\n        character (str): The character to replace blank spaces with.\n    \n    Returns:\n        str: The modified string with blank spaces replaced by the given character.\n    \"\"\"\n    return string.replace(' ', character)\nassert replace_blank(\"hello people\",'@')==(\"hello@people\")\nassert replace_blank(\"python program language\",'$')==(\"python$program$language\")\nassert replace_blank(\"blank space\",\"-\")==(\"blank-space\")\n\nassert replace_blank(\"hello people\",'@')==(\"hello@people\")\nassert replace_blank(\"python program language\",'$')==(\"python$program$language\")\nassert replace_blank(\"blank space\",\"-\")==(\"blank-space\")", "passed": true, "fail_reason": "[]"}
{"task_id": "220", "problem": "Write a function to find the maximum sum in the given right triangle of numbers.", "completion": "\ndef max_sum(triangle, n):\n    for i in range(n-2, 0, -1):\n        for j in range(len(triangle[i])):\n            triangle[i-1][j] += max(triangle[i][j], triangle[i][j+1])\n    return triangle[0][0]\n\nassert max_sum([[1], [2,1], [3,3,2]], 3) == 6\nassert max_sum([[1], [1, 2], [4, 1, 12]], 3) == 15 \nassert max_sum([[2], [3,2], [13,23,12]], 3) == 28", "passed": false, "fail_reason": "[IndexError('list index out of range')]"}
{"task_id": "221", "problem": "Write a function to get the n largest items from a dataset.", "completion": "\ndef larg_nnum(dataset, n):\n    if n < 0:\n        return []\n    it = iter(dataset)\n    result = list(islice(it, n))\n    if not result:\n        return result\n    heapify(result)\n    _heappushpop = heappushpop\n    for elem in it:\n        _heappushpop(result, elem)\n    result.sort(reverse=True)\n    return result[:n]\nimport heapq\nimport itertools\ndef heappushpop(heap, item):\n    heap.append(item)\n    heapq.heapify(heap)\n    return heap.pop(0)\nimport heapq\ndef islice(iterable, n):\n    return itertools.islice(iterable, n)\nimport heapq\ndef heapify(iterable):\n    heapq.heapify(iterable)\n\nassert larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],2)==[100,90]\nassert larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],5)==[100,90,80,70,60]\nassert larg_nnum([10, 20, 50, 70, 90, 20, 50, 40, 60, 80, 100],3)==[100,90,80]", "passed": false, "fail_reason": "[NameError(\"name 'islice' is not defined\")]"}
{"task_id": "222", "problem": "Write a function to find the lateral surface area of a cylinder.", "completion": "\nimport math\n\ndef lateralsuface_cylinder(radius, height):\n    return 2 * math.pi * radius * (radius + math.sqrt(height**2 + radius**2))\n\nassert lateralsuface_cylinder(10,5)==314.15000000000003\nassert lateralsuface_cylinder(4,5)==125.66000000000001\nassert lateralsuface_cylinder(4,10)==251.32000000000002", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "223", "problem": "Write a function to find the volume of a cube.", "completion": "\ndef volume_cube(side_length):\n    \"\"\"\n    Calculate the volume of a cube.\n    \n    Args:\n        side_length (float): The length of one side of the cube.\n        \n    Returns:\n        float: The volume of the cube.\n    \"\"\"\n    volume = side_length ** 3\n    return volume\n\nassert volume_cube(3)==27\nassert volume_cube(2)==8\nassert volume_cube(5)==125\n\nassert volume_cube(3)==27\nassert volume_cube(2)==8\nassert volume_cube(5)==125", "passed": true, "fail_reason": "[]"}
{"task_id": "224", "problem": "Write a python function to set all even bits of a given number.", "completion": "\ndef even_bit_set_number(n):\n    return n | (n & -n)\n\nassert even_bit_set_number(10) == 10\nassert even_bit_set_number(20) == 30\nassert even_bit_set_number(30) == 30", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "225", "problem": "Write a python function to count the maximum number of equilateral triangles that can be formed within a given equilateral triangle.", "completion": "\ndef No_of_Triangle(n, k):\n    if n < k:\n        return -1\n    if k == 1:\n        return 1\n    return (n*(n-1)*(n-2))//6 + (n*(n-1))//2 - (k*(k-1))//2 + 1\n\nassert No_of_Triangle(4,2) == 7\nassert No_of_Triangle(4,3) == 3\nassert No_of_Triangle(1,3) == -1", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "226", "problem": "Write a function to check the occurrences of records which occur similar times in the given tuples.", "completion": "\ndef check_occurences(tuples):\n    result = {}\n    for tup in tuples:\n        if tup in result:\n            result[tup] += 1\n        else:\n            result[tup] = 1\n    return result\n\nassert check_occurences([(3, 1), (1, 3), (2, 5), (5, 2), (6, 3)] ) == {(1, 3): 2, (2, 5): 2, (3, 6): 1}\nassert check_occurences([(4, 2), (2, 4), (3, 6), (6, 3), (7, 4)] ) == {(2, 4): 2, (3, 6): 2, (4, 7): 1}\nassert check_occurences([(13, 2), (11, 23), (12, 25), (25, 12), (16, 23)] ) == {(2, 13): 1, (11, 23): 1, (12, 25): 2, (16, 23): 1}", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "227", "problem": "Write a python function to count number of non-empty substrings of a given string.", "completion": "\ndef number_of_substrings(s):\n    return len(s) ** 2\n\nassert number_of_substrings(\"abc\") == 6\nassert number_of_substrings(\"abcd\") == 10\nassert number_of_substrings(\"abcde\") == 15", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "228", "problem": "Write a function to find the number of possible sequences of length n such that each of the next element is greater than or equal to twice of the previous element but less than or equal to m.", "completion": "\ndef get_total_number_of_sequences(n, m):\n    dp = [0] * (n + 1)\n    dp[1] = 1\n    for i in range(2, n + 1):\n        for j in range(1, m + 1):\n            if j >= 2 * i - 1:\n                dp[i] += dp[i - j]\n    return dp[n]\n\nassert get_total_number_of_sequences(10, 4) == 4\nassert get_total_number_of_sequences(5, 2) == 6\nassert get_total_number_of_sequences(16, 3) == 84", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "229", "problem": "Write a function to replace the last element of the list with another list.", "completion": "\ndef replace_last_element(list1, list2):\n    list1[-1:] = list2\n    return list1\nassert replace_list([1, 3, 5, 7, 9, 10],[2, 4, 6, 8])==[1, 3, 5, 7, 9, 2, 4, 6, 8]\nassert replace_list([1,2,3,4,5],[5,6,7,8])==[1,2,3,4,5,6,7,8]\nassert replace_list([\"red\",\"blue\",\"green\"],[\"yellow\"])==[\"red\",\"blue\",\"yellow\"]\n\nassert replace_list([1, 3, 5, 7, 9, 10],[2, 4, 6, 8])==[1, 3, 5, 7, 9, 2, 4, 6, 8]\nassert replace_list([1,2,3,4,5],[5,6,7,8])==[1,2,3,4,5,6,7,8]\nassert replace_list([\"red\",\"blue\",\"green\"],[\"yellow\"])==[\"red\",\"blue\",\"yellow\"]", "passed": false, "fail_reason": "[NameError(\"name 'replace_list' is not defined\")]"}
{"task_id": "230", "problem": "Write a function to generate a 3d array having each element as '*'.", "completion": "\ndef array_3d(rows, cols, depth):\n    return [[[ '*' for _ in range(cols)] for _ in range(rows)] for _ in range(depth)]\n\nassert array_3d(6,4,3)==[[['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*']], [['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*']], [['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*', '*']]]\nassert array_3d(5,3,4)==[[['*', '*', '*', '*', '*'], ['*', '*', '*', '*','*'], ['*', '*', '*', '*', '*']], [['*', '*', '*', '*', '*'],['*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*']], [['*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*']], [['*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*'], ['*', '*', '*', '*', '*']]]\nassert array_3d(1,2,3)==[[['*'],['*']],[['*'],['*']],[['*'],['*']]]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "231", "problem": "Write a function to count total characters in a string.", "completion": "\ndef count_charac(s):\n    return len(s)\n\nassert count_charac(\"python programming\")==18\nassert count_charac(\"language\")==8\nassert count_charac(\"words\")==5", "passed": true, "fail_reason": "[]"}
{"task_id": "232", "problem": "Write a function to sort the given list based on the occurrence of first element of tuples.", "completion": "\ndef sort_on_occurence(lst):\n    freq = {}\n    for item in lst:\n        if item[0] in freq:\n            freq[item[0]] += 1\n        else:\n            freq[item[0]] = 1\n    sorted_lst = sorted(lst, key=lambda x: (x[0], -freq[x[0]]))\n    return sorted_lst + [freq[x[0]] for x in sorted_lst]\n\nassert sort_on_occurence([(1, 'Jake'), (2, 'Bob'), (1, 'Cara')]) == [(1, 'Jake', 'Cara', 2), (2, 'Bob', 1)]\nassert sort_on_occurence([('b', 'ball'), ('a', 'arm'), ('b', 'b'), ('a', 'ant')]) == [('b', 'ball', 'b', 2), ('a', 'arm', 'ant', 2)]\nassert sort_on_occurence([(2, 'Mark'), (3, 'Maze'), (2, 'Sara')]) == [(2, 'Mark', 'Sara', 2), (3, 'Maze', 1)]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "233", "problem": "Write a python function to find the next perfect square greater than a given number.", "completion": "\nimport math\n\ndef next_Perfect_Square(n):\n    root = math.sqrt(n)\n    if root == int(root):\n        next_square = (root + 1) ** 2\n        return int(next_square)\n    else:\n        next_square = (math.ceil(root) + 1) ** 2\n        return next_square\n\nassert next_Perfect_Square(35) == 36\nassert next_Perfect_Square(6) == 9\nassert next_Perfect_Square(9) == 16\n\nassert next_Perfect_Square(35) == 36\nassert next_Perfect_Square(6) == 9\nassert next_Perfect_Square(9) == 16", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "234", "problem": "Write a function to find the maximum sum of bi-tonic sub-sequence for the given array.", "completion": "\ndef max_sum(arr, k):\n    if len(arr) <= k:\n        return sum(arr)\n    \n    dp = [[0 for _ in range(k+1)] for _ in range(len(arr))]\n    \n    for i in range(1, len(arr)):\n        for j in range(1, min(i+1, k+1)):\n            if j == 1:\n                dp[i][j] = max(dp[i-1][j], arr[i-1])\n            else:\n                dp[i][j] = max(dp[i-1][j], dp[i-1][j-1] + arr[i-1])\n    \n    return dp[-1][-1]\n\nassert max_sum([1, 15, 51, 45, 33, 100, 12, 18, 9], 9) == 194\nassert max_sum([80, 60, 30, 40, 20, 10], 6) == 210\nassert max_sum([2, 3 ,14, 16, 21, 23, 29, 30], 8) == 138", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "235", "problem": "Write a function for computing square roots using the babylonian method.", "completion": "\ndef babylonian_squareroot(s):\n    \"\"\"\n    Find the square root of a number using the Babylonian method.\n    \"\"\"\n    x = int(s)\n    guess = x / 2.0\n    while True:\n        better_guess = (guess + s / guess) / 2.0\n        if abs(guess - better_guess) < 0.5:\n            return round(better_guess)\n        guess = better_guess\n\nassert babylonian_squareroot(10)==3.162277660168379\nassert babylonian_squareroot(2)==1.414213562373095\nassert babylonian_squareroot(9)==3.0\n\nassert babylonian_squareroot(10)==3.162277660168379\nassert babylonian_squareroot(2)==1.414213562373095\nassert babylonian_squareroot(9)==3.0", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "236", "problem": "Write a function to find the longest palindromic subsequence in the given string.", "completion": "\ndef lps(s):\n    def is_palindrome(s):\n        return s == s[::-1]\n\n    def longest_palindromic_subsequence(s):\n        max_length = 0\n        for i in range(len(s)):\n            for j in range(i + 1, len(s) + 1):\n                subsequence = s[i:j]\n                if is_palindrome(subsequence):\n                    max_length = max(max_length, len(subsequence))\n        return max_length\n\n    return longest_palindromic_subsequence(s.upper())\n\nassert lps(\"TENS FOR TENS\") == 5 \nassert lps(\"CARDIO FOR CARDS\") == 7\nassert lps(\"PART OF THE JOURNEY IS PART\") == 9 ", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "237", "problem": "Write a function to calculate the harmonic sum of n-1.", "completion": "\ndef harmonic_sum(n):\n    if n < 2:\n        return 1\n    else:\n        return 1 + 1/n + harmonic_sum(n-1)\n\nassert harmonic_sum(7) == 2.5928571428571425\nassert harmonic_sum(4) == 2.083333333333333\nassert harmonic_sum(19) == 3.547739657143682", "passed": false, "fail_reason": "[NameError(\"name 'harmonic_sum' is not defined\")]"}
{"task_id": "238", "problem": "Write a function to find the intersection of two arrays using lambda function.", "completion": "\nassert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[1, 2, 4, 8, 9])==[1, 2, 8, 9]\nassert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[3,5,7,9])==[3,5,7,9]\nassert intersection_array([1, 2, 3, 5, 7, 8, 9, 10],[10,20,30,40])==[10]", "passed": false, "fail_reason": "[NameError(\"name 'intersection_array' is not defined\")]"}
{"task_id": "239", "problem": "Write a python function to count the occcurences of an element in a tuple.", "completion": "\ndef count_X(tup, x):\n    return tup.count(x)\n\nassert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),4) == 0\nassert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),10) == 3\nassert count_X((10, 8, 5, 2, 10, 15, 10, 8, 5, 8, 8, 2),8) == 4", "passed": true, "fail_reason": "[]"}
{"task_id": "240", "problem": "Write a function to insert an element before each element of a list.", "completion": "\ndef insert_element(lst, element):\n    return [element] + [i for i in lst] + [element]\n\nassert insert_element(['Red', 'Green', 'Black'] ,'c')==['c', 'Red', 'c', 'Green', 'c', 'Black'] \nassert insert_element(['python', 'java'] ,'program')==['program', 'python', 'program', 'java'] \nassert insert_element(['happy', 'sad'] ,'laugh')==['laugh', 'happy', 'laugh', 'sad'] ", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "241", "problem": "Write a python function to convert complex numbers to polar coordinates.", "completion": "\nimport math\n\ndef convert(z):\n    \"\"\"\n    Convert a complex number to polar form.\n    \n    Parameters:\n    z (float): The complex number.\n    \n    Returns:\n    tuple: A tuple containing the magnitude and angle of the complex number in polar form.\n    \"\"\"\n    # Calculate the magnitude\n    r = abs(z)\n\n    # Calculate the angle\n    if z == 0:\n        theta = 0\n    else:\n        theta = math.degrees(math.atan(z / abs(z)))\n\n    # Return the polar form\n    return (r, theta)\n\nassert convert(1) == (1.0, 0.0)\nassert convert(4) == (4.0,0.0)\nassert convert(5) == (5.0,0.0)", "passed": false, "fail_reason": "[NameError(\"name 'math' is not defined\")]"}
{"task_id": "242", "problem": "Write a python function to count integers from a given list.", "completion": "\ndef count_integer(lst):\n    return sum(1 for x in lst if isinstance(x, int))\n\nassert count_integer([1,2,'abc',1.2]) == 2\nassert count_integer([1,2,3]) == 3\nassert count_integer([1,1.2,4,5.1]) == 2", "passed": true, "fail_reason": "[]"}
{"task_id": "243", "problem": "Write a function to find all words starting with 'a' or 'e' in a given string.", "completion": "\nimport re\n\ndef words_ae(s):\n  \"\"\"\n  Find all words starting with 'a' or 'A' in a string\n  :param s: string\n  :return: list of words\n  \"\"\"\n  regex = r'\\b[aA]\\w*\\b'    # handles words starting with both 'a' and 'A'\n  matches = re.findall(regex, s)\n  return matches\n\nassert words_ae(\"python programe\")==['ame']\nassert words_ae(\"python programe language\")==['ame','anguage']\nassert words_ae(\"assert statement\")==['assert', 'atement']\n\nassert words_ae(\"python programe\")==['ame']\nassert words_ae(\"python programe language\")==['ame','anguage']\nassert words_ae(\"assert statement\")==['assert', 'atement']", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "244", "problem": "Write a function to choose specified number of colours from three different colours and generate all the combinations with repetitions.", "completion": "\ndef combinations_colors(colors, n):\n    return [(color for color in colors for _ in range(n))][1:]\n\nassert combinations_colors( [\"Red\",\"Green\",\"Blue\"],1)==[('Red',), ('Green',), ('Blue',)]\nassert combinations_colors( [\"Red\",\"Green\",\"Blue\"],2)==[('Red', 'Red'), ('Red', 'Green'), ('Red', 'Blue'), ('Green', 'Green'), ('Green', 'Blue'), ('Blue', 'Blue')]\nassert combinations_colors( [\"Red\",\"Green\",\"Blue\"],3)==[('Red', 'Red', 'Red'), ('Red', 'Red', 'Green'), ('Red', 'Red', 'Blue'), ('Red', 'Green', 'Green'), ('Red', 'Green', 'Blue'), ('Red', 'Blue', 'Blue'), ('Green', 'Green', 'Green'), ('Green', 'Green', 'Blue'), ('Green', 'Blue', 'Blue'), ('Blue', 'Blue', 'Blue')]", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "245", "problem": "Write a python function to count the number of prime numbers less than a given non-negative number.", "completion": "\ndef count_Primes_nums(n):\n    \"\"\"\n    Count the number of prime numbers less than a non-negative number, n\n    \"\"\"\n    # Create a boolean array \"is_prime[0..n]\" and initialize\n    # all entries it as true.\n    is_prime = [True] * (n+1)\n    is_prime[0] = is_prime[1] = False\n\n    count = 0\n\n    p = 2\n    while p * p <= n:\n        # If is_prime[p] is not changed, then it is a prime\n        if is_prime[p] == True:\n            # Update all multiples of p\n            for i in range(p * p, n+1, p):\n                is_prime[i] = False\n        p += 1\n\n    # Count all prime numbers\n    for i in range(2, n+1):\n        if is_prime[i]:\n            count += 1\n\n    return count\n\nassert count_Primes_nums(5) == 2\nassert count_Primes_nums(10) == 4\nassert count_Primes_nums(100) == 25", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "246", "problem": "Write a function to swap two numbers.", "completion": "\ndef swap_numbers(a, b):\n    temp = a\n    a = b\n    b = temp\n    return a, b\n\nassert swap_numbers(10,20)==(20,10)\nassert swap_numbers(15,17)==(17,15)\nassert swap_numbers(100,200)==(200,100)", "passed": true, "fail_reason": "[]"}
{"task_id": "247", "problem": "Write a function to find number of odd elements in the given list using lambda function.", "completion": "\ndef count_odd(lst):\n    return sum(1 for i in lst if i % 2!= 0)\nassert count_odd([1, 2, 3, 5, 7, 8, 10])==4\nassert count_odd([10,15,14,13,-18,12,-20])==2\nassert count_odd([1, 2, 4, 8, 9])==2\n\nassert count_odd([1, 2, 3, 5, 7, 8, 10])==4\nassert count_odd([10,15,14,13,-18,12,-20])==2\nassert count_odd([1, 2, 4, 8, 9])==2", "passed": true, "fail_reason": "[]"}
{"task_id": "248", "problem": "Write a function to maximize the given two tuples.", "completion": "\ndef maximize_elements(tuple1, tuple2):\n    return tuple(max(a, b) for a, b in zip(tuple1, tuple2))\n\nassert maximize_elements(((1, 3), (4, 5), (2, 9), (1, 10)), ((6, 7), (3, 9), (1, 1), (7, 3))) == ((6, 7), (4, 9), (2, 9), (7, 10))\nassert maximize_elements(((2, 4), (5, 6), (3, 10), (2, 11)), ((7, 8), (4, 10), (2, 2), (8, 4))) == ((7, 8), (5, 10), (3, 10), (8, 11))\nassert maximize_elements(((3, 5), (6, 7), (4, 11), (3, 12)), ((8, 9), (5, 11), (3, 3), (9, 5))) == ((8, 9), (6, 11), (4, 11), (9, 12))", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "249", "problem": "Write a function to find the nth newman\u2013shanks\u2013williams prime number.", "completion": "\nassert newman_prime(3) == 7 \nassert newman_prime(4) == 17\nassert newman_prime(5) == 41", "passed": false, "fail_reason": "[NameError(\"name 'newman_prime' is not defined\")]"}
{"task_id": "250", "problem": "Write a function to perform mathematical division operation across the given tuples.", "completion": "\ndef division_elements(tuple1, tuple2):\n    return tuple(i / j for i, j in zip(tuple1, tuple2))\n\nassert division_elements((10, 4, 6, 9),(5, 2, 3, 3)) == (2, 2, 2, 3)\nassert division_elements((12, 6, 8, 16),(6, 3, 4, 4)) == (2, 2, 2, 4)\nassert division_elements((20, 14, 36, 18),(5, 7, 6, 9)) == (4, 2, 6, 2)", "passed": true, "fail_reason": "[]"}
{"task_id": "251", "problem": "Write a function to split a given list into two parts where the length of the first part of the list is given.", "completion": "\ndef split_two_parts(lst, n):\n    return lst[:n], lst[n:]\n\nassert split_two_parts([1,1,2,3,4,4,5,1],3)==([1, 1, 2], [3, 4, 4, 5, 1])\nassert split_two_parts(['a', 'b', 'c', 'd'],2)==(['a', 'b'], ['c', 'd'])\nassert split_two_parts(['p', 'y', 't', 'h', 'o', 'n'],4)==(['p', 'y', 't', 'h'], ['o', 'n'])", "passed": true, "fail_reason": "[]"}
{"task_id": "252", "problem": "Write a function to merge two dictionaries.", "completion": "\ndef merge_dict(dict1, dict2):\n    return {**dict2, **dict1}\n\nassert merge_dict({'a': 100, 'b': 200},{'x': 300, 'y': 200})=={'x': 300, 'y': 200, 'a': 100, 'b': 200}\nassert merge_dict({'a':900,'b':900,'d':900},{'a':900,'b':900,'d':900})=={'a':900,'b':900,'d':900,'a':900,'b':900,'d':900}\nassert merge_dict({'a':10,'b':20},{'x':30,'y':40})=={'x':30,'y':40,'a':10,'b':20}", "passed": true, "fail_reason": "[]"}
{"task_id": "253", "problem": "Write a function to calculate a dog's age in dog's years.", "completion": "\ndef dog_age(age):\n    return (age + 2) * 3\n\nassert dog_age(12)==61\nassert dog_age(15)==73\nassert dog_age(24)==109", "passed": false, "fail_reason": "[AssertionError()]"}
{"task_id": "254", "problem": "Write a function to split a list for every nth element.", "completion": "\ndef list_split(lst, n):\n    return [lst[i::n] for i in range(n)]\n\nassert list_split(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'],3)==[['a', 'd', 'g', 'j', 'm'], ['b', 'e', 'h', 'k', 'n'], ['c', 'f', 'i', 'l']] \nassert list_split([1,2,3,4,5,6,7,8,9,10,11,12,13,14],3)==[[1,4,7,10,13], [2,5,8,11,14], [3,6,9,12]] \nassert list_split(['python','java','C','C++','DBMS','SQL'],2)==[['python', 'C', 'DBMS'], ['java', 'C++', 'SQL']] ", "passed": true, "fail_reason": "[]"}
{"task_id": "255", "problem": "Write a function to find the lateral surface area of a cube.", "completion": "\ndef lateralsurface_cube(side):\n    return 4 * side**2\n\nassert lateralsurface_cube(5)==100\nassert lateralsurface_cube(9)==324\nassert lateralsurface_cube(10)==400", "passed": true, "fail_reason": "[]"}
{"task_id": "256", "problem": "Write a python function to find the sum of squares of first n odd natural numbers.", "completion": "\ndef square_Sum(n):\n    \"\"\"\n    Return the sum of the squares of the first n odd integers.\n    \"\"\"\n    sum = 0\n    for i in range(1, n + 1):\n        if i % 2!= 0:\n            sum += i ** 2\n    return sum\n    \nassert square_Sum(2) == 10\nassert square_Sum(3) == 35\nassert square_Sum(4) == 84\n\nassert square_Sum(2) == 10\nassert square_Sum(3) == 35\nassert square_Sum(4) == 84", "passed": false, "fail_reason": "[AssertionError()]"}
