{"task_id": 0, "problem": [[0.898766040802002, "def modify_string(s: str) -> str:\n    \"\"\"\n    Given a string s, remove the first and last character of the string.\n    \n    Args:\n        s (str): The string to be modified.\n    \n    Returns:\n        str: The modified string.\n    \"\"\"\n    # If string s is empty, return.\n    if not s:\n        return s\n    # If the length of string s is 1, we assume the index is 0, so return an empty string.\n    elif len(s) == 1:\n        return ''\n    # Recursive case: return the character at index 1 (which is an odd index in 0-based indexing) concatenated with the result of the function called on the rest of the string (starting from index 2).\n    else:\n        return s[1] + modify_string(s[2:])"], [0.8935100436210632, "def remove_from_front(string, num_chars):\n    \"\"\"\n    Remove the first num_chars from string.\n    \"\"\"\n    return string[num_chars:]\n    \n    def remove_from_end(string, num_chars):\n    \"\"\"\n    Remove the last num_chars from string.\n    \"\"\"\n    return string[num_chars:]"]]}
{"task_id": 1, "problem": [[0.9161108136177063, "def sort_rows(arr):\n    \"\"\"\n    Sort rows in ascending order based on the sum of their elements.\n\n    Args:\n        arr (list): A 2D list of integers.\n\n    Returns:\n        list: A 2D list of integers sorted in ascending order based on the sum of their elements.\n    \"\"\"\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"], [0.9138094186782837, "def sort_rows(arr):\n    \"\"\"\n    Sort the rows of a 2D array in descending order based on their sums.\n\n    Args:\n        arr (list): A 2D array of integers.\n\n    Returns:\n        list: A new 2D array with the rows sorted in descending order based on their sums.\n    \"\"\"\n    # Sort the rows in descending order based on their sums\n    sums = get_row_sums(arr)\n    sorted_arr = [x for _, x in sorted(zip(sums, arr), reverse=True)]\n    return sorted_arr"], [0.9122312068939209, "def sort_2d_array(arr):\n    \"\"\"\n    Sort a 2D array in ascending order based on the sum of each row.\n    \n    Args:\n    - arr: A 2D array of integers.\n    \n    Returns:\n    - A sorted 2D array in ascending order based on the sum of each row.\n    \"\"\"\n    arr.sort(key=lambda x: sum(x))\n    return arr"], [0.9116837978363037, "def sortArrayBySum(array):\n    \"\"\"\n    :type array: List[List[int]]\n    :rtype: List[List[int]]\n    \"\"\"\n    array.sort(key=lambda x: sum(x))\n    return array"]]}
{"task_id": 2, "problem": []}
{"task_id": 3, "problem": [[0.9004223942756653, "def tri_area(base, height):\n    \"\"\"\n    Return the area of a triangle with the given base and height.\n    \"\"\"\n    return 0.5*base*height\n    \n    def tri_area(base, height):\n    \"\"\"\n    Return the area of a triangle with the given base and height.\n    \"\"\"\n    return 0.5*base*height"], [0.9004121422767639, "def tri_area(base, height):\n    \"\"\"\n    Return the area of a triangle with the given base and height.\n    \"\"\"\n    return 0.5*base*height\n    \n    def tri_area(base, height):\n    \"\"\"\n    Return the area of a triangle with the given base and height.\n    \"\"\"\n    return 0.5*base*height"]]}
{"task_id": 4, "problem": [[0.9032272696495056, "def split_string(s):\n    \"\"\"\n    Split a string by uppercase letters.\n    >>> split_string('Hello')\n    ['Hello']\n    >>> split_string('Hello, World!')\n    ['Hello', 'World']\n    >>> split_string('Hi')\n    ['Hi']\n    \"\"\"\n    return re.findall('[A-Z][^A-Z]*', s)"], [0.8924493193626404, "def string_split(str):\n    \"\"\"\n    Write a function that takes a string and returns an array of words.\n    \"\"\"\n    return str.split(\" \")"]]}
{"task_id": 5, "problem": []}
{"task_id": 6, "problem": [[0.9000412225723267, "def square_properties(n):\n    \"\"\"\n    Return the area and perimeter of a square of size n.\n    \n    >>> square_properties(5)\n    (25, 20)\n    \"\"\"\n    area = n * n\n    perimeter = 4 * n\n    return (area, perimeter)"], [0.8990646004676819, "def Perimeter_of_square(side):\n    \"\"\"\n    Return the perimeter of a square.\n    \n    :param side: side of the square\n    :type side: float\n    :return: perimeter of the square\n    :rtype: float\n    \"\"\"\n    return 4 * side"]]}
{"task_id": 7, "problem": [[0.9256370663642883, "def remove_characters(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"], [0.9173795580863953, "def delete_chars(A, B):\n    \"\"\"\n    Given two strings A and B, remove characters from A that occur in B.\n    \n    Example 1:\n    \n    Input:\n    A = \"geeksforgeeks\"\n    B = \"geeks\"\n    \n    Output:\n    \"frks\"\n    \n    Explanation:\n    'g', 'e', and 'k' occur in both the strings hence they are removed.\n    \n    Example 2:\n    \n    Input:\n    A = \"xy\"\n    B = \"xypq\"\n    \n    Output:\n    \"\"\"\n    C = ''\n    prev_char = None\n\n    for char in A:\n        if char not in B and char != prev_char:\n            C += char\n        prev_char = char\n\n    return C"], [0.91619873046875, "def remove_chars(string, chars):\n    \"\"\"\n    It should remove characters that are in the second string from the first string.\n    \"\"\"\n    \n    def remove_chars(string, chars):\n    \"\"\"\n    It should remove characters that are in the second string from the first string.\n    \"\"\"\n    if not string:\n        return \"\"\n    chars = set(chars.lower())\n    return \"\".join(char for char in string if char.lower() not in chars)"], [0.9161351323127747, "def remove_chars(s, chars):\n    \"\"\"\n    Given a string and a set of characters, return a string with all the characters from the set removed.\n    \n    >>> remove_chars(\"hello world\", \"l\")\n    'heo word'\n    \"\"\"\n    res = \"\"\n    \n    for c in s:\n        if c not in chars:\n            res+=c\n    return res"], [0.9150521755218506, "def delete_common_characters(str1, str2):\n    \"\"\"\n    Given two strings, remove the characters that are common in both strings\n    \"\"\"\n    str1_list = list(str1)\n    str2_list = list(str2)\n    for char in str1_list:\n        if char in str2_list:\n            str1_list.remove(char)\n\n    output_str = ''.join(str1_list)\n    return output_str\n    def delete_common_characters(str1, str2):\n    \"\"\"\n    Given two strings, remove the characters that are common in both strings\n    \"\"\"\n    str1_list = list(str1)\n    str2_list = list(str2)\n    for char in str1_list:\n        if char in str2_list:\n            str1_list.remove(char)\n\n    output_str = ''.join(str1_list)\n    return output_str"], [0.9141068458557129, "def remove_chars(string, chars):\n    \"\"\"\n    It should remove all occurrence of given characters from a string.\n    \"\"\"\n    # your code goes here\n    for char in chars:\n        string = string.replace(char, \"\")\n    return string\n    \n    def remove_chars(string, chars):\n    \"\"\"\n    It should remove all occurrence of given characters from a string.\n    \"\"\"\n    for char in chars:\n        string = string.replace(char, \"\")\n    return string"]]}
{"task_id": 8, "problem": [[0.935748279094696, "def hasDups(arr): \n    \"\"\"\n    Given an array of integers, write a function that returns true if the array contains any duplicates.\n    \"\"\"\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\n    \n    def hasDups(arr): \n    \"\"\"\n    Given an array of integers, write a function that returns true if the array contains any duplicates.\n    \"\"\"\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"], [0.9296699166297913, "def has_duplicate(arr):\n    \"\"\"\n    Given an array of integers, find if the array contains any duplicates.\n    Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.\n    \n    Args:\n       arr(list): input array\n    Returns:\n       bool: True if the array contains any duplicates, else False\n    \"\"\"\n    seen = set()\n    for i in arr:\n        if i in seen:\n            return True\n        else:\n            seen.add(i)\n    return False"], [0.9293336868286133, "def arrayDuplicate(arr): \n    \"\"\"\n    Given an array of integers, find if the array contains any duplicates. \n    Your function should return true if any value appears at least twice in the array, \n    and it should return false if every element is distinct. \n    \n    Example 1: \n    Input: [1,2,3,1] \n    Output: true \n    \n    Example 2: \n    Input: [1,2,3,4] \n    Output: false \n    \n    Example 3: \n    Input: [1,1,1,\"\"\"\n    # Loop through the array \n    for i in range(len(arr)): \n        for j in range(i+1, len(arr)): \n            # If there is a duplicate, return true \n            if arr[i] == arr[j]: \n                return True \n    return False"], [0.927590548992157, "def contains_duplicates(arr):\n    \"\"\"\n    Given an array of integers, find if the array contains any duplicates.\n    Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.\n    \n    Example 1:\n    Input: [1,2,3,1]\n    Output: true\n    \n    Example 2:\n    Input: [1,2,3,4]\n    Output: false\n    \n    Example 3:\n    Input: [1,1,1,3,3,4,3,2,4,\"\"\"\n    seen = set()\n    for num in arr:\n        if num in seen:\n            return True\n        seen.add(num)\n    return False"], [0.9267053008079529, "def check_repeats(nums):\n    \"\"\"\n    Given an array of integers, find if the array contains any duplicates.\n    Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.\n    :type nums: List[int]\n    :rtype: bool\n    \"\"\"\n    num_set = set()\n\n    for i in range(len(nums)):\n        if nums[i] in num_set:\n            return True\n        num_set.add(nums[i])\n    return False"], [0.9262169599533081, "def contains_duplicates(lst):\n    \"\"\"\n    Given an array of integers, find if the array contains any duplicates.\n    Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.\n    \n    Example 1:\n    Input: [1,2,3,1]\n    Output: true\n    \n    Example 2:\n    Input: [1,2,3,4]\n    Output: false\n    \n    Example 3:\n    Input: [1,1,1,3,3,4,3,2,4,\"\"\"\n    seen = {}  # We'll use a dictionary to keep track of seen elements\n\n    for item in lst:\n        if item in seen:\n            return True  # If we find a duplicate, we return True\n        seen[item] = True  # Otherwise, mark the element as seen\n\n    return False  # If no duplicates found, return False"], [0.924727201461792, "def contains_duplicates(arr):\n    \"\"\"\n    Given an array of integers, find if the array contains any duplicates.\n    Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.\n    \n    Args:\n       arr(list): input array\n    Returns:\n       bool: True if any are duplicated in the array, False otherwise\n    \"\"\"\n    seen = set()\n    for el in arr:\n        if el in seen:\n            return True\n        else:\n            seen.add(el)\n    return False"]]}
{"task_id": 9, "problem": []}
{"task_id": 10, "problem": [[0.9182089567184448, "def f(n, multiple):\n    \"\"\"\n    Return a list of multiples of multiple up to and including n.\n    \"\"\"\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    def f(n, multiple):\n    \"\"\"\n    Return a list of multiples of multiple up to and including n.\n    \"\"\"\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"]]}
{"task_id": 11, "problem": [[0.9360371828079224, "def find_duplicate(arr):\n    \"\"\"\n    Find a duplicate in a given array of integers.\n    \"\"\"\n    elements_seen = set()\n\n    for element in arr:\n        if element in elements_seen:\n            return element\n        else:\n            elements_seen.add(element)\n    return None\n    \n    def find_duplicate(arr):\n    \"\"\"\n    Find a duplicate in a given array of integers.\n    \"\"\"\n    elements_seen = set()\n\n    for element in arr:\n        if element in elements_seen:\n            return element\n        else:\n            elements_seen.\"\"\"\n    elements_seen = set()\n\n    for element in arr:\n        if element in elements_seen:\n            print(\"Found duplicate\")\n        else:\n            elements_seen.add(element)"], [0.9269710779190063, "def find_duplicate(nums):\n    \"\"\"\n    Given a list of integers, finds the first duplicate number within the list.\n\n    Args:\n    - nums: a list of integers\n\n    Returns:\n    - the first duplicate number found within the list\n    - -1 if no duplicates are found\n\n    Time Complexity:\n    - O(nlogn), where n is the number of integers in the list\n\n    Space Complexity:\n    - O(1)\n    \"\"\"\n    nums.sort()\n    for i in range(1, len(nums)):\n        if nums[i] == nums[i-1]:\n            return nums[i]\n    return -1"], [0.9262967109680176, "def find_duplicate(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    # Sort the array to bring duplicate elements together\n    nums.sort()\n\n    # Iterate through the array to find duplicates\n    for i in range(len(nums)-1):\n        # If adjacent elements are equal, return the duplicate element\n        if nums[i] == nums[i+1]:\n            return nums[i]\n\n    # If no duplicates found, return -1\n    return -1"], [0.9258524179458618, "def find_duplicate(A: List[int]) -> int:\n    \"\"\"\n    Find a duplicate in a list of integers in O(n) time and O(1) space.\n    :param A: List of integers\n    :return: Duplicate integer\n    \"\"\"\n    seen = set()\n    for i in A:\n        if i in seen:\n            return i\n        seen.add(i)\n    return -1"], [0.9250427484512329, "def find_duplicate(nums: List[int]) -> int:\n    \"\"\"\n    Find the duplicate number in the given array.\n    :param nums: List of integers\n    :return: The duplicate number\n    \"\"\"\n    num_count = {}\n    for num in nums:\n        if num in num_count:\n            num_count[num] += 1\n        else:\n            num_count[num] = 1\n        if num_count[num] > 1:\n            return num\n    return -1  # If no duplicate is found"]]}
{"task_id": 12, "problem": [[0.926188588142395, "def max_sum_list(list_of_lists):\n    \"\"\"\n    Find the list in list_of_lists with the largest sum of elements.\n    >>> max_sum_list([[1, 2, 3], [3, 2, 1], [2, 3, 1]])\n    [3, 2, 1]\n    \"\"\"\n    max_sum = None\n    max_list = None\n    for lst in list_of_lists:\n        if max_sum is None or sum(lst) > max_sum:\n            max_sum = sum(lst)\n            max_list = lst\n    return max_list"], [0.9065106511116028, "def max_sum(arr):\n    \"\"\"\n    Write a function that takes in a 2-dimensional array of integers and returns the maximum sum of any of its subarrays.\n    A subarray can be any contiguous subsection of the array.\n    \n    Sample Input\n    arr = [\n      [5, 3, -1, 5],\n      [-7, 3, 7, 4],\n      [8, 5, 9, 2]\n    ]\n    \n    Sample Output\n    29\n    \n    \"\"\"\n    sum_list = [sum(row) for row in arr]\n    max_element = max(sum_list)\n    return max_element"], [0.9023380279541016, "def find_max_nested(list1, list2, list3):\n    \"\"\"\n    Find the maximum number of elements in a list of lists\n    \"\"\"\n    max_num_elm = 0\n    for lst in [list1, list2, list3]:\n        cur_num_elm = max([len(s) for s in lst])\n        if cur_num_elm > max_num_elm:\n            max_num_elm = cur_num_elm\n    return max_num_elm\n    def find_max_nested(list1, list2, list3):\n    \"\"\"\n    Find the maximum number of elements in a list\"\"\"\n    max_num_elm = 0\n    for lst in [list1, list2, list3]:\n        cur_num_elm = max([len(s) for s in lst])\n        if cur_num_elm > max_num_elm:\n            max_num_elm = cur_num_elm\n    return max_num_elm"]]}
{"task_id": 13, "problem": []}
{"task_id": 14, "problem": []}
{"task_id": 15, "problem": [[0.9035768508911133, "def check_tuple(tuples):\n    \"\"\"\n    Check if a tuple contains a string 'k'\n    :param tuples: a list of tuples\n    :return: True if a tuple contains a string 'k'\n    \"\"\"\n    for t in tuples:\n        if 'k' in t:\n            return True\n    return False"]]}
{"task_id": 16, "problem": [[0.9025259613990784, "def remove_digits_special_chars(string):\n    \"\"\"\n    Remove all digits and special characters from a string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if not char.isdigit() and not char.isalpha():\n            new_string += char\n    return new_string\n    \n    def remove_digits(string):\n    \"\"\"\n    Remove all digits from a string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if not char.isdigit():\n            new_string += char\n    return new_string\n    \n    def remove_special_chars(\"\"\"\n    new_string = \"\"\n    for char in string:\n        if char.islower():\n            new_string += char\n    return new_string"]]}
{"task_id": 17, "problem": []}
{"task_id": 18, "problem": [[0.922247588634491, "def find_odd(arr):\n    \"\"\"\n    Given an array of integers, find the integer that appears an odd number of times.\n    There will always be only one integer that appears an odd number of times.\n    \"\"\"\n    # define a dictionary to store the frequency of each number\n    freq = {} \n\n    # iterate over the array\n    for num in arr:\n        # if num is not in the dictionary, initialize it with 1, else increment it\n        freq[num] = freq.get(num, 0) + 1 \n\n    # iterate over the array again\n    for num in arr:\n        # if the count of num in the dictionary is odd, return num\n        if freq[num] % 2 != 0: \n            return num\n\n    # if no odd count numbers are found, return None\n    return None  "], [0.9154081344604492, "def find_odd_occurrence(arr):\n    \"\"\"\n    Find the number that occurs an odd number of times in the array.\n    :param arr: List of integers\n    :return: Integer\n    \"\"\"\n    result = 0\n    for num in arr:\n        result ^= num\n    return result"]]}
{"task_id": 19, "problem": [[0.905217707157135, "def count_strings(lst):\n    \"\"\"\n    Return the count of the number of strings where the string length is 2 or more and the first and last character are the same.\n    \n    >>> count_strings(['aba', 'xyz', 'aa', 'x', 'bbb'])\n    3\n    >>> count_strings(['', 'x', 'xy', 'xyx', 'xx'])\n    2\n    >>> count_strings(['aaa', 'be', 'abc', 'hello'])\n    1\n    \"\"\"\n    count = 0\n    \n    # Iterate through the list\n    for s in lst:\n        # Check if string length is greater than 2 and first and last character is same\n        if len(s) >= 2 and s[0] == s[-1]:\n            count += 1\n    \n    return count"]]}
{"task_id": 20, "problem": [[0.9234486818313599, "def k_most_frequent(nums, k):\n    \"\"\"\n    Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.\n\n    Example 1:\n    Input: nums = [1,1,1,2,2,3], k = 2\n    Output: [1,2]\n\n    Example 2:\n    Input: nums = [1], k = 1\n    Output: [1]\n    \"\"\"\n    # Step 1: Create a hashmap to count the frequency of each element\n    counter = Counter(nums)\n\n    # Step 2: Create a min heap to store the k most frequent elements\n    heap = []\n\n    # Step 3: Iterate through the hashmap and add elements to the min 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    # Step 4: Return the k most frequent elements\n    return [num for count, num in heap]"], [0.9198451042175293, "def topKFrequent(nums, k):\n    \"\"\"\n    :type nums: List[int]\n    :type k: int\n    :rtype: List[int]\n    \"\"\"\n    # Step 1: Create a hash map to store the frequency count of each element\n    freq_map = defaultdict(int)\n    \n    # Step 2: Update the frequency count in the hash map\n    for num in nums:\n        freq_map[num] += 1\n    \n    # Step 3: Create a min heap to store the k most frequent elements\n    min_heap = []\n    \n    # Step 4: Iterate through the hash map\n    for num, freq in freq_map.items():\n        # Step 4a: Add the key to the heap if heap size < k\n        if len(min_heap) < k:\n            heapq.heappush(min_heap, (freq, num))\n        else:\n            # Step 4b: Compare the frequency count with the root element of the heap\n            if freq > min_heap[0][0]:\n                heapq.heappop(min_heap)\n                heapq.heappush(min_heap, (freq, num))\n    \n    # Step 6: Iterate through the heap to get the k most frequent elements\n    result = []\n    while min_heap:\n        result.append(heapq.heappop(min_heap)[1])\n    \n    return result[::-1] # Reverse the result to get the desired order"], [0.9178884029388428, "def topKFrequent(nums, k):\n    \"\"\"\n    :type nums: List[int]\n    :type k: int\n    :rtype: List[int]\n    \"\"\"\n    # Step 1: Create a hash map to store the frequency of each element\n    freq_map = {}\n    for num in nums:\n        freq_map[num] = freq_map.get(num, 0) + 1\n\n    # Step 2: Create a min heap to store the k most frequent elements\n    min_heap = []\n    for num, freq in freq_map.items():\n        heapq.heappush(min_heap, (freq, num))\n        if len(min_heap) > k:\n            heapq.heappop(min_heap)\n\n    # Step 3: Create the result array\n    result = []\n    while min_heap:\n        result.append(heapq.heappop(min_heap)[1])\n\n    # Step 4: Reverse the result array to maintain non-increasing order of frequency\n    result.reverse()\n\n    return result"]]}
{"task_id": 21, "problem": []}
{"task_id": 22, "problem": [[0.9317243695259094, "def decimal_to_binary(num): \n    \"\"\"\n    Function to convert decimal number to binary\n    \"\"\"\n    if num > 1:\n        decimal_to_binary(num//2) \n    print(num % 2, end='')\n    \n    def decimal_to_binary(num): \n    \"\"\"\n    Function to convert decimal number to binary\n    \"\"\"\n    if num > 1:\n        decimal_to_binary(num//2) \n    print(num % 2, end='')"], [0.9303419589996338, "def dec_to_bin(num): \n    \"\"\"\n    Convert decimal to binary\n    \"\"\"\n    if num > 1: \n        dec_to_bin(num // 2) \n    print(num % 2, end = '')\n    def dec_to_bin(num): \n    \"\"\"\n    Convert decimal to binary\n    \"\"\"\n    if num > 1: \n        dec_to_bin(num // 2) \n    print(num % 2, end = '')"], [0.927934467792511, "def dec2bin(num): \n    \"\"\"\n    Convert decimal to binary \n    \"\"\"\n    if num > 1: \n        dec2bin(num // 2) \n    print(num % 2, end = '') \n    \n    def dec2bin(num): \n    \"\"\"\n    Convert decimal to binary \n    \"\"\"\n    if num > 1: \n        dec2bin(num // 2) \n    print(num % 2, end = '') "], [0.9221658706665039, "def convert_to_binary(num):\n    \"\"\"\n    Convert a decimal number to binary\"\"\"\n    if num == 0:\n        return\n    else:\n        convert_to_binary(num//2)\n        print(num % 2, end=\"\")"], [0.9191741943359375, "def binary_conversion(n):\n    \"\"\"\n    This function converts a decimal number to binary\"\"\"\n    if n == 0:\n        return '0'\n    elif n == 1:\n        return '1'\n    else:\n        return binary_conversion(n // 2) + str(n % 2)"]]}
{"task_id": 23, "problem": [[0.9274944067001343, "def find_missing(arr): \n    \"\"\"\n    Find the missing number in a given integer array of 1 to 100\n    \"\"\"\n    arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37\"\"\"\n    arr.sort() \n    for i in range(len(arr)): \n        if (arr[i+1] - arr[i] != 1): \n            return arr[i] + 1"], [0.927086353302002, "def missing_nums(arr):\n    \"\"\"\n    Given an array of sorted numbers, find the missing number in the array.\n    The array contains numbers in the range of 1 to 100.\n    The array is sorted in ascending order.\n    \n    Input: [1, 2, 4, 5, 6, 7, 9]\n    Output: 3\n    \n    Input: [1, 2, 3, 4, 6, 7, 8, 9, 10]\n    Output: 5\n    \n    Input: [1, \"\"\"\n    n = len(arr)\n    for i in range(n - 1):\n        expected_num = arr[i] + 1\n        if arr[i + 1] != expected_num:\n            return expected_num\n    return None"], [0.926863431930542, "def find_missing_element(arr, missing):\n    \"\"\"\n    Find the missing element in a given array.\n    \n    Args:\n        arr: a sorted array of integers\n        missing: the missing element\n    \n    Returns:\n        The missing element\n    \"\"\"\n    sorted_arr = sorted(arr)\n    curr = sorted_arr[0]\n    for element in sorted_arr[1:]:\n        if element != (curr + 1):\n            return curr + 1\n        else:\n            curr = element\n    return missing"]]}
{"task_id": 24, "problem": [[0.8955259323120117, "def triangular_number(n):\n    \"\"\"\n    Return the nth triangular number.\n    \n    >>> triangular_number(1)\n    1\n    >>> triangular_number(2)\n    3\n    >>> triangular_number(3)\n    6\n    >>> triangular_number(10)\n    55\n    \"\"\"\n    return n * (n + 1) // 2"], [0.8918617367744446, "def triangular_number(n):\n    \"\"\"\n    Return the nth triangular number.\n    \n    >>> triangular_number(0)\n    0\n    >>> triangular_number(1)\n    1\n    >>> triangular_number(2)\n    3\n    >>> triangular_number(3)\n    6\n    >>> triangular_number(10)\n    55\n    >>> triangular_number(100)\n    5050\n    >>> triangular_number(1000)\n    500500\n    >>> triangular_number(10000)\n    5000\"\"\"\n    if n < 0:\n        raise ValueError(\"n must be a non-negative integer.\")\n    return n * (n + 1) // 2"]]}
{"task_id": 25, "problem": [[0.8829457759857178, "def find_longest_repeating_decimal(n):\n    \"\"\"\n    Find the longest repeating decimal of a number\n    :param n: number\n    :return: longest repeating decimal\n    \"\"\"\n    maxi = 0\n    maxidx = 0\n    for d in range(2, n):\n        remainders = []\n        num = 1\n        count = 0\n        while num != 0 and num not in remainders:\n            remainders.append(num)\n            num *= 10\n            num %= d\n            count += 1\n        if num != 0 and count > maxi:\n            maxi = count\n            maxidx = d\n    return maxidx"], [0.8812135457992554, "def fraction_to_base_n(num, base, precision):\n    \"\"\"\n    Convert a fraction to a base-n number.\n    \n    num: a fraction\n    base: a positive integer\n    precision: a positive integer\n    \n    Returns a string.\n    \"\"\"\n    chars = \"0123456789ABCDEF\"\n    \n    result = \"\"\n    \n    for _ in range(precision):\n        num = num * base\n        digit = int(num)\n        result += chars[digit]\n        num -= digit\n    \n    return result"], [0.8768733739852905, "def fraction_to_decimal(numerator, denominator):\n    \"\"\"\n    Convert a fraction to a decimal.\n    \"\"\"\n    if numerator == 0:\n        return \"0\"\n    res = []\n    if (numerator > 0) ^ (denominator > 0):\n        res.append(\"-\")\n    num = abs(numerator)\n    den = abs(denominator)\n    res.append(str(num // den))\n    num %= den\n    if num == 0:\n        return \"\".join(res)\n    res.append(\".\")\n    map = {}\n    while num:\n        if num in map:\n            \"\"\"\n    if numerator == 0:\n        return \"0\"\n    res = []\n    if (numerator > 0) ^ (denominator > 0):\n        res.append(\"-\")\n    num = abs(numerator)\n    den = abs(denominator)\n    res.append(str(num // den))\n    num %= den\n    if num == 0:\n        return \"\".join(res)\n    res.append(\".\")\n    map = {}\n    while num:\n        if num in map:\n            res.insert(map[num], \"(\")\n            res.append(\")\")\n            break\n        map[num] = len(res)\n        num *= 10\n        res.append(str(num // den))\n        num %= den\n    return \"\".join(res)"]]}
{"task_id": 26, "problem": [[0.9186805486679077, "def sort_mixed_list(lst):\n    \"\"\"\n    Sort a list of numbers and strings.\n    Numbers come first. Strings are sorted alphabetically.\n    \"\"\"\n    return sorted(lst, key=lambda x: (not isinstance(x, int), x))\n    \n    def sort_mixed_list(lst):\n    \"\"\"\n    Sort a list of numbers and strings.\n    Numbers come first. Strings are sorted alphabetically.\n    \"\"\"\n    return sorted(lst, key=lambda x: int(''.join(filter(str.isdigit, x))))"]]}
{"task_id": 27, "problem": [[0.9184417724609375, "def divide_list(l):\n    \"\"\"\n    \"\"\"\n    odd_list = []\n    even_list = []\n    for num in l:\n        if num % 2 == 0: \n            even_list.append(num)\n        else:\n            odd_list.append(num)\n    return even_list, odd_list"], [0.9156134128570557, "def find_even_odd(nums):\n  \"\"\"\n  Given a list of numbers, return a tuple containing two lists. The first list should contain all even numbers in the original list in the same order they appeared. The second list should contain all odd numbers in the original list in the same order they appeared.\n  \n  Example:\n  \n  find_even_odd([1,2,3,4,5,6])\n  \n  return ([2,4,6],[1,3,5])\n  \"\"\"\n  even_list = []\n  odd_list = []\n  for num in nums:\n    if num % 2 == 0:\n      even_list.append(num)\n    else:\n      odd_list.append(num)\n  \n  return even_list, odd_list"]]}
{"task_id": 28, "problem": [[0.9126439094543457, "def can_rearrange_to_palindrome(s):\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    For example, \"aabb\" -> true, \"abc\" -> false\n    You can only rearrange characters, you can't add or remove any.\n    \"\"\"\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    return odd_count <= 1"], [0.9063710570335388, "def can_form_palindrome(s):\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    For example, \"abcba\" can be rearranged to form \"abcba\", but \"abca\" cannot.\n    \"\"\"\n    char_counts = {}\n    for char in s:\n        if char not in char_counts:\n            char_counts[char] = 1\n        else:\n            char_counts[char] += 1\n    odd_counts = 0\n    for count in char_counts.values():\n        if count % 2 != 0:\n            odd_counts += 1\n    if odd_counts > 1:\n        return False\n    return True"], [0.905531644821167, "def can_form_palindrome(string):\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    \n    For example,\n    \"abcba\" can be rearranged to form \"abcba\", but \"abca\" cannot be rearranged to form a palindrome.\n    \n    Return true if the string can be rearranged to form a palindrome, otherwise return false.\n    \"\"\"\n    # Create a count array to store count of characters\n    count_map = [0]*256  # Assuming ASCII characters\n \n    # Traverse through given string and increment\n    # count of characters in count_map.\n    for char in string:\n        count_map[ord(char)] += 1\n \n    # Count odd occurring characters\n    odd_count = 0\n    for count in count_map:\n        if count % 2 != 0:\n            odd_count += 1\n    \n    # Return true if the count of odd occurrences is less than or equal to 1.\n    return odd_count <= 1"], [0.9051216840744019, "def is_palindrome_possible(string):\n    \"\"\"\n    \"\"\"\n    is_palindromeable = False\n\n    for i in range(len(string)):\n        j = len(string) - i - 1\n        if string[i] == string[j]:\n            is_palindromeable = True\n        else: \n            is_palindromeable = False\n            break\n\n    if is_palindromeable:\n        print('It is possible to rearrange the letters in the string to create a palindrome.')\n    else:\n        print('It is not possible to rearrange the letters in the string to create a palindrome.')"], [0.9039062261581421, "def can_form_palindrome(str1):\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    \"\"\"\n    \"\"\"\n    The idea is to count the frequency of each character in the string.\n    If the number of characters with odd frequency is more than 1, then the string cannot form a palindrome.\n    \"\"\"\n    str1 = str1.lower()\n\n    count = [0] * 128\n\n    for i in range(len(str1)):\n        count[ord(str1[i])] += 1\n\n    odd_count = 0\n    for i in range(128):\n        if count[i] % 2 != 0:\n            odd_count += 1\n\n    return odd_count <= 1"], [0.9030259847640991, "def can_form_palindrome(s):\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    \n    For example,\n    \"aabb\" -> true\n    \"abc\" -> false\n    \n    You may assume all characters are in lowercase and the string's length will not exceed 100,000.\n    \"\"\"\n    # Create a dictionary to store the frequency of each character\n    freq = {}\n  \n    # Traverse the given string and count frequency of each character\n    for char in s:\n\n        # If character already present in dictionary, increment its count\n        if char in freq:\n            freq[char] += 1\n        else:\n            # Else add this character to dictionary\n            freq[char] = 1\n  \n    # Count characters with odd count\n    odd = 0\n    for k, v in freq.items():\n\n        # If count is odd, increment odd\n        odd += v & 1\n  \n    # If count of characters with odd count is greater than 1, return false. \n    # Else return true.\n    return odd <= 1"], [0.9006029367446899, "def can_form_palindrome(s):\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    \"\"\"\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    \"\"\"\n    \"\"\"\n    Given a string, determine if it can be rearranged to form a palindrome.\n    \"\"\"\n    char_freq = {}\n    for char in s:\n        if char in char_freq:\n            char_freq[char] += 1\n        else:\n            char_freq[char] = 1\n    odd_count = 0\n    for count in char_freq.values():\n        if count % 2 != 0:\n            odd_count += 1\n        if odd_count > 1:\n            return False\n    return True"]]}
{"task_id": 29, "problem": [[0.9064834117889404, "def count_lists(lst):\n    \"\"\"Main function to count number of lists in a list\"\"\"\n    # Flatten all lists in lst and convert them into tuples\n    lst = [tuple(flatten(sublist)) for sublist in lst if isinstance(sublist, list)]\n    \n    # Get the counts of each tuple\n    return {t: lst.count(t) for t in set(lst)}"], [0.9047269821166992, "def count_lists(l):\n  \"\"\"\n  Given a list of lists, return a dictionary where the keys are the indices of the lists and the values are dictionaries of the items in the list and their counts.\n  \n  For example, given the list [[1, 2, 3], [1, 2, 3], [1, 2, 3, 4]], return {0: {1: 3, 2: 3, 3: 3}, 1: {1: 2, 2: 2, 3: 2}, 2: {1: 1, \"\"\"\n  result = {}\n  for i, sublist in enumerate(l):\n    if type(sublist) == list:\n      inner_dict = {}\n      for item in sublist:\n        if item in inner_dict:\n          inner_dict[item] += 1\n        else:\n          inner_dict[item] = 1\n      result[i] = inner_dict\n  return result"]]}
{"task_id": 30, "problem": []}
{"task_id": 31, "problem": []}
{"task_id": 32, "problem": []}
{"task_id": 33, "problem": [[0.8907791376113892, "def match_pattern(word):\n    \"\"\"\n    Write a regex to match a word that starts with 'Py' and ends with 'on'\n    \"\"\"\n    pattern = r\"^Py[\\\\w]*[a-zA-Z_]$\"\n    if re.match(pattern, word):\n        return True\n    else:\n        return False\n    def match_pattern(word):\n    \"\"\"\n    Write a regex to match a word that starts with 'Py' and ends with 'on'\n    \"\"\"\n    pattern = r\"^Py[\\\\w]*[a-zA-Z_]$\"\n    if re.match(pattern, word):\n        return True\n    else:\n        return False"]]}
{"task_id": 34, "problem": [[0.9321423768997192, "def gcd(arr):\n    \"\"\"\n    Find the greatest common divisor of an array of numbers.\n    \"\"\"\n    def gcd_recursion(a, b):\n        \"\"\"\n        Find the greatest common divisor of two numbers.\n        \"\"\"\n        if b == 0:\n            return a\n        return gcd_recursion(b, a % b)\n    \"\"\"\n    result = arr[0]\n    for i in range(1, len(arr)):\n        result = gcd_recursion(result, arr[i])\n    return result"], [0.9291998147964478, "def gcd(arr):\n    \"\"\"\n    Find the gcd of an array of numbers\n    \"\"\"\n    return gcd_array(arr)\n\n    def gcd_array(arr):\n    \"\"\"\n    Find the gcd of an array of numbers\n    \"\"\"\n    num1=arr[0]\n    num2=arr[1]\n    gcd1,factor1,factor2 = extended_euclid(num1,num2)\n\n    for i in range(2,len(arr)):\n        gcd1,factor1,factor2 = extended_euclid(gcd1,arr[i])\n\n    return gcd1"]]}
{"task_id": 35, "problem": []}
{"task_id": 36, "problem": [[0.895783007144928, "def last_non_zero_digit(n):\n    \"\"\"\n    Last non-zero digit in the factorial of a given number\n    \n    Args:\n        n (int): Given number\n    \n    Returns:\n        int: Last non-zero digit in the factorial of a given number\n    \"\"\"\n    # Array to store last non-zero digit of \n    # factorial of all numbers from 0 to 10\n    res = [1, 1, 2, 6, 4, 2, 2, 4, 2, 8]\n    \n    if (n < 10):\n        return res[n]\n   \n    if (((n//10)%10)%2 == 0):\n        return (6*last_non_zero_digit(n//5)*res[n%10]) % 10\n    else:\n        return (4*last_non_zero_digit(n//5)*res[n%10]) % 10"]]}
{"task_id": 37, "problem": []}
{"task_id": 38, "problem": []}
{"task_id": 39, "problem": [[0.8890246748924255, "def find_min(lst):\n    \"\"\"\n    Find the minimum value in a list of numbers\n    \"\"\"\n    min_val = lst[0] # Initialize the min_val with the first element of the tuple\n    for i in lst:\n        if i < min_val:\n            min_val = i\n    return min_val\n    def find_min(lst):\n    \"\"\"\n    Find the minimum value in a list of numbers\n    \"\"\"\n    min_val = lst[0] # Initialize the min_val with the first element of the tuple\n    for i in lst:\n        if i < min_val:\n            min_val = i\n    return min_val"]]}
{"task_id": 40, "problem": [[0.9134213924407959, "def is_equilateral(a, b, c):\n    \"\"\"\n    Determines if a triangle is equilateral given the lengths of its sides a, b, and c.\n    \"\"\"\n    if a == b and b == c:\n        return True\n    else:\n        return False"], [0.9095579385757446, "def is_equilateral(a, b, c):\n    \"\"\"\n    Return True if all three angles are equal, False otherwise.\n    \"\"\"\n    if a == b == c:\n        return True\n    else:\n        return False"]]}
{"task_id": 41, "problem": [[0.9247100353240967, "def 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"], [0.9125247001647949, "def parallelogram_area(lst):\n    \"\"\"\n    Calculate the area of a parallelogram.\n    \n    Args:\n        lst: list of base and height of the parallelogram.\n    \n    Returns:\n        list of area of the parallelogram.\n    \"\"\"\n    return [round(base * height, 2) for base, height in lst]"], [0.9111216068267822, "def area_of_parallelogram(base, side, alpha):\n    \"\"\"\n    Calculate the area of a parallelogram.\n    \n    :param base: The base of the parallelogram.\n    :param side: The side of the parallelogram.\n    :param alpha: The angle between the base and the side.\n    :return: The area of the parallelogram.\n    \"\"\"\n    return round(base * side * math.sin(math.radians(alpha)))"]]}
{"task_id": 42, "problem": [[0.9115945100784302, "def first_last_same(string):\n    \"\"\"\n    Checks if the first and last characters of the string are the same.\n    \n    Args:\n        string (str): The string to be examined\n        \n    Returns:\n        bool: True if the first and last characters are the same, False otherwise\n    \"\"\"\n    if len(string) < 2:\n        return False\n\n    return string[0] == string[-1]"]]}
{"task_id": 43, "problem": []}
{"task_id": 44, "problem": [[0.9193241596221924, "def nth_term(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))"]]}
{"task_id": 45, "problem": []}
{"task_id": 46, "problem": [[0.8939317464828491, "def maxNumber(arr):\n    \"\"\"\n    :type arr: List[int]\n    :rtype: int\n    \"\"\"\n    arr.sort(reverse=True)\n    numStr = \"\"\n    for a in arr:\n        numStr += str(a)\n    return int(numStr)"]]}
{"task_id": 47, "problem": [[0.8881471157073975, "def same_magnitude(x, y):\n    \"\"\"\n    Return True if x and y have the same magnitude, False otherwise.\n    \n    >>> same_magnitude(5, 7)\n    False\n    >>> same_magnitude(-1, 1)\n    True\n    >>> same_magnitude(2.2, -4.5)\n    True\n    \"\"\"\n    if abs(x) == abs(y):\n        return True\n    else:\n        return False"]]}
{"task_id": 48, "problem": [[0.8962805271148682, "def heptagonal_number(n):\n    \"\"\"\n    Returns the nth heptagonal number.\n    \n    >>> heptagonal_number(1)\n    1\n    >>> heptagonal_number(2)\n    7\n    >>> heptagonal_number(3)\n    18\n    >>> heptagonal_number(10)\n    125\n    \"\"\"\n    return n*(5*n - 3)/2 "]]}
{"task_id": 49, "problem": [[0.910391092300415, "def longestSubsequence(arr, n):\n    \"\"\"\n    :param arr: given array\n    :param n: size of array\n    :return: return the length of longest subsequence\n    \"\"\"\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"], [0.9098790884017944, "def longestSubsequence(arr, difference):\n    \"\"\"\n    :type arr: List[int]\n    :type difference: int\n    :rtype: int\n    \"\"\"\n    dp = {}\n    maxLength = 0\n    for num in arr:\n        dp[num] = dp.get(num - difference, 0) + 1\n        maxLength = max(maxLength, dp[num])\n    return maxLength"], [0.9098753929138184, "def longestSubsequence(arr, difference):\n    \"\"\"\n    :type arr: List[int]\n    :type difference: int\n    :rtype: int\n    \"\"\"\n    dp = {}\n    maxLength = 0\n    for num in arr:\n        dp[num] = dp.get(num - difference, 0) + 1\n        maxLength = max(maxLength, dp[num])\n    return maxLength"], [0.9093453884124756, "def longestSubsequence(arr, difference):       \n    \"\"\"\n    :type arr: List[int]\n    :type difference: int\n    :rtype: int\n    \"\"\"\n    dp = {}\n    for elem in arr:\n        if elem - difference in dp:\n            dp[elem] = dp[elem - difference] + 1\n        else:\n            dp[elem] = 1\n    return max(dp.values())"], [0.9032495021820068, "def longest_subarray(arr):\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    Returns:\n        int: Length of the longest subarray.\n    \"\"\"\n    cur_length = 1\n    max_length = 1\n\n    for i in range(1, len(arr)):\n        if arr[i] - 1 == arr[i-1]:\n            cur_length += 1\n        else:\n            if cur_length > max_length:\n                max_length = cur_length\n            cur_length = 1\n\n    if cur_length > max_length:\n        max_length = cur_length\n\n    return max_length"]]}
{"task_id": 50, "problem": []}
{"task_id": 51, "problem": [[0.9370683431625366, "def find_smallest_num(lst):\n    \"\"\"\n    Find the smallest number in a list.\n    \n    Args:\n        lst: a list of numbers\n    \n    Returns:\n        The smallest number in the list.\n    \"\"\"\n    return min(lst)"], [0.9311667680740356, "def smallest_num(numbers): \n    \"\"\"\n    Find the smallest number in a list of numbers\n    \"\"\"\n    smallest = numbers[0]\n    for number in numbers:\n        if number < smallest:\n            smallest = number\n    return smallest\n    def smallest_num(numbers): \n    \"\"\"\n    Find the smallest number in a list of numbers\n    \"\"\"\n    smallest = numbers[0]\n    for number in numbers:\n        if number < smallest:\n            smallest = number\n    return smallest"], [0.9308810234069824, "def find_smallest(arr):\n    \"\"\"\n    Find the smallest number in a list\n    \"\"\"\n    smallest = arr[0]\n    for num in arr:\n        if num < smallest:\n            smallest = num\n    return smallest\n    def find_smallest(arr):\n    \"\"\"\n    Find the smallest number in a list\n    \"\"\"\n    smallest = arr[0]\n    for num in arr:\n        if num < smallest:\n            smallest = num\n    return smallest"], [0.9308220148086548, "def find_smallest(nums):\n    \"\"\"\n    Find the smallest number in a list.\n    \n    Args:\n        nums: a list of numbers\n    \n    Returns:\n        The smallest number in the list.\n    \"\"\"\n    return min([num for num in nums])"], [0.9286795258522034, "def find_smallest(arr):\n    \"\"\"\n    Find the smallest number in a list.\n    \n    :param arr: a list of numbers\n    :return: the smallest number in the list\n    \"\"\"\n    smallest = None\n    for n in arr:\n        if smallest is None or n < smallest:\n            smallest = n\n    return smallest"], [0.9277645945549011, "def find_smallest_number(lst):\n  \"\"\"\n  Find the smallest number in a list.\n  \n  Args:\n    lst: a list of numbers\n  \n  Returns:\n    The smallest number in the list.\n  \"\"\"\n  smallest = lst[0]\n  for number in lst:\n    if number < smallest:\n      smallest = number\n  return smallest"], [0.9277079105377197, "def find_min(lst):\n    \"\"\"\n    Find the minimum element in a list.\n    \n    Args:\n        lst: A list of numbers.\n    \n    Returns:\n        The minimum element in the list.\n    \"\"\"\n    return min(lst)"]]}
{"task_id": 52, "problem": [[0.910883903503418, "def findMaxDifference(arr):\n    \"\"\"\n    Find the maximum difference between two elements in an array\n    such that the larger element appears after the smaller number.\n    \"\"\"\n    max_1, max_2 = arr[0], arr[0]\n    for num in arr[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\n    return max_1 - max_2\n    def findMaxDifference(arr):\n    \"\"\"\n    Find the maximum difference between two elements in\"\"\"\n    max_1, max_2 = arr[0], arr[0]\n    for num in arr[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\n    return max_1, max_2"], [0.9034507870674133, "def max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in an array.\n    \n    Args:\n        arr (list): The input array.\n        \n    Returns:\n        int: The maximum difference between any two elements in the array.\n    \"\"\"\n    # Initialize the maximum difference to 0\n    max_diff = 0\n    \n    # Loop through the array \n    for i in range(len(arr) - 1):\n        for j in range(i + 1, len(arr)):\n            # Calculate the difference between the current pair of elements\n            diff = arr[j] - arr[i]    \n                \n            # Update the maximum difference if needed\n            if diff > max_diff:\n                max_diff = diff\n                \n    # Return the maximum difference\n    return max_diff"], [0.9033412933349609, "def max_difference(numbers):\n    \"\"\"\n    Find the maximum difference between any two elements in a list of numbers.\n    \n    Args:\n       numbers(list): list of numbers\n    Returns:\n       difference (int): maximum difference between any two elements\n    \"\"\"\n    max_diff = 0\n    for i in range(len(numbers)-1):\n        for j in range(i+1, len(numbers)):\n            cur_diff = abs(numbers[i] - numbers[j])\n            if cur_diff > max_diff:\n                max_diff = cur_diff\n    return max_diff"]]}
{"task_id": 53, "problem": []}
{"task_id": 54, "problem": []}
{"task_id": 55, "problem": [[0.9386467933654785, "def countPositive(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    print(\"Number of positive numbers:\", count)"], [0.9309738278388977, "def count_positive(arr):\n    \"\"\"\n    Return the number of positive numbers in an array\n    \"\"\"\n    count = 0\n    for i in arr:\n        if i > 0:\n            count += 1\n    return count\n    def count_positive(arr):\n    \"\"\"\n    Return the number of positive numbers in an array\n    \"\"\"\n    count = 0\n    for i in arr:\n        if i > 0:\n            count += 1\n    return count"], [0.9248071312904358, "def count_positive_nums(arr):\n    \"\"\"\n    Return the count of numbers greater than zero in the list.\n    \n    >>> count_positive_nums([1, 2, 3, -4, 5])\n    4\n    \"\"\"\n    return sum(1 for num in arr if num > 0)"]]}
{"task_id": 56, "problem": [[0.8939943313598633, "def nth_bell_number(n):\n    \"\"\"\n    Return the nth Bell number.\n    \"\"\"\n    return bell_number(n)\n    \n    def bell_number(n):\n    \"\"\"\n    Return the Bell number of order n.\n    \"\"\"\n    Bell = [[0 for i in range(n+1)] for j in range(n+1)]\n    Bell[0][0] = 1\n    for i in range(1, n+1):\n        Bell[i][0] = Bell[i-1][i-1]\n        for j in range(1, i+1):\n            Bell[i][j] = Bell[i-1][j-1] + Bell[i][j-1]\n\n    return Bell[n][0]"], [0.8939656615257263, "def bell_number(n: int) -> int:\n    \"\"\"\n    Return the Bell number of n.\n    \n    >>> bell_number(0)\n    1\n    >>> bell_number(1)\n    1\n    >>> bell_number(2)\n    2\n    >>> bell_number(3)\n    5\n    >>> bell_number(4)\n    15\n    >>> bell_number(5)\n    52\n    >>> bell_number(6)\n    203\n    >>> bell_number(7)\n    877\n    >>> bell_number(8)\n    4140\"\"\"\n    check_input(n)\n    bell_matrix = [[0 for i in range(n+1)] for j in range(n+1)]\n    bell_matrix[0][0] = 1\n    for i in range(1, n+1):\n        bell_matrix[i][0] = bell_matrix[i-1][i-1]\n        for j in range(1, i+1):\n            bell_matrix[i][j] = bell_matrix[i-1][j-1] + bell_matrix[i][j-1]\n    return bell_matrix[n][0]"], [0.8934227824211121, "def bell_number(n: int) -> int:\n    \"\"\"\n    Return the Bell number of n.\n    \n    >>> bell_number(0)\n    1\n    >>> bell_number(1)\n    1\n    >>> bell_number(2)\n    2\n    >>> bell_number(3)\n    5\n    >>> bell_number(4)\n    15\n    >>> bell_number(5)\n    52\n    >>> bell_number(6)\n    203\n    >>> bell_number(7)\n    877\n    >>> bell_number(8)\n    4140\"\"\"\n    check_input(n)\n    bell_matrix = [[0 for i in range(n+1)] for j in range(n+1)]\n    bell_matrix[0][0] = 1\n    for i in range(1, n+1):\n        bell_matrix[i][0] = bell_matrix[i-1][i-1]\n    for j in range(1, i+1):\n        bell_matrix[i][j] = bell_matrix[i-1][j-1] + bell_matrix[i][j-1]\n    return bell_matrix[n][0]"], [0.8874837160110474, "def nth_bell_number(n):\n    \"\"\"\n    Return the nth Bell number.\n    \n    >>> nth_bell_number(1)\n    1\n    >>> nth_bell_number(2)\n    2\n    >>> nth_bell_number(3)\n    5\n    >>> nth_bell_number(4)\n    15\n    >>> nth_bell_number(5)\n    52\n    \"\"\"\n    Bell = [[0 for _ in range(n+1)] for j in range(n+1)]\n    Bell[0][0] = 1\n    for i in range(1, n+1):\n        Bell[i][0] = Bell[i-1][i-1]\n        for j in range(1, i+1):\n            Bell[i][j] = Bell[i-1][j] + Bell[i][j-1]\n\n    return Bell[n][0]"]]}
{"task_id": 57, "problem": [[0.9157615900039673, "def isMonotonic(A):\n    \"\"\"\n    :type A: List[int]\n    :rtype: bool\n    \"\"\"\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)))"], [0.9119415283203125, "def isIncreasing(arr): \n    \"\"\"\n    Given an array of integers, determine whether the array is monotonic or not.\n    An array is monotonic if it is either monotone increasing or monotone decreasing.\n    \n    Example 1:\n    Input: arr = [1,2,2,3]\n    Output: true\n    \n    Example 2:\n    Input: arr = [6,5,4,4]\n    Output: true\n    \n    Example 3:\n    Input: arr = [1,3,2]\n    Output: false\n    \n    Example 4:\n    Input: arr\"\"\"\n    for i in range(len(arr)-1): \n        if arr[i] > arr[i+1]: \n            return False\n      \n    return True"], [0.9085062742233276, "def check_monotonic(list):\n    \"\"\"\n    Check if a list is monotonic\n    :param list: list of numbers\n    :return: True if monotonic, False otherwise\n    \"\"\"\n    is_monotonic = True\n    for i in range(len(list)-1):\n        if(list[i] > list[i+1]):\n            is_monotonic = False\n    return is_monotonic"], [0.9009613990783691, "def monotonic(l: list, strict: bool = False) -> bool:\n    \"\"\"\n    Returns True if the list is monotonic.\n    \n    >>> monotonic([1, 2, 3, 4, 5])\n    True\n    >>> monotonic([5, 4, 3, 2, 1])\n    True\n    >>> monotonic([1, 2, 3, 2, 1])\n    False\n    >>> monotonic([1, 2, 3, 4, 5], strict=True)\n    True\n    >>> monotonic([5, 4, 3, 2, 1], strict=True)\n\"\"\"\n    if len(l) < 2:\n        return True\n    \n    if strict:\n        return all(x < y for x, y in zip(l, l[1:])) or all(x > y for x, y in zip(l, l[1:]))\n    else:\n        return all(x <= y for x, y in zip(l, l[1:])) or all(x >= y for x, y in zip(l, l[1:]))"], [0.899867832660675, "def monotonic(l: list, strict: bool = False):\n    \"\"\"\n    This function determines if the sequence of elements in the list is either monotonically increasing or decreasing, considering the strictness criterion put in place.\n    If the strict parameter is assigned to be True, consecutive elements are not allowed to be identical; however, if it's False, they may be the same.\n\n    >>> monotonic([1, 2, 4, 20])\n    True\n    >>> monotonic([1, 20, 4, 10])\n    False\n    >>> monotonic([4, 1, 1, 0, -10], strict=True)\n    False\n    >>> monotonic([1, 1, 1, 1], strict=False)\n    True\n    \"\"\"\n    # Initialize flags for increasing and decreasing\n    increasing = decreasing = True\n\n    # Loop through the list to check sequence\n    for i in range(len(l) - 1):\n        # If strict is True\n        if strict:\n            if l[i] > l[i + 1]:\n                increasing = False\n            elif l[i] < l[i + 1]:\n                decreasing = False\n        # If strict is False\n        else:\n            if l[i] >= l[i + 1]:\n                increasing = False\n            elif l[i] <= l[i + 1]:\n                decreasing = False\n\n        # If list is not increasing and not decreasing, return False\n        if not increasing and not decreasing:\n            return False\n\n    # If the function has not returned yet, it means the list is either increasing or decreasing.\n    return True"], [0.8998265266418457, "def monotonic(l: list, strict: bool = False):\n    \"\"\"\n    This function determines if the sequence of elements in the list is either monotonically increasing or decreasing, considering the strictness criterion put in place.\n    If the strict parameter is assigned to be True, consecutive elements are not allowed to be identical; however, if it's False, they may be the same.\n\n    >>> monotonic([1, 2, 4, 20])\n    True\n    >>> monotonic([1, 20, 4, 10])\n    False\n    >>> monotonic([4, 1, 1, 0, -10], strict=True)\n    False\n    >>> monotonic([1, 1, 1, 1], strict=False)\n    True\n    \"\"\"\n    # Initialize flags for increasing and decreasing\n    increasing = decreasing = True\n\n    # Loop through the list to check sequence\n    for i in range(len(l) - 1):\n        # If strict is True\n        if strict:\n            if l[i] <= l[i + 1]:\n                increasing = False\n            elif l[i] >= l[i + 1]:\n                decreasing = False\n        # If strict is False\n        else:\n            if l[i] < l[i + 1]:\n                increasing = False\n            elif l[i] > l[i + 1]:\n                decreasing = False\n\n    # If list is not increasing and not decreasing, return False\n    if not increasing and not decreasing:\n        return False\n\n    # If the function has not returned yet, it means the list is either increasing or decreasing.\n    return True"]]}
{"task_id": 58, "problem": []}
{"task_id": 59, "problem": [[0.9007546901702881, "def all_same_length(strings):\n    \"\"\"\n    Return True if all the strings in the list have the same length.\n    >>> all_same_length(['one', 'two', 'three'])\n    False\n    >>> all_same_length(['one', 'two', 'three', 'four'])\n    False\n    >>> all_same_length(['one', 'two', 'three', 'four', 'five'])\n    True\n    \"\"\"\n    for i in range(1,len(strings)):\n        if len(strings[0]) != len(strings[i]):\n            return False\n    return True"]]}
{"task_id": 60, "problem": [[0.9060235023498535, "def comb_sort(arr):\n    \"\"\"\n    Comb sort algorithm\n    \n    Args:\n        arr (list): list of numbers\n    \"\"\"\n    gap = len(arr)\n    swapped = True\n\n    while gap > 1 or swapped is True:\n        gap = max(1, int(gap/1.3))\n        swapped = False\n        \n        for i in range(len(arr)-gap):\n            if arr[i] > arr[i+gap]:\n                arr[i], arr[i+gap] = arr[i+gap], arr[i]\n                swapped = True"], [0.8977251052856445, "def combSort(arr):\n    \"\"\"\n    Comb sort algorithm\n    :param arr: list\n    :return: list\n    \"\"\"\n    gap = len(arr)\n    swapped = True\n\n    while gap > 1 or swapped:\n        gap = int(gap / 1.3)\n        if gap < 1:\n            gap = 1\n        swapped = False\n\n        for i in range(len(arr) - gap):\n            if arr[i] > arr[i + gap]:\n                arr[i], arr[i + gap] = arr[i + gap], arr[i]\n                swapped = True\n\n    return arr"], [0.889298677444458, "def comb_sort(arr):\n    \"\"\"\n    Comb sort algorithm\n    :param arr: array\n    :return: sorted array\n    \"\"\"\n    gap = len(arr)\n    shrink_factor = 1.3\n    sorted = False\n\n    while not sorted:\n        gap = int(gap / shrink_factor)\n        if gap <= 1:\n            gap = 1\n            sorted = True\n\n        i = 0\n        while i + gap < len(arr):\n            if arr[i] > arr[i + gap]:\n                arr[i], arr[i + gap] = arr[i + gap], arr[i]\n                sorted = False\n            i += 1\n\n    return arr"]]}
{"task_id": 61, "problem": []}
{"task_id": 62, "problem": [[0.9037225842475891, "def split_string(s, delimiters):\n    \"\"\"\n    Split a string by one or more delimiters.\n    \n    :param s: string to split\n    :param delimiters: list of delimiters\n    :return: list of substrings\n    \"\"\"\n    return re.split('|'.join(map(re.escape, delimiters)), s)"], [0.9037133455276489, "def split_string(s, delimiters):\n    \"\"\"\n    Split a string by one or more delimiters.\n    \n    :param s: string to split\n    :param delimiters: list of delimiters\n    :return: list of substrings\n    \"\"\"\n    return re.split('|'.join(map(re.escape, delimiters)), s)"]]}
{"task_id": 63, "problem": [[0.8919104337692261, "def match_character_sequence(sequence):\n    \"\"\"\n    Match the given sequence\"\"\"\n    pattern = re.compile('abbccd')\n    match = pattern.match(sequence)\n    \n    if match:\n        return True\n    \n    return False"]]}
{"task_id": 64, "problem": [[0.8944212794303894, "def count_multiples(lst, k):\n    \"\"\"\n    Given a list of numbers and a number k, return multiple_counts which contains all numbers in the list that have a count that is a multiple of k.\n    \n    For example, given [12, 17, 18, 10, 17, 14, 12, 17, 14, 12, 10, 14] and k = 3, return {12: 3, 14: 4}.\n    \n    If there are no numbers with a count that is a multiple of\"\"\"\n    multiples_dict = {}\n    for i in lst:\n        if i in multiples_dict:\n            multiples_dict[i] += 1\n        else:\n            multiples_dict[i] = 1\n    \n    multiple_counts = {}\n    for element, count in multiples_dict.items():\n        if count % k == 0:\n            multiple_counts[element] = count // k\n    \n    return multiple_counts"]]}
{"task_id": 65, "problem": []}
{"task_id": 66, "problem": [[0.8969037532806396, "def even_odd_sum_and_count(num):\n    \"\"\"\n    Given a number, find the sum of even digits and odd digits separately and return them in a dictionary.\n    The keys of the dictionary should be 'even' and 'odd' respectively.\n    \"\"\"\n    # Your code here\n    \"\"\"\n    Given a number, find the sum of even digits and odd digits separately and return them in a dictionary.\n    The keys of the dictionary should be 'even' and 'odd' respectively.\n    \"\"\"\n    even_sum = 0\n    odd_sum = 0\n    even_count = 0\n    odd_count = 0\n    for digit in str(abs(num)):\n        if int(digit) % 2 == 0:\n            even_sum += int(digit)\n            even_count += 1\n        else:\n            odd_sum += int(digit)\n            odd_count += 1\n    return { \"even\": {'sum' : even_sum, 'count' : even_count}, \"odd\": { 'sum': odd_sum, 'count' : odd_count}}"], [0.8930492997169495, "def even_odd_count(num):\n    \"\"\"\n    This function accepts a number and returns the count of even and odd digits in the number\n    \"\"\"\n    even_count = 0\n    odd_count = 0\n    # we should ignore the negative sign if the number is negative\n    num = abs(num)\n    for digit in str(num):\n        if int(digit) % 2 == 0:\n            even_count += 1\n        else:\n            odd_count += 1\n    return (even_count, odd_count)"]]}
{"task_id": 67, "problem": []}
{"task_id": 68, "problem": [[0.899071216583252, "def is_odd(n):\n    \"\"\"\n    Return True if n is odd, False otherwise\n    \"\"\"\n    if n % 2 == 0:\n        return \"Even\"\n    else:\n        return \"Odd\""]]}
{"task_id": 69, "problem": [[0.9245641231536865, "def tetra(n):\n    \"\"\"\n    Compute the first n tetrahedral numbers.\n    \n    Parameters\n    ----------\n    n : int\n        The number of tetrahedral numbers to compute.\n        \n    Returns\n    -------\n    tetra_list : list\n        A list of the first n tetrahedral numbers.\n    \"\"\"\n    if n < 0:\n        return \"Input must be a non-negative integer.\"\n\n    # Base cases\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+1]"], [0.9135174751281738, "def tetra(n):\n    \"\"\"\n    Returns the first n tetra numbers\n    :param n: number of tetra numbers\n    :return: list of tetra numbers\n    \"\"\"\n    if n<1:\n        return []\n    sequence = [1,4]\n    for num in range(2, n+1): # Finding the tetra values for each num until n\n        if num % 2 == 0:\n            value = 1 + num // 2\n        elif num % 3 == 0:\n            value = sequence[-1] + sequence[-2]\n        else:\n            value = sequence[-1] + sequence[-2] + sequence[-3]\n        sequence.append(value) # Appending it in the list\n    return sequence[:n+1] # N+1 values"], [0.903485119342804, "def tetra(n):\n    \"\"\"\n    Returns the first n terms of the tetranacci sequence.\n    \n    Args:\n        n (int): number of terms to return\n    \n    Returns:\n        list: first n terms of the tetranacci sequence\n    \"\"\"\n    #Initialize list with initial tetranacci numbers\n    tetra_sequence = [0, 4, 2, 6, 3] \n    for i in range(5, n+1):\n        if i % 2 == 0: #even-indexed term\n            tetra_sequence.append(1 + i // 2) \n        elif i % 3 == 0: #term divisible by 3\n            tetra_sequence.append(tetra_sequence[i-1] + tetra_sequence[i-2]) \n        else: #remaining odd-index terms\n            tetra_sequence.append(tetra_sequence[i-1] + tetra_sequence[i-2] + tetra_sequence[i-3]) \n    return tetra_sequence[1:n+1] #return required sequence"]]}
{"task_id": 70, "problem": [[0.8930747509002686, "def zip_two_lists(list1, list2):\n    \"\"\"\n    \"\"\"\n    return zip(list1, list2)"]]}
{"task_id": 71, "problem": [[0.9224098920822144, "def vol_sphere(r):\n    '''Calculate the volume of a sphere with a given radius'''\n    return (4/3) * math.pi * r**3"]]}
{"task_id": 72, "problem": []}
{"task_id": 73, "problem": [[0.9048193097114563, "def hofstadter_conway(n):\n    \"\"\"\n    Returns the Hofstadter-Conway sequence up to the nth term.\n    \n    Args:\n        n (int): The number of terms to generate.\n    \n    Returns:\n        list: The Hofstadter-Conway sequence up to the nth term.\n    \"\"\"\n    C = [0, 1, 1] # start with the first three values\n    for i in range(3, n + 1):\n        C.append(C[i - C[i-1]] + C[i - C[i-2]]) # calculate the next value in the sequence\n    return C[1:] # return the sequence starting from the 1st value"], [0.9027669429779053, "def find_nth_number(n):\n    \"\"\"\n    Find the nth number in the sequence.\n    The sequence starts with 1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, 13, 17, 12, 19, 17, 23, 15, 25, 21, 29, 20, 31, 25, 35, 28, 37, 30, 41, 3\"\"\"\n    if n == 1:\n        return 1\n    elif n == 2:\n        return 2\n    else:\n        res = 2\n        pre = 1\n        for _ in range(3, n + 1):\n            res, pre = res + pre, res\n        return res"]]}
{"task_id": 74, "problem": [[0.9256902933120728, "def sphere_surface_area(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 "], [0.9234554171562195, "def sphere_surface_area(radius):\n    '''\n    Computes the surface area of a sphere given its radius\n    '''\n    return 4 * 3.14 * (radius ** 2)"], [0.9168764352798462, "def calculate_surface_area(radius):\n    \"\"\"\n    Calculate the surface area of a sphere.\n    \n    Args:\n        radius (float): The radius of the sphere.\n        \n    Returns:\n        float: The surface area of the sphere.\n    \"\"\"\n    surface_area = 4 * 3.14159 * (radius ** 2)\n    return round(surface_area, 2)"], [0.9090690612792969, "def calculate_surface_area(radius):\n    '''\n    This function calculates the surface area of a sphere given a radius. \n    It checks to ensure that the radius is a positive number.\n    '''\n    if not isinstance(radius, (int, float)):\n        raise TypeError(\"The radius must be a numeric value.\")\n    elif radius < 0:\n        raise ValueError(\"The radius cannot be negative.\")\n    \n    surface_area = 4 * math.pi * (radius ** 2)\n    return round(surface_area, 2)"]]}
{"task_id": 75, "problem": [[0.8908417820930481, "def isHexagonal(num):\n    \"\"\"\n    Returns True if num is a hexagonal number, False otherwise.\n    \n    >>> isHexagonal(1)\n    True\n    >>> isHexagonal(2)\n    False\n    >>> isHexagonal(17)\n    True\n    >>> isHexagonal(22)\n    False\n    >>> isHexagonal(145)\n    True\n    >>> isHexagonal(146)\n    False\n    \"\"\"\n    return (1 + math.sqrt(1 + 8 * num)) % 4 == 0"]]}
{"task_id": 76, "problem": []}
{"task_id": 77, "problem": [[0.9206169843673706, "def frequency(my_list): \n    \"\"\"\n    The frequency function takes a list as an argument and returns a list of tuples where the first element is the element from the original list and the second element is the frequency of that element in the list.\n    \n    For example, if the argument is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\"\"\"\n    frequency_list = [] \n    for item in my_list: \n        if item not in frequency_list: \n            frequency_list.append(item) \n  \n    for i in range(0, len(frequency_list)): \n        frequency_list[i] = (frequency_list[i], my_list.count(frequency_list[i])) \n          \n    return frequency_list"]]}
{"task_id": 78, "problem": [[0.899041473865509, "def get_next_lower(arr, num):\n  \"\"\"\n  Find the closest number in the array that is lower than the given number.\n  \n  Args:\n    arr: an array of integers\n    num: an integer\n  \n  Returns:\n    The closest number in the array that is lower than the given number.\n  \"\"\"\n  closest_low = 0\n  for i in range(len(arr)):\n    if num > arr[i] > closest_low:\n      closest_low = arr[i]\n  \n  return closest_low"]]}
{"task_id": 79, "problem": [[0.9320865869522095, "def longest_word(sentence):\n    \"\"\"\n    Find the longest word in a sentence\n    \"\"\"\n    words = sentence.split()\n    max_len = len(words[0])\n    longest_word = words[0]\n    for word in words[1:]:\n        if len(word) > max_len:\n            max_len = len(word)\n            longest_word = word\n    return longest_word\n    def longest_word(sentence):\n    \"\"\"\n    Find the longest word in a sentence\n    \"\"\"\n    words = sentence.split()\n    max_len = len(words[0])\n    longest_word = words[0]\n    for word in words[1:]:\n        if len(word) > max_len:\n            max_len = len(word)\n            longest_word = word\n    return longest_word"]]}
{"task_id": 80, "problem": []}
{"task_id": 81, "problem": []}
{"task_id": 82, "problem": [[0.9248223304748535, "def 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"], [0.9152974486351013, "def power(a, b):\n    \"\"\"\n    Calculate a to the power of b\n    \"\"\"\n    result = 1\n    if b >= 0:\n        for _ in range(b):\n            result *= a\n    else:\n        for _ in range(-b):\n            result /= a\n    return result\n    def power(a, b):\n    \"\"\"\n    Calculate a to the power of b\n    \"\"\"\n    result = 1\n    if b >= 0:\n        for _ in range(b):\n            result *= a\n    else:\n        for _ in range(-b):\n            result /= a\n    return result"], [0.9126012921333313, "def exponentiation(a, b):\n    \"\"\"Returns a to the power of b\"\"\"\n    return float('%.3f' % (pow(a, b)))"], [0.9087669849395752, "def exponentiation(a, b):\n    \"\"\"return a to the power of b\"\"\"\n    return float('%.3f'%(exp(b * log(a))))"]]}
{"task_id": 83, "problem": [[0.8870929479598999, "def find_min_k_records(tup_list, k):\n    \"\"\"\n    Find the minimum k records from a list of tuples.\n    :param tup_list: List of tuples.\n    :param k: Number of records to return.\n    :return: List of tuples.\n    \"\"\"\n    if len(tup_list) == 0:\n        return \"The tuple list is empty.\"\n    if k > len(tup_list):\n        return \"K is greater than the size of list. Returning all records.\"\n    tup_list.sort(key=lambda x: x[0])\n    return tup_list[:k]"], [0.8815889954566956, "def find_min(lst):\n    \"\"\"\n    Find the minimum value in a list of numbers\n    \"\"\"\n    min_val = lst[0] # Initialize the min_val with the first element of the tuple\n    for i in lst:\n        if i < min_val:\n            min_val = i\n    return min_val\n    def find_min(lst):\n    \"\"\"\n    Find the minimum value in a list of numbers\n    \"\"\"\n    min_val = lst[0] # Initialize the min_val with the first element of the tuple\n    for i in lst:\n        if i < min_val:\n            min_val = i\n    return min_val"], [0.8760649561882019, "def find_min(tpl):\n    \"\"\"\n    Find the minimum value in a tuple\n    :param tpl: tuple\n    :return: minimum value\n    \"\"\"\n    min_value = tpl[0]  # We start from the first element\n    for i in tpl:\n        if i < min_value:\n            min_value = i  # If we found a lesser value, we update our minimum\n    return min_value"], [0.8760641813278198, "def find_min(tpl):\n    \"\"\"\n    Find the minimum value in a tuple\n    :param tpl: tuple\n    :return: minimum value\n    \"\"\"\n    min_value = tpl[0]  # We start from the first element\n    for i in tpl:\n        if i < min_value:\n            min_value = i  # If we found a lesser value, we update our minimum\n    return min_value"]]}
{"task_id": 84, "problem": []}
{"task_id": 85, "problem": [[0.9340718984603882, "def divisor_count(n): \n    \"\"\"\n    Count the number of divisors of a positive integer\n    :param n: a positive integer\n    :return: the number of divisors of n\n    :rtype: int\n    :Example:\n    >>> divisor_count(10)\n    4\n    >>> divisor_count(13)\n    2\n    >>> divisor_count(28)\n    6\n    >>> divisor_count(17)\n    2\n    >>> divisor_count(100000000000000000000000000\"\"\"\n    # Get divisors for a number\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"], [0.9302680492401123, "def count_divisors(num):\n    \"\"\"\n    This function takes an integer and returns the number of divisors it has.\n    \n    >>> count_divisors(10)\n    4\n    >>> count_divisors(12)\n    6\n    >>> count_divisors(13)\n    2\n    \"\"\"\n    count = 0\n    for i in range(1, num + 1):\n        if num % i == 0:\n            count += 1\n    return count"], [0.9268606901168823, "def count_number_divisors(x): \n    \"\"\"\n    This function takes an integer x and returns the number of divisors of x.\n    \n    Parameters\n    ----------\n    x : int\n        The number to count the divisors of.\n    \n    Returns\n    -------\n    int\n        The number of divisors of x.\n    \"\"\"\n    count = 0\n    for i in range(1, x+1): \n        if x % i == 0: \n            count = count + 1\n    return count"], [0.926322340965271, "def divisor_count(n) :\n    \"\"\"\n    Count the number of divisors of a positive integer\n    :param n: a positive integer\n    :return: the number of divisors of n\n    :rtype: int\n    \"\"\"\n    # Get divisors for a number\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    "]]}
{"task_id": 86, "problem": [[0.9128949642181396, "def count_lists(lst):\n    \"\"\"Main function to count number of lists in a list\"\"\"\n    # Flatten all lists in lst and convert them into tuples\n    lst = [tuple(flatten(sublist)) for sublist in lst if isinstance(sublist, list)]\n    \n    # Get the counts of each tuple\n    return {t: lst.count(t) for t in set(lst)}"], [0.9087579250335693, "def count_lists(l):\n  \"\"\"\n  Given a list of lists, return a dictionary where the keys are the indices of the lists and the values are dictionaries of the items in the list and their counts.\n  \n  For example, given the list [[1, 2, 3], [1, 2, 3], [1, 2, 3, 4]], return {0: {1: 3, 2: 3, 3: 3}, 1: {1: 2, 2: 2, 3: 2}, 2: {1: 1, \"\"\"\n  result = {}\n  for i, sublist in enumerate(l):\n    if type(sublist) == list:\n      inner_dict = {}\n      for item in sublist:\n        if item in inner_dict:\n          inner_dict[item] += 1\n        else:\n          inner_dict[item] = 1\n      result[i] = inner_dict\n  return result"], [0.9044976830482483, "def count_lists(lst: List[Any]) -> dict:\n    \"\"\"\n    Count the number of times each list appears in a list of lists.\n    \n    Args:\n        lst (List[Any]): A list of lists.\n    \n    Returns:\n        dict: A dictionary mapping each list to the number of times it appears in the list of lists.\n    \"\"\"\n    freq_dict = defaultdict(int)\n    for item in lst:\n        if isinstance(item, list):\n            item = flatten(item)\n            freq_dict[tuple(item)] += 1\n    return freq_dict"]]}
{"task_id": 87, "problem": []}
{"task_id": 88, "problem": [[0.9300466775894165, "def decimal_to_binary(num): \n    \"\"\"\n    Function to convert decimal number to binary\n    \"\"\"\n    if num > 1:\n        decimal_to_binary(num//2) \n    print(num % 2, end='')\n    \n    def decimal_to_binary(num): \n    \"\"\"\n    Function to convert decimal number to binary\n    \"\"\"\n    if num > 1:\n        decimal_to_binary(num//2) \n    print(num % 2, end='')"], [0.9279680252075195, "def dec_to_bin(num): \n    \"\"\"\n    Convert decimal to binary\n    \"\"\"\n    if num > 1: \n        dec_to_bin(num // 2) \n    print(num % 2, end = '')\n    def dec_to_bin(num): \n    \"\"\"\n    Convert decimal to binary\n    \"\"\"\n    if num > 1: \n        dec_to_bin(num // 2) \n    print(num % 2, end = '')"]]}
{"task_id": 89, "problem": [[0.9328644275665283, "def next_largest_palindrome(num):\n    \"\"\"\n    Return the next largest palindrome number for a given number.\n    :param num: str\n    :return: str\n    \"\"\"\n    # convert string to a number\n    num = int(num)\n    # increment number by 1\n    num += 1\n    while not is_palindrome(str(num)):\n        # increment number by 1\n        num += 1\n\n    return num"], [0.9300032258033752, "def nextPalindrome(num: str) -> str:\n    \"\"\"\n    Given an integer num, find the smallest palindrome greater than or equal to num.\n    \n    If no such palindrome exists, return an empty string.\n    \n    \n    \n    Example 1:\n    \n    Input: num = \"121\"\n    Output: \"221\"\n    \n    \n    Example 2:\n    \n    Input: num = \"199999999999999999999999999999999999999999\"\"\"\n    n = len(num)\n    first_half = num[:(n + 1) // 2]\n    candidates = sorted(set(int(\"\".join(p)) for p in permutations(first_half)))\n\n    for c in candidates:\n        c_str = str(c)\n        second_half = c_str[::-1]\n        if n % 2 == 1: second_half = second_half[1:]\n        candidate_str = c_str + second_half\n\n        if candidate_str > num:\n            return candidate_str\n\n    return \"\""], [0.9299936294555664, "def nextPalindrome(num: str) -> str:\n    \"\"\"\n    Given an integer num, find the smallest palindrome greater than or equal to num.\n    \n    If no such palindrome exists, return an empty string.\n    \n    \n    \n    Example 1:\n    \n    Input: num = \"121\"\n    Output: \"221\"\n    \n    \n    Example 2:\n    \n    Input: num = \"199999999999999999999999999999999999999999\"\"\"\n    n = len(num)\n    first_half = num[:(n + 1) // 2]\n    candidates = sorted(set(int(\"\".join(p)) for p in permutations(first_half)))\n\n    for c in candidates:\n        c_str = str(c)\n        second_half = c_str[::-1]\n        if n % 2 == 1: second_half = second_half[1:]\n        candidate_str = c_str + second_half\n\n        if candidate_str > num:\n            return candidate_str\n\n    return \"\""], [0.9275603294372559, "def find_next_palindrome(N):\n    \"\"\"\n    Find the next palindrome number greater than N.\n    \n    Args:\n        N (int): The starting number.\n    \n    Returns:\n        int: The next palindrome number.\n    \"\"\"\n    # Increment N by 1 and check if it is a palindrome\n    N += 1\n    while not is_palindrome(N):\n        N += 1\n    \n    return N"]]}
{"task_id": 90, "problem": []}
{"task_id": 91, "problem": []}
{"task_id": 92, "problem": [[0.8815024495124817, "def S(n, m):\n    \"\"\"\n    \"\"\"\n    return ((m * (n * (n + 1)) // 2) % 1234567891)"]]}
{"task_id": 93, "problem": []}
{"task_id": 94, "problem": [[0.8903680443763733, "def count_sheeps(sheep):\n    \"\"\"\n    \"\"\"\n    total = 0\n    for i in sheep:\n        if i == True:\n            total += 1\n    return total"]]}
{"task_id": 95, "problem": []}
{"task_id": 96, "problem": []}
{"task_id": 97, "problem": []}
{"task_id": 98, "problem": [[0.8836989402770996, "def count_binary(s):\n    \"\"\"\n    \"\"\"\n    count = 0\n    current = s[0]\n    prev = ''\n    for el in s:\n        if el == current:\n            if prev == '1':\n                count += 1\n            prev = el\n        else:\n            current = el\n            prev = el \n    return count"]]}
{"task_id": 99, "problem": [[0.893462061882019, "def find_missing_ranges(nums: List[int], lower: int, upper: int) -> List[str]:\n    \"\"\"\n    Find missing ranges in a sorted integer array.\n    \n    Args:\n        nums (List[int]): Sorted integer array.\n        lower (int): Lower bound of the range.\n        upper (int): Upper bound of the range.\n    \n    Returns:\n        List[str]: List of missing ranges.\n    \"\"\"\n    result = []\n    prev = lower - 1\n\n    for i, num in enumerate(nums + [upper + 1]):\n        if num - prev >= 2:\n            result.append(f\"{prev + 1}\" + (\"\" if num - prev == 2 else \"->\") + f\"{num - 1}\")\n        prev = num\n\n    return result"], [0.8934407234191895, "def find_missing_ranges(nums: List[int], lower: int, upper: int) -> List[str]:\n    \"\"\"\n    Find missing ranges in a sorted integer array.\n    \n    Args:\n        nums (List[int]): Sorted integer array.\n        lower (int): Lower bound of the range.\n        upper (int): Upper bound of the range.\n    \n    Returns:\n        List[str]: List of missing ranges.\n    \"\"\"\n    result = []\n    prev = lower - 1\n\n    for i, num in enumerate(nums + [upper + 1]):\n        if num - prev >= 2:\n            result.append(f\"{prev + 1}\" + (\"\" if num - prev == 2 else \"->\") + f\"{num - 1}\")\n        prev = num\n\n    return result"], [0.8876484632492065, "def find_ranges(nums, start, end):\n    \"\"\"\n    Find the ranges of consecutive numbers in a sorted array.\n    :param nums: a sorted array of integers\n    :param start: the start of the range\n    :param end: the end of the range\n    :return: a list of strings representing the ranges\n    \"\"\"\n    result = []\n    if start < nums[0]:\n        if start + 1 == nums[0]:\n            result.append(str(start))\n        else:\n            result.append(f\"{start}->{nums[0]-1}\")\n    for i in range(len(nums) - 1):\n        if nums[i] + 1 < nums[i + 1]:\n            if nums[i] + 2 == nums[i + 1]:\n                result.append(str(nums[i] + 1))\n            else:\n                result.append(f\"{nums[i]+1}->{nums[i+1]-1}\")\n    if nums[-1] < end:\n        if nums[-1] + 1 == end:\n            result.append(str(end))\n        else:\n            result.append(f\"{nums[-1]+1}->{end}\")\n    return result"], [0.8862160444259644, "def missing_elements(L, start, end):\n    \"\"\"\n    Find all missing elements in a sorted array.\n    \n    Args:\n        L: a sorted array of unique integers\n        start: index of the start of the array to search\n        end: index of the end of the array to search\n    \n    Returns:\n        A list of missing elements in the array.\n    \"\"\"\n    if start > end:\n        return []\n\n    if start == end:\n        if L[start] == start:\n            return []\n        else:\n            return [start]\n\n    mid = start + (end - start) // 2\n\n    if L[mid] > mid:\n        return missing_elements(L, start, mid) + missing_elements(L, mid+1, end)\n    else:\n        return missing_elements(L, mid+1, end)"]]}
{"task_id": 100, "problem": [[0.9339838027954102, "def nested_common(list1, list2):\n    \"\"\"Function to extract nested common elements.\"\"\"\n    list1_flat = set(flatten(list1))\n    list2_flat = set(flatten(list2))\n    \n    common = list1_flat.intersection(list2_flat)\n    \n    return list(common)"]]}
{"task_id": 101, "problem": []}
{"task_id": 102, "problem": [[0.916590690612793, "def check_string(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"]]}
{"task_id": 103, "problem": [[0.9071215391159058, "def frequency(my_list): \n    \"\"\"\n    The frequency function takes a list as an argument and returns a list of tuples where the first element is the element from the original list and the second element is the frequency of that element in the list.\n    \n    For example, if the argument is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\"\"\"\n    frequency_list = [] \n    for item in my_list: \n        if item not in frequency_list: \n            frequency_list.append(item) \n  \n    for i in range(0, len(frequency_list)): \n        frequency_list[i] = (frequency_list[i], my_list.count(frequency_list[i])) \n          \n    return frequency_list"], [0.8928298354148865, "def frequency_sort(lst):\n    \"\"\"\n    Given a list of numbers, return a list where\n    each element is the count of occurrence of a number.\n    \n    >>> frequency_sort([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\"\"\"\n    count_dict = {}\n    for i in lst:\n        if i in count_dict:\n            count_dict[i] += 1\n        else:\n            count_dict[i] = 1\n    freq_lst = [(key, value) for key, value in count_dict.items()]\n    freq_lst = sorted(freq_lst, key= lambda x: (-x[1], x[0]))\n    return freq_lst"]]}
{"task_id": 104, "problem": []}
{"task_id": 105, "problem": [[0.8873040080070496, "def int_to_int(int_list):\n    \"\"\"\n    \"\"\"\n    return int(''.join(str(e) for e in int_list))"]]}
{"task_id": 106, "problem": [[0.9067257642745972, "def convert_to_float(list_):\n    \"\"\"\n    Converts all the elements in the list to float\n    \n    Args:\n        list_ (list): list of numbers\n    \n    Returns:\n        list: list of numbers converted to float\n    \"\"\"\n    return [float(i) for i in list_]"]]}
{"task_id": 107, "problem": []}
{"task_id": 108, "problem": []}
{"task_id": 109, "problem": [[0.9183452129364014, "def max_product_pair(lst):\n    \"\"\"\n    Find the pair of elements in a list that have the maximum product.\n    \n    Args:\n        lst: a list of integers\n    \n    Returns:\n        A tuple of two integers that have the maximum product.\n    \"\"\"\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]*lst[j] > max_product:\n                max_product = lst[i]*lst[j]\n                pair = (lst[i], lst[j])\n    return pair"], [0.9124895334243774, "def max_product_pair(lst):\n    \"\"\"\n    Find the pair of elements in a list that have the maximum product.\n    \n    Args:\n        lst (list): A list of integers.\n    \n    Returns:\n        list: A list containing the two elements with the maximum product.\n    \"\"\"\n    if len(lst) < 2:\n        return None\n    max_product = float('-inf')\n    max_pair = None\n    for pair in combinations(lst, 2):\n         product = pair[0] * pair[1]\n         if product > max_product:\n             max_product = product\n             max_pair = pair\n    return list(max_pair)"], [0.9123547077178955, "def max_product_pairs(lst):\n    \"\"\"\n    Given a list of integers, find all pairs of integers whose product is the maximum product of any pair.\n    \n    Args:\n        lst: list of integers\n    \n    Returns:\n        list of pairs of integers whose product is the maximum product of any pair\n    \"\"\"\n    if not lst:          # check if the list is empty\n        return []\n    #check all possible pairs\n    possible_pairs = [[lst[i], lst[j]] for i in range(len(lst)) for j in range(i+1, len(lst))]\n    #calculate product for each pair\n    products = [pair[0]*pair[1] for pair in possible_pairs]\n    #find maximum product\n    max_product = max(products) \n    #return pairs having maximum product\n    return [possible_pairs[i] for i in range(len(products)) if products[i] == max_product]"]]}
{"task_id": 110, "problem": [[0.9269185066223145, "def findTriplet(arr, sum):\n    \"\"\"\n    :param arr: given array\n    :param sum: given sum\n    :return: boolean\n    \"\"\"\n    n = len(arr)\n    for i in range(0, n - 2):\n        for j in range(i + 1, n - 1):\n            for k in range(j + 1, n):\n                if arr[i] + arr[j] + arr[k] == sum:\n                    return True\n    return False"], [0.9235258102416992, "def find_triplet(array, target):\n    \"\"\"\n    Find a triplet in the array that sums to the target value.\n    \n    Args:\n        array (list): The input array of integers.\n        target (int): The target value to find a triplet for.\n        \n    Returns:\n        list: A list containing the indices of the triplet if found, or an empty list if not found.\n    \"\"\"\n    # Iterate through the array from index 0 to len(array) - 3\n    for i in range(len(array) - 2):\n        # Check if the sum of current element and next two elements equals the target\n        if array[i] + array[i+1] + array[i+2] == target:\n            # Return the indices of the triplet\n            return [i, i+1, i+2]\n    \n    # If no triplet is found, return an empty list\n    return []"], [0.9231307506561279, "def find_three_numbers(array, target):\n    \"\"\"\n    Find if there is a triplet in the array whose sum is equal to the target\n    :param array: list of numbers\n    :param target: target\n    :return: True or False\n    \"\"\"\n    # using combinations function to get all the combinations of 3 numbers in the list \n    for comb in combinations(array, 3):\n        if sum(comb) == target:   # if the sum of a combination is equal to the target\n            return True   # return True and end the function\n    return False   # if no combination found, return False"]]}
{"task_id": 111, "problem": [[0.8918217420578003, "def nthPoliteNumber(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    return findNthPolite(n)"], [0.891810953617096, "def nthPoliteNumber(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    return findNthPolite(n)"]]}
{"task_id": 112, "problem": [[0.9065374135971069, "def find_amicable_pairs(n):\n    \"\"\"\n    Find all amicable pairs up to n.\n    \"\"\"\n    def find_divisors(n):\n    \"\"\"\n    Find all divisors of n.\n    \"\"\"\n    divisors = []\n    for i in range(1, n+1):\n        if n % i == 0:\n            divisors.append(i)\n    return divisors\n    \"\"\"\n    amicable_pairs = []\n    for i in range(2, n+1):\n        divisors_sum = sum(find_divisors(i))\n        if i != divisors_sum and sum(find_divisors(divisors_sum)) == i:\n            if sorted([i, divisors_sum]) not in amicable_pairs:\n                amicable_pairs.append(sorted([i, divisors_sum]))\n    return amicable_pairs"], [0.8983582258224487, "def is_amicable_pair(num1, num2):\n    \"\"\"\n    Check if two given numbers are an amicable pair\n    \"\"\"\n    s1 = 0\n    s2 = 0\n\n    for i in range(1, num1):\n        if num1 % i == 0:\n            s1 += i\n\n    for j in range(1, num2):\n        if num2 % j == 0:\n            s2 += j\n            \n    if s1 == num2 and s2 == num1 and s1 != s2:\n        return True \n    return False"]]}
{"task_id": 113, "problem": []}
{"task_id": 114, "problem": [[0.9032430648803711, "def maxScore(s):\n    \"\"\"\n    :type s: str\n    :rtype: List[int]\n    \"\"\"\n    max_score = 0\n    max_substrings = 0\n    for i in range(1, len(s)):\n        left = s[:i]\n        right = s[i:]\n        #check for consecutive zeros or ones in the left substring\n        if ('000' in left) or ('111' in left):\n            continue\n        score = left.count('0') + right.count('1')\n        substrings = right.split('0')\n        substrings = sum(1 for sub in substrings if sub.startswith('1') and sub.endswith('1'))\n        if score > max_score:\n            max_score = score\n            max_substrings = substrings\n        elif score == max_score:\n            max_substrings = max(max_substrings, substrings)\n    return [max_score, max_substrings]"], [0.9022431373596191, "def max_ones(num):\n    \"\"\"\n    Given a binary string, find the maximum number of consecutive 1's in the string.\n    \n    >>> max_ones('0111000111')\n    3\n    >>> max_ones('1111111111')\n    9\n    >>> max_ones('1001110011')\n    3\n    \"\"\"\n    count = 0\n    result = 0\n    for i in range(len(num)):\n        if num[i] == '1':\n            count += 1\n            result = max(result, count)\n        else:\n            count = 0\n    return result"], [0.8979295492172241, "def findMaxLength(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    max_length, zeroes, ones = 0, 0, 0\n    count_map = {0: -1}\n\n    for i, num in enumerate(nums):\n        if num == 0:\n            zeroes += 1\n        else:\n            ones += 1\n\n        if zeroes - ones not in count_map:\n            count_map[zeroes - ones] = i\n        else:\n            max_length = max(max_length, i - count_map[zeroes - ones])\n\n    return max_length"], [0.8978874683380127, "def findMaxLength(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    max_length, zeroes, ones = 0, 0, 0\n    count_map = {0: -1}\n\n    for i, num in enumerate(nums):\n        if num == 0:\n            zeroes += 1\n        else:\n            ones += 1\n\n        if zeroes - ones not in count_map:\n            count_map[zeroes - ones] = i\n        else:\n            max_length = max(max_length, i - count_map[zeroes - ones])\n\n    return max_length"]]}
{"task_id": 115, "problem": [[0.9058184027671814, "def countCommonDivisors(a, b):\n    \"\"\"\n    Count the number of common divisors of two numbers.\n    \n    Args:\n        a (int): First number.\n        b (int): Second number.\n    \n    Returns:\n        int: Number of common divisors.\n    \"\"\"\n    divisors = []\n    for i in range(1, min(a, b) + 1):\n        if (a % i == 0 and b % i == 0):\n            divisors.append(i)\n    return len(divisors)"], [0.9009144902229309, "def sum_gcd(set1, set2):\n    \"\"\"\n    Given two sets of integers, return the sum of the greatest common divisors of all pairs in the sets.\n    \n    For example, given the following sets:\n    \n    set1 = [4, 6, 8, 10]\n    set2 = [2, 4, 6, 8]\n    \n    The greatest common divisors of all pairs are:\n    \n    4 and 2 = 2\n    6 and 4 = 2\n    8 and 6 = 2\n    10 and 8 = 2\n    \n    \"\"\"\n    return math.gcd(set1[0], set1[1]) + math.gcd(set2[0], set2[1])"]]}
{"task_id": 116, "problem": [[0.9356161952018738, "def multiply(a, b):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    if b == 1:\n        return a\n    return a + multiply(a, subtract(b, 1))\n    def multiply(a, b):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    if b == 0:\n        return 0\n    return a + multiply(a, subtract(b, 1))"], [0.9333585500717163, "def multiply(a, b):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    if a == 0 or b == 0:\n        return 0\n\n    sign = 1 if (a > 0 and b > 0) or (a < 0 and b < 0) else -1\n\n    a = abs(a)\n    b = abs(b)\n    result = 0\n\n    for _ in range(b):\n        result += a\n\n    return result * sign\n    def multiply(a, b):\n    \"\"\"\n    Multiply two numbers without using the *\"\"\"\n    if a == 0 or b == 0:\n        return 0\n\n    sign = 1 if (a > 0 and b > 0) or (a < 0 and b < 0) else -1\n\n    a = abs(a)\n    b = abs(b)\n    result = 0\n\n    for _ in range(b):\n        result += a\n\n    return result * sign"], [0.9331914186477661, "def multiply_without_operator(x, y):\n    \"\"\"\n    This function multiplies two numbers without using the * operator.\n    \"\"\"\n    res = 0\n    while(y > 0):\n        res = res + x\n        y = y - 1\n    return res\n    def multiply_without_operator(x, y):\n    \"\"\"\n    This function multiplies two numbers without using the * operator.\n    \"\"\"\n    res = 0\n    while(y > 0):\n        res = res + x\n        y = y - 1\n    return res"], [0.932662844657898, "def multiply(x, y):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \n    Args:\n        x (int): The first number.\n        y (int): The second number.\n    \n    Returns:\n        int: The product of x and y.\n    \"\"\"\n    result = 0\n    is_negative = (x < 0) ^ (y < 0) # Check if result should be negative\n    x, y = abs(x), abs(y)\n\n    for _ in range(y):\n        result += x\n    \n    if is_negative:\n        result = -result\n    \n    return result"], [0.9308221340179443, "def multiply(a: int, b: int) -> int:\n    \"\"\"\n    Multiply two integers without using the * operator.\n    :param a: The first integer.\n    :param b: The second integer.\n    :return: The product of a and b.\n    \"\"\"\n    result = 0\n    for _ in range(abs(b)):\n        result += a\n    result = -result if ((a < 0 and b > 0) or (a > 0 and b < 0)) else result\n    return result"], [0.9305160045623779, "def multiply(x, y):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    # Initialize result to 0\n    result = 0\n\n    # Handle the negative numbers case\n    if y < 0:\n        y, x = -y, -x\n\n    # Loop through the range from 0 to absolute value of y\n    for _ in range(y):\n        result += x\n\n    return result\n    def multiply(x, y):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    # Initialize result to 0\n    result = 0\n\n    # Handle the negative numbers case\n    if y < 0:\n        y, x = -y, -x\n\n    # Loop through the range from 0 to absolute value of y\n    for _ in range(y):\n        result += x\n\n    return result"], [0.9270467758178711, "def multiply(a, b):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    # handle the case when either input is 0\n    if a == 0 or b == 0:\n        return 0\n\n    # handle the case when either input is negative\n    if a < 0 and b < 0:\n        a = -a\n        b = -b\n    elif a < 0:\n        a, b = b, a\n\n    result = 0\n    for i in range(a):\n        result += b\n\n    return result\n    def multiply(a,\"\"\"\n    # handle the case when either input is 0\n    if a == 0 or b == 0:\n        return 0\n\n    # handle the case when either input is negative\n    if a < 0 and b < 0:\n        a = -a\n        b = -b\n    elif a < 0:\n        a, b = b, a\n\n    result = 0\n    for i in range(a):\n        result += b\n\n    return result"], [0.9269951581954956, "def multiply(x, y):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    if y == 0:\n        return 0\n    if y < 0:\n        return -multiply(x, -y)\n    if x < 0:\n        return -multiply(-x, y)\n    if y % 1 != 0 or x % 1 != 0:\n        return float(x) * float(y)\n    if x > 1000000 or y > 1000000:\n        return x * y\n    \"\"\"\n    if y == 0:\n        return 0\n    if y < 0:\n        return -multiply(x, -y)\n    if x < 0:\n        return -multiply(-x, y)\n    if y % 1 != 0 or x % 1 != 0:\n        return float(x) * float(y)\n    if x > 1000000 or y > 1000000:\n        return x * y\n    return (x << int(y-1).bit_length()) + multiply(x, y - (1 << int(y-1).bit_length()))"], [0.9259232878684998, "def multiply(x, y):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    # Base case\n    if y == 0:\n        return 0\n\n    # Recursive case\n    else:\n        return (x + multiply(x, y-1))\n    def multiply(x, y):\n    \"\"\"\n    Multiply two numbers without using the * operator.\n    \"\"\"\n    # Base case\n    if y == 0:\n        return 0\n\n    # Recursive case\n    else:\n        return (x + multiply(x, y-1))"], [0.9253469705581665, "def product_without_multiply_op(a, b):\n    \"\"\"\n    Write a function that takes two positive integers < 1000 and returns the\n    product. You can not use the * operator.\n    \"\"\"\n    \n    \n    \"\"\"\n    result = 0 \n    for i in range(b):\n        result += a \n    \n    return result"]]}
{"task_id": 117, "problem": [[0.9404537677764893, "def get_long_words(word_list, n):\n  \"\"\"\n  Input: list of words and an integer n\n  Output: list of words that are longer than n\n  \"\"\"\n  return [w for w in word_list if len(w) > n]"], [0.9211826324462891, "def remove_short_words(words: List[str], n: int) -> List[str]:\n    \"\"\"\n    Remove words that are shorter than n.\n    \n    :param words: a list of words\n    :param n: the minimum length of a word\n    :return: a list of words that are at least n characters long\n    \"\"\"\n    return [word for word in words if len(word) >= n]"]]}
{"task_id": 118, "problem": [[0.9086219072341919, "def is_magic_square(mat):\n    \"\"\"\n    Check if a matrix is a magic square.\n    :param mat: a matrix of integers\n    :return: True if the matrix is a magic square, False otherwise\n    \"\"\"\n    sum_diag_1 = 0\n    sum_diag_2 = 0\n    sum_all = sum(mat[0]) # calculate the sum of the first row\n    # check if all the rows have the same sum\n    for row in mat:\n        if sum(row) != sum_all:\n            return False\n    # check if all the columns have the same sum\n    for col in range(3):\n        col_sum = 0\n        for row in range(3):\n            col_sum += mat[row][col]\n        if col_sum != sum_all:\n            return False\n    # check if the first diagonal has the same sum\n    for row in range(3):\n        sum_diag_1 += mat[row][row]\n    if sum_diag_1 != sum_all:\n        return False\n    # check if the second diagonal has the same sum\n    j = 2\n    for row in range(3):\n        sum_diag_2 += mat[row][j]\n        j -= 1\n    if sum_diag_2 != sum_all:\n        return False\n    # if all checks are passed, the matrix is a magic square\n    return True"], [0.907010555267334, "def generate_magic_square(n):\n    \"\"\"\n    Generate a magic square of order n.\n    \"\"\"\n    magic_square = [[0] * n for _ in range(n)]\n\n    num = 1\n    i, j = 0, n // 2\n\n    while num <= n * n:\n        magic_square[i][j] = num\n        num += 1\n        newi, newj = (i - 1) % n, (j + 1) % n\n        if magic_square[newi][newj]:\n            i += 1\n        else:\n            i, j = newi, newj\n\n    for row in magic_square:\n        print(\" \".join(str(x).rjust(len(str(n * n))) for x in row))"], [0.8958832025527954, "def is_magic_square(matrix):\n    \"\"\"\n    Check if a given matrix is a magic square.\n    \n    Args:\n        matrix (list of lists): The matrix to check.\n        \n    Returns:\n        bool: True if the matrix is a magic square, False otherwise.\n    \"\"\"\n    # Get the size of the matrix\n    n = len(matrix)\n    \n    # Check if the matrix is a 3x3 matrix\n    if n != 3:\n        return False\n    \n    # Check if all elements in the matrix are distinct\n    elements = set([int(i) for row in matrix for i in row])\n    if len(elements) != n * n:\n        return False\n    \n    # Check if the sum of each row and each column is equal \n    # to the same number\n    expected_sum = sum(matrix[0])\n    row_sums = [sum(row) for row in matrix]\n    col_sums = [sum(col) for col in zip(*matrix)]\n    if not all(x == expected_sum for x in row_sums) or \\\n       not all(x == expected_sum for x in col_sums):\n        return False\n    \n    # Check if the sum of the two diagonals is the same\n    sum_diagonal1 = 0\n    sum_diagonal2 = 0\n    for i in range(n):\n        sum_diagonal1 += matrix[i][i]\n        sum_diagonal2 += matrix[i][n - i - 1]\n    if sum_diagonal1 != expected_sum or sum_diagonal2 != expected_sum:\n        return False\n    \n    return True"], [0.8945983648300171, "def is_magic_square(matrix):\n    \"\"\"\n    Check if a matrix is a magic square.\n    \n    Args:\n        matrix (list): A matrix represented as a list of lists.\n    \n    Returns:\n        bool: True if the matrix is a magic square, False otherwise.\n    \"\"\"\n    # We convert the matrix into a list of lists for easier manipulation\n    matrix = [m[:] for m in matrix]\n    \n    # Get the size of the square\n    size = len(matrix)\n    \n    # Get the magic constant (the sum in each row, column, or diagonal)\n    magic_constant = sum(matrix[0])\n    \n    # Check rows and columns\n    for i in range(size):\n        if sum(matrix[i]) != magic_constant or sum([row[i] for row in matrix]) != magic_constant:\n            return False\n\n    # Check diagonals\n    if sum(matrix[i][i] for i in range(size)) != magic_constant or sum(matrix[i][size - i - 1] for i in range(size)) != magic_constant:\n        return False\n\n    # If we are here, it means that the matrix is a magic square\n    return True"]]}
{"task_id": 119, "problem": [[0.9380597472190857, "def most_frequent(input_list):\n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    # Your code here\n    # Create a dictionary to store the frequency of each item\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    # Find the most frequent item\n    most_frequent_item = max(frequency_dict, key=frequency_dict.get)\n\n    return most_frequent_item\n    def most_frequent\"\"\"\n    # Create a dictionary to store the frequency of each item\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    # Find the most frequent item\n    most_frequent_item = max(frequency_dict, key=frequency_dict.get)\n\n    return most_frequent_item"], [0.9357403516769409, "def most_frequent_item(lst):\n    \"\"\"\n    Return the most frequent item in a list.\n    \"\"\"\n    # initialize variables\n    max_count = 0\n    max_item = None\n\n    # iterate through the list\n    for i in range(len(lst)):\n        count = 0\n\n        # count occurrences of the current item in the list\n        for j in range(len(lst)):\n            if lst[j] == lst[i]:\n                count += 1\n\n        # check if the current item has higher frequency than the current maximum\n        if count > max_count:\n            max_count\"\"\"\n    max_count = 0\n    max_item = None\n\n    # iterate through the list\n    for i in range(len(lst)):\n        count = 0\n\n        # count occurrences of the current item in the list\n        for j in range(len(lst)):\n            if lst[j] == lst[i]:\n                count += 1\n\n        # check if the current item has higher frequency than the current maximum\n        if count > max_count:\n            max_count = count\n            max_item = lst[i]\n\n    return max_item"], [0.9339750409126282, "def most_frequent(input_list):\n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    \n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    \n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    \n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    \n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    \n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    \n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\"\"\"\n    frequency_dict = {} \n    max_count = 0 \n    max_item = None\n\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        if frequency_dict[item] > max_count:\n            max_count = frequency_dict[item]\n            max_item = item\n    return (max_item, max_count)"]]}
{"task_id": 120, "problem": []}
{"task_id": 121, "problem": []}
{"task_id": 122, "problem": [[0.9004349708557129, "def negative_stats(numbers):\n    \"\"\"\n    Return the number of negative numbers in a list and the sum of all negative numbers.\n    \n    >>> negative_stats([1, -3, 4, -2, 5])\n    (2, -5)\n    \"\"\"\n    negative_nums = [num for num in numbers if num < 0]\n    return len(negative_nums), sum(negative_nums)"], [0.8972134590148926, "def sum_matrix(matrix):\n    \"\"\"\n    Write a function that takes a list of lists of integers and adds up the\n    negative numbers\n    \n    Args:\n       matrix(list of lists of ints): 2-d list of integers containing at least \n                                       one positive integer\n    Returns:\n       int: the sum of the negative integers in matrix.\n    \"\"\"\n    total_sum = 0\n    for row in matrix:\n        for element in row:\n            if element >= 0:\n                total_sum += element\n    return total_sum"], [0.895289957523346, "def negative_list(numbers):\n    \"\"\"\n    Return a list of negative numbers from a list of numbers.\n    \n    >>> negative_list([1, 2, 3, -1, -2, -3])\n    [-1, -2, -3]\n    >>> negative_list([1, 2, 3])\n    []\n    \"\"\"\n    return sorted([num for num in numbers if num < 0])"], [0.892196774482727, "def negative(int_list):\n    \"\"\"\n    Return a list of the negative integers in the input list.\n    \n    >>> negative([1, -2, 3, -4])\n    [-2, -4]\n    \"\"\"\n    return [num for num in int_list if num < 0]"], [0.891535758972168, "def iterate_and_add(list_of_numbers):\n    \"\"\"\n    Iterates through a list of numbers and adds them together.\n    If any of the numbers are negative, the function should return None.\n    \"\"\"\n    total = 0\n    negative_count = 0\n\n    for number in list_of_numbers:\n        total += int(number)\n        if number < 0:\n            negative_count += 1\n\n    return f\"Result: {round(total)}, Negative numbers: {negative_count}\"\n    def iterate_and_add(list_of_numbers):\n    \"\"\"\n    Iterates through a list of\"\"\"\n    total = 0\n    negative_count = 0\n\n    for number in list_of_numbers:\n        total += int(number)\n        if number < 0:\n            negative_count += 1\n\n    return f\"Result: {round(total)}, Negative numbers: {negative_count}\""]]}
{"task_id": 123, "problem": []}
{"task_id": 124, "problem": [[0.9106165170669556, "def isHexagonal(num):\n    \"\"\"\n    Returns True if num is a hexagonal number, False otherwise.\n    \n    >>> isHexagonal(1)\n    True\n    >>> isHexagonal(2)\n    False\n    >>> isHexagonal(17)\n    True\n    >>> isHexagonal(22)\n    False\n    >>> isHexagonal(145)\n    True\n    >>> isHexagonal(146)\n    False\n    \"\"\"\n    return (1 + math.sqrt(1 + 8 * num)) % 4 == 0"], [0.8985764980316162, "def nth_nonagonal(n):\n  \"\"\"\n  Returns the nth nonagonal number.\n  \n  >>> nth_nonagonal(1)\n  1\n  >>> nth_nonagonal(2)\n  6\n  >>> nth_nonagonal(3)\n  18\n  >>> nth_nonagonal(4)\n  36\n  >>> nth_nonagonal(5)\n  63\n  >>> nth_nonagonal(6)\n  99\n  >>> nth_nonagonal(7)\n  144\n  >>> nth_nonagonal(8)\n  198\n  >>> nth_\"\"\"\n  return n*(7*n-5)//2"]]}
{"task_id": 125, "problem": [[0.9269739389419556, "def calculate_electric_bill(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"], [0.9145617485046387, "def calculate_bill(rate, consumption):\n    \"\"\"\n    This function calculates the bill amount based on the rate and consumption.\n    :param rate: The rate per unit of electricity.\n    :param consumption: The total consumption of electricity in units.\n    \"\"\"\n    bill = rate * consumption\n    print(\"Your total electricity bill is Rs. {}\".format(bill))"], [0.9056203365325928, "def calc_elec_bill(one_off, night_rate, standard_rate, total_kwh):\n    \"\"\"\n    Calculate the electricity bill for a given number of kWh.\n    \n    Args:\n        one_off (float): The one-off fee for the electricity bill.\n        night_rate (float): The night rate for the electricity bill.\n        standard_rate (float): The standard rate for the electricity bill.\n        total_kwh (float): The total number of kWh used.\n    \n    Returns:\n        float: The total electricity bill.\n    \"\"\"\n    one_off_fee = one_off\n    night_rate_fee = night_rate * total_kwh\n    standard_rate_fee = standard_rate * total_kwh\n    return one_off_fee + night_rate_fee + standard_rate_fee"]]}
{"task_id": 126, "problem": [[0.8967102766036987, "def count_zeros(list):\n    \"\"\"\n    Return the number of zeros in a list.\n    >>> count_zeros([1, 2, 3, 4, 5])\n    0\n    >>> count_zeros([1, 0, 2, 0, 3])\n    2\n    \"\"\"\n    count = 0\n    for num in list:\n        if num == 0:\n            count += 1\n    return count"], [0.8899387121200562, "def count_zeros(matrix: List[List[int]], strict_zero: bool = False) -> int:\n    \"\"\"The data input is a matrix of integers. The task at hand is to devise a function which can quantify the zero occurrences in the matrix. An optional parameter 'strict_zero' has been added to the function to increase the level of difficulty. If this parameter is turned on (strict_zero=True), the function counts only true zeros, discarding any units that could potentially qualify as false in a boolean context like '' or False. If off (strict_zero=False), these units should also be categorized as zeros.\n\n    Examples:\n    >>> count_zeros([[1, 0, 3], [4, 0, 0]])\n    3\n    >>> count_zeros([[1, '', 3], [4, '0', '-0']])\n    0\n    >>> count_zeros([[1, '', 3], [4, '0', '-0']], False)\n    3\n    \"\"\"    \n    zero_count = 0\n    for row in matrix:\n        for num in row:\n            if (strict_zero and num == 0) or (not strict_zero and not num):\n                zero_count += 1\n    return zero_count"]]}
{"task_id": 127, "problem": []}
{"task_id": 128, "problem": [[0.9303004741668701, "def circumference(r):\n    '''Calculates the circumference of a circle given its radius'''\n    PI = 3.14159\n    return 2* PI * r"], [0.9297464489936829, "def circumference_calc(radius):\n  \"\"\"\n  This function calculates the circumference of a circle.\n  \n  Args:\n    radius: The radius of the circle.\n  \n  Returns:\n    The circumference of the circle.\n  \"\"\"\n  return 2 * 3.14 * radius"], [0.9201474189758301, "def find_circumference(radius):\n    \"\"\"\n    Finds the circumference of a circle with the given radius.\n    :param radius: The radius of the circle.\n    :return: The circumference of the circle.\n    \"\"\"\n    return 2 * math.pi * radius"], [0.9187995195388794, "def circumference_of_circle(radius):\n    \"\"\"\n    This function calculates the circumference of a circle\n    :param radius: radius of the circle\n    :return: circumference of the circle\n    \"\"\"\n    circ = 2 * 3.14 * radius\n    return circ"]]}
{"task_id": 129, "problem": []}
{"task_id": 130, "problem": [[0.8915826082229614, "def pancakeSort(arr):\n    \"\"\"\n    :type arr: List[int]\n    :rtype: List[int]\n    \"\"\"\n    res = []\n    n = len(arr)\n    for i in range(n, 0, -2):\n        m = arr.index(max(arr[:i]))\n        if m != i - 1:\n            arr[0:i] = arr[0:i][::-1]\n            res.append(i)\n        if i > 1:\n            arr[0:i-1] = arr[0:i-1][::-1]\n            res.append(i-1)\n    return res"], [0.8914242386817932, "def pancakeSort(arr):\n    \"\"\"\n    :type arr: List[int]\n    :rtype: List[int]\n    \"\"\"\n    flips = []\n    for size in range(len(arr), 1, -1):\n        maxIdx = arr.index(max(arr[:size]))\n        flips.extend([maxIdx + 1, size])\n        arr[:maxIdx + 1] = reversed(arr[:maxIdx + 1])\n        arr[:size] = reversed(arr[:size])\n    return flips"]]}
{"task_id": 131, "problem": []}
{"task_id": 132, "problem": [[0.9144686460494995, "def count_lists(lst):\n    \"\"\"Main function to count number of lists in a list\"\"\"\n    # Flatten all lists in lst and convert them into tuples\n    lst = [tuple(flatten(sublist)) for sublist in lst if isinstance(sublist, list)]\n    \n    # Get the counts of each tuple\n    return {t: lst.count(t) for t in set(lst)}"], [0.8963185548782349, "def unique_same_elements(lists):\n    \"\"\"\n    Return the number of unique lists in the given list of lists.\n    \n    >>> unique_same_elements([[1, 2, 3], [1, 2, 3], [1, 2, 3], [4, 5, 6]])\n    2\n    >>> unique_same_elements([[1, 2, 3], [1, 2, 3], [4, 5], [6, 7, 8]])\n    3\n    >>> unique_same_elements([[1, 2, 3], [1,\"\"\"\n    unique_lists = {}\n    for lst in lists:\n        if len(set(lst)) == 1 and len(lst)!=0:\n            frozen = frozenset(lst)\n            if frozen in unique_lists:\n                unique_lists[frozen] += 1\n            else:\n                unique_lists[frozen] = 1\n    return sum(unique_lists.values())"]]}
{"task_id": 133, "problem": [[0.9124339818954468, "def absolute_difference_sum(ints):\n    \"\"\"\n    Given an array of ints, find the sum of the absolute difference of all the pairs in the array.\n    For example, [2, 4, 7] -> 10\n    2 & 4: |2 - 4| = 2\n    2 & 7: |2 - 7| = 5\n    4 & 7: |4 - 7| = 3\n    10 = 2 + 5 + 3\n    \n    :param ints: list of ints\n    :return: int\n    \"\"\"\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"], [0.9054545164108276, "def sum_diff_pair(arr):\n    \"\"\"\n    Given an array of integers, find the sum of all pairs of integers whose\n    difference is the same.\n    \n    For example, given the array [1, 2, 3, 4], return 5 because there are two\n    pairs of integers in the array whose difference is 1 (3 - 2 = 1 and 4 - 3 = 1).\n    \n    The function should return 0 for an empty array.\n    \n    The function should return 0 for an array with less than two elements.\n    \n    The function should return 0\"\"\"\n    total = 0\n    for i in range(len(arr)-1):\n        for j in range(i+1, len(arr)):\n            total += abs(arr[i]-arr[j])\n    return total"], [0.9045728445053101, "def absolute_differences_sum(arr: List[int]) -> int:\n    \"\"\"\n    Return the sum of absolute differences between adjacent elements in arr.\n    \n    Args:\n        arr (List[int]): List of integers.\n    \n    Returns:\n        int: Sum of absolute differences between adjacent elements in arr.\n    \"\"\"\n    abs_diff_sum = 0\n    for i in range(len(arr) - 1):\n        abs_diff_sum += abs(arr[i] - arr[i+1])\n    return abs_diff_sum"]]}
{"task_id": 134, "problem": [[0.9390615224838257, "def max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in the array.\n    :param arr: list of integers\n    :return: integer\n    \"\"\"\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"], [0.9377593398094177, "def max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in the array.\n    \n    Args:\n        arr (list): The input array of integers.\n    \n    Returns:\n        int: The maximum difference between any two elements in the array.\n    \"\"\"\n    # Initialize max_difference to a negative value\n    max_difference = -float(\"inf\")\n\n    for i in range(len(arr)):\n        for j in range(i+1, len(arr)):\n            diff = abs(arr[i] - arr[j])\n            if diff > max_difference:\n                max_difference = diff\n    return max_difference"], [0.9359066486358643, "def max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in the array.\n    :param arr: list of integers\n    :return: integer\n    \"\"\"\n    if len(arr) < 2:\n        return 0\n\n    min_val = arr[0]\n    max_diff = 0\n\n    for i in range(1, len(arr)):\n        if arr[i] < min_val:\n            min_val = arr[i]\n        else:\n            diff = arr[i] - min_val\n            if diff > max_diff:\n                max_diff = diff\n\n    return max_diff"], [0.9356594085693359, "def max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in the array.\n    \n    Args:\n        arr (list): List of integers.\n    \n    Returns:\n        int: Maximum difference between any two elements in the array.\n    \"\"\"\n    max_difference = 0\n    for i in range(len(arr)):\n        for j in range(i+1, len(arr)):\n            diff = abs(arr[i] - arr[j])\n            if diff > max_difference:\n                max_difference = diff\n    return max_difference"], [0.9348507523536682, "def find_max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in an array.\n    \n    Args:\n        arr (list): The input array.\n    \n    Returns:\n        int: The maximum difference between any two elements in the array.\n    \"\"\"\n    min_num = arr[0]\n    max_num = arr[0]\n    \n    for num in arr:\n        if num < min_num:\n            min_num = num\n        if num > max_num:\n            max_num = num\n    \n    max_diff = max_num - min_num\n    \n    return max_diff"], [0.9346572756767273, "def find_max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in an array.\n    \n    Args:\n        arr (list): The input array.\n        \n    Returns:\n        int: The maximum difference between any two elements in the array.\n    \"\"\"\n    min_value = arr[0]\n    max_value = arr[0]\n    max_diff = 0\n    \n    for num in arr:\n        if num < min_value:\n            min_value = num\n        if num > max_value:\n            max_value = num\n        \n        if max_value - min_value > max_diff:\n            max_diff = max_value - min_value\n            \n    return max_diff"], [0.9342225193977356, "def maximum_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in the array.\n    \n    Args:\n        arr (list): List of integers.\n    \n    Returns:\n        int: Maximum difference between any two elements in the array.\n    \"\"\"\n    max_diff = 0\n    for i in range(len(arr)):\n        for j in range(i+1, len(arr)):\n            diff = abs(arr[i] - arr[j])\n            if diff > max_diff:\n                max_diff = diff\n\n    return max_diff"], [0.933927595615387, "def max_difference(arr):\n    \"\"\"\n    Find the maximum difference between any two elements in an array.\n    \n    Args:\n        arr (list): The input array.\n        \n    Returns:\n        int: The maximum difference between any two elements in the array.\n    \"\"\"\n    # Initialize the maximum difference to 0\n    max_diff = 0\n    \n    # Loop through the array \n    for i in range(len(arr) - 1):\n        for j in range(i + 1, len(arr)):\n            # Calculate the difference between the current pair of elements\n            diff = arr[j] - arr[i]    \n                \n            # Update the maximum difference if needed\n            if diff > max_diff:\n                max_diff = diff\n                \n    # Return the maximum difference\n    return max_diff"], [0.9329338073730469, "def findMaxDifference(arr):\n    \"\"\"\n    Find the maximum difference between two elements in an array\n    such that the larger element appears after the smaller number.\n    \"\"\"\n    max_1, max_2 = arr[0], arr[0]\n    for num in arr[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\n    return max_1 - max_2\n    def findMaxDifference(arr):\n    \"\"\"\n    Find the maximum difference between two elements in\"\"\"\n    max_1, max_2 = arr[0], arr[0]\n    for num in arr[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\n    return max_1, max_2"]]}
{"task_id": 135, "problem": [[0.9359117150306702, "def char_total(string):\n    \"\"\"\n    Returns the sum of the ASCII values of all characters in a string.\n    \"\"\"\n    total = 0\n\n    for char in string:\n        total += ord(char)\n\n    return total"]]}
{"task_id": 136, "problem": [[0.9175533056259155, "def maxTotal(triangle: List[List[int]]) -> int:\n    \"\"\"\n    :type triangle: List[List[int]]\n    :rtype: int\n    \"\"\"\n    n = len(triangle)\n    \n    # Start from the second bottom row and work upwards\n    for i in range(n - 2, -1, -1):\n        for j in range(i + 1):\n            # For each position, choose the maximum adjacent number from the row below and add it to the current number\n            triangle[i][j] += max(triangle[i + 1][j], triangle[i + 1][j + 1])\n    \n    return triangle[0][0]"], [0.9161092042922974, "def max_total(triangle: List[List[int]]) -> int:\n    \"\"\"\n    \"\"\"\n    size_triangle = range(len(triangle)-1, -1, -1)\n\n    for i in size_triangle:\n        for j in range(i):\n            if triangle[i][j] > triangle[i][j + 1]:\n                triangle[i - 1][j] += triangle[i][j]\n            else:\n                triangle[i - 1][j] += triangle[i][j + 1]\n\n    return triangle[0][0]"], [0.9152696132659912, "def find_max_path_sum(test_array):\n    \"\"\"\n    Find the maximum sum of a path in a triangle.\n    :param test_array: A triangle represented as a 2D array.\n    :return: The maximum sum of a path in the triangle.\n    \"\"\"\n    rows = len(test_array)\n    cols = len(test_array[0])\n\n    # Create dp array\n    dp = [[0] * cols for _ in range(rows)]\n\n    # Initialize the top left cell of dp array\n    dp[0][0] = test_array[0][0]\n\n    # Fill the first row of dp array\n    for j in range(1, cols):\n        dp[0][j] = dp[0][j-1] + test_array[0][j]\n\n    # Fill the first column of dp array\n    for i in range(1, rows):\n        dp[i][0] = dp[i-1][0] + test_array[i][0]\n\n    # Fill the rest of the dp array\n    for i in range(1, rows):\n        for j in range(1, cols):\n            dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + test_array[i][j]\n\n    # Return the maximum sum of a path\n    return dp[-1][-1]"], [0.9039718508720398, "def find_max_path_sum(test_array):\n    \"\"\"\n    Find the maximum sum of non-prime numbers in a triangle.\n    \n    Args:\n        test_array (list): A triangle of numbers.\n    \n    Returns:\n        int: The maximum sum of non-prime numbers in the triangle.\n    \"\"\"\n    m = len(test_array)\n    n = len(test_array[0])\n    \n    dp = [[0 for _ in range(n)] for _ in range(m)]\n    \n    dp[0][0] = test_array[0][0]\n    \n    for i in range(1, m):\n        if is_prime(test_array[i][0]):\n            dp[i][0] = -1\n        else:\n            dp[i][0] = dp[i-1][0] + test_array[i][0]\n    \n    for j in range(1, n):\n        if is_prime(test_array[0][j]):\n            dp[0][j] = -1\n        else:\n            dp[0][j] = dp[0][j-1] + test_array[0][j]\n    \n    for i in range(1, m):\n        for j in range(1, n):\n            if is_prime(test_array[i][j]):\n                dp[i][j] = -1\n            else:\n                dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + test_array[i][j]\n    \n    return dp[m-1][n-1]"]]}
{"task_id": 137, "problem": [[0.894497275352478, "def divide_list(l):\n    \"\"\"\n    \"\"\"\n    l.sort()\n    i = 0\n    j = len(l) - 1\n\n    left_sum = l[i]\n    right_sum = l[j]\n\n    while i < j:\n        if left_sum < right_sum:\n            i += 1\n            left_sum += l[i]\n        else:\n            j -= 1\n            right_sum += l[j]\n\n    return (l[:i+1], l[i+1:])"]]}
{"task_id": 138, "problem": [[0.9313064813613892, "def longest_subarray(arr):\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    Returns:\n        int: Length of the longest subarray.\n    \"\"\"\n    cur_length = 1\n    max_length = 1\n\n    for i in range(1, len(arr)):\n        if arr[i] - 1 == arr[i-1]:\n            cur_length += 1\n        else:\n            if cur_length > max_length:\n                max_length = cur_length\n            cur_length = 1\n\n    if cur_length > max_length:\n        max_length = cur_length\n\n    return max_length"], [0.9226171970367432, "def find_longest_subarray(arr):\n    \"\"\"\n    Find the length of the longest subarray where the difference between adjacent elements is 1.\n    \n    Args:\n        arr: A list of integers.\n    \n    Returns:\n        The length of the longest subarray where the difference between adjacent elements is 1.\n    \"\"\"\n    maxLength = 1\n    curLength = 1\n    n = len(arr)\n    for i in range(1, n): \n        if (arr[i] > arr[i - 1]): \n            curLength += 1 \n            maxLength = max(maxLength, curLength) \n        else: \n            curLength = 1 \n    return maxLength"]]}
{"task_id": 139, "problem": []}
{"task_id": 140, "problem": [[0.9169600009918213, "def 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    def 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"], [0.9110210537910461, "def is_coprime(a, b):\n    \"\"\"\n    Check if two numbers are coprime.\n    :param a: first number\n    :param b: second number\n    :return: True if a and b are coprime, False otherwise\n    \"\"\"\n    return math.gcd(a, b) == 1\n    \n    def is_coprime(a, b):\n    \"\"\"\n    Check if two numbers are coprime.\n    :param a: first number\n    :param b: second number\n    :return: True if a and b are coprime, False otherwise\n    \"\"\"\n    return math.gcd(a, b) == 1"], [0.9103754758834839, "def check_coprime(a, b):\n    \"\"\"\n    Check if two numbers are co-prime.\n    \n    Parameters:\n    a (int): First number.\n    b (int): Second number.\n    \n    Returns:\n    None\n    \"\"\"\n    if ( math.gcd(a, b) == 1):\n        print(f\"{a} and {b} are co-prime numbers.\")\n    else:\n        print(f\"{a} and {b} are not co-prime numbers.\")"]]}
{"task_id": 141, "problem": []}
{"task_id": 142, "problem": []}
{"task_id": 143, "problem": [[0.8994060158729553, "def extract_elements(my_list):\n    \"\"\"\n    Extract elements from a list\n    :param my_list: list\n    :return: list\n    \"\"\"\n    new_list = []\n    for i in range(len(my_list)):\n        if i == 2 or i == 4:\n            new_list.append(my_list[i])\n    return new_list"], [0.88901686668396, "def extract_elements(given_list):\n    \"\"\"\n    Extract elements from a given list.\n    \n    Args:\n        given_list (list): The list from which elements will be extracted.\n    \n    Returns:\n        list: A new list containing the extracted elements.\n    \"\"\"\n    return given_list[1:4]"]]}
{"task_id": 144, "problem": [[0.8922808170318604, "def even_odd_change(arr):\n    \"\"\"\n    Given an array of numbers, replace all even numbers with 0 and all odd numbers with 1.\n    \n    Example:\n    \n    Input: [1, 2, 3, 4, 5, 6]\n    Output: [1, 0, 1, 0, 1, 0]\n    \n    Input: [10, 11, 12, 13, 14, 15]\n    Output: [0, 1, 0, 1, 0, 1]\n\"\"\"\n    for i in range(len(arr)):\n        if arr[i] % 2 == 0:\n            arr[i] = 0\n        else:\n            arr[i] = 1\n    return arr"], [0.8873116970062256, "def is_even(num):\n    \"\"\"\n    Returns True if num is even, otherwise False\n    \"\"\"\n    if num % 2 == 0:\n        return True\n    else:\n        return False\n    \n    def is_even(num):\n    \"\"\"\n    Returns True if num is even, otherwise False\n    \"\"\"\n    if (num & 1) == 0:\n        return True\n    else:\n        return False"]]}
{"task_id": 145, "problem": [[0.8953846096992493, "def convert_list_of_strings(lst):\n    \"\"\"\n    Converts a list of strings to a list of integers.\n    \n    Args:\n        lst (list): A list of strings.\n    \n    Returns:\n        list: A list of integers.\n    \"\"\"\n    return [convert_string(s) for s in lst]"]]}
{"task_id": 146, "problem": [[0.9085070490837097, "def run_length_encoding(input_string):\n    \"\"\"\n    Run length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string \"AAAABBBCCDAA\" would be encoded as \"4A3B2C1D2A\".\n    \"\"\"\n    encoding = ''\n    i = 0\n\n    while i < len(input_string):\n        count = 1\n        while i + 1 < len(input_string) and input_string[i] == input_string[i+1]:\n            i += 1\n            \"\"\"\n    encoding = ''\n    i = 0\n\n    while i < len(input_string):\n        count = 1\n        while i + 1 < len(input_string) and input_string[i] == input_string[i+1]:\n            i += 1\n            count += 1\n        encoding += str(count) + input_string[i]\n        i += 1\n\n    return encoding"], [0.9082828164100647, "def encodeList(list_to_encode):\n    \"\"\"\n    \"\"\"\n    if not list_to_encode:\n        return []\n    else:\n        tmp = []\n        tmp.append(list_to_encode[0])\n        tmp.append(1)\n        i = 1\n        while i < len(list_to_encode) and list_to_encode[i] == tmp[0]:\n            tmp[1] += 1\n            i += 1\n        return tmp + encodeList(list_to_encode[i:])"], [0.9018041491508484, "def run_length_encoding(string):\n    \"\"\"\n    Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string \"AAAABBBCCDAA\" would be encoded as \"4A3B2C1D2A\".\n    \"\"\"\n    # Check if the string is empty\n    if not string:\n        return \"\"\n\n    compressed_string = \"\"\n    count = 1\n\n    for i in range(1, len(string)):\n        if string[i] == string[i - 1]:\n            count += \"\"\"\n    # Check if the string is empty\n    if not string:\n        return \"\"\n\n    compressed_string = \"\"\n    count = 1\n\n    for i in range(1, len(string)):\n        if string[i] == string[i - 1]:\n            count += 1\n        else:\n            compressed_string += string[i - 1] + str(count)\n            count = 1\n\n    # Add the last character and its count to the compressed string\n    compressed_string += string[-1] + str(count)\n\n    return compressed_string"]]}
{"task_id": 147, "problem": [[0.9071027636528015, "def min_steps(arr):\n    \"\"\"\n    Given an array of integers, find the minimum number of steps required to make all elements equal. In one step, you can increase the value of any element by 1.\n    \n    Example 1:\n    \n    Input:\n    N = 4\n    Arr[] = {1,1,1,1}\n    Output:\n    0\n    Explanation:\n    No need to do any step as all the elements are already equal.\n    Example 2:\n    \n    Input:\n    N = 5\n    Arr[] = {2,2,1,\"\"\"\n    min_step = 0\n    min_val = min(arr)\n    for i in range(len(arr)):\n        min_step += arr[i] - min_val \n    \n    return min_step"], [0.9004983901977539, "def minOperations(arr, k):\n    \"\"\"\n    :type arr: List[int]\n    :type k: int\n    :rtype: int\n    \"\"\"\n    dp = [0] * len(arr)\n    for i in range(k, len(arr)):\n        dp[i] = max(dp[i - k] + 1 - (arr[i] - arr[i - k]), 0)\n    return sum(dp)"], [0.9004645347595215, "def minOperations(arr, k):\n    \"\"\"\n    :type arr: List[int]\n    :type k: int\n    :rtype: int\n    \"\"\"\n    dp = [0] * len(arr)\n    for i in range(k, len(arr)):\n        dp[i] = max(dp[i - k] + 1 - (arr[i] - arr[i - k]), 0)\n    return sum(dp)"], [0.8953546285629272, "def min_steps_to_equal_elements(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    min_elem = min(nums)\n    steps = 0\n    for num in nums:\n        steps += (num - min_elem)\n    return steps"], [0.8953545093536377, "def min_steps_to_equal_elements(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    min_elem = min(nums)\n    steps = 0\n    for num in nums:\n        steps += (num - min_elem)\n    return steps"], [0.89012610912323, "def minOperationsToHomogenize(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    # Find the middle number (median)\n    mid = sorted(nums)[len(nums) // 2]\n    \n    # Compute and return the total absolute difference with the median.\n    return sum(abs(num - mid) for num in nums)"]]}
{"task_id": 148, "problem": []}
{"task_id": 149, "problem": [[0.8967446088790894, "def egcd(a, b):\n    \"\"\"\n    Extended Euclidean algorithm.\n    Returns a tuple (g, x, y) such that g = gcd(a, b) = ax + by.\n    \"\"\"\n    if a == 0:\n        return (b, 0, 1)\n    else:\n        g, x, y = egcd(b % a, a)\n        return (g, y - (b // a) * x, x)\n    def egcd(a, b):\n    \"\"\"\n    Extended Euclidean algorithm.\n    Returns a tuple (g, x, y) such that\"\"\"\n    if a == 0:\n        return (b, 0, 1)\n    else:\n        g, x, y = egcd(b % a, a)\n        return (g, y - (b // a) * x, x)"], [0.8938005566596985, "def extended_euclid(a, b):\n    \"\"\"\n    Returns a tuple (g, x, y) such that\n    g = gcd(a, b) = ax + by\n    \"\"\"\n    if a == 0:\n        return (b, 0, 1)\n    else:\n        gcd, x, y = extended_euclid(b % a, a)\n        return (gcd, y - (b // a) * x, x)"], [0.8931587934494019, "def solve_equation(equation):\n    \"\"\"\n    Solve the equation of the form ax + by = c\n    and return the values of x and y.\n    \"\"\"\n    coefficients = equation.split()\n    x_coeff = int(coefficients[0][:-1])\n    y_coeff = int(coefficients[2][:-1])\n    value = int(coefficients[4])\n\n    if x_coeff == 0 and y_coeff == 0:\n        raise ValueError(\"Invalid equation!\")\n    elif x_coeff == 0:\n        return [None, value // y_coeff]\n    elif y_coeff\"\"\"\n    coefficients = equation.split()\n    x_coeff = int(coefficients[0][:-1])\n    y_coeff = int(coefficients[2][:-1])\n    value = int(coefficients[4])\n\n    if x_coeff == 0 and y_coeff == 0:\n        raise ValueError(\"Invalid equation!\")\n    elif x_coeff == 0:\n        return [None, value // y_coeff]\n    elif y_coeff == 0:\n        return [value // x_coeff, None]\n\n    x = (value * y_coeff) // (x_coeff * y_coeff + y_coeff * y_coeff)\n    y = (value - x_coeff * x) // y_coeff\n    return [x, y]"], [0.8920186758041382, "def extended_euclidean_algorithm(a, b):\n    \"\"\"\n    Extended Euclidean Algorithm\n    Returns a tuple (x, y) such that ax + by = gcd(a, b)\n    \"\"\"\n    if a == 0:\n        return (0, 1)\n    (x, y) = extended_euclidean_algorithm(b % a, a)\n    return (y - (b // a) * x, x)\n    \n    def extended_euclidean_algorithm(a, b):\n    \"\"\"\n    Extended Euclidean Algorithm\n    Returns a tuple (x, y) such that ax + by = gcd(a,\"\"\"\n    if b == 0:\n        return (1, 0)\n    (x, y) = extended_euclidean_algorithm(b, a % b)\n    return (y, x - (a // b) * y)"], [0.8913435935974121, "def extended_euclidean(a, b):\n    \"\"\"\n    Returns a tuple (gcd, x, y) such that a*x + b*y = gcd\n    \"\"\"\n    if a == 0:\n        return b, 0, 1\n    else:\n        gcd, x, y = extended_euclidean(b % a, a)\n        return gcd, y - (b // a) * x, x\n    def extended_euclidean(a, b):\n    \"\"\"\n    Returns a tuple (gcd, x, y) such that a*x + b*y = gcd\n    \"\"\"\n    if a == 0:\n        return b, 0, 1\n    else:\n        gcd, x, y = extended_euclidean(b % a, a)\n        return gcd, y - (b // a) * x, x"], [0.8913298845291138, "def extended_euclidean(a, b):\n    \"\"\"\n    Returns a tuple (gcd, x, y) such that a*x + b*y = gcd\n    \"\"\"\n    if a == 0:\n        return b, 0, 1\n    else:\n        gcd, x, y = extended_euclidean(b % a, a)\n        return gcd, y - (b // a) * x, x\n    def extended_euclidean(a, b):\n    \"\"\"\n    Returns a tuple (gcd, x, y) such that a*x + b*y = gcd\n    \"\"\"\n    if a == 0:\n        return b, 0, 1\n    else:\n        gcd, x, y = extended_euclidean(b % a, a)\n        return gcd, y - (b // a) * x, x"]]}
{"task_id": 150, "problem": [[0.9151356220245361, "def remove_elements(list1, list2):\n    \"\"\"\n    Remove all elements from list1 that are also in list2.\n    \n    >>> list1 = [1, 2, 3, 4, 5]\n    >>> list2 = [1, 2, 3]\n    >>> remove_elements(list1, list2)\n    [4, 5]\n    \"\"\"\n    for item in list2:\n        if item in list1:\n            list1.remove(item)\n    \n    return list1"], [0.9130475521087646, "def remove_from_list(list1, list2):\n    \"\"\"\n    Remove all elements of list2 from list1\n    :param list1: the first list\n    :param list2: the second list\n    \"\"\"\n    for i in list2: \n        list1.remove(i) \n        \n    return list1"]]}
{"task_id": 151, "problem": [[0.921188235282898, "def sum(x):\n    '''This function will sum all the numbers from 0 to x.'''\n    return (x * (x + 1)) // 2"], [0.9096030592918396, "def sum(n):\n    \"\"\"\n    Return the sum of the first n positive integers.\n    \"\"\"\n    if n == 0:\n        return 0\n    else:\n        return n + sum(n-1)\n    def sum(n):\n    \"\"\"\n    Return the sum of the first n positive integers.\n    \"\"\"\n    if n == 0:\n        return 0\n    else:\n        return n + sum(n-1)"], [0.9095675945281982, "def my_function(x):\n    \"\"\"\n    Return the sum of the first n positive integers.\n    \n    >>> my_function(100)\n    5050\n    \"\"\"\n    return (x * (x - 1)) // 2"]]}
{"task_id": 152, "problem": [[0.93938148021698, "def area(n):\n \"\"\"\n Return the area of a regular polygon.\n\"\"\"\n return f(n)*g(n)"], [0.9305984973907471, "def area(n):\n  \"\"\"\n  Return the area of a regular polygon.\n  \n  >>> area(3)\n  3.897\n  >>> area(4)\n  6.097\n  >>> area(5)\n  7.659\n  \"\"\"\n  return round(n * ((n / 4) + 0.75) / 2)"], [0.927751898765564, "def area_polygon(n, side):\n    \"\"\"\n    Compute the area of an n-sided regular polygon.\n    \"\"\"\n    area = (n * (side ** 2)) / (4 * math.tan(math.pi / n))\n    return area"], [0.9230159521102905, "def calculate_polygon_area(n, s):\n    \"\"\"\n    Calculate the area of a regular polygon.\n\n    :param n: Number of sides of the regular polygon\n    :param s: Length of each side of the regular polygon\n    :return: Area of the regular polygon\n    \"\"\"\n    area = (n * s ** 2) / (4 * math.tan(math.pi / n))\n    return area"], [0.9167738556861877, "def calculatePolygonArea(n, r):\n    \"\"\"\n    Calculate the area of a regular polygon with n sides and radius r.\n\n    Args:\n        n (int): Number of sides of the polygon.\n        r (float): Radius of the polygon.\n\n    Returns:\n        float: Area of the regular polygon.\n    \"\"\"\n    angle = (2 * math.pi) / n  # Calculate the interior angle of the regular polygon\n    area = (r ** 2) * math.sin(angle) / 2  # Calculate the area using the formula\n    return area"], [0.9145193099975586, "def surface_area_regular_polygon(n):\n    \"\"\"\n    Computes the surface area of a regular polygon with n sides, given its side length\n    \"\"\"\n    area = (n * (math.pow(n, 2) - (math.pow(n-1, 2))) / 4) * math.pow(math.pi, 2)\n    return area"], [0.9135140180587769, "def area_of_regular_polygon(side, n_sides):\n    \"\"\"Calculate area of a given regular polygon with known side length and number of sides\n    \"\"\"\n    return (n_sides * side**2) / (4 * math.tan(math.pi/n_sides))"]]}
{"task_id": 153, "problem": []}
{"task_id": 154, "problem": []}
{"task_id": 155, "problem": [[0.9048709869384766, "def find_odd_xor_pairs(lst):\n    \"\"\"\n    Find the number of odd xor pairs in a list of integers.\n    \n    Args:\n        lst (list): A list of integers.\n    \n    Returns:\n        int: The number of odd xor pairs in the list.\n    \"\"\"\n    pairs = get_pairs(lst)\n    return len(pairs), pairs"]]}
{"task_id": 156, "problem": [[0.9279285669326782, "def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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\n    def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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"], [0.9278101921081543, "def maxPowerOfTwo(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    p = 0\n    while ((1 << (p + 1)) <= n): p += 1\n    return p"]]}
{"task_id": 157, "problem": [[0.9252846240997314, "def frequency(arr, num):\n    \"\"\"\n    Return the frequency of num in the given array.\n    \"\"\"\n    return arr.count(num)\n    \n    def frequency(arr, num):\n    \"\"\"\n    Return the frequency of num in the given array.\n    \"\"\"\n    return arr.count(num)"]]}
{"task_id": 158, "problem": [[0.9297803044319153, "def 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    \"\"\"\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 * pell(n-1) + pell(n-2)\n    return pell_dict[n]"], [0.8995983600616455, "def pell_series(n):\n    \"\"\"\n    Pell series\n    \n    \"\"\"\n    a, b = 0, 1\n    for _ in range(n):\n        print(a)\n        a, b = b, 2*b + a"]]}
{"task_id": 159, "problem": [[0.9024869799613953, "def sum_between_indices(arr, start, end):\n    \"\"\"\n    Given an array of integers between indices start and end, inclusive, return the sum of the elements in the array between those indices.\n    \n    Args:\n        arr (list): The array of integers.\n        start (int): The start index.\n        end (int): The end index.\n    \n    Returns:\n        int: The sum of the elements between start and end indices.\n    \"\"\"\n    # Set the initial sum to 0\n    sum = 0 \n    # Traverse the array\n    for i in range(start, end + 1):\n        # Add each element between start and end indices to sum\n        sum += arr[i]\n    \n    return sum"]]}
{"task_id": 160, "problem": [[0.8840959072113037, "def number_of_sides():\n    \"\"\"\n    Returns the number of sides on a regular polygon.\n    \"\"\"\n    return 6\n    \n    def side_length(n, s):\n    \"\"\"\n    Returns the length of one side of a regular polygon.\n    \"\"\"\n    return s / n\n    \n    def area(n, s):\n    \"\"\"\n    Returns the area of a regular polygon.\n    \"\"\"\n    return (n * s**2) / (4 * math.tan(math.pi / n))\n    \n    def perimeter(n, s):\n    \"\"\"\n    Returns the perimeter\"\"\"\n    result = 1\n    for i in range(2021, 2067):\n        result *= i\n    return result"]]}
{"task_id": 161, "problem": []}
{"task_id": 162, "problem": []}
{"task_id": 163, "problem": [[0.871941089630127, "def group_strings(lst):\n    \"\"\"\n    Write a function that takes a list of strings as an argument and returns a dictionary.\n    The keys of the dictionary should be the length of the strings in the list.\n    The values should be lists of strings of that length.\n    \n    >>> group_strings([\"a\", \"aa\", \"aaa\", \"aaaa\"])\n    {1: [\"a\"], 2: [\"aa\"], 3: [\"aaa\"], 4: [\"aaaa\"]}\n    \"\"\"\n    return {len(word): [i for i in lst if len(i) == len(word)] for word in lst}"]]}
{"task_id": 164, "problem": [[0.9239267110824585, "def parentheses_validator(string):\n    \"\"\"\n    Write a function that takes a string of parentheses, and determines if the order of the parentheses is valid. The function should return true if the string is valid, and false if it's invalid.\n    \n    Examples\n    \"()\" => returns true\n    \")(()))\" => returns false\n    \"(\" => returns false\n    \"((()))\" => returns true\n    \"\"\"\n    c = 0\n    for i in string:\n        if i == '(':\n            c += 1\n        if i == ')': \n            c -= 1\n        if c < 0:\n            return False\n    return c == 0"], [0.9238661527633667, "def check_parens(string):\n    \"\"\"Check whether the parentheses are valid. \"\"\"\n    # Keep a count of how many left and right brackets\n    left_count = 0\n    right_count = 0\n    \n    # Iterate through the string \n    for char in string:\n        if char == '(':\n            left_count += 1\n        elif char == ')':\n            right_count += 1\n            \n        # If the right count is ever greater than the left, return False \n        if right_count > left_count:\n            return False\n    \n    # If both counts are equal, the parentheses are valid \n    if left_count == right_count:\n        return True\n    \n    # Otherwise, the parentheses are invalid \n    return False"]]}
{"task_id": 165, "problem": [[0.915186882019043, "def calculate_perimeter(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    perimeter = side1 + side2 + side3\n    return perimeter"], [0.9120898246765137, "def calc_perimeter(a, b, c):\n    \"\"\"\n    Calculate the perimeter of a triangle.\n    :param a: side a\n    :param b: side b\n    :param c: side c\n    :return: perimeter\n    \"\"\"\n    return a + b + c"], [0.9070957899093628, "def calculate_perimeter(side1, side2, side3):\n    \"\"\"\n    Calculate the perimeter of a triangle given the lengths of its sides.\n    \n    Parameters:\n    side1 (float): Length of the first side of the triangle.\n    side2 (float): Length of the second side of the triangle.\n    side3 (float): Length of the third side of the triangle.\n    \n    Returns:\n    float: The perimeter of the triangle.\n    \"\"\"\n    # Calculate the perimeter\n    perimeter = side1 + side2 + side3\n    \n    # Round the perimeter to two decimal places\n    perimeter = round(perimeter, 2)\n    \n    return perimeter"]]}
{"task_id": 166, "problem": [[0.8844113945960999, "def find_LCM(first_num, second_num):\n    \"\"\"\n    This function takes two numbers and returns the LCM.\n    \"\"\"\n    maximum = max(first_num, second_num)\n    lcm = maximum\n\n    while True:\n        if lcm % first_num == 0 and lcm % second_num == 0:\n            break\n        lcm += maximum\n\n    return lcm"], [0.8841421604156494, "def find_lcm(num1, num2):\n    \"\"\"\n    Find the least common multiple of two numbers.\n    \"\"\"\n    if num1 == 0 or num2 == 0:\n        return 0\n    else:\n        return int((num1 * num2) / find_gcd(num1, num2))\n    def find_lcm(num1, num2):\n    \"\"\"\n    Find the least common multiple of two numbers.\n    \"\"\"\n    if num1 == 0 or num2 == 0:\n        return 0\n    else:\n        return int((num1 * num2) / find_gcd(num1, num2))"]]}
{"task_id": 167, "problem": [[0.9018117189407349, "def search_string(search_string, list_of_strings):\n    \"\"\"\n    Return True if any string in the list contains `search_string` as a substring.\n    Return False otherwise.\n    \"\"\"\n    for string in list_of_strings:\n        if search_string in string:\n            return True\n    return False\n    \n    def search_string(search_string, list_of_strings):\n    \"\"\"\n    Return True if any string in the list contains `search_string` as a substring.\n    Return False otherwise.\n    \"\"\"\n    for string in list_of_strings:\n        if string == search_string:\n            return True\n    return False"]]}
{"task_id": 168, "problem": [[0.879241943359375, "def is_magic_number(num):\n    \"\"\"\n    \"\"\"\n    num = str(num)\n    digits = [int(x) for x in num]\n    return sum(digits) == 1"]]}
{"task_id": 169, "problem": []}
{"task_id": 170, "problem": [[0.926497220993042, "def longest_common_prefix(strings):\n    \"\"\"\n    Find the longest common prefix among a set of strings.\n    \n    Args:\n        strings (list): A list of strings.\n    \n    Returns:\n        str: The longest common prefix among the given strings.\n    \"\"\"\n    if not strings:\n        return \"\"  # Return empty string if the set of strings is empty\n\n    # Find the minimum length of the strings\n    min_length = min(len(string) for string in strings)\n    \n    # Iterate through each character in the minimum length of the strings\n    for i in range(min_length):\n        # Check if the character at position i is the same in all strings\n        if any(string[i] != strings[0][i] for string in strings):\n            return strings[0][:i]  # Return the prefix if characters differ\n    \n    return strings[0][:min_length]  # Return the minimum length prefix"], [0.925122857093811, "def longest_common_prefix(strings):\n    \"\"\"\n    Find the longest common prefix among an array of strings.\n    \n    :type strs: List[str]\n    :rtype: str\n    \"\"\"\n    if not strings:\n        return \"\"\n\n    prefix = strings[0]\n    for i in range(1, len(strings)):\n        while strings[i].find(prefix) != 0:\n            prefix = prefix[:-1]\n            if not prefix:\n                return \"\"\n    \n    return prefix"]]}
{"task_id": 171, "problem": []}
{"task_id": 172, "problem": [[0.9343194365501404, "def count_pairs_with_difference_k(nums, k):\n    \"\"\"\n    Count pairs in a list of numbers with a given difference k.\n    :param nums: List of integers\n    :param k: Difference between the numbers\n    :return: Count of pairs with difference k\n    \"\"\"\n    freq_map = {}\n    count = 0\n\n    for num in nums:\n        count += freq_map.get(num - k, 0) + freq_map.get(num + k, 0)\n        freq_map[num] = freq_map.get(num, 0) + 1\n\n    return count"], [0.9342989921569824, "def count_pairs_with_difference_k(nums, k):\n    \"\"\"\n    Count pairs in a list of numbers with a given difference k.\n    :param nums: List of integers\n    :param k: Difference between the numbers\n    :return: Count of pairs with difference k\n    \"\"\"\n    freq_map = {}\n    count = 0\n\n    for num in nums:\n        count += freq_map.get(num - k, 0) + freq_map.get(num + k, 0)\n        freq_map[num] = freq_map.get(num, 0) + 1\n\n    return count"]]}
{"task_id": 173, "problem": [[0.9292531609535217, "def numbers_greater_than(arr, x):\n  \"\"\"\n  Return a list of all numbers greater than x\n  \"\"\"\n  return [num for num in arr if num > x]\n    def numbers_greater_than(arr, x):\n  \"\"\"\n  Return a list of all numbers greater than x\n  \"\"\"\n  return [num for num in arr if num > x]"], [0.9257360100746155, "def filter_greater_than(arr, num):\n    \"\"\"\n    Return a new array with only the elements from the original array that are greater than the given number.\n    \"\"\"\n    return [x for x in arr if x > num]\n    def filter_greater_than(arr, num):\n    \"\"\"\n    Return a new array with only the elements from the original array that are greater than the given number.\n    \"\"\"\n    return [x for x in arr if x > num]"], [0.9236041903495789, "def filter_greater_than(lst, num):\n    \"\"\"\n    Return a new list containing all numbers from the original list that are greater than the given number.\n    :param lst: list of numbers\n    :param num: number\n    :return: list of numbers\n    \"\"\"\n    return [n for n in lst if n > num]"], [0.9170977473258972, "def greater_than_target(numbers, target):\n    \"\"\"\n    Given a list of numbers and a target number, return all values in the list that are greater than the target.\n    Args:\n       param1(list): list of numbers\n       param2(int): target number\n    Returns:\n       list of numbers that are greater than the target\n    \"\"\"\n    result = []\n    for num in numbers:\n        if num > target:\n            result.append(num)\n    return result"], [0.9149011969566345, "def get_numbers_greater_than(nums, n):\n    \"\"\"\n    Return a list of numbers greater than n.\n    \n    >>> get_numbers_greater_than([1, 2, 3], 2)\n    [3]\n    \"\"\"\n    return [num for num in nums if num > n]"]]}
{"task_id": 174, "problem": []}
{"task_id": 175, "problem": []}
{"task_id": 176, "problem": [[0.9321498274803162, "def longest_common_subsequence(str1, str2):\n    \"\"\"\n    Find the length of longest common subsequence (LCS) of two given sequences.\n    str1, str2: input strings\n    return: length of LCS\n    \"\"\"\n    m = len(str1)\n    n = len(str2)\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]"]]}
{"task_id": 177, "problem": []}
{"task_id": 178, "problem": [[0.9340323209762573, "def find_first_missing_positive(arr):\n    \"\"\"\n    Finds the first missing positive number in an unsorted array\n    \"\"\"\n    # Sort the array\n    arr.sort()\n\n    # Iterate over the array\n    for i in range(len(arr) - 1):\n        # if the difference between the current and the next number is > 1\n        # then the missing positive is the current number plus 1\n        if (arr[i + 1] - arr[i]) > 1:\n            return arr[i] + 1\n    \n    # Return the last element + 1 if all numbers are continuous\n    return arr[-1] + 1"]]}
{"task_id": 179, "problem": []}
{"task_id": 180, "problem": [[0.904896080493927, "def check_days(month, year):\n    \"\"\"\n    Check if a month has 30 days.\n    \n    Args:\n        month (int): The month number (1-12).\n        year (int): The year.\n    \n    Returns:\n        bool: True if the month has 30 days, False otherwise.\n    \"\"\"\n    thirty_days_months = [4, 6, 9, 11]\n    if month in thirty_days_months:\n        return True\n    elif month == 2:\n        if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):\n            return False  # February has 29 days in a leap year\n        else:\n            return True  # February has 28 days in a non-leap year\n    else:\n        return False  # Months not listed have 31 days"], [0.8951505422592163, "def num_of_days(month): \n    \"\"\"\n    Takes a month name as input and returns the number of days in that month.\n    \n    Parameters:\n    month (str): The name of the month.\n    \n    Returns:\n    str: The number of days in the month.\n    \"\"\"\n    if month == \"January\" or month == \"March\" or month == \"May\" or month == \"July\" or month == \"August\" or month == \"October\" or month == \"December\": \n        return \"31 days\"\n    elif month == \"April\" or month == \"June\" or month == \"September\" or month == \"November\":\n        return \"30 days\"\n    elif month == \"February\":\n        return \"28 or 29 days\"\n    else:\n        return \"Invalid input\""]]}
{"task_id": 181, "problem": [[0.908181369304657, "def has_number(password):\n    \"\"\"\n    Check if a password contains a number\n    :param password: str\n    :return: bool\n    \"\"\"\n    return any(letter.isdigit() for letter in password)"]]}
{"task_id": 182, "problem": [[0.9072756767272949, "def removeDupes(input_tuple):\n\"\"\"\n    Removes duplicates from a tuple.\n\n    Args:\n        input_tuple (tuple): The input tuple.\n\n    Returns:\n        tuple: The tuple with duplicates removed.\n    \"\"\"\n\n    # Convert tuple to set to remove duplicates\n    result_set = set(input_tuple)\n\n    # Convert set back to tuple\n    result_tuple = tuple(result_set)\n\n    return result_tuple"]]}
{"task_id": 183, "problem": [[0.9284827709197998, "def convert_to_octal(num):\n    \"\"\"\n    This function converts a decimal number to octal\n    \"\"\"\n    oct_num = oct(num)\n    print(\"The octal form of {} is {}\".format(num, oct_num))\n    \n    def convert_to_octal(num):\n    \"\"\"\n    This function converts a decimal number to octal\n    \"\"\"\n    oct_num = oct(num)\n    print(\"The octal form of {} is {}\".format(num, oct_num))"], [0.9217933416366577, "def octal_to_decimal(octal):\n    \"\"\"\n    Convert octal number to decimal\n    \"\"\"\n    decimal = 0\n    base = 1\n\n    while (octal):\n        last_digit = octal % 10\n        octal = int(octal / 10)\n\n        decimal += last_digit * base\n        base = base * 8\n\n    return decimal\n    def octal_to_decimal(octal):\n    \"\"\"\n    Convert octal number to decimal\n    \"\"\"\n    decimal = 0\n    base = 1\n\n    while (octal):\n        last_digit = octal % 10\n        octal = int(octal / 10)\n\n        decimal += last_digit * base\n        base = base * 8\n\n    return decimal"]]}
{"task_id": 184, "problem": [[0.9220010042190552, "def find_index(arr, val):\n    \"\"\"\n    Given a sorted array, return the index of val in the array.\n    If val is not present in the array, return -1.\n    \"\"\"\n    # TODO: Write your code here\n    # return index\n    \"\"\"\n    index = 0\n    found = False\n    for i, num in enumerate(arr):\n        if num == val:\n            index += i\n            found = True\n    return index if found else -1"], [0.9219817519187927, "def find_index(arr, val):\n    \"\"\"\n    Given a sorted array, return the index of val in the array.\n    If val is not present in the array, return -1.\n    \"\"\"\n    # TODO: Write your code here\n    # return index\n    \"\"\"\n    index = 0\n    found = False\n    for i, num in enumerate(arr):\n        if num == val:\n            index += i\n            found = True\n    return index if found else -1"], [0.9146754741668701, "def find_position(arr, num):\n    \"\"\"\n    Find the position of num in the sorted array\n    :param arr: sorted array of integers\n    :param num: integer to be found\n    :return: position of num in the array\n    \"\"\"\n    return linear_search(arr, num)\n    \n    def linear_search(arr, num):\n    \"\"\"\n    Find the position of num in the sorted array\n    :param arr: sorted array of integers\n    :param num: integer to be found\n    :return: position of num in the array\n    \"\"\"\n    for i in range(len(arr)):\"\"\"\n    return binary_search(arr, num, 0, len(arr) - 1)"]]}
{"task_id": 185, "problem": []}
{"task_id": 186, "problem": []}
{"task_id": 187, "problem": [[0.9252520799636841, "def largest_inscribed_triangle(radius, h=0, k=0, a=None, b=None):\n    \"\"\"\n    Find the largest inscribed triangle in a circle or ellipse.\n    \n    Parameters\n    ----------\n    radius : float\n        The radius of the circle or ellipse.\n    h : float, optional\n        The x-coordinate of the center of the circle or ellipse.\n    k : float, optional\n        The y-coordinate of the center of the circle or ellipse.\n    a : float, optional\n        The length of the major axis of the ellipse.\n    b : float, optional\n        The length of the minor axis of the ellipse.\n        \n    Returns\n    -------\n    \"\"\"\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, vertices"], [0.8941512107849121, "def get_triangle(radius):\n    \"\"\"\n    Compute the area and perimeter of the largest inscribed triangle in a semicircle.\n    \n    Parameters\n    ----------\n    radius : float\n        The radius of the semicircle.\n        \n    Returns\n    -------\n    area : float\n        The area of the largest inscribed triangle.\n    a : tuple\n        The coordinates of the first vertex of the triangle.\n    b : tuple\n        The coordinates of the second vertex of the triangle.\n    c : tuple\n        The coordinates of the third vertex of the triangle.\n    perimeter : float\n        The perimeter of the largest inscribed triangle.\"\"\"\n    # The largest inscribed triangle in a semicircle is equilateral triangle.\n    # The length of the triangle's side equals the semicircle's diameter.\n\n    # Hence, the coordinates of the vertices of the triangle are:\n    a = (-radius, 0)\n    b = (radius, 0)\n    c = (0, radius)\n\n    # The area of an equilateral triangle is computed using the formula: (s^2 * sqrt(3)) / 4\n    # where s is the side length of the triangle. \n    # The side length of our triangle is twice the radius (which is the diameter of the semicircle).\n    area = ((2*radius)**2 * math.sqrt(3)) / 4\n    \n    # The perimeter of an equilateral triangle is 3 times its side.\n    # The side length of our triangle is twice the radius (which is the diameter of the semicircle).\n    perimeter = 3 * (2*radius)\n\n    return area, a, b, c, perimeter"], [0.8918155431747437, "def get_triangle(radius):\n    \"\"\"\n    Return the area, coordinates of the vertices, and perimeter of the largest inscribed triangle in a semicircle.\n    \n    Args:\n        radius (float): radius of the semicircle\n    \n    Returns:\n        tuple: (area, a, b, c, perimeter)\n    \"\"\"\n    # The largest inscribed triangle in a semicircle is equilateral_triangle.\n    # The length of the triangle's_side_equals the semicircle's diameter.\n\n    # Hence, the coordinates of the vertices of the triangle are:\n    a = (-radius, 0)\n    b = (radius, 0)\n    c = (0, radius)\n\n    # The area of an equilateral triangle is computed using the formula: (s^2 * sqrt(3)) / 4\n    # where s is the side length of the triangle. \n    # The side length of our_triangle is twice the radius (which is the diameter_of the semicircle).\n    area = ((2*radius)**2 * math.sqrt(3)) / 4\n\n    # The perimeter of an equilateral triangle is 3 times its side.\n    # The side length of our triangle is twice the radius (which is the diameter of the semicircle).\n    perimeter = 3 * (2*radius)\n\n    return area, a, b, c, perimeter"], [0.8910485506057739, "def max_triangle_semicircle(h=0, k=0, r=1):\n    \"\"\"\n    Find the area and vertices of the largest triangle that can be inscribed in a semicircle.\n    \n    Parameters\n    ----------\n    h : float\n        The x-coordinate of the center of the semicircle.\n    k : float\n        The y-coordinate of the center of the semicircle.\n    r : float\n        The radius of the semicircle.\n        \n    Returns\n    -------\n    area : float\n        The area of the largest triangle that can be inscribed in the semicircle.\n    vertices : list\n        The vertices of the largest triangle that can be inscribed in\"\"\"\n    if r <= 0:\n        return None, None\n        \n    area = r**2\n    vertices = [(h-r, k), (h+r, k), (h, k+r)]\n    return area, vertices"], [0.8882154822349548, "def max_triangle_semicircle(r):\n\"\"\"\n    Find the maximum area of a triangle inscribed in a semicircle of radius r.\n    \n    Parameters\n    ----------\n    r : float\n        The radius of the semicircle.\n    \n    Returns\n    -------\n    area : float\n        The maximum area of the triangle.\n    vertices : list\n        The coordinates of the vertices of the triangle.\n    \"\"\"\n\n    # The coordinates are (-r, 0), (r, 0) and (0, r)\n    vertices = [(-r, 0), (r, 0), (0, r)]\n\n    # The area is (1/2) * Base * Height. For maximum area, Base = Diameter = 2*r and Height = r.\n    area = 0.5 * (2*r) * r\n\n    return area, vertices"]]}
{"task_id": 188, "problem": [[0.9284058213233948, "def maxPowerOfTwo(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    p = 0\n    while ((1 << (p + 1)) <= n): p += 1\n    return p"], [0.913205623626709, "def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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\n    def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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"], [0.9131944179534912, "def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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\n    def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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"]]}
{"task_id": 189, "problem": [[0.9048170447349548, "def find_max_val_indices(lst):\n    \"\"\"\n    Find the indices of the maximum value in a list.\n    \n    Args:\n        lst (list): A list of integers.\n    \n    Returns:\n        list: A list of indices of the maximum value.\n    \"\"\"\n    max_val = max(lst)\n    indices = [i for i, val in enumerate(lst) if val == max_val]\n    print(\"The greatest number is {} and its indices are {}\".format(max_val, indices))"], [0.9006492495536804, "def find_max(lst):\n    \"\"\"\n    Find the maximum number in a list and its index(es).\n    \n    Args:\n        lst (list): A list of numbers.\n    \n    Returns:\n        tuple: A tuple containing the maximum number and a list of indices where the maximum number occurs.\n    \"\"\"\n    max_num = lst[0]\n    max_index = [0]  # Consider first value as a potential max value\n    for i in range(1, len(lst)):\n        if lst[i] > max_num:\n            max_num = lst[i]\n            max_index = [i]    # If the new number is greater, update max_num and reinitialize max_index\n        elif lst[i] == max_num:\n            max_index.append(i)   # If the number is equal to max_num, just append its index to max_index\n    return max_num, max_index"]]}
{"task_id": 190, "problem": [[0.9241238236427307, "def is_same(my_list):\n  \"\"\"\n  Checks if all elements in a list are the same.\n  Args:\n    my_list: a list of elements\n  Returns:\n    True if all elements are the same, False otherwise\n  \"\"\"\n  for i in range(len(my_list)):\n    for j in range(i + 1, len(my_list)):\n      if my_list[i] != my_list[j]:\n        return False\n  return True"], [0.9143980741500854, "def check_list_elements(list_of_elements):\n    \"\"\"\n    Check if all elements in a list are the same\n    :param list_of_elements: list of elements\n    :return: True if all elements are the same, False otherwise\n    \"\"\"\n    if len(set(list_of_elements)) == 1:\n        return True\n    else:\n        return False"]]}
{"task_id": 191, "problem": [[0.9392486810684204, "def 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\n    def 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"], [0.9352778196334839, "def remove_odd_index_characters(string):\n    \"\"\"\n    Remove characters which have odd index values in the given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result += string[i]\n    return result\n    def remove_odd_index_characters(string):\n    \"\"\"\n    Remove characters which have odd index values in the given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result += string[i]\n    return result"], [0.9331322908401489, "def remove_odd_index_char(string):\n    \"\"\"\n    Remove the characters of odd index in a given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result = result + string[i]\n    return result"], [0.9193971157073975, "def remove_every_other_char(str):\n    \"\"\"\n    Given a string, return a new string made of every other char starting with the first, so \"Hello\" yields \"Hlo\".\n    \"\"\"\n    result = \"\"\n    for i in range(len(str)):\n        if i % 2 == 0:\n            result += str[i]\n    return result"]]}
{"task_id": 192, "problem": [[0.9241868257522583, "def hamming_distance(x, y):\n    \"\"\"\n    Calculate the Hamming distance between two integers x and y.\n    The Hamming distance between two integers is the number of positions\n    at which the corresponding bits are different.\n    \n    :param x: integer\n    :param y: integer\n    :return: integer\n    \"\"\"\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"], [0.9238351583480835, "def hamming_distance(x, y):\n    \"\"\"\n    Calculate the Hamming distance between two integers.\n    The Hamming distance between two integers is the number of positions\n    at which the corresponding bits are different.\n    :param x: int\n    :param y: int\n    :return: int\n    \"\"\"\n    return bin(x ^ y).count('1')"], [0.9094763994216919, "def hammingDistance(x: int, y: int) -> int:\n    \"\"\"\n    :type x: int\n    :type y: int\n    :rtype: int\n    \"\"\"\n    xorResult = x ^ y\n    dist = 0\n    while xorResult:\n        dist += xorResult & 1\n        xorResult >>= 1\n    return dist"]]}
{"task_id": 193, "problem": []}
{"task_id": 194, "problem": [[0.8908635377883911, "def count_inversions(arr):\n  \"\"\"\n  Return the number of inversions in the given array.\n  >>> count_inversions([2, 4, 1, 3, 5])\n  3\n  \"\"\"\n  inv_count = 0\n  for i in range(len(arr)):\n    for j in range(i + 1, len(arr)):\n      if arr[i] > arr[j]:\n        inv_count += 1\n  return inv_count"], [0.8902403712272644, "def count_inversions(arr): \n    \"\"\"\n    Return the number of inversions in the given array.\n    \n    >>> count_inversions([2, 4, 1, 3, 5])\n    3\n    \"\"\"\n    inversion_count = 0\n    for i in range(0, len(arr)): \n        for j in range(i+1, len(arr)): \n            if arr[i] > arr[j]: \n                inversion_count += 1\n    return inversion_count"]]}
{"task_id": 195, "problem": [[0.8878861665725708, "def merge_tuples(t1, t2):\n    \"\"\"\n    Merge two tuples t1 and t2.\n    \n    >>> merge_tuples((1, 2, 3), (4, 5, 6))\n    (1, 4, 2, 5, 3, 6)\n    >>> merge_tuples((1, 2, 3), (4, 5, 6, 7))\n    (1, 4, 2, 5, 3, 6, 7)\n    >>> merge_tuples((1, 2, 3, 4), (5,\"\"\"\n    merged = ()\n    length = min(len(t1), len(t2)) # to handle tuples of unequal lengths\n    for i in range(length):\n        merged += (t1[i],)\n        merged += (t2[i],)\n    return merged + t1[length:] + t2[length:] # add remaining elements if tuples are of unequal lengths"]]}
{"task_id": 196, "problem": []}
{"task_id": 197, "problem": [[0.8993039131164551, "def isValidDecimal(s):\n    \"\"\"\n    :type s: str\n    :rtype: bool\n    \"\"\"\n    # remove any non-numeric characters and trim whitespaces\n    s = \"\".join(re.findall(\"\\d+\\.?\\d*\", s.strip()))\n\n    try: \n        num = float(s)\n        # checking if the number num has 2 decimal places\n        if not('.' in s and (len(s) - s.index('.') - 1) == 2):\n            return False      \n        else: \n             # check if it's a positive number within the range and not multiple of 10\n             return 0 < num < 1000 and num % 10 != 0\n    except ValueError:\n        return False"], [0.884856641292572, "def is_valid_decimal(s):\n    \"\"\"\n    Check if a string is a valid decimal number.\n    :param s: string to check\n    :return: True if s is a valid decimal number, False otherwise\n    \"\"\"\n    stripped_str = s.strip()\n    try:\n        number = float(stripped_str)\n        if (str(number) == stripped_str) and (int(stripped_str) != int(number)):\n            fract_part = int(str(number).split('.')[1])\n            if 0 < number < 1000 and number % 10 != 0 and len(str(fract_part)) == 2:\n                return True\n        return False\n    except ValueError:\n        return False"], [0.884850025177002, "def is_valid_decimal(s):\n    \"\"\"\n    Check if a string is a valid decimal number.\n    :param s: string to check\n    :return: True if s is a valid decimal number, False otherwise\n    \"\"\"\n    stripped_str = s.strip()\n    try:\n        number = float(stripped_str)\n        if (str(number) == stripped_str) and (int(stripped_str) != int(number)):\n            fract_part = int(str(number).split('.')[1])\n            if 0 < number < 1000 and number % 10 != 0 and len(str(fract_part)) == 2:\n                return True\n        return False\n    except ValueError:\n        return False"]]}
{"task_id": 198, "problem": [[0.8817126154899597, "def in_min_heap(array, index, heap_size):\n    \"\"\"\n    Check if the given index is in the min heap.\n    \"\"\"\n    if index < 0 or index >= heap_size:\n        return False\n    return True\n    \n    def is_min_heap(array):\n    \"\"\"\n    Check if the given array is a min heap.\n    \"\"\"\n    left = 2 * index + 1\n    right = 2 * index + 2\n    if left < heap_size and array[left] < array[index]:\n        return False\n    if right < heap_size and array[right] < array[index]:\n        return False\n    return True"]]}
{"task_id": 199, "problem": [[0.909605860710144, "def check_str(string):\n    '''\n    This function takes a string as input and checks if it contains all letters of the \n    English alphabet (a-z).\n    '''\n\n    alphabet = 'abcdefghijklmnopqrstuvwxyz'\n    for letter in alphabet:\n        if letter not in string.lower():\n            return False\n    return True"], [0.9071197509765625, "def is_alphabet_string(s):\n    \"\"\"\n    Check if a string contains only alphabets\n    \"\"\"\n    import re\n    \"\"\"\n    Write your code here\n    \"\"\"\n    if(re.search('^[a-z]+$', s)):\n        return True\n    else:\n        return False"]]}
{"task_id": 200, "problem": []}
{"task_id": 201, "problem": [[0.9243209362030029, "def sum_of_fourth_power_of_odds(n):\n    \"\"\"\n    Write a function that takes a positive integer n and returns the sum of the fourth powers of all the odd positive integers smaller than n.\n    \n    sum_of_fourth_power_of_odds(10) \u279e 285\n    # 1**4 + 3**4 + 5**4 + 7**4 + 9**4 = 285\n    \n    sum_of_fourth_power_of_odds(1) \u279e 1\n    \n    sum_of_fourth_power_of_odds(1000\"\"\"\n    if n == 1:\n        return 1\n    else:\n        return ((2*n-1)**4 + sum_of_fourth_power_of_odds(n-1))"], [0.9139100909233093, "def fourth_power(n):\n    \"\"\"\n    Calculate the fourth power of the given number.\n    :param n: int\n    :return: int\n    \"\"\"\n    return n ** 4"]]}
{"task_id": 202, "problem": []}
{"task_id": 203, "problem": [[0.9196987748146057, "def degrees_to_radians(degrees):\n    \"\"\"\n    Converts degrees to radians.\n    :param degrees: The degrees to convert.\n    :return: The radians.\n    \"\"\"\n    pi = 3.14159\n    radians = (degrees * pi) / 180\n    return radians"]]}
{"task_id": 204, "problem": [[0.9063906669616699, "def decompressRLElist(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: List[int]\n    \"\"\"\n    return [nums[i+1] for i in range(0, len(nums), 2) for _ in range(nums[i])]"]]}
{"task_id": 205, "problem": [[0.8997484445571899, "def is_sublist(main_list, potential_sublist):\n    \"\"\"\n    Return True if potential_sublist is a sublist of main_list\n    \"\"\"\n    return all(i in main_list for i in potential_sublist)\n    \n    def is_sublist(main_list, potential_sublist):\n    \"\"\"\n    Return True if potential_sublist is a sublist of main_list\n    \"\"\"\n    return all(i in main_list for i in potential_sublist)"]]}
{"task_id": 206, "problem": [[0.9248712658882141, "def first_repeated_letter(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        int: The index of the first repeated letter, or -1 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 its index\n            return \"Index:\", i\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 -1\n    return \"Index:\", -1"], [0.9241628646850586, "def find_first_repeated_character(s):\n    \"\"\"\n    Find the first repeated character in a given string.\n    \n    Args:\n        s (str): The input string.\n        \n    Returns:\n        str: The first repeated character in s, or None if no repeated characters are found.\n    \"\"\"\n    char_set = set()\n    for c in s:\n        if c in char_set:\n            return c\n        char_set.add(c)\n    return None"], [0.922087550163269, "def duplicate_characters(string):\n    \"\"\"\n    Given a string, find the first duplicate character in it.\n    For example, in the string \"abaccdeff\" the first duplicate character is 'a'\n    \n    :param string: string to search\n    :return: first duplicate character\n    \"\"\"\n    visited = [\"\\0\"] * 26 # create ASCII table\n    duplicates = [\"\\0\"] * 26 # store duplicates\n    for char in string:\n        index = get_index(char) \n        if visited[index] == \"\\0\": \n            visited[index] = char\n        elif visited[index] == char and duplicates[index] == \"\\0\":\n            duplicates[index] = char\n    \n    return ''.join([char for char in duplicates if char != '\\0'])"]]}
{"task_id": 207, "problem": [[0.9001457691192627, "def minOperations(X, Y):\n    \"\"\"\n    :type X: int\n    :type Y: int\n    :rtype: int\n    \"\"\"\n    diff = Y - X\n    \n    # if destination is below or at current location\n    if diff <= 0:\n        return -diff\n      \n    # if destination is above current location\n    q, r = divmod(diff, 2)\n    return q + r"], [0.8947091102600098, "def operations(num1, num2):\n    \"\"\"\n    Write a function that takes two positive integers as arguments, and returns the number of times you can subtract the smaller integer from the larger integer, so that the result is always greater than or equal to zero.\n    \n    You can assume that the first argument is always greater than or equal to the second.\n    \n    Example:\n    \n    operations(4, 17) # returns 2\n    \"\"\"\n    count = 0\n    while num1 != 0 and num2 != 0:\n        if num1 >= num2:\n            num1 -= num2\n        else:\n            num2 -= num1\n        count += 1\n    return count"], [0.8946556448936462, "def operations(num1, num2):\n    \"\"\"\n    Write a function that takes two positive integers as arguments, and returns the number of times you can subtract the smaller integer from the larger integer, so that the result is always greater than or equal to zero.\n    \n    You can assume that the first argument is always greater than or equal to the second.\n    \n    Example:\n    \n    operations(4, 17) # returns 2\n    \"\"\"\n    count = 0\n    while num1 != 0 and num2 != 0:\n        if num1 >= num2:\n            num1 -= num2\n        else:\n            num2 -= num1\n        count += 1\n    return count"], [0.8926690220832825, "def min_operations(nums1, nums2):\n    \"\"\"\n    :type nums1: List[int]\n    :type nums2: List[int]\n    :rtype: int\n    \"\"\"\n    sum1, sum2 = sum(nums1), sum(nums2)\n    if sum1 == sum2: return 0\n    if sum1 < sum2: nums1, nums2 = nums2, nums1\n    nums1.sort(reverse=True)\n    nums2.sort()\n    diff, operations, i, j = abs(sum1 - sum2), 0, 0, 0\n    while diff > 0 and (i < len(nums1) or j < len(nums2)):\n        option1 = nums1[i] - 1 if i < len(nums1) else 0\n        option2 = 6 - nums2[j] if j < len(nums2) else 0\n        if option1 > option2:\n            diff -= option1\n            i += 1\n        else:\n            diff -= option2\n            j += 1\n        operations += 1\n    return operations if diff == 0 else -1"], [0.8894594311714172, "def min_operations_to_one(n: int) -> int:\n    \"\"\"\n    Given an integer n, return the minimum number of operations to make n equal to 1.\n    You can apply any of the following operations:\n    If n is even, you can divide n by 2.\n    If n is odd, you can add 1 or subtract 1 from n.\n    \n    Example 1:\n    Input: n = 10\n    Output: 4\n    Explanation: 10 -> 5 -> 6 -> 3 -> 4 -> 2 -> 1\n    \n    Example 2:\n    Input: n =\"\"\"\n    operations = 0\n    while n > 1:\n        if n % 2 == 0:\n            n //= 2\n        else:\n            if n == 3 or n % 4 == 1:\n                n -= 1\n            else:\n                n += 1\n        operations += 1\n    return operations"], [0.8885034322738647, "def least_ops_express_target(x, target):\n    \"\"\"\n    :type x: int\n    :type target: int\n    :rtype: int\n    \"\"\"\n    if x == target:\n        return 0\n    if target == 1:\n        return 1\n    if x > target:\n        return min(2 * target - 1, 2 * (x - target))\n\n    k = 0\n    p = x\n    while p < target:\n        k += 1\n        p *= x\n\n    ans = float('inf')\n    d = 1\n\n    for i in range(k - 1, -1, -1):\n        while p >= target + d * (1 - x):\n            p -= d\n            ans = min(ans, i + int(math.log2(target // d) + 1) + int(d == 1 and -1 or 0))\n        d = d * x + 1\n\n    return ans"]]}
{"task_id": 208, "problem": [[0.8806426525115967, "def find_min_max(input_list):\n    \"\"\"\n    Return a tuple containing the minimum and maximum elements in a list.\n    \"\"\"\n    if not all(isinstance(num, int) for num in input_list):\n        print(\"Input list should only contain integers.\")\n        return\n\n    if len(input_list) < 2:\n        print(\"Input list should have at least 2 integers.\")\n        return\n\n    min_num = min(input_list)\n    max_num = max(input_list)\n\n    return min_num, max_num\n    \n    def find_min_max(input_\"\"\"\n    if not all(isinstance(num, int) for num in input_list):\n        print(\"Input list should only contain integers.\")\n        return\n\n    if len(input_list) < 2:\n        print(\"Input list should have at least 2 integers.\")\n        return\n\n    smallest = second_smallest = float('inf')\n    largest = second_largest = float('-inf')\n\n    for num in input_list:\n        if num < smallest:\n            second_smallest = smallest\n            smallest = num\n        elif num < second_smallest and num != smallest:\n            second_smallest = num\n\n        if num > largest:\n            second_largest = largest\n            largest = num\n        elif num > second_largest and num != largest:\n            second_largest = num\n\n    print(\"Smallest number:\", smallest)\n    print(\"Second smallest number:\", second_smallest)\n    print(\"Largest number:\", largest)\n    print(\"Second largest number:\", second_largest)"], [0.8801046013832092, "def find_min_k_records(tup_list, k):\n    \"\"\"\n    Find the minimum k records from a list of tuples.\n    :param tup_list: List of tuples.\n    :param k: Number of records to return.\n    :return: List of tuples.\n    \"\"\"\n    if len(tup_list) == 0:\n        return \"The tuple list is empty.\"\n    if k > len(tup_list):\n        return \"K is greater than the size of list. Returning all records.\"\n    tup_list.sort(key=lambda x: x[0])\n    return tup_list[:k]"], [0.878049373626709, "def minMax(numbers):\n    \"\"\"\n    Given a list of integers, return a tuple containing the minimum and maximum\n    elements in the list.\n    \n    >>> minMax([1, 2, 3, 4, 5])\n    (1, 5)\n    >>> minMax([1])\n    (1, 1)\n    \"\"\"\n    max_num = numbers[0]\n    min_num = numbers[0]\n   \n    for num in numbers:\n        if num > max_num: \n            max_num = num\n        elif num < min_num:\n            min_num = num\n   \n    return (min_num, max_num)"], [0.8767906427383423, "def select_k_elements(arr, k):\n    \"\"\"\n    Select k elements from an array such that the sum of the selected elements is maximum.\n    The selected elements must be adjacent to each other.\n    :param arr: List[int]\n    :param k: int\n    :return: Tuple[int, List[int]]\n    \"\"\"\n    n = len(arr)\n\n    # Initialize variables\n    inclusiveSum = 0\n    exclusiveSum = 0\n    selectedElements = [False] * n\n\n    for i in range(n):\n        # Calculate new sums\n        newInclusiveSum = exclusiveSum + arr[i]\n        newExclusiveSum = max(inclusiveSum, exclusiveSum)\n\n        # Check if the current element is adjacent to any selected element\n        if i > 0 and selectedElements[i-1]:\n            newInclusiveSum = max(newInclusiveSum, exclusiveSum)\n\n        # Update sums and selected elements\n        inclusiveSum = newInclusiveSum\n        exclusiveSum = newExclusiveSum\n        selectedElements[i] = inclusiveSum > exclusiveSum\n\n    # Find the maximum sum\n    maxSum = max(inclusiveSum, exclusiveSum)\n\n    # Find the selected elements\n    selected = []\n    prevSelected = False\n    for i in range(n):\n        if selectedElements[i]:\n            if not prevSelected:\n                selected.append(arr[i])\n            prevSelected = True\n        else:\n            prevSelected = False\n\n    return maxSum, selected"]]}
{"task_id": 209, "problem": [[0.9054792523384094, "def replace_chars(line):\n    \"\"\"\n    Replace all spaces, commas and dots in a string with a colon.\n    \n    >>> replace_chars('This is a test.')\n    ('This:is:a:test:', 4)\n    \"\"\"\n    replacements = 0\n    new_line = []\n    \n    for char in line:\n        if char in [' ', ',', '.']:\n            new_line.append(':')\n            replacements += 1\n        else:\n            new_line.append(char)\n    \n    return ''.join(new_line), replacements"], [0.8919072151184082, "def replace_and_count(filename):\n    \"\"\"\n    Replace all occurrences of space, comma, or period with a colon.\n    Return the number of replacements made.\n    \"\"\"\n    # +++your code here+++\n    # Open the file and read its contents\n    # Open a temporary file and write to it\n    # Replace the characters\n    # Close the files\n    \"\"\"\n    temp_file = filename + '.tmp'\n    count = 0\n    try:\n        with open(filename, 'r', encoding='utf-8') as read_file, \\\n            open(temp_file, 'w', encoding='utf-8') as write_file:\n            for line in read_file:\n                new_line = ''\n                for char in line:\n                    if char.isalnum() or char.isspace():\n                        new_line += char\n                    else:\n                        new_line += ':'\n                        count += 1\n                write_file.write(new_line)\n    except Exception as e:\n        print('An error occurred: {}'.format(str(e)))\n        return\n    finally:\n        os.remove(filename)\n        os.rename(temp_file, filename)\n    return count"], [0.8795851469039917, "def add_spaces(string): \n    \"\"\"\n    Add spaces between commas in a string.\n    \n    >>> add_spaces(\"hello,world\")\n    'hello, world'\n    >>> add_spaces(\"hello,world,how,are,you\")\n    'hello, world, how, are, you'\n    \"\"\"\n    output = \"\"\n    for char in string:\n        if char == \",\":\n            output += char + \" \"\n        else:\n            output += char\n    return output"]]}
{"task_id": 210, "problem": [[0.9352662563323975, "def find_first_even(numbers):\n    \"\"\"\n    Find the first even number in a list of numbers.\n    If there are no even numbers, return None.\n    :param numbers: a list of numbers\n    :return: the first even number in the list, or None\n    \"\"\"\n    for n in numbers:\n        if n % 2 == 0:\n            return n\n    return None"], [0.9218041300773621, "def find_index_of_first_even_number(numbers):\n    \"\"\"\n    Find the index of the first even number in a list of numbers.\n    If no even numbers are found, return 0.\n    \n    Args:\n        numbers (list): A list of integers.\n    \n    Returns:\n        int: The index of the first even number in the list, or 0 if no even numbers are found.\n    \"\"\"\n    for index, num in enumerate(numbers):\n        if num % 2 == 0:\n            return index + 1\n    return 0"]]}
{"task_id": 211, "problem": [[0.9031148552894592, "def check_same_data_type(lst):\n    \"\"\"\n    Check if all items in a list have the same data type.\n    \"\"\"\n    if len(lst) < 2:\n        return True\n\n    first_type = type(lst[0])\n\n    if first_type == list or first_type == dict:\n        first_type = check_same_data_type(lst[0])\n\n    for item in lst[1:]:\n        item_type = type(item)\n        if item_type == list or item_type == dict:\n            item_type = check_same_data_type(item)\"\"\"\n    if len(lst) < 2:\n        return True\n\n    first_type = type(lst[0])\n\n    if first_type == list or first_type == dict:\n        first_type = check_same_data_type(lst[0])\n\n    for item in lst[1:]:\n        item_type = type(item)\n        if item_type == list or item_type == dict:\n            item_type = check_same_data_type(item)\n        \n        if item_type != first_type:\n            return False\n    \n    return True"], [0.8934249877929688, "def validate_types(old_tuple, new_elements):\n    \"\"\" Check types of new_elements against types in old_tuple \"\"\"\n    for element in new_elements:\n        if type(element) != type(old_tuple[0]):\n            return False\n    return True"]]}
{"task_id": 212, "problem": [[0.9096955060958862, "def majority_element(arr):\n    '''This function takes an array and returns the majority element, if\n    exists. Otherwise, None is returned.\n    '''\n    # Create a dictionary to store the frequency of elements\n    elem_count = {}\n    for elem in arr:\n        if elem not in elem_count:\n            elem_count[elem] = 0\n        elem_count[elem] += 1\n    \n    # Loop through the dictionary to find the majority element\n    max_count = 0\n    majority_element = None\n    for elem, freq in elem_count.items():\n        if freq > max_count:\n            max_count = freq\n            majority_element = elem\n    return majority_element"]]}
{"task_id": 213, "problem": [[0.9258160591125488, "def count_set_bits(n): \n    \"\"\"\n    Count the number of set bits in a number\n    :param n: number\n    :return: number of set bits\n    \"\"\"\n    count = 0\n    while n: \n        count += n & 1\n        n >>= 1\n    return count"], [0.9201330542564392, "def count_bits(num):\n    \"\"\"\n    Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.\n\n    Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case\n    \"\"\"\n    count = 0\n    while num != 0:\n        num //= 2\n        count += 1\n    return count"], [0.9174692630767822, "def countSetBits(A: int) -> int:\n    \"\"\"\n    :type A: int\n    :rtype: int\n    \"\"\"\n    num = 0\n    while A:\n        num += A & 1\n        A = A >> 1\n    return num"]]}
{"task_id": 214, "problem": [[0.9316076040267944, "def find_minimum(arr):\n    \"\"\"\n    Find the minimum element in a rotated sorted array.\n    :param arr: List of integers\n    :return: Minimum element\n    \"\"\"\n    left = 0\n    right = len(arr) - 1\n\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]"], [0.9301156997680664, "def find_min_element(arr): \n    \"\"\"\n    Find the minimum element in a sorted and rotated array\n    \n    Args:\n        arr (list): Sorted and rotated array\n    \n    Returns:\n        int: Minimum element in the array\n    \"\"\"\n    # Base case - if array is empty, return None\n    if len(arr) == 0:\n        return None\n  \n    # Base case - if array has only one element, return the element\n    if len(arr) == 1:\n        return arr[0]\n  \n    # Find the middle element\n    mid = len(arr)//2\n  \n    # Check if the middle element is the minimum\n    if mid > 0 and arr[mid - 1] > arr[mid]:\n        return arr[mid]\n    elif arr[mid + 1] < arr[mid]:\n        return arr[mid + 1]\n    # Finding the minimum in the left portion of the array\n    elif arr[mid] > arr[0]: \n        return find_min_element(arr[0:mid])\n    else: \n        return find_min_element(arr[mid + 1:len(arr) - 1])"], [0.9175933599472046, "def find_pivot(arr, low, high):\n    \"\"\"\n    Find the pivot element in a rotated sorted array.\n    This is the smallest element in the array.\n    \"\"\"\n    # base case\n    if high < low:\n        return 0\n    if high == low:\n        return low\n\n    mid = (low + high)//2\n\n    if mid < high and arr[mid] > arr[mid + 1]:\n        return mid\n    if mid > low and arr[mid] < arr[mid - 1]:\n        return (mid-1)\n    if arr[low] >= arr[mid]:\n        \"\"\"\n    # base case\n    if high < low:\n        return 0\n    if high == low:\n        return low\n\n    mid = (low + high)//2\n\n    if mid < high and arr[mid] > arr[mid + 1]:\n        return mid\n    if mid > low and arr[mid] < arr[mid - 1]:\n        return (mid-1)\n    if arr[low] >= arr[mid]:\n        return find_pivot(arr, low, mid - 1)\n    return find_pivot(arr, mid + 1, high)"], [0.9121354818344116, "def find_pivot(arr, low, high):\n    \"\"\"\n    Find the pivot element in a rotated sorted array.\n    This is the smallest element in the array.\n    \"\"\"\n    # base cases\n    if high < low:\n        return 0\n    if high == low:\n        return low\n\n    mid = (low + high) // 2\n\n    if mid < high and arr[mid] < arr[mid + 1]:\n        return mid\n    if mid > low and arr[mid] < arr[mid - 1]:\n        return (mid-1)\n    if arr[low] >= arr[mid]:\"\"\"\n    # base cases\n    if high < low:\n        return 0\n    if high == low:\n        return low\n\n    mid = (low + high) // 2\n\n    if mid < high and arr[mid] < arr[mid + 1]:\n        return mid\n    if mid > low and arr[mid] < arr[mid - 1]:\n        return (mid-1)\n    if arr[low] >= arr[mid]:\n        return find_pivot(arr, low, mid - 1)\n    return find_pivot(arr, mid + 1, high)"], [0.9094018936157227, "def rotationalSearch(arr, n): \n    \"\"\"\n    Function to find the index of the smallest element in the array\n    \n    Parameters:\n    arr: array of integers\n    n: length of the array\n    \n    Returns:\n    index of the smallest element in the array\n    \"\"\"\n    low = 0\n    high = len(arr) - 1\n  \n    max_ele = arr[high]\n  \n    if (max_ele > arr[low]): \n        return 0\n  \n    while (low <= high): \n        mid = low + (high - low) // 2\n  \n        if (arr[mid] > arr[mid + 1]): \n            return (mid + 1) % n\n  \n        if (arr[mid] < arr[mid - 1]): \n            return mid \n  \n        if (arr[high] > arr[mid]): \n            high = mid - 1\n        else: \n            low = mid + 1\n  \n    return 0"], [0.9052538275718689, "def findMaxElement(arr, low, high):\n    \"\"\"\n    Find the maximum element in a sorted and rotated array.\n    \n    Args:\n       arr(list): Input array\n       low(int): Starting index\n       high(int): Ending index\n    Returns:\n       int: Maximum value in the array\n    \"\"\"\n    if (high == low): \n        return arr[low] \n    else: \n        mid = (low + high) // 2\n        max_left = findMaxElement(arr, low, mid) \n        max_right = findMaxElement(arr, mid + 1, high) \n        return max(max_left, max_right) "]]}
{"task_id": 215, "problem": [[0.9525721669197083, "def remove_odd_index_char(string):\n    \"\"\"\n    Remove the characters of odd index in a given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result = result + string[i]\n    return result"], [0.9523904323577881, "def remove_odd_index_characters(string):\n    \"\"\"\n    Remove characters which have odd index values in the given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result += string[i]\n    return result\n    def remove_odd_index_characters(string):\n    \"\"\"\n    Remove characters which have odd index values in the given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result += string[i]\n    return result"], [0.9361382126808167, "def deleteAtOddIndex(s):\n    \"\"\"\n    Given a string s, delete all the characters at odd indices in it.\n    For example, if the given string is \"abcdef\", then your function should return \"acf\".\n    The string is indexed from 0.\n    Args:\n        s(str): the given string\n    Returns:\n        str: resultant string\n    \"\"\"\n    output = \"\"\n    for i in range(len(s)):\n        # delete the character at an odd index\n        if i % 2 != 0:\n            pass\n        else:\n            output += s[i]\n    return output"], [0.9276894330978394, "def 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\n    def 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"], [0.9243675470352173, "def remove_every_other_char(str):\n    \"\"\"\n    Given a string, return a new string made of every other char starting with the first, so \"Hello\" yields \"Hlo\".\n    \"\"\"\n    result = \"\"\n    for i in range(len(str)):\n        if i % 2 == 0:\n            result += str[i]\n    return result"]]}
{"task_id": 216, "problem": [[0.9369652271270752, "def find_min(a, b, c):\n    \"\"\"Function which finds the minimum of three numbers\"\"\"\n    min_number = min(a, b, c)\n    return min_number"], [0.9238196015357971, "def min_function(a, b, c):\n    \"\"\"\n    Find the minimum of three numbers.\n    \n    Parameters\n    ----------\n    a : int\n        First number.\n    b : int\n        Second number.\n    c : int\n        Third number.\n    \n    Returns\n    -------\n    int\n        The minimum of the three numbers.\n    \"\"\"\n    return min(a, b, c)"], [0.921434760093689, "def find_smallest_number(a, b, c):\n    \"\"\"\n    Find the smallest number among three numbers.\n    \n    Args:\n        a (int): First number.\n        b (int): Second number.\n        c (int): Third number.\n    \n    Returns:\n        int: The smallest number.\n    \"\"\"\n    return min(a, b, c)"]]}
{"task_id": 217, "problem": []}
{"task_id": 218, "problem": [[0.9378997087478638, "def rearrange(arr):\n    \"\"\"\n    Rearrange positive and negative numbers in O(n) time and O(1) extra space\n    \"\"\"\n    # TODO: Write your code here\n    # Hint: Use two pointers technique\n    #       One pointer to traverse the array from left to right\n    #       Another pointer to traverse the array from right to left\n    \"\"\"\n    left = 0\n    right = len(arr) - 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"], [0.9373679161071777, "def optimizeArray(arr): \n    \"\"\"\n    Given an array of integers, move all negative integers to the beginning of the array and all positive integers to the end of the array. The order of the positive integers does not matter.\n    \n    Example:\n    \n    Input: [1, -1, 3, 2, -7]\n    Output: [-1, -7, 1, 3, 2]\n    \n    Input: [1, 2, 3, -1, -2, -3]\n    Output: [-1, -2, -3, 1, 2,\"\"\"\n    j = -1\n    for i in range(len(arr)): \n        if arr[i] < 0: \n            j += 1\n            arr[i], arr[j] = arr[j], arr[i] \n    return arr"], [0.9368343353271484, "def rearrangeNegativePositive(arr, n):\n    \"\"\"\n    Rearrange positive and negative numbers in O(n) time and O(1) extra space\n    \"\"\"\n    # code here\n    \n    def rearrange(self,arr, n):\n    \"\"\"\n    Rearrange positive and negative numbers in O(n) time and O(1) extra space\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\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            left += 1\n            right -= 1"], [0.929431676864624, "def rearrange_negative_numbers(array):\n    \"\"\"\n    Rearrange the elements of the array such that all negative numbers come before all positive numbers.\n    The order of the negative numbers and the positive numbers does not matter.\n    \n    Args:\n        array: A list of integers.\n    \n    Returns:\n        A list of integers where all negative numbers come before all positive numbers.\n    \"\"\"\n    negative_nums = []\n    positive_nums = []\n    for num in array:\n        if num < 0:\n            negative_nums.append(num)\n        else:\n            positive_nums.append(num)\n    return negative_nums + positive_nums"], [0.9281833171844482, "def negative_at_beginning(arr):\n    \"\"\"\n    Given an array of integers, move all negative integers to the beginning of the array.\n    The order of the positive integers in the array should be unchanged.\n    The negative integers should be in the same order as they were in the original array.\n    \n    Example:\n    Input: [1, -2, 3, -4, 5, -6, 7]\n    Output: [-2, -4, -6, 1, 3, 5, 7]\n    \n    Input: [1, -2, 3, -4, \"\"\"\n    left, right = 0, len(arr) - 1\n    while left < right:\n        if arr[left] < 0:\n            left += 1\n        elif arr[right] >= 0:\n            right -= 1\n        else:\n            arr[left], arr[right] = arr[right], arr[left]\n            left += 1\n            right -= 1\n    return arr"], [0.9246528744697571, "def move_negatives(numbers):\n    \"\"\"\n    Move all negative numbers to the start and positive to the end of the list.\n    The relative order of the positive numbers and the negative numbers should\n    stay the same.\n    \"\"\"\n    positive_list = []\n    negative_list = []\n    for num in numbers:\n        if num < 0:\n            negative_list.append(num)\n        else:\n            positive_list.append(num)\n    return negative_list + positive_list\n    def move_negatives(numbers):\n    \"\"\"\n    Move all negative numbers to the start and positive\"\"\"\n    positive_list = []\n    negative_list = []\n    for num in numbers:\n        if num < 0:\n            negative_list.append(num)\n        else:\n            positive_list.append(num)\n    return positive_list + negative_list"]]}
{"task_id": 219, "problem": [[0.9108548164367676, "def 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)"]]}
{"task_id": 220, "problem": [[0.8907344937324524, "def max_sum_path(matrix):\n    \"\"\"\n    Find the maximum sum of a path from top left to bottom right.\n    You can only move down or right.\n    \"\"\"\n    rows = len(matrix)\n    cols = len(matrix[0])\n\n    for row in range(rows):\n        for col in range(cols):\n            if row == 0 and col == 0: \n                continue\n            elif row == 0: \n                matrix[row][col] += matrix[row][col-1]\n            elif col == 0: \n                matrix[row][col] += matrix[row-1][col]\n            else: \n                matrix[row][col] += max(matrix[row-1][col], matrix[row][col-1])\n\n    return matrix[rows-1][cols-1]"]]}
{"task_id": 221, "problem": [[0.9116641283035278, "def nlargest(n, iterable):\n    \"\"\"Find the n largest elements in a dataset.\n    Equivalent to:  sorted(iterable, reverse=True)[:n]\n    \"\"\"\n\n    if n < 0:\n        return []\n    it = iter(iterable)\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"], [0.9035091400146484, "def get_most_expensive_items(dataset, n):\n    \"\"\"\n    Returns the n most expensive items in the dataset.\n    \n    Args:\n        dataset (list): A list of dictionaries representing items.\n        n (int): The number of most expensive items to return.\n        \n    Returns:\n        list: A list of dictionaries representing the n most expensive items.\n    \"\"\"\n    # Sorting the dataset by 'cost' in descending order (from highest to lowest)\n    sorted_dataset = sorted(dataset, key=lambda item: item['cost'], reverse=True)\n    # Returning the first n items\n    return sorted_dataset[:n]"], [0.903169572353363, "def get_most_expensive_items(dataset, n):\n    \"\"\"\n    Returns the n most expensive items in a dataset.\n    \n    Args:\n        dataset (list): A list of dictionaries representing items in a dataset.\n        n (int): The number of most expensive items to return.\n    \n    Returns:\n        list: A list of dictionaries representing the n most expensive items in the dataset.\n    \"\"\"\n    # sorting the dataset by 'cost' in descending order (from highest to lowest)\n    sorted_dataset = sorted(dataset, key=lambda item: item['cost'], reverse=True)\n    # returning first n items\n    return sorted_dataset[:n]"]]}
{"task_id": 222, "problem": [[0.9055103063583374, "def surface_area_cylinder(radius, height):\n    \"\"\"\n    Calculate the surface area of a cylinder.\n    \n    Args:\n        radius (float): The radius of the cylinder.\n        height (float): The height of the cylinder.\n    \n    Returns:\n        float: The surface area of the cylinder.\n    \"\"\"\n    pi = 3.14\n    return (2 * pi * radius * height) + (2 * pi * (radius ** 2))"]]}
{"task_id": 223, "problem": [[0.9112489223480225, "def cube_volume(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"], [0.9103088974952698, "def calculate_volume(s):\n  \"\"\"\n  Calculate the volume of a cube.\n  \n  Args:\n    s: The length of one side of the cube.\n  \n  Returns:\n    The volume of the cube.\n  \"\"\"\n  V = s**3\n  return V"], [0.9089083671569824, "def calculate_cube_volume(length):\n    \"\"\"Calculate the volume of a cube.\n    \n    Args:\n        length (float): The length of a side of the cube.\n        \n    Returns:\n        float: The volume of the cube.\n    \"\"\"\n    volume = length ** 3\n    return volume"]]}
{"task_id": 224, "problem": [[0.8876368999481201, "def even_odd_change(arr):\n    \"\"\"\n    Given an array of numbers, replace all even numbers with 0 and all odd numbers with 1.\n    \n    Example:\n    \n    Input: [1, 2, 3, 4, 5, 6]\n    Output: [1, 0, 1, 0, 1, 0]\n    \n    Input: [10, 11, 12, 13, 14, 15]\n    Output: [0, 1, 0, 1, 0, 1]\n\"\"\"\n    for i in range(len(arr)):\n        if arr[i] % 2 == 0:\n            arr[i] = 0\n        else:\n            arr[i] = 1\n    return arr"]]}
{"task_id": 225, "problem": [[0.8838199377059937, "def T(n):\n   \"\"\"\n   Return the number of triangles in a triangle of size n.\n   \"\"\"\n   return math.floor(n / math.sqrt(3))"]]}
{"task_id": 226, "problem": [[0.8963366150856018, "def count_occurrences(lst):\n    \"\"\"\n    Given a list of integers, return a list of tuples where each tuple contains a number and the number of occurrences of that number in the list.\n    The list of tuples should be ordered in descending order based on the count of occurrences.\n    For example, given the list [1, 2, 3, 1, 2, 3, 1, 4, 5], return [(1, 3), (2, 2), (3, 2), (4, 1), (5, 1)].\n    \"\"\"\n    from collections import Counter\n    \n\"\"\"\n    count = Counter(lst)  # Count occurrences of each distinct integer\n    result = [(i, count[i]) for i in count]  # Convert to the desired output format\n    result.sort(key=lambda x: (-x[1], x[0]))  # Sort first by descending count, then by ascending integer\n    return result"]]}
{"task_id": 227, "problem": []}
{"task_id": 228, "problem": [[0.8881839513778687, "def f(n):\n    \"\"\"\n    \"\"\"\n    ans = 0\n    n //= 2\n    for i in range(1, n+1):\n        h[i] = n // i - 1\n    for i in range(1, n+1):\n        f[i] = binom(h[i])\n        j = 2\n        while i * j <= n:\n            f[i] -= f[i * j]\n            j += 1\n        ans = (ans + i * f[i]) % MOD\n    return ans * 2 % MOD"]]}
{"task_id": 229, "problem": [[0.9148705005645752, "def replace_last_element(list1, list2):\n    \"\"\"\n    Replace the last element of list1 with the last element of list2\n    \n    >>> replace_last_element([1, 2, 3], [4, 5, 6])\n    [1, 2, 6]\n    >>> replace_last_element([1, 2, 3], [4])\n    [1, 2, 4]\n    \"\"\"\n    list1[-1:] = list2\n    return list1"], [0.8855752944946289, "def last_element(list):\n    \"\"\"Find the last element of a given list.\"\"\"\n    return list[-1]"]]}
{"task_id": 230, "problem": [[0.8953325748443604, "def generate_3d_array(m, n, l):\n    \"\"\"\n    Generate a 3D array of size m x n x l\n    :param m: int\n    :param n: int\n    :param l: int\n    :return: list\n    \"\"\"\n    threeD = [[[0 for x in range(l)] for y in range(n)] for z in range(m)]\n    return threeD"]]}
{"task_id": 231, "problem": []}
{"task_id": 232, "problem": []}
{"task_id": 233, "problem": [[0.9175034761428833, "def find_next_perfect_square(n):\n    \"\"\"\n    Find the next perfect square after the given number.\n    :param n: The given number.\n    :return: The next perfect square.\n    \"\"\"\n    if is_perfect_square(n):\n        root = math.sqrt(n)\n        next_square = (root + 1) ** 2\n        return int(next_square)\n    else:\n        return \"Number is not a perfect square\""], [0.9108990430831909, "def next_square(n):\n    \"\"\"\n    Find the next square number after n\n    :param n: int\n    :return: int\n    \"\"\"\n    return int(math.ceil(math.sqrt(n)))**2"]]}
{"task_id": 234, "problem": [[0.8948610424995422, "def max_sum_subarray(arr):\n    \"\"\"\n    Find the maximum sum of a subarray in the given array.\n    \n    Args:\n        arr (list): The input array.\n    \n    Returns:\n        int: The maximum sum of a subarray in the given array.\n    \"\"\"\n    n = len(arr)\n    \n    # Base cases\n    if n == 0:\n        return 0\n    if n == 1:\n        return arr[0]\n    \n    # Initialize two variables to store the maximum sum\n    include = arr[0]\n    exclude = 0\n    \n    # Iterate through the array\n    for i in range(1, n):\n        # Update the maximum sum by including or excluding the current element\n        new_include = exclude + arr[i]\n        new_exclude = max(include, exclude)\n        \n        # Update the include and exclude variables\n        include = new_include\n        exclude = new_exclude\n    \n    # Return the maximum sum\n    return max(include, exclude)"], [0.8929369449615479, "def maxsum(arr):\n    \"\"\"\n    Find the maximum sum of a contiguous subarray.\n    :param arr: array of integers\n    :return: maximum sum\n    \"\"\"\n    if len(arr) == 0:\n        return 0\n\n    incl = arr[0]\n    excl = 0\n\n    for i in arr[1:]:\n        new_excl = max(incl, excl)\n        incl = excl + i\n        excl = new_excl\n\n    return max(incl, excl)"], [0.8922436237335205, "def max_sum_subarray(arr):\n    \"\"\"\n    Find the maximum sum subarray in a given array.\n    :param arr: list of integers\n    :return: integer\n    \"\"\"\n    max_ending_here = max_so_far = arr[0]\n    for i in range(1, len(arr)):\n        max_ending_here = max(arr[i], max_ending_here + arr[i])\n        max_so_far = max(max_ending_here, max_so_far)\n    return max_so_far"], [0.889336109161377, "def max_subarray_sum(arr):\n    \"\"\"\n    Find the maximum sum of a subarray in the given array.\n    \n    Args:\n        arr (list): The input array.\n    \n    Returns:\n        int: The maximum sum of a subarray in the array.\n    \"\"\"\n    n = len(arr)\n    memo = [0] * n  # Create a memoization array to store the maximum sum of subarrays ending at each index\n    \n    memo[0] = arr[0]  # Base case: the maximum sum of a subarray ending at the first element is the element itself\n    \n    for i in range(1, n):\n        # The maximum sum of a subarray ending at index i is the maximum of:\n        #   1. The element itself\n        #   2. The element plus the maximum sum of a subarray ending at the previous index (i-1)\n        #   3. The maximum sum of a subarray ending at the previous index (i-1)\n        memo[i] = max(arr[i], arr[i] + memo[i-1], memo[i-1])\n    \n    return max(memo)  # The maximum sum of any subarray in the array is the maximum value in the memoization array"], [0.8887341022491455, "def max_sum_non_contiguous(arr):\n    \"\"\"\n    Find the maximum sum of non-contiguous subarray in an array.\n    \n    Args:\n        arr (list): The input array.\n    \n    Returns:\n        int: The maximum sum of non-contiguous subarray.\n    \"\"\"\n    if len(arr) == 0:\n        return 0\n    if len(arr) == 1:\n        return max(arr[0], 0)\n    \n    incl = max(arr[0], 0)\n    excl = 0\n    \n    for i in range(1, len(arr)):\n        # Calculate the new incl and excl values based on the current element\n        new_excl = max(incl, excl)\n        incl = excl + max(arr[i], 0)\n        excl = new_excl\n    \n    # Return the maximum sum of non-contiguous subarray\n    return max(incl, excl)"], [0.888486385345459, "def max_sum(arr): \n     \"\"\"\n     Find the maximum sum of a contiguous subsequence in arr.\n     \n     Args:\n       arr(list): array of integers\n     Returns:\n       int: the maximum sum of a contiguous subsequence\n     \"\"\"\n     if len(arr) == 0: \n         return 0\n  \n     if len(arr) == 1: \n         return arr[0] \n  \n     if len(arr) == 2: \n         return max(arr[0], arr[1]) \n  \n     max_sum_incl = arr[0] \n     max_sum_excl = 0\n  \n     for i in range(1, len(arr)): \n        temp = max_sum_incl \n        max_sum_incl = max(max_sum_excl + arr[i] , max_sum_incl) \n        max_sum_excl = temp \n  \n     return max(max_sum_incl, max_sum_excl)"], [0.8879979848861694, "def maxsumSubsequence(arr): \n    \"\"\"\n    Find the maximum sum of a subsequence in an array\n    :param arr: array of integers\n    :return: maximum sum of a subsequence\n    \"\"\"\n    max_including = arr[0] \n    max_excluding = 0\n    max_sum = 0\n\n    for i in range(1, len(arr)):\n        max_sum = max(max_including, max_excluding)\n\n        max_including = max_excluding + arr[i]\n        max_excluding = max_sum\n\n    return max(max_including, max_excluding)"], [0.8876867890357971, "def max_sum_sequence(arr): \n    \"\"\"\n    Find the contiguous subarray within an array (containing at least one number) which has the largest sum.\n    For example:\n    Given the array [-2,1,-3,4,-1,2,1,-5,4],\n    the contiguous subarray [4,-1,2,1] has the largest sum = 6.\n    \n    Args:\n       arr(list): input array\n    Returns:\n       int: largest sum\n    \"\"\"\n    n = len(arr) \n    current_max = arr[0] \n    global_max = arr[0] \n      \n    for i in range(1, n): \n        current_max = max(arr[i], current_max+arr[i]) \n        if current_max > global_max: \n            global_max = current_max \n      \n    return global_max"], [0.8863278031349182, "def max_sum_subarray(arr):\n    \"\"\"\n    Find the maximum sum of a subarray in a given array.\n    \n    Args:\n        arr (list): The input array.\n    \n    Returns:\n        int: The maximum sum of a subarray.\n    \"\"\"\n    max_sum = 0\n    \n    for i in range(len(arr)):\n        cur_sum = 0\n        \n        for j in range(i, len(arr)):\n            cur_sum += arr[j]\n            \n            if cur_sum > max_sum:\n                max_sum = cur_sum\n    \n    return max_sum"]]}
{"task_id": 235, "problem": [[0.9364761710166931, "def sqrt_babylonian(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 + x / guess) / 2.0\n        if abs(guess - better_guess) < 0.5:\n            return round(better_guess)\n        guess = better_guess"], [0.9348063468933105, "def babylonian_sqrt(n):\n    \"\"\"Babylonian square root\"\"\"\n    x = n\n    y = 1\n    e = 0.000001  # This defines the accuracy level\n    while (x - y > e):\n        x = (x + y)/2\n        y = n/x\n    return x"], [0.9237368702888489, "def square_root(number):\n    \"\"\"\n    Calculate the square root of a number using the Babylonian method.\n    \n    Args:\n        number (float): The number whose square root is to be calculated.\n        \n    Returns:\n        float: The square root of the given number.\n    \"\"\"\n    guess = number / 2  # initial guess\n    threshold = 0.0001  # acceptable error threshold\n    \n    while abs(guess * guess - number) > threshold:\n        guess = (guess + number / guess) / 2\n        \n    return guess"], [0.9208081960678101, "def sqrt(n):\n    \"\"\"\n    Return the square root of n.\n    \"\"\"\n    x = n\n    y = (x + 1) / 2\n\n    while abs(y - x) > 0.000001:\n        x = y\n        y = (x + n / x) / 2\n\n    return y"], [0.9191723465919495, "def square_root(number):\n    \"\"\"\n    Calculate the square root of a number using the Babylonian method.\n    \n    Args:\n        number (float): The number whose square root is to be calculated.\n    \n    Returns:\n        float: The square root of the given number.\n    \"\"\"\n    if number == 0 or number == 1:\n        return number\n    \n    # Initialize variables\n    root = number\n    remainder = 0\n    result = 0\n    \n    # Set the divisor and quotient\n    divisor = 1\n    quotient = 0\n    \n    # Loop until we get the desired precision\n    while root - result > 0.0001:\n        # Calculate the next digit of the square root\n        while quotient * ((divisor * 2 * 10) + quotient) <= root:\n            quotient += 1\n        \n        # Adjust the divisor and result\n        divisor = divisor * 10\n        result = result * 10 + quotient\n        \n        # Calculate the remainder for the next iteration\n        remainder = root - (quotient * quotient)\n        \n        # Prepare for the next iteration\n        quotient = 0\n        root = remainder * 100\n    \n    return result"], [0.9166451692581177, "def sqrt(number): \n    \"\"\"\n    Return the square root of the given number.\n    \n    >>> sqrt(9)\n    3.0\n    >>> sqrt(2)\n    1.4142135623730951\n    \"\"\"\n    # Initialize the square root \n    # of the given number \n    sqrt = number / 2\n  \n    # Use the Babylonian algorithm \n    # for calculating the square root \n    # of the given number \n    temp = 0\n    while(sqrt != temp): \n        temp = sqrt \n        sqrt = ( number/temp + temp) / 2\n  \n    return sqrt"], [0.9128643870353699, "def sqrt(x):\n    \"\"\"\n    Returns the square root of x.\n    \"\"\"\n    root = x\n    epsilon = 0.0001\n    while abs(x - root * root) > epsilon:\n        root = (x/root + root)/2\n    return root"], [0.9128344655036926, "def sqrt(x):\n    \"\"\"\n    Compute square roots using the method of Heron of Alexandria.\n    \n    Args:\n      x: the number for which the square root is to be computed\n    Returns:\n      The square root of x.\n    \"\"\"\n    guess = x\n    i = 0\n    while guess * guess != x and i < 20:\n        guess = (guess + x / guess) / 2.0\n        i += 1\n    return guess"]]}
{"task_id": 236, "problem": []}
{"task_id": 237, "problem": [[0.9292917251586914, "def harmonic_sum(n):\n    \"\"\"\n    Return the nth harmonic sum.\n    \n    The nth harmonic sum is the sum of the reciprocals of the positive integers\n    less than or equal to n.\n    \n    >>> harmonic_sum(1)\n    1.0\n    >>> harmonic_sum(2)\n    1.5\n    >>> harmonic_sum(3)\n    1.8333333333333333\n    >>> harmonic_sum(4)\n    1.9166666666666665\n    >>> harmonic\"\"\"\n    if n < 2:\n        return 1\n    else:\n        return 1/n + harmonic_sum(n-1)"], [0.9282971620559692, "def harmonic(n):\n    \"\"\"\n    Harmonic number\"\"\"\n    if n < 1: \n        return 0\n    elif n == 1: \n        return 1\n    else: \n        return harmonic(n - 1) + 1 / n"], [0.9053475856781006, "def harmonic_series(N):\n    \"\"\"\n    This function calculates the harmonic series up to N.\n    \n    Parameters\n    ----------\n    N : int\n        The number of terms in the series.\n    \n    Returns\n    -------\n    sum : float\n        The sum of the harmonic series up to N.\n    \"\"\"\n    sum = 0\n    for i in range(1, N+1):\n        sum += 1/i\n    return sum"]]}
{"task_id": 238, "problem": [[0.9145195484161377, "def intersection(arr1, arr2):\n  \"\"\"\n  Find the intersection of two arrays\n  \"\"\"\n  # Use built-in set function to find intersection\n  result = list(set(arr1) & set(arr2))\n  return result\n    def intersection(arr1, arr2):\n  \"\"\"\n  Find the intersection of two arrays\n  \"\"\"\n  # Use built-in set function to find intersection\n  result = list(set(arr1) & set(arr2))\n  return result"]]}
{"task_id": 239, "problem": []}
{"task_id": 240, "problem": []}
{"task_id": 241, "problem": [[0.9135926961898804, "def complex_to_polar(a, b):\n    \"\"\"\n    Convert a complex number to polar form.\n    \n    Parameters:\n    a (float): The real part of the complex number.\n    b (float): The imaginary part of 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 = (a**2 + b**2) ** 0.5\n\n    # Calculate the angle\n    if a == 0:\n        theta = 90 if b > 0 else 270\n    else:\n        theta = math.degrees(math.atan(b / a))\n\n    # Return the polar form\n    return (r, theta)"], [0.8814173340797424, "def convert_to_polar(x, y):\n    \"\"\"\n    Converts Cartesian coordinates to polar coordinates.\n    \n    Args:\n        x (float): x-coordinate\n        y (float): y-coordinate\n        \n    Returns:\n        tuple: (r, theta)\n    \"\"\"\n    r = math.sqrt(x**2 + y**2)\n    theta = math.atan2(y, x)\n    \n    if x < 0:\n        theta += math.pi\n    \n    return (r, theta)"]]}
{"task_id": 242, "problem": []}
{"task_id": 243, "problem": [[0.9118198156356812, "def word_find(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\n  # return unique words only by converting the list to a set\n  return list(set(matches))"]]}
{"task_id": 244, "problem": [[0.873788595199585, "def comb3(arr):\n    \"\"\"\n    \"\"\"\n    result = []\n    for i in range(len(arr)):\n        for j in range(i+1, len(arr)):\n            for k in range(j+1, len(arr)):\n                t = [arr[i], arr[j], arr[k]]\n                result.append(t)\n    return result"]]}
{"task_id": 245, "problem": [[0.9299114346504211, "def count_primes(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"], [0.9273073077201843, "def prime_count(n):\n    \"\"\"\n    Count the number of prime numbers less than a non-negative number, n.\n    \n    :type n: int\n    :rtype: int\n    \"\"\"\n    prime_count = 0\n    for i in range(2, n + 1):\n        is_prime = True\n        for j in range(2, int(i ** 0.5) + 1):\n            if i % j == 0:\n                is_prime = False\n                break\n        if is_prime:\n            prime_count += 1\n        \n    return prime_count"], [0.9266175031661987, "def count_primes(l):\n    \"\"\"\n    Count the number of prime numbers less than a non-negative number, l.\n    \"\"\"\n    count = 0\n    for elem in l:\n        if is_prime(elem):\n            count += 1\n    return count"], [0.9249802827835083, "def count_primes(num) :\n    \"\"\"\n    Return the number of prime numbers that exist up to and including a given number.\n    \"\"\"\n    def check_primes(num) :\n        \"\"\"\n        Check if a number is prime or not\n        \"\"\"\n        if num > 1 :\n            for i in range(2,num) :\n                if num % i == 0 :\n                    return False\n            return True\n        else :\n            return False\n\n    \"\"\"\n    count = 0\n    for m in range(2,num) :\n        if check_primes(m) == True :\n            count += 1\n\n    return count"]]}
{"task_id": 246, "problem": [[0.9232127666473389, "def swap(a, b):\n    \"\"\"Swap two numbers\"\"\"\n    # Store a in temp\n    temp = a\n\n    # Copy b to a\n    a = b\n\n    # Copy temp to b\n    b = temp"], [0.9203928709030151, "def swap_numbers(a, b):\n    \"\"\"\n    Swap two numbers\n    \"\"\"\n    a = a + b\n    b = a - b\n    a = a - b\n    return a, b\n    def swap_numbers(a, b):\n    \"\"\"\n    Swap two numbers\n    \"\"\"\n    a = a + b\n    b = a - b\n    a = a - b\n    return a, b"], [0.9203890562057495, "def swap_numbers(a, b):\n    \"\"\"\n    Swap two numbers\n    \"\"\"\n    a = a + b\n    b = a - b\n    a = a - b\n    return a, b\n    def swap_numbers(a, b):\n    \"\"\"\n    Swap two numbers\n    \"\"\"\n    a = a + b\n    b = a - b\n    a = a - b\n    return a, b"], [0.9194864630699158, "def swap(a, b):\n    \"\"\"\n    Swap two variables.\n    \"\"\"\n    return b, a\n    def swap(a, b):\n    \"\"\"\n    Swap two variables.\n    \"\"\"\n    return b, a"]]}
{"task_id": 247, "problem": [[0.9179342985153198, "def count_odd(lst):\n    \"\"\"\n    Return the number of elements in the list that are odd.\n    \"\"\"\n    count = 0\n    for i in lst:\n        if i % 2 != 0:\n            count += 1\n    return count\n    def count_odd(lst):\n    \"\"\"\n    Return the number of elements in the list that are odd.\n    \"\"\"\n    count = 0\n    for i in lst:\n        if i % 2 != 0:\n            count += 1\n    return count"], [0.9051287174224854, "def count_odd(nums):\n    \"\"\"\n    Return the number of integers in the given list which are odd.\n    \n    >>> count_odd([1, 2, 3, 4, 5])\n    3\n    >>> count_odd([2, 4, 6, 8])\n    0\n    >>> count_odd([1, 3, 5, 7])\n    4\n    \"\"\"\n    count = 0\n    for num in nums:\n        if num % 2 != 0:\n            count += 1\n    return count"]]}
{"task_id": 248, "problem": [[0.8909956812858582, "def optimize(list1, list2):\n    \"\"\"\n    Find the combination of two lists that maximizes the sum of their elements.\n    \n    Args:\n        list1 (list): The first list of integers.\n        list2 (list): The second list of integers.\n        \n    Returns:\n        tuple: A tuple containing the two integers from the two lists that maximize the sum.\n    \"\"\"\n    best_combination = (0, 0)\n    best_value = -float('inf')\n    for x in list1:\n        for y in list2:\n            value = x + y\n            if value > best_value:\n                best_value = value\n                best_combination = (x, y)\n    return best_combination"]]}
{"task_id": 249, "problem": []}
{"task_id": 250, "problem": []}
{"task_id": 251, "problem": [[0.9031261205673218, "def split_list(arr):\n    \"\"\"\n    Write a function that takes in a list of numbers and returns a new list containing the first half of the numbers in the input list.\n    If there are an odd number of elements, return the middle element.\n    \n    Example:\n    Input: [1,2,3,4,5]\n    Output: [1,2,3]\n    \n    Input: [1,2,3,4,5,6]\n    Output: [1,2,3,4]\n    \"\"\"\n    first_half = arr[:(len(arr)//2)]\n    second_half = arr[(len(arr)//2):]\n    return [first_half, second_half]"]]}
{"task_id": 252, "problem": []}
{"task_id": 253, "problem": []}
{"task_id": 254, "problem": [[0.904079794883728, "def split_list(L, n):\n    \"\"\"\n    >>> list(split_list([1,2,3,4,5,6,7,8], 3))\n    [[1, 2, 3], [4, 5, 6], [7, 8]]\n    >>> list(split_list([1,2,3,4,5,6,7,8], 4))\n    [[1, 2, 3, 4], [5, 6, 7, 8]]\n    >>> list(split_list([1,2,3,4,5,6\"\"\"\n    assert type(L) is list, \"L is not a list\"\n    it = iter(L)\n    while True:\n        chunk = list(islice(it,n))\n        if not chunk:\n            return\n        yield chunk"], [0.895561933517456, "def group_list(mylist, n): \n    \"\"\"\n    group_list([1,2,3,4], 2)\n    [[1,2], [3,4]]\n    \"\"\"\n    newlist = [] \n    indices = list(range(0, len(mylist), n))  \n    for start in indices: \n        end = start + n\n        newlist.append(mylist[start:end])  \n    return newlist \n    \n    def group_list(mylist, n): \n    \"\"\"\n    group_list([1,2,3,4], 2)\n    [[\"\"\"\n    newlist = [] \n    indices = list(range(0, len(mylist), n))  \n    for start in indices: \n        end = start + n\n        newlist.append(mylist[start:end])  \n    return newlist "], [0.8952036499977112, "def split_string(string, n):\n    \"\"\"\n    Split a string into a list of strings, each of length n.\n    \n    >>> split_string(\"Lovelace\", 3)\n    ['Lov', 'ele', 'ace']\n    \n    >>> split_string(\"Chocolate\", 3)\n    ['Cho', 'col', 'ate']\n    \n    >>> split_string(\"Chocolate\", 2)\n    ['Ch', 'oc', 'ol', 'at', 'e']\n    \n    >>> split_string(\"Chocolate\", 4)\n    ['Choc', 'olat', 'e']\n    \n\"\"\"\n    return [string[i:i+n] for i in range(0, len(string), n)]"]]}
{"task_id": 255, "problem": [[0.912993311882019, "def cube_surface_area(side):\n    \"\"\" \n    Calculate and return the total surface area of a cube \n    given the side length.\n    \"\"\"\n    return 6 * side**2"], [0.9041370153427124, "def calc_surface_area(side_length):\n    \"\"\"\n    Calculate the surface area of a cube.\n    \n    Args:\n        side_length (float): The length of one side of the cube.\n        \n    Returns:\n        float: The surface area of the cube.\n    \"\"\"\n    return side_length * side_length * 6"]]}
{"task_id": 256, "problem": [[0.9226610660552979, "def sum_odd_integers(n):\n    \"\"\"\n    Return the sum 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\n    return sum\n    \n    def sum_odd_integers(n):\n    \"\"\"\n    Return the sum of the first n odd integers.\n    \"\"\"\n    sum = 0\n    if n % 2 == 0:\n        sum = (n // 2) ** 2\n    else:\n        sum = ((n + 1) // 2) ** 2\n    return sum"], [0.9226177930831909, "def sum_of_squares_of_n_odds(n):\n    \"\"\"\n    Calculate the sum of the squares of the first n odd numbers.\n    \n    Args:\n        n (int): The number of odd numbers to consider.\n    \n    Returns:\n        int: The sum of the squares of the first n odd numbers.\n    \"\"\"\n    # Step 1: Generate a list of the first n odd numbers.\n    odd_numbers = [2 * i + 1 for i in range(n)]\n\n    # Step 2: Calculate the square of each odd number in the list.\n    squared_odd_numbers = [x ** 2 for x in odd_numbers]\n\n    # Step 3: Sum the squared odd numbers.\n    total_sum = sum(squared_odd_numbers)\n\n    return total_sum"]]}
{"task_id": 257, "problem": []}
{"task_id": 258, "problem": [[0.9394608736038208, "def get_ascii_code(char):\n    \"\"\"Implement a function that takes a character and returns its ASCII code.\"\"\"\n    return ord(char)"], [0.9217381477355957, "def print_ascii_value():\n    \"\"\"\n    This function takes a character as input and prints its ASCII value.\n    \"\"\"\n    char = input(\"Enter a character: \")  # Read a single character from the standard input\n    ascii_value = ord(char)  # Get the ASCII value of the character\n    print(f\"The ASCII value of '{char}' is {ascii_value}\")  # Print the ASCII value"], [0.921252965927124, "def get_ascii(character):\n  \"\"\"\n    Return the ASCII value of a character.\n    :param character: The character to get the ASCII value of.\n    :return: The ASCII value of the character.\n    \"\"\"\n  return ord(character)"], [0.9146664142608643, "def char_to_ascii(char):\n    \"\"\"\n    Converts a character to its ASCII value.\n    \n    Args:\n        char (str): The character to convert.\n        \n    Returns:\n        int: The ASCII value of the character.\n    \"\"\"\n    return ord(char)"], [0.9146560430526733, "def char_to_ascii(char):\n    \"\"\"\n    Converts a character to its ASCII value.\n    \n    Args:\n        char (str): The character to convert.\n        \n    Returns:\n        int: The ASCII value of the character.\n    \"\"\"\n    return ord(char)"]]}
{"task_id": 259, "problem": []}
{"task_id": 260, "problem": []}
{"task_id": 261, "problem": [[0.8869010806083679, "def get_first_element(lst):\n    \"\"\"\n    Return the first element of the given list.\n    \"\"\"\n    return lst[0]\n    \n    def get_last_element(lst):\n    \"\"\"\n    Return the last element of the given list.\n    \"\"\"\n    return lst[-1]\n    \n    def get_second_element(lst):\n    \"\"\"\n    Return the second element of the given list.\n    \"\"\"\n    return lst[1]\n    \n    def get_second_to_last_element(lst):\n    \"\"\"\n    Return the second to last element of the given list.\"\"\"\n    result = []\n    for tuple in lst:\n        if tuple[0] % 2 == 1:\n            result.append(tuple[0])\n        else:\n            result.append(tuple[1])\n    return result"], [0.8802847862243652, "def extract_last(a):\n    \"\"\"\n    Extract the last element from a list.\n    >>> extract_last([1, 2, 3])\n    3\n    >>> extract_last([1, 2, 3, 4])\n    4\n    \"\"\"\n    return a[-1]"], [0.8749561905860901, "def switch_indices(arr):\n    \"\"\"\n    Given a list of tuples, return a list of tuples where the first and last elements have been swapped.\n    \"\"\"\n    # Get length of the tuple \n    n = len(arr[0])\n    # Loop over each tuple in the list\n    res = []\n    for tup in arr:\n        # Create a new tuple\n        tmp = []\n        for i in range(n):\n            tmp.append(tup[n - 1 - i])\n        res.append(tuple(tmp))\n    return res\n    def switch_indices(arr):\n    \"\"\"\n    # Get length of the tuple \n    n = len(arr[0])\n    # Loop over each tuple in the list\n    res = []\n    for tup in arr:\n        # Create a new tuple\n        tmp = []\n        for i in range(n):\n            tmp.append(tup[n - 1 - i])\n        res.append(tuple(tmp))\n    return res"]]}
{"task_id": 262, "problem": []}
{"task_id": 263, "problem": [[0.8980141282081604, "def binomial_sum(n):\n    \"\"\"\n    This function calculates the sum of binomial coefficients for a given n.\n    \n    Args:\n        n (int): The value of n for which the sum is to be calculated.\n    \n    Returns:\n        int: The sum of binomial coefficients for the given n.\n    \"\"\"\n    total = 0\n    for i in range(n-1):  # We use n-1 to avoid going out of bounds\n        total += math.comb(n, i) * math.comb(n, i+1)\n    return total"]]}
{"task_id": 264, "problem": [[0.8991132378578186, "def find_final_position(nums, target):\n    \"\"\" This function receives a list and a target number\n    returns the index of the last occurrence of the target number in the list.\n    \"\"\"\n    last_position = None\n    \n    for idx, num in enumerate(nums):\n        if num == target:\n            last_position = idx\n    \n    return last_position"], [0.8990560173988342, "def find_last_position(nums, target):\n    \"\"\"\n    :type nums: List[int]\n    :type target: int\n    :rtype: int\n    \"\"\"\n    pos = -1\n    for i in range(len(nums)):\n        if nums[i] == target:\n            pos = i\n    return pos"], [0.8942476511001587, "def find_last_occurrence(arr, n, x):\n    \"\"\"\n    Find the last occurrence of x in arr[] of size n\n    \"\"\"\n    i = n\n    while (i >= 0):\n        if (x == arr[i]):\n            return i\n        i -= 1\n    return -1"]]}
{"task_id": 265, "problem": [[0.9146116971969604, "def calculate_volume_of_cylinder(radius, height):\n    \"\"\"\n    Calculate the volume of a cylinder.\n    \n    Parameters:\n    radius (float): The radius of the cylinder.\n    height (float): The height of the cylinder.\n    \n    Returns:\n    float: The volume of the cylinder.\n    \"\"\"\n    pi = 3.14\n    return pi * radius**2 * height"], [0.9117310643196106, "def volume_of_cylinder(radius, height):\n    \"\"\"\n    Calculate the volume of a cylinder.\n    \n    Parameters:\n    radius (float): The radius of the cylinder.\n    height (float): The height of the cylinder.\n    \n    Returns:\n    float: The volume of the cylinder.\n    \"\"\"\n    return math.pi * radius**2 * height"], [0.9109563827514648, "def calculate_cylinder_volume(radius, height):\n  \"\"\"\n  Calculate the volume of a cylinder.\n  \n  Args:\n    radius: The radius of the cylinder.\n    height: The height of the cylinder.\n  \n  Returns:\n    The volume of the cylinder.\n  \"\"\"\n  return math.pi * math.pow(radius, 2) * height"], [0.9067398905754089, "def calculate_cylinder_volume(radius, height):\n    \"\"\"\n    Calculate the volume of a cylinder.\n    \n    Parameters:\n    radius (float): The radius of the cylinder.\n    height (float): The height of the cylinder.\n    \n    Returns:\n    float: The volume of the cylinder.\n    \"\"\"\n    volume = math.pi * radius**2 * height\n    return volume"]]}
{"task_id": 266, "problem": []}
{"task_id": 267, "problem": []}
{"task_id": 268, "problem": [[0.8982739448547363, "def nth_nonagonal(n):\n  \"\"\"\n  Returns the nth nonagonal number.\n  \n  >>> nth_nonagonal(1)\n  1\n  >>> nth_nonagonal(2)\n  6\n  >>> nth_nonagonal(3)\n  18\n  >>> nth_nonagonal(4)\n  36\n  >>> nth_nonagonal(5)\n  63\n  >>> nth_nonagonal(6)\n  99\n  >>> nth_nonagonal(7)\n  144\n  >>> nth_nonagonal(8)\n  198\n  >>> nth_\"\"\"\n  return n*(7*n-5)//2"], [0.8874015808105469, "def heptagonal_number(n):\n    \"\"\"\n    Returns the nth heptagonal number.\n    \n    >>> heptagonal_number(1)\n    1\n    >>> heptagonal_number(2)\n    7\n    >>> heptagonal_number(3)\n    18\n    >>> heptagonal_number(10)\n    125\n    \"\"\"\n    return n*(5*n - 3)/2 "]]}
{"task_id": 269, "problem": [[0.918633759021759, "def sequential_search(array, target):\n    \"\"\"\n    \"\"\"\n    for i in range(len(array)):\n        if array[i] == target:\n            return i \n    return -1"], [0.9186090230941772, "def sequential_search(array, target):\n    \"\"\"\n    \"\"\"\n    for i in range(len(array)):\n        if array[i] == target:\n            return i \n    return -1"], [0.9142885208129883, "def search(arr, element):\n    \"\"\"\n    Search for an element in an array\n    :param arr: array\n    :param element: element to search for\n    :return: True if element is in array, False otherwise\n    \"\"\"\n    # Linear search algorithm\n    for item in arr:\n        if item == element:\n            return True\n    return False"], [0.9131421446800232, "def search(arr, x):\n    \"\"\"This function searches for the given element in the given array\"\"\"\n    for i in range(len(arr)):\n        if arr[i] == x:\n            return i\n    return -1"], [0.9064117670059204, "def search(arr, number):\n    \"\"\"\n    \"\"\"\n    for i in range(len(arr)):\n        if arr[i] == number:\n            return True\n    return False"], [0.906389057636261, "def linear_search(arr, element):\n    \"\"\"\n    A linear search algorithm to find the given \n    element in the given array.\n    \"\"\"\n    for i in range(len(arr)):\n        if arr[i] == element:\n            return i\n    return -1"], [0.906104564666748, "def search_array(num, arr):\n    \"\"\"\n    This function searches for a number in the given array. \n    \n    Input:\n    num: The number to search for\n    arr: The array in which to search\n\n    Output: \n    returns True if the number is found. Otherwise, returns False\n    \"\"\"\n    \n    # iterate through the array\n    for i in range(0, len(arr)):\n        # if the current number equals the number being searched for, \n        # return True because we found the number\n        if arr[i] == num:\n            return True\n    \n    # after searching all elements, if we didn't find the number, return False\n    return False"]]}
{"task_id": 270, "problem": [[0.916667103767395, "def unique(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: bool\n    \"\"\"\n    # Fix: Check if all elements in the input tuple are unique\n    if len(nums) == len(set(nums)):\n        return 'True'\n    else:\n        return 'False'"]]}
{"task_id": 271, "problem": []}
{"task_id": 272, "problem": [[0.891099214553833, "def same_frequency(num1, num2):\n    \"\"\"Do two numbers have the same frequency of digits?\n    >>> same_frequency(551122, 221515)\n    True\n    >>> same_frequency(321142, 3212215)\n    False\n    >>> same_frequency(1212, 2211)\n    True\n    \"\"\"\n    digit_count1 = [0] * 10\n    digit_count2 = [0] * 10\n\n    # Count the frequency of each digit in num1\n    while num1 > 0:\n        digit = num1 % 10\n        digit_count1[digit] += 1\n        num1 //= 10\n\n    # Count the frequency of each digit in num2\n    while num2 > 0:\n        digit = num2 % 10\n        digit_count2[digit] += 1\n        num2 //= 10\n\n    # Check if the frequency of each digit is the same in both numbers\n    for i in range(10):\n        if digit_count1[i] != digit_count2[i]:\n            return False\n\n    return True"], [0.8904181718826294, "def same_frequency(num1, num2):\n    \"\"\"Does number 1 have the same frequency of digits as number 2?\n    \n    >>> same_frequency(551122, 221515)\n    True\n    >>> same_frequency(321142, 3212215)\n    False\n    >>> same_frequency(1212, 2211)\n    True\n    \"\"\"\n    freq1 = {}\n    freq2 = {}\n    temp1 = num1\n    temp2 = num2\n    \n    while temp1 != 0 or temp2 != 0:\n        digit1 = temp1 % 10\n        digit2 = temp2 % 10\n        temp1 //= 10\n        temp2 //= 10\n        \n        if freq1.get(digit1) is None:\n            freq1[digit1] = 1\n        else:\n            freq1[digit1] += 1\n        \n        if freq2.get(digit2) is None:\n            freq2[digit2] = 1\n        else:\n            freq2[digit2] += 1\n    \n    if temp1 != 0 or temp2 != 0:\n        return False\n    \n    return freq1 == freq2"]]}
{"task_id": 273, "problem": [[0.9047665596008301, "def all_equal(s, char):\n    \"\"\"\n    Check if all characters in a string are equal.\n    :param s: string\n    :param char: character\n    :return: boolean\n    \"\"\"\n    return s.count(char) == len(s)"], [0.8926793336868286, "def all_same(items):\n    \"\"\"All items are the same\"\"\"\n    return len(set(items)) == 1"]]}
{"task_id": 274, "problem": [[0.9152544736862183, "def check_string(s):\n    \"\"\"\n    Check if a string starts with a substring 'a' followed by two to three 'b's.\n    \"\"\"\n    pattern = '^[a][b]{2,3}$' ## matches if sequence starts with \"a\" and followed by 2 to 3 \"b\"\n    if re.match(pattern, s):\n        return True\n    else:\n        return False\n    \n    def check_string(s):\n    \"\"\"\n    Check if a string starts with a substring 'a' followed by two to three 'b's.\n    \"\"\"\n    pattern = '^[a-zA-Z]*py$' ## matches if sequence only consist uppercase or lowercase alphabets and ends with \"py\"\n    if re.match(pattern, s):\n        return True\n    else:\n        return False"], [0.8982797265052795, "def match_pattern(string):\n    \"\"\"\n    Write a regex to match a string that has an 'a' followed by anything,\n    followed by a 'b'\n    \"\"\"\n    pattern = re.compile(r'abc(?=.*[0-9].*?[0-9].*).*xyz$')\n    return bool(pattern.match(string))"], [0.8886249661445618, "def match_string(s):\n    \"\"\"\n    Match a string that contains 'a' followed by any characters, ending in 'b'.\n    \n    Args:\n        s (str): The string to be matched.\n    \n    Returns:\n        bool or str: True if the string matches the pattern, False otherwise.\n    \"\"\"\n    if not isinstance(s, str):\n        return \"Error: Input is not a string.\"\n    pattern = 'a.*b$'\n    if re.search(pattern, s):\n        return True\n    else:\n        return \"Error: The string does not contain 'a' followed by any characters, ending in 'b'.\""], [0.8869063258171082, "def is_matching(s):\n    \"\"\"\n    \"\"\"\n    pattern = \"Ab?c\"\n    return re.match(pattern, s) is not None"]]}
{"task_id": 275, "problem": [[0.9081374406814575, "def kConcatenationMaxSum(arr, k):\n    \"\"\"\n    :type arr: List[int]\n    :type k: int\n    :rtype: int\n    \"\"\"\n    mod = 10**9 + 7\n    n = len(arr)\n    max_sum, max_left, max_right = 0, 0, 0\n    total_sum = sum(arr)\n    temp_sum = 0\n\n    for i in range(n):\n        temp_sum += arr[i]\n        max_sum = max(max_sum, temp_sum)\n        temp_sum = max(0, temp_sum)\n        max_left = max(max_left, temp_sum)\n\n    temp = total_sum\n    for i in range(n - 1, -1, -1):\n        temp -= arr[i]\n        max_right = max(max_right, temp)\n\n    ans = max(max_sum, max_left + max_right + total_sum * (k - 2), 0)\n    return ans % mod"]]}
{"task_id": 276, "problem": [[0.9287712574005127, "def sum_of_squares_even(n):\n    \"\"\"\n    Return the sum of the squares of all even numbers from 0 to n.\n    \n    >>> sum_of_squares_even(5)\n    30\n    >>> sum_of_squares_even(10)\n    385\n    \"\"\"\n    sum = 0\n    for i in range(n+1):\n        if i % 2 == 0:\n            sum += i**2\n    return sum"]]}
{"task_id": 277, "problem": [[0.8877038359642029, "def modInverse(n, p) : \n    \"\"\"\n    Returns the modular multiplicative inverse of n under modulo p\n    \"\"\"\n    return power(n, p - 2, p) \n    def modInverse(n, p) : \n    \"\"\"\n    Returns the modular multiplicative inverse of n under modulo p\n    \"\"\"\n    return power(n, p - 2, p) "], [0.8772658109664917, "def countPrimeOccurrences(arr, num):\n    \"\"\"\n    Given an array of integers arr and an integer num, return the number of occurrences of num in arr where num is a prime number.\n    \n    Example 1:\n    \n    Input: arr = [2,3,5,7,11], num = 2\n    Output: 1\n    Explanation: The only prime number in the array is 2.\n    \n    Example 2:\n    \n    Input: arr = [2,3,5,7,11], num = 13\n    Output: 0\n    Explanation: There are no\"\"\"\n    count = 0\n    for i in arr:\n        if i >= 0 and is_prime(i) and i == num:\n            count += 1\n    return count"]]}
{"task_id": 278, "problem": []}
{"task_id": 279, "problem": [[0.9124315977096558, "def find_max_nested(list1, list2, list3):\n    \"\"\"\n    Find the maximum number of elements in a list of lists\n    \"\"\"\n    max_num_elm = 0\n    for lst in [list1, list2, list3]:\n        cur_num_elm = max([len(s) for s in lst])\n        if cur_num_elm > max_num_elm:\n            max_num_elm = cur_num_elm\n    return max_num_elm\n    def find_max_nested(list1, list2, list3):\n    \"\"\"\n    Find the maximum number of elements in a list\"\"\"\n    max_num_elm = 0\n    for lst in [list1, list2, list3]:\n        cur_num_elm = max([len(s) for s in lst])\n        if cur_num_elm > max_num_elm:\n            max_num_elm = cur_num_elm\n    return max_num_elm"]]}
{"task_id": 280, "problem": [[0.8887183666229248, "def numWays(n, k):\n    \"\"\"\n    :type n: int\n    :type k: int\n    :rtype: int\n    \"\"\"\n    if n == 0:\n        return 0\n    elif n == 1:\n        return k\n    else:\n        same = [0]*n\n        diff = [0]*n\n        same[0] = k\n        same[1] = k\n        diff[0] = k\n        diff[1] = (k-1)*k\n        for i in range(2,n):\n            same[i] = diff[i-1]\n            diff[i] = (k-1)*(same[i-1] + diff[i-1])\n        return same[n-1] + diff[n-1]"], [0.8860114812850952, "def ways(n, k, mem):\n    \"\"\"\n    :type n: int\n    :type k: int\n    :type mem: dict\n    :rtype: int\n    \"\"\"\n    if n == 1:\n        return k\n    if (n_tuple := (n, k)) in mem:\n        return mem[n_tuple]\n    if k == 1:\n        mem[n_tuple] = 1\n        return 1\n    if n > k:\n        mem[n_tuple] = 0\n        return 0\n    res = mul(ways(n, k - 1, mem), n)\n    res = (res - mul(n - 1, ways(n - 1, k - 1, mem)) + MOD) % MOD\n    mem[n_tuple] = res\n    return res"], [0.8830456733703613, "def numWays(n, k):\n    \"\"\"\n    :type n: int\n    :type k: int\n    :rtype: int\n    \"\"\"\n    if n == 0:\n        return 0\n    if n == 1:\n        return k\n    same = k\n    different = k * (k - 1)\n    for i in range(2, n):\n        temp = different\n        different = (same + different) * (k - 1)\n        same = temp\n    return same + different"]]}
{"task_id": 281, "problem": [[0.8951212167739868, "def division(a, b):\n    \"\"\"\n    This function divides two numbers and prints the quotient and remainder.\n    \n    Args:\n        a (int): The first number.\n        b (int): The second number.\n    \"\"\"\n    quotient = a // b\n    remainder = a % b\n    print('Quotient:', quotient)\n    print('Remainder:', remainder)"], [0.8948271870613098, "def division_with_remainder(num1, num2):\n \"\"\"\n Divide two numbers and return the quotient and remainder\n \"\"\"\n quotient = num1 // num2 # integer division\n remainder = num1 % num2 # remainder\n print(f\"{num1} divided by {num2} is {quotient} with a remainder of {remainder}\")\n return quotient"], [0.8933533430099487, "def divide_numbers(numerator, denominator):\n    \"\"\"Divide two numbers and return the quotient.\n    \n    Args:\n        numerator (int or float): The number to be divided.\n        denominator (int or float): The number to divide by.\n    \n    Returns:\n        float: The quotient of the division.\n    \n    Raises:\n        ZeroDivisionError: If the denominator is zero.\n        TypeError: If either numerator or denominator is not a number.\n    \"\"\"\n    try:\n        quotient = numerator / denominator\n        print(\"The quotient is:\", quotient)\n    except ZeroDivisionError:\n        print(\"Error: You are attempting to divide by zero.\")\n    except TypeError:\n        print(\"Error: Invalid input. Both the numerator and denominator should be numbers.\")\n    finally:\n        print(\"This is the end of the division operation.\")"]]}
{"task_id": 282, "problem": []}
{"task_id": 283, "problem": [[0.9107310175895691, "def max_value(arr):\n    \"\"\"\n    Find the maximum value in a list of numbers.\n    \"\"\"\n    \"\"\"\n    max_value = None\n    no_numeric_values = True\n\n    for el in arr:\n        if type(el) == int or type(el) == float:\n            no_numeric_values = False\n            if max_value is None or el > max_value:\n                max_value = el\n\n    if no_numeric_values:\n        return \"No numerical values found.\"\n    else:\n        return max_value"], [0.9086018800735474, "def find_max(lst):\n    \"\"\"\n    Find the maximum value in a list\n    \"\"\"\n    max_val = lst[0]\n    for num in lst:\n        if num > max_val:\n            max_val = num\n\n    return max_val\n    def find_max(lst):\n    \"\"\"\n    Find the maximum value in a list\n    \"\"\"\n    max_val = lst[0]\n    for num in lst:\n        if num > max_val:\n            max_val = num\n\n    return max_val"]]}
{"task_id": 284, "problem": [[0.9321038126945496, "def sum_divisors(n):\n    \"\"\"\n    Find the sum of all divisors of a positive integer.\n    \n    >>> sum_divisors(1)\n    1\n    >>> sum_divisors(12)\n    28\n    >>> sum_divisors(987654321)\n    220316986\n    \"\"\"\n    divisors = []\n    for i in range(1, n + 1):\n        if n % i == 0:\n            divisors.append(i)\n    return sum(divisors)"], [0.9316538572311401, "def sum_divisors(num):\n    \"\"\"\n    Return the sum of all divisors of a positive integer.\n    \n    >>> sum_divisors(10)\n    10\n    >>> sum_divisors(12)\n    16\n    >>> sum_divisors(15)\n    15\n    \"\"\"\n    divisors = [i for i in range(1, num) if num % i == 0]\n    return sum(divisors)"]]}
{"task_id": 285, "problem": [[0.9319338798522949, "def countInversions(arr):\n    \"\"\"\n    Count the number of inversions in the given array.\n    An inversion is when array[i] > array[j] and i < j\n    \n    :param arr: array of integers\n    :return: number of inversions\n    \"\"\"\n    count = 0\n    for i in range(len(arr)):\n        for j in range(i+1, len(arr)):\n            if arr[i] > arr[j]:\n                count += 1\n    return count"], [0.9316608309745789, "def countInversions(arr):\n    \"\"\"\n    Count the number of inversions in the given array.\n    An inversion is when a pair of elements appear in the wrong order.\n    For example, in the array [2, 4, 1, 3, 5], there are three inversions:\n    (2, 1), (4, 1), and (4, 3).\n    \n    :param arr: a list of integers\n    :return: the number of inversions in the array\n    \"\"\"\n    count = 0\n    for i in range(len(arr)):\n        for j in range(i + 1, len(arr)):\n            if arr[i] > arr[j]:\n                count += 1\n    return count"], [0.9299689531326294, "def count_inversions(arr): \n    \"\"\"\n    Return the number of inversions in the given array.\n    \n    >>> count_inversions([2, 4, 1, 3, 5])\n    3\n    \"\"\"\n    inversion_count = 0\n    for i in range(0, len(arr)): \n        for j in range(i+1, len(arr)): \n            if arr[i] > arr[j]: \n                inversion_count += 1\n    return inversion_count"], [0.9269877672195435, "def count_inversions(arr):\n    \"\"\"\n    Return the number of inversions in the given array.\n    >>> count_inversions([2, 4, 1, 3, 5])\n    3\n    \"\"\"\n    count = 0\n\n    for i in range(len(arr)):\n        for j in range(0, i):\n            if arr[i] < arr[j]:\n                count += 1\n\n    return count"]]}
{"task_id": 286, "problem": []}
{"task_id": 287, "problem": [[0.9164535999298096, "def nested_common(list1, list2):\n    \"\"\"Function to extract nested common elements.\"\"\"\n    list1_flat = set(flatten(list1))\n    list2_flat = set(flatten(list2))\n    \n    common = list1_flat.intersection(list2_flat)\n    \n    return list(common)"]]}
{"task_id": 288, "problem": [[0.8929442763328552, "def find_max(list_of_tuples):\n    \"\"\"\n    Find the maximum value in each tuple in a list of tuples.\n    \n    Args:\n        list_of_tuples (list): A list of tuples.\n    \n    Returns:\n        list: A list of maximum values.\n    \"\"\"\n    max_values = []\n    for tup in list_of_tuples:\n        max_values.append(max(tup))\n    return max_values"], [0.888931155204773, "def aggregate_tuples(tuples):\n    \"\"\"\n    Given a list of tuples, return the sum of all the numbers in the tuples.\n    \"\"\"\n    total = 0\n    for t in tuples:\n        total += sum(t)\n    return total\n    def aggregate_tuples(tuples):\n    \"\"\"\n    Given a list of tuples, return the sum of all the numbers in the tuples.\n    \"\"\"\n    total = 0\n    for t in tuples:\n        total += sum(t)\n    return total"]]}
{"task_id": 289, "problem": [[0.9064934849739075, "def countBinaryStrings(N): \n    \"\"\"\n    :type N: int\n    :rtype: int\n    \"\"\"\n    a = [1, 1] \n    for i in range(2, N+1): \n        b = [1] \n        for j in range(1,i): \n            b.append(a[j] + a[j-1]) \n        b.append(1) \n        a = b.copy() \n    count = 0\n    for i in range(len(a)): \n        count += a[i]\n    return count"]]}
{"task_id": 290, "problem": [[0.8994672298431396, "def find_max_depth(dictionary):\n    \"\"\"\n    Find the maximum depth of a nested dictionary.\n\n    Args:\n        dictionary (dict): The dictionary to find the maximum depth of.\n\n    Returns:\n        int: The maximum depth of the dictionary.\n    \"\"\"\n    if not isinstance(dictionary, dict):\n        return 0\n\n    max_depth = 0\n    for value in dictionary.values():\n        depth = 1 + find_max_depth(value)\n        max_depth = max(max_depth, depth)\n\n    return max_depth"]]}
{"task_id": 291, "problem": []}
{"task_id": 292, "problem": []}
{"task_id": 293, "problem": []}
{"task_id": 294, "problem": []}
{"task_id": 295, "problem": [[0.8994789719581604, "def longestIncreasingSubsequence(seq):\n    \"\"\"\n    Find the longest increasing subsequence in a sequence\n    and return all subsequences with maximum sum\n    \n    :param seq: sequence of integers\n    :return: list of subsequences with maximum sum\n    \"\"\"\n    n = len(seq)\n\n    # Initialize lengths and sums of all increasing subsequences\n    lengths = [1]*n\n    sums = seq[:]\n\n    for i in range (1 , n):\n        for j in range(0 , i):\n            if seq[i] > seq[j] and lengths[i]< lengths[j] + 1:\n                lengths[i] = lengths[j]+1\n                sums[i] = sums[j] + seq[i]\n            # If lengths are equal, choose the one with larger sum\n            elif lengths[i] == lengths[j] + 1 and sums[i] < sums[j] + seq[i]:\n                sums[i] = sums[j] + seq[i]\n\n    # Initialize maximum values\n    maxlen = max(lengths)\n    maxsum = max(sums)\n\n    # sequences is the list of all longest increasing subsequences with maximum sum\n    sequences = [seq[i] for i in range(n) if lengths[i] == maxlen and sums[i] == maxsum]\n\n    return sequences"], [0.8990825414657593, "def max_sum_subarray(arr, k):\n    \"\"\"\n    Find the maximum sum of a subarray with a given sum k.\n    :param arr: List[int]\n    :param k: int\n    :return: int\n    \"\"\"\n    n = len(arr)\n    prefix_sum = [0] * (n+1)\n    prefix_sum[0] = 0\n    max_sum = float('-inf')\n    max_subarray_sum = float('-inf')\n\n    for i in range(1, n+1):\n        prefix_sum[i] = prefix_sum[i-1] + arr[i-1]\n        max_sum = max(max_sum, prefix_sum[i])\n\n    for i in range(1, n+1):\n        for j in range(i):\n            subarray_sum = prefix_sum[i] - prefix_sum[j]\n            if subarray_sum <= k:\n                max_subarray_sum = max(max_subarray_sum, subarray_sum)\n\n    return max_subarray_sum"]]}
{"task_id": 296, "problem": []}
{"task_id": 297, "problem": [[0.8982522487640381, "def largest_product(num, arr): \n    \"\"\"\n    Find the largest product of a number and all of the elements in an array.\n    \n    Args:\n        num (int): The number to multiply.\n        arr (list): The array of numbers.\n    \n    Returns:\n        int: The largest product.\n    \"\"\"\n    best = 0\n    for i in range(len(arr)): \n        curr_prod = num * arr[i]\n        for j in range(i+1, len(arr)): \n            curr_prod *= arr[j]\n            best = max(best, curr_prod) \n    return best"], [0.8944305181503296, "def max_product(lst):\n    \"\"\"\n    This function receives a collection of numerical values (integers),\n    and returns the two elements within that list that, if multiplied\n    together, will yield the absolute highest possible product.\n    \"\"\"\n    \n    # To consider negative numbers and their product which can yield the highest product\n    lst.sort() # First sort the list in increasing order\n    \n    # Checking maximum positive product of first two elements and last two elements\n    product_1 = lst[0] * lst[1]\n    product_2 = lst[-1] * lst[-2]\n    \n    # If first two elements product is higher, return them\n    # Else, return last two elements\n    if product_1 > product_2:\n        return [lst[0], lst[1]]\n    else:\n        return [lst[-1], lst[-2]]"]]}
{"task_id": 298, "problem": [[0.9327257871627808, "def find_max(num1, num2):\n    \"\"\"\n    Find the maximum of two numbers.\n    \n    Parameters:\n    num1 (int): The first number.\n    num2 (int): The second number.\n    \n    Returns:\n    int: The maximum of the two numbers.\n    \"\"\"\n    return max(num1, num2)"], [0.9304901361465454, "def max_of_two(num_1, num_2):\n    \"\"\"\n    This function returns the maximum of two numbers.\n    \"\"\"\n    return max(num_1, num_2)\n    def max_of_three(num_1, num_2, num_3):\n    \"\"\"\n    This function returns the maximum of three numbers.\n    \"\"\"\n    return max(num_1, num_2)"], [0.9301162362098694, "def max_of_two(x, y):\n    \"\"\"\n    This function returns the maximum of two numbers\n    \"\"\"\n    if x > y:\n        return x\n    else:\n        return y"], [0.9300880432128906, "def max_of_two(x, y):\n    \"\"\"\n    This function returns the maximum of two numbers\n    \"\"\"\n    if x > y:\n        return x\n    else:\n        return y"], [0.9297508597373962, "def max(a, b):\n    \"\"\"\n    Return the maximum of two numbers.\n    \"\"\"\n    return (a if a > b else b)\n    def max(a, b):\n    \"\"\"\n    Return the maximum of two numbers.\n    \"\"\"\n    return (a if a > b else b)"]]}
{"task_id": 299, "problem": []}
{"task_id": 300, "problem": [[0.88246089220047, "def smallestNumber(num): \n    \"\"\"\n    :type num: int\n    :rtype: int\n    \"\"\"\n    least_bit = (num & (-num)) \n    small_num = num + least_bit \n    num = num ^ small_num \n    num = (num) >> 2 \n    small_num = small_num | num \n    return small_num"]]}
{"task_id": 301, "problem": [[0.9126754999160767, "def cone_volume(radius, height):\n    \"\"\"\n    Calculate the volume of a cone.\n    \n    Args:\n        radius (float): Radius of the base of the cone.\n        height (float): Height of the cone.\n    \n    Returns:\n        float: Volume of the cone.\n    \"\"\"\n    return (1./3) * math.pi * radius**2 * height"], [0.909123420715332, "def cone_volume(r: float, h: float) -> float:\n    \"\"\"\n    Calculate the volume of a cone.\n    \n    Args:\n        r (float): radius of the base of the cone\n        h (float): height of the cone\n    \n    Returns:\n        float: volume of the cone\n    \"\"\"\n    if r <= 0 or h <= 0:\n        return \"Radius and Height must be greater than zero.\"\n    return (1.0/3) * math.pi * r * r * h"], [0.907709002494812, "def calculate_cone_volume(radius, height):\n    \"\"\"\n    Calculate the volume of a cone.\n    \n    Parameters:\n    radius (float): The radius of the cone.\n    height (float): The height of the cone.\n    \n    Returns:\n    float: The volume of the cone.\n    \"\"\"\n    pi = 3.14\n    return (1/3) * pi * radius * radius * height"]]}
{"task_id": 302, "problem": [[0.916901707649231, "def countPositive(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    print(\"Number of positive numbers:\", count)"], [0.914391279220581, "def get_positive(l: list):\n    \"\"\"Return only positive numbers in the list.\n    >>> get_positive([-1, 2, -4, 5, 6])\n    [2, 5, 6]\n    >>> get_positive([5, 3, -5, 2, -3, 3, 9, 0, 123, 1, -10])\n    [5, 3, 2, 3, 9, 123, 1]\n    \"\"\"\n\n    result = []\n    for num in l:\n        if num > 0:\n          result.append(num)\n    return result"], [0.9124453067779541, "def get_positive_numbers(nums):\n    \"\"\"\n    Given a list of numbers, return a list which contains only the positive numbers.\n    \n    >>> get_positive_numbers([1, -2, 3, -4, 5])\n    [1, 3, 5]\n    \"\"\"\n    result = []\n    for num in nums:\n        if num > 0:\n            result.append(num)\n    return result"], [0.9122923612594604, "def get_positive_numbers(nums):\n    \"\"\"\n    Given a list of numbers, return a list of only the positive numbers.\n    \n    >>> get_positive_numbers([1, 2, 3, -4, -5, -6])\n    [1, 2, 3]\n    \"\"\"\n    positive_nums = []\n    \n    for num in nums:\n        if num > 0:\n            positive_nums.append(num)\n    \n    return positive_nums"]]}
{"task_id": 303, "problem": [[0.9032034873962402, "def subsequence_sum(arr):\n    \"\"\"\n    Given an array of integers, find the maximum sum of a subsequence with the constraint\n    that no 2 numbers in the sequence should be adjacent in the array.\n    \"\"\"\n    # Write your code here\n    \"\"\"\n    The idea is to use Kadane's algorithm to find the maximum sum of a subsequence.\n    We keep track of the maximum sum and the current sum.\n    If the current sum is negative, we reset it to 0.\n    If the current sum is positive, we update the maximum sum.\n    We return the maximum sum.\n    \"\"\"\n    max_sum = 0\n    current_sum = 0\n    for i in range(len(arr)):\n        current_sum = current_sum + arr[i]\n        if current_sum > max_sum:\n            max_sum = current_sum\n        elif current_sum < 0:\n            current_sum = 0\n\n    return max_sum"], [0.9023658633232117, "def max_sum_no_adjacent(arr):\n        \"\"\"\n        Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative.\n\n        For example, [2, 4, 9, 8] should return 23, since we pick 2, 4, and 9. [5, 1, 1, 5] should return 10, since we pick 5 and 5.\n\n        You may not use the same element twice.\n\n        Example:\n\n        max_sum_no_adjacent([2, 4, 9, 8\"\"\"\n        if not arr:\n            return 0\n        \n        elif len(arr) <= 2:\n            return max(arr)\n        \n        else:\n            dp = [0] * len(arr)\n            dp[0] = arr[0]\n            dp[1] = max(arr[0], arr[1])\n\n            for i in range(2, len(arr)):\n                dp[i] = max(dp[i - 2] + arr[i], dp[i - 1])\n                \n            return dp[-1]"], [0.9008266925811768, "def maxSumNonAdj(arr): \n    \"\"\"\n    :type arr: List[int]\n    :rtype: int\n    \"\"\"\n    if len(arr) == 0: \n        return 0\n  \n    dp = [0] * len(arr) \n  \n    dp[0] = arr[0] \n    dp[1] = max(arr[0], arr[1]) \n  \n    for i in range(2, len(arr)): \n        dp[i] = max(dp[i - 1], dp[i - 2] + arr[i]) \n  \n    return dp[len(arr) - 1] "], [0.9006829261779785, "def max_subset_of_non_adjacent_numbers(nums):\n    \"\"\"\n    Given a list of numbers, find the maximum sum of a subset of non-adjacent numbers.\n    \n    For example, given nums = [2, 4, 6, 2, 5], the maximum sum is 8 (nums[0] + nums[2] + nums[4]).\n    \n    \"\"\"\n    \n    result = list() \n    result.append(nums[0])   \n    if len(nums) >= 2: \n        result.append(max(nums[1], nums[0])) \n          \n    for i in range(2, len(nums)):  \n        maxValue = max(nums[i] + result[i-2], result[i-1])\n        result.append(maxValue)\n       \n    return result[-1]"]]}
{"task_id": 304, "problem": [[0.9148746132850647, "def find_longest_even_words(words: List[str]) -> List[str]:\n    \"\"\"\n    Find the longest even words in a list of words.\n    \n    Args:\n        words (List[str]): A list of words.\n    \n    Returns:\n        List[str]: A list of the longest even words.\n    \"\"\"\n    max_length = 0\n    result = []\n    \n    for word in words:\n        if len(word) % 2 == 0:\n            if len(word) > max_length:\n                max_length = len(word)\n                result = [word]\n            elif len(word) == max_length:\n                result.append(word)\n    \n    return result"], [0.9038605690002441, "def find_even_length(lst):\n    \"\"\"\n    Find all the words in a list that have an even length.\n    >>> find_even_length(['apples', 'oranges', 'grapes'])\n    ['apples', 'oranges']\n    \"\"\"\n    even_list = []\n    for l in lst:\n        if len(l) % 2 == 0:\n            even_list.append(l)\n    return even_list"]]}
{"task_id": 305, "problem": [[0.9191213846206665, "def final_occurrence(array, target):\n    \"\"\"\n    Find the final occurrence of a target in a sorted array.\n    If the target is not found in the array, return -1.\n    \"\"\"\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO: Write your code here\n    # TODO:\"\"\"\n    lower, upper = 0, len(array)\n\n    while lower < upper:\n        mid = lower + (upper - lower) // 2\n        if array[mid] <= target:\n            lower = mid + 1\n        else:\n            upper = mid\n\n    if lower-1 >= 0 and array[lower-1] == target:\n        return lower - 1\n    else:\n        return \"The element does not exist in the array\";"]]}
{"task_id": 306, "problem": [[0.905556857585907, "def encodeList(list_to_encode):\n    \"\"\"\n    \"\"\"\n    if not list_to_encode:\n        return []\n    else:\n        tmp = []\n        tmp.append(list_to_encode[0])\n        tmp.append(1)\n        i = 1\n        while i < len(list_to_encode) and list_to_encode[i] == tmp[0]:\n            tmp[1] += 1\n            i += 1\n        return tmp + encodeList(list_to_encode[i:])"], [0.9048423767089844, "def run_length_encoding(input_string):\n    \"\"\"\n    Run length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string \"AAAABBBCCDAA\" would be encoded as \"4A3B2C1D2A\".\n    \"\"\"\n    encoding = ''\n    i = 0\n\n    while i < len(input_string):\n        count = 1\n        while i + 1 < len(input_string) and input_string[i] == input_string[i+1]:\n            i += 1\n            \"\"\"\n    encoding = ''\n    i = 0\n\n    while i < len(input_string):\n        count = 1\n        while i + 1 < len(input_string) and input_string[i] == input_string[i+1]:\n            i += 1\n            count += 1\n        encoding += str(count) + input_string[i]\n        i += 1\n\n    return encoding"], [0.8998106122016907, "def run_length_encoding(input_string):\n    \"\"\"\n    Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string \"AAAABBBCCDAA\" would be encoded as \"4A3B2C1D2A\".\n    \"\"\"\n    \n    \"\"\"\n    Your solution here\n    \"\"\"\n    if not input_string:\n        return ''\n\n    result = ''\n    current_char = input_string[0]\n    count = 1\n\n    for char in input_string[1:]:\n        if char == current_char:\n            count += 1\n        else:\n            result += current_char + str(count)\n            current_char = char\n            count = 1\n\n    result += current_char + str(count)\n    return result"]]}
{"task_id": 307, "problem": []}
{"task_id": 308, "problem": [[0.9126358032226562, "def five_letter_words(text):\n    \"\"\"\n    Find all five letter words in a text.\n    \n    Args:\n        text (str): The text to search.\n    \n    Returns:\n        list: A list of all five letter words in the text.\n    \"\"\"\n    words = text.split()\n    five_letter_words = [word for word in words if len(word) == 5]\n    unique_words = list(set(five_letter_words))\n    return unique_words"]]}
{"task_id": 309, "problem": [[0.9406228065490723, "def difference_of_squares(n: int) -> int:\n    \"\"\"\n    The sum of the squares of the first n natural numbers is:\n    1^2 + 2^2 + ... + n^2 = (n(n+1)(2n+1))/6\n    The square of the sum of the first n natural numbers is:\n    (1 + 2 + ... + n)^2 = n(n+1)^2/2\n    The difference between the sum of the squares of the first n natural numbers and the square of the sum is:\n    (n(n+1)(2n+1))/6 - n(n+1\"\"\"\n    sum_of_squares = sum(i**2 for i in range(1, n+1))\n    square_of_sum = sum(range(1, n+1)) ** 2\n    return square_of_sum - sum_of_squares"], [0.933597207069397, "def difference_ss_sqsum(n):\n    \"\"\"\n    Compute the difference between the sum of the squares of the first n natural numbers and the square of the sum.\n    \n    Parameters:\n    n (int): The number of natural numbers to consider.\n    \n    Returns:\n    int: The difference between the sum of the squares and the square of the sum.\n    \"\"\"\n    sum_of_squares = 0\n    square_of_sum = 0\n    \n    # Compute the sum of squares\n    for i in range(1, n+1):\n        sum_of_squares += i*i\n    \n    # Compute the square of sum\n    for i in range(1, n+1):\n        square_of_sum += i\n    square_of_sum *= square_of_sum\n    \n    # Return the difference between sum of squares and square of sum\n    return square_of_sum - sum_of_squares"], [0.9303397536277771, "def find_difference(n):\n    \"\"\"\n    Find the difference between the sum of the squares of the first n natural numbers and the square of the sum.\n    \n    Args:\n       n (int): a positive integer\n    \n    Returns:\n       int: the difference between the sum of the squares of the first n natural numbers and the square of the sum.\n    \"\"\"\n    # Base case\n    if n == 1:\n        return 1\n    else:\n        # Recursive call\n        return n*n*n + find_difference(n-1) - n"], [0.9260668754577637, "def sum_of_squares(n):\n    \"\"\"\n    Return the sum of the squares of the first n natural numbers.\n    \"\"\"\n    if n < 0:\n        return \"Invalid input\"\n\n    result = 0\n    for i in range(1, n + 1):\n        result += i ** 2\n\n    return result\n    \n    def sum_of_squares(n):\n    \"\"\"\n    Return the sum of the squares of the first n natural numbers.\n    \"\"\"\n    if n < 0:\n        return \"Invalid input\"\n\n    result = n * (n + 1) * (2 * n + 1) // 6\n\n    return result"], [0.9205406308174133, "def sumOfSquares(n):\n    \"\"\"\n    Return sum of squares of first n natural numbers\n    \"\"\"\n    # Initialize sum\n    sum = 0\n\n    # Add squares of every element to sum\n    for i in range(1, n+1):\n        sum += i * i\n    return sum\n    def sumOfSquares(n):\n    \"\"\"\n    Return sum of squares of first n natural numbers\n    \"\"\"\n    # Initialize sum\n    sum = 0\n\n    # Add squares of every element to sum\n    for i in range(1, n+1):\n        sum += i * i\n    return sum"], [0.9199371337890625, "def diff_square_sum_sum_square(n):\n    \"\"\"\n    Find the difference between the sum of the squares of the first n natural numbers and the square of the sum.\n    \n    Parameters\n    ----------\n    n : int\n        The number of natural numbers to be considered.\n    \n    Returns\n    -------\n    int\n        The difference between the sum of the squares of the first n natural numbers and the square of the sum.\n    \"\"\"\n    square_sum = 0\n    sum_square = 0\n    for digit in str(n):\n        digit = int(digit)\n        square_sum += digit\n        sum_square += digit ** 2\n    square_sum **= 2\n    return square_sum - sum_square"], [0.9181469678878784, "def calculate_difference(n):\n    \"\"\"\n    Calculate the difference between the sum of the cubes of the first n natural numbers and the sum of the first n natural numbers.\n    \n    Args:\n        n (int): The number of natural numbers to consider.\n    \n    Returns:\n        int: The difference between the sum of the cubes and the sum of the numbers.\n    \"\"\"\n    if not isinstance(n, int) or n < 1:\n        return \"Error: Input should be a natural number.\"\n    \n    sum_of_cubes = sum([i**3 for i in range(1, n+1)])\n    sum_of_numbers = sum([i for i in range(1, n+1)])\n    \n    return sum_of_cubes - sum_of_numbers"]]}
{"task_id": 310, "problem": [[0.8749122023582458, "def find_num():\n  \"\"\"\n  Find the number\"\"\"\n  for i in range(100,1000):\n    hun = i // 100\n    ten = (i % 100) // 10\n    one = i % 10\n    if hun != 3*ten or ten != 3*one:\n      continue\n    if i * 1.49 != int(str(one) + str(ten) + str(hun)):\n      continue\n    return i"], [0.8738114237785339, "def find_number():\n    \"\"\"\n    \"\"\"\n    for i in range(10000,100000):\n        ones = i % 10\n        tens = (i // 10) % 10\n        hundreds = (i // 100) % 10\n        thousands = (i // 1000) % 10\n        tenthousands = (i // 10000) % 10\n\n        if tenthousands == 4*thousands and thousands == 3*hundreds and hundreds == 2*tens and tens == 2*ones:\n            switch_i = ones*10000 + tens*1000 + hundreds*100 + thousands*10 + tenthousands\n            if switch_i == i * 1.45:\n                return i"]]}
{"task_id": 311, "problem": [[0.9027283191680908, "def find_min(lst):\n    \"\"\"\n    Find the minimum number in a list and its index(es).\n    \n    Parameters:\n    lst (list): A list of numbers.\n    \n    Returns:\n    tuple: A tuple containing the minimum number and a list of indices where the minimum number occurs.\n    \"\"\"\n    min_num = lst[0]\n    min_index = [0]  # Adding 0 as the initial index\n    for i in range(1, len(lst)):\n        if lst[i] < min_num:\n            min_num = lst[i]\n            min_index = [i] \n        elif lst[i] == min_num:\n            min_index.append(i)\n    return min_num, min_index"], [0.8997608423233032, "def find_min_index(list_of_nums):\n    \"\"\"\n    Find the index of the minimum value in a list of numbers.\n    \n    Args:\n       list_of_nums(list): a list of numbers\n    Returns:\n       int: the index of the minimum element\n    \"\"\"\n    minimum = min(list_of_nums)\n    return list_of_nums.index(minimum)"]]}
{"task_id": 312, "problem": [[0.9223708510398865, "def rearrange_array(input_array):\n    \"\"\"\n    Rearrange positive and negative numbers in a given array\n    \n    Args:\n       input_array(list): List of numbers\n    Returns:\n       list: Rearranged list\n    \"\"\"\n    # sort the array in ascending order\n    input_array.sort()\n    \n    # define an empty result array\n    output_array = []\n\n    while input_array:\n        # add the largest element\n        output_array.append(input_array.pop(-1))\n        if input_array:\n            # add the smallest element\n            output_array.append(input_array.pop(0))\n    \n    return output_array"], [0.9213085174560547, "def rearrange(arr):\n    \"\"\"\n    Rearrange positive and negative numbers in O(n) time and O(1) extra space\n    \"\"\"\n    # TODO: Write your code here\n    # Hint: Use two pointers technique\n    #       One pointer to traverse the array from left to right\n    #       Another pointer to traverse the array from right to left\n    \"\"\"\n    left = 0\n    right = len(arr) - 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"], [0.9146265983581543, "def rearrangeNegativePositive(arr, n):\n    \"\"\"\n    Rearrange positive and negative numbers in O(n) time and O(1) extra space\n    \"\"\"\n    # code here\n    \n    def rearrange(self,arr, n):\n    \"\"\"\n    Rearrange positive and negative numbers in O(n) time and O(1) extra space\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\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            left += 1\n            right -= 1"]]}
{"task_id": 313, "problem": [[0.8918388485908508, "def aggregate_tuples(tuples):\n    \"\"\"\n    Given a list of tuples, return the sum of all the numbers in the tuples.\n    \"\"\"\n    total = 0\n    for t in tuples:\n        total += sum(t)\n    return total\n    def aggregate_tuples(tuples):\n    \"\"\"\n    Given a list of tuples, return the sum of all the numbers in the tuples.\n    \"\"\"\n    total = 0\n    for t in tuples:\n        total += sum(t)\n    return total"], [0.8890612721443176, "def add_tuple(tpl):\n    \"\"\"\n    Add up all the odd elements of a tuple\"\"\"\n    \n    # Extract elements at odd indices\n    odd_indices_elements = tpl[1::2]\n\n    # Filter out even elements from those extracted earlier\n    even_elements = list(filter(lambda x: x % 2 == 0, odd_indices_elements))\n\n    # Calculate the sum of the even elements and return that value\n    return sum(even_elements)"]]}
{"task_id": 314, "problem": [[0.9130324125289917, "def numSquares(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    dp = [0] + [sys.maxsize]*n\n    for i in range(1, n+1):\n        for j in range(1, int(i**0.5)+1):\n            dp[i] = min(dp[i], dp[i-j*j] + 1)\n    return dp[-1]"], [0.9129249453544617, "def numSquares(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    dp = [float('inf')] * (n + 1)\n    dp[0] = 0\n    \n    for i in range(1, n + 1):\n        j = 1\n        while j * j <= i:\n            dp[i] = min(dp[i], dp[i - j * j] + 1)\n            j += 1\n            \n    return dp[n]"], [0.9056128263473511, "def perfectSquares(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    dp = [0]\n    for i in range(1, n + 1):\n        dp.append(min([dp[i - j * j] for j in range(1, int(math.sqrt(i)) + 1)] + [dp[i - 1]]))\n    return dp[n]\n    \n    def numSquares(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    dp = [0]\n    for\"\"\"\n    count = numSquares(n)\n    result = []\n    while n:\n        for i in range(int(math.sqrt(n)), 0, -1):\n            if n >= i * i and numSquares(n - i * i) == count - 1:\n                result.append(i * i)\n                n -= i * i\n                count -= 1\n                break\n    return result"], [0.8952136635780334, "def sumOfSquares(n):\n    \"\"\"\n    Return sum of squares of first n natural numbers\n    \"\"\"\n    # Initialize sum\n    sum = 0\n\n    # Add squares of every element to sum\n    for i in range(1, n+1):\n        sum += i * i\n    return sum\n    def sumOfSquares(n):\n    \"\"\"\n    Return sum of squares of first n natural numbers\n    \"\"\"\n    # Initialize sum\n    sum = 0\n\n    # Add squares of every element to sum\n    for i in range(1, n+1):\n        sum += i * i\n    return sum"], [0.8951255083084106, "def sqrt(x): \n    \"\"\"\n    Return the square root of x.\n    \"\"\"\n    if x == 0 or x == 1: \n        return x \n      \n    i = 1 \n    res = 1 \n    while res <= x: \n        i += 1 \n        res = i * i \n      \n    return i-1\n    def sqrt(x): \n    \"\"\"\n    Return the square root of x.\n    \"\"\"\n    if x == 0 or x == 1: \n        return x \n      \n    i = 1 \n    res = 1 \n    while res <= x: \n        i += 1 \n        res = i * i \n      \n    return i-1"], [0.8941684365272522, "def search(lst):\n    \"\"\"\n    Given a list of numbers, return the greatest number whose square is less than or equal to the sum of the list.\n    \n    >>> search([1, 2, 3, 4])\n    2\n    >>> search([1, 2, 3, 4, 5])\n    3\n    >>> search([1, 2, 3, 4, 5, 6])\n    4\n    \"\"\"\n    freq = {}\n    for num in lst:\n        if num in freq:\n            freq[num] += 1\n        else:\n            freq[num] = 1\n    greatest = -1\n    for num, count in freq.items():\n        if count >= num*num:\n            greatest = max(greatest, num)\n    return greatest"]]}
{"task_id": 315, "problem": []}
{"task_id": 316, "problem": []}
{"task_id": 317, "problem": []}
{"task_id": 318, "problem": [[0.9079719185829163, "def negative_stats(numbers):\n    \"\"\"\n    Return the number of negative numbers in a list and the sum of all negative numbers.\n    \n    >>> negative_stats([1, -3, 4, -2, 5])\n    (2, -5)\n    \"\"\"\n    negative_nums = [num for num in numbers if num < 0]\n    return len(negative_nums), sum(negative_nums)"], [0.9039167165756226, "def negative(int_list):\n    \"\"\"\n    Return a list of the negative integers in the input list.\n    \n    >>> negative([1, -2, 3, -4])\n    [-2, -4]\n    \"\"\"\n    return [num for num in int_list if num < 0]"]]}
{"task_id": 319, "problem": []}
{"task_id": 320, "problem": [[0.9066583514213562, "def hamming_weight(n):\n    \"\"\"\n    Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight).\n    \n    Note:\n    \n    Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input will be given as a signed integer type. It should not affect your implementation, as the integer's internal binary representation is the same, whether it is signed or unsigned.\n    In Java, the compiler represents the signed integers using 2's complement notation. Therefore, in Example 3, the input represents the\"\"\"\n    count = 0\n    while n:\n        count += n & 1\n        n >>= 1\n    return count"], [0.9057872295379639, "def count_bits(num):\n    \"\"\"\n    Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative.\n\n    Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case\n    \"\"\"\n    count = 0\n    while num != 0:\n        num //= 2\n        count += 1\n    return count"]]}
{"task_id": 321, "problem": []}
{"task_id": 322, "problem": [[0.9076259136199951, "def sort_list(tuples):\n    \"\"\"\n    A function to sort a list of tuples by the second item in each tuple.\n    \"\"\"\n    return sorted(tuples, key=lambda x: x[1])"]]}
{"task_id": 323, "problem": [[0.9268591403961182, "def is_valid_triangle(a, b, c): \n    \"\"\"\n    Check if a triangle is valid or not\n    :param a: side a\n    :param b: side b\n    :param c: side c\n    :return: True if the triangle is valid else False\n    \"\"\"\n    # A triangle should have 3 sides\n    if a + b <= c or a + c <= b or b + c <= a: \n        return False\n\n    # The sum of any two sides should always be greater than the third side\n    if a + b > c and a + c > b and b + c > a: \n        return True\n    return False"], [0.9236353039741516, "def is_valid_triangle(a, b, c):\n    \"\"\"\n    Write a function that accepts the three sides of a triangle as arguments.\n    The function should return True if a triangle can be built with the sides\n    and False otherwise.\n    \n    >>> is_valid_triangle(1, 1, 1)\n    True\n    >>> is_valid_triangle(1, 1, 3)\n    False\n    \"\"\"\n    if (a + b) > c and (a + c) > b and (b + c) > a:\n        return True\n    else:\n        return False"], [0.9233072996139526, "def valid_triangle(side1, side2, side3): \n    \"\"\"\n    Check if a triangle is valid given the length of the three sides.\n    \n    :param side1: length of side 1\n    :param side2: length of side 2\n    :param side3: length of side 3\n    :return: True if the triangle is valid, False otherwise\n    \"\"\"\n    a = side1 + side2 \n    b = side1 + side3 \n    c = side2 + side3 \n       \n    if (a > side3) and (b > side2) and (c > side1): \n        return True\n    else: \n        return False"], [0.9221632480621338, "def is_valid(side1, side2, side3):\n    \"\"\"\n    Check if a triangle is valid\n    :param side1: first side\n    :param side2: second side\n    :param side3: third side\n    :return: True if the triangle is valid, False otherwise\n    \"\"\"\n    if (side1 + side2 > side3) and (side1 + side3 > side2) and (side2 + side3 > side1):\n        return True\n    else:\n        return False"], [0.9220161437988281, "def valid_triangle(a, b, c):\n    \"\"\"\n    Check if a triangle is valid or not\n    :param a: side a\n    :param b: side b\n    :param c: side c\n    :return: True if triangle is valid else False\n    \"\"\"\n    # Use inequality theorem \n    return a + b > c and a + c > b and b + c > a"], [0.9122471213340759, "def is_valid_triangle(a, b, c):\n    \"\"\"\n    Determines if a triangle is valid given the length of its sides.\n\n    :param a: length of side a\n    :param b: length of side b\n    :param c: length of side c\n    :return: True if a valid triangle, False otherwise\n    \"\"\"\n    if a + b > c and b + c > a and a + c > b:\n        return True\n    return False"]]}
{"task_id": 324, "problem": [[0.8879648447036743, "def arithmeticSum(start, end, diff):\n    \"\"\"\n    Calculate the sum of an arithmetic series\n    :param start: the first term\n    :param end: the last term\n    :param diff: the common difference\n    :return: the sum of the series\n    \"\"\"\n    # Calculate the number of terms\n    n = (end - start) / diff + 1\n    # Calculate the sum\n    mysum = n * (start + end) / 2\n    return mysum"]]}
{"task_id": 325, "problem": []}
{"task_id": 326, "problem": [[0.8942587375640869, "def ends_with_letter(word):\n    \"\"\"\n    Returns True if the word ends with a letter, False otherwise.\n    \"\"\"\n    return word.endswith(letter)\n    def ends_with_letter(word):\n    \"\"\"\n    Returns True if the word ends with a letter, False otherwise.\n    \"\"\"\n    return word.endswith(letter)"], [0.8837177157402039, "def last_char_s(arr):\n    \"\"\"\n    Return a list of words that end in 's'\n    \"\"\"\n    return [word for word in arr if word[-1] == 's']\n    \n    def last_char_s(arr):\n    \"\"\"\n    Return a list of words that end in 's'\n    \"\"\"\n    return [word for word in arr if word.endswith('s')]"]]}
{"task_id": 327, "problem": [[0.9112409949302673, "def count_strings(lst):\n    \"\"\"\n    Return the count of the number of strings where the string length is 2 or more and the first and last character are the same.\n    \n    >>> count_strings(['aba', 'xyz', 'aa', 'x', 'bbb'])\n    3\n    >>> count_strings(['', 'x', 'xy', 'xyx', 'xx'])\n    2\n    >>> count_strings(['aaa', 'be', 'abc', 'hello'])\n    1\n    \"\"\"\n    count = 0\n    \n    # Iterate through the list\n    for s in lst:\n        # Check if string length is greater than 2 and first and last character is same\n        if len(s) >= 2 and s[0] == s[-1]:\n            count += 1\n    \n    return count"]]}
{"task_id": 328, "problem": [[0.8966752290725708, "def find_max_divisor(nums):\n    \"\"\"\n    Find the maximum divisor that divides all numbers in the list.\n    \n    Args:\n        nums (list): A list of integers.\n    \n    Returns:\n        int: The maximum divisor that divides all numbers in the list.\n    \"\"\"\n    n = len(nums)\n    if n < 2:\n        return nums[0]\n\n    max_div = 0\n    for i in range(n-1):\n        num = nums[i]\n        for j in range(i+1, n):\n            if num % nums[j] == 0 and nums[j] > max_div:\n                max_div = nums[j]\n                break  # Exit the inner loop if a larger divisor is found\n    return max_div"]]}
{"task_id": 329, "problem": [[0.9190161824226379, "def sum_smallest_three(arr):\n    \"\"\"\n    Given an array of integers, return the sum of the three smallest numbers.\n    \n    >>> sum_smallest_three([1, 2, 3, 4, 5])\n    6\n    >>> sum_smallest_three([1, 1, 1])\n    3\n    >>> sum_smallest_three([1, 2, 3, 4, 5, 6])\n    6\n    >>> sum_smallest_three([1, 2, 3, 4, 5, 6, 7])\n    9\n    \"\"\"\n    if len(arr) < 3:\n        return sum(arr)\n    smallest_nums = [float('inf')] * 3\n    for num in arr:\n        if num < smallest_nums[2]:\n            smallest_nums = sorted(smallest_nums[:-1] + [num])\n    return sum(smallest_nums)"], [0.9142948389053345, "def two_smallest_numbers(lst):\n    \"\"\"\n    Given a list of numbers, return the sum of the two lowest positive numbers.\n    \n    Examples\n    two_smallest_numbers([19, 5, 42, 2, 77]) \u279e 7\n    \n    two_smallest_numbers([10, 56, 32, 4, 5, 7]) \u279e 11\n    \n    two_smallest_numbers([10, -80, 90, 100]) \u279e 19\n    \"\"\"\n    smallest = lst[0]\n    second_smallest = lst[1]\n    \n    for i in lst:\n        if i < smallest:\n            second_smallest = smallest\n            smallest = i\n        elif i < second_smallest:\n            second_smallest = i\n    \n    return (smallest, second_smallest)"], [0.9009478092193604, "def sum_of_first_three(arr, index=0):\n    \"\"\"\n    Given an array of integers, return the sum of the first three elements.\n    \n    If the array has fewer than three elements, return the sum of all elements.\n    \n    For example, given [1, 2, 3, 4], return 6.\n    \n    Given [1, 2], return 3.\n    \n    Given [1], return 1.\n    \n    Given [], return 0.\n    \"\"\"\n    if index >= len(arr):\n        return 0\n    \n    if index == 2:\n        return max(arr[index] + arr[index - 1] + arr[index - 2], 0)\n    \n    return arr[index] + sum_of_first_three(arr, index + 1)"], [0.9008499979972839, "def sum_of_list(numbers):\n    \"\"\"\n    Return the sum of all positive numbers in the list.\n    \n    >>> sum_of_list([1, 2, 3, 4, 5])\n    15\n    >>> sum_of_list([1, -2, 3, -4, 5])\n    9\n    >>> sum_of_list([1, -2, 3, -4, 5, 6])\n    16\n    \"\"\"\n    total = 0\n    for num in numbers:\n        if num >= 0 and num % 3 != 0:\n            total += num\n    return total"]]}
{"task_id": 330, "problem": []}
{"task_id": 331, "problem": [[0.9009892344474792, "def find_smallest_range(dictionary):\n    \"\"\"\n    Find the smallest range that includes a number from each of the sorted arrays.\n    :param dictionary: a dictionary of sorted arrays\n    :return: a tuple of the smallest range\n    \"\"\"\n    min_range = float('inf')\n    min_key = None\n    for key, value in dictionary.items():\n        range_val = max(value) - min(value)\n        if range_val < min_range:\n            min_range = range_val\n            min_key = key\n    return min_key"]]}
{"task_id": 332, "problem": [[0.9050012230873108, "def string_stats(s):\n    \"\"\"\n    Given a string, this function returns a tuple with three elements:\n    1. The number of letters in the string\n    2. The number of digits in the string\n    3. The number of other characters in the string (anything that is not a letter or a digit)\n    \"\"\"\n    num_letter = 0\n    num_digit = 0\n    num_other = 0\n    for c in s:\n        if c.isalpha():\n            num_letter += 1\n        elif c.isdigit():\n            num_digit += 1\n        else:\n            num_other += 1\n            \n    return (num_letter, num_digit, num_other)"], [0.903843879699707, "def digit_count(s):\n    \"\"\"\n    Return two integers. The first is the count of digits in the string, the second is the count of each digit.\n    \"\"\"\n    count = 0\n    freq = {str(x): 0 for x in range(10)}\n    for char in s:\n        if char.isdigit():\n            count += 1\n            freq[char] += 1\n    return count, freq\n    def digit_count(s):\n    \"\"\"\n    Return two integers. The first is the count of digits in the string, the second is the count of each digit.\n\"\"\"\n    count = 0\n    freq = {str(x): 0 for x in range(10)}\n    for char in s:\n        if char.isdigit():\n            count += 1\n            freq[char] += 1\n    return count, freq"]]}
{"task_id": 333, "problem": [[0.8998741507530212, "def count_odd(lst):\n    \"\"\"\n    Return the number of elements in the list that are odd.\n    \"\"\"\n    count = 0\n    for i in lst:\n        if i % 2 != 0:\n            count += 1\n    return count\n    def count_odd(lst):\n    \"\"\"\n    Return the number of elements in the list that are odd.\n    \"\"\"\n    count = 0\n    for i in lst:\n        if i % 2 != 0:\n            count += 1\n    return count"]]}
{"task_id": 334, "problem": [[0.9218735098838806, "def find_difference(lst):\n    \"\"\"\n    Given a list of integers, return the difference between the largest and smallest integers in the list.\n    \n    For example:\n    \n    [1, 2, 3] -> 2 # since 3 - 1 = 2\n    [10, 11, 12] -> 2 # since 12 - 10 = 2\n    [1, 1, 1] -> 0 # since 1 - 1 = 0\n    [1, 1, 2] -> 1 # since 2 - 1\"\"\"\n    return max(lst) - min(lst)"], [0.9218732714653015, "def find_difference(lst):\n    \"\"\"\n    Given a list of integers, return the difference between the largest and smallest integers in the list.\n    \n    For example:\n    \n    [1, 2, 3] -> 2 # since 3 - 1 = 2\n    [10, 11, 12] -> 2 # since 12 - 10 = 2\n    [1, 1, 1] -> 0 # since 1 - 1 = 0\n    [1, 1, 2] -> 1 # since 2 - 1\"\"\"\n    return max(lst) - min(lst)"], [0.9190673232078552, "def find_difference(numbers):\n    \"\"\"\n    Find the difference between the biggest and the smallest number in a list.\n    \n    Args:\n       numbers(list): list of numbers\n    Returns:\n       difference (int): the difference between biggest and smallest number\n    \"\"\"\n    return max(numbers) - min(numbers)"], [0.9140927195549011, "def max_difference(lst):\n    \"\"\"\n    Given a list of integers, find the maximum difference between any two elements.\n    \n    >>> max_difference([1, 2, 3, 4, 5])\n    4\n    >>> max_difference([10, 9, 8, 7, 6])\n    -1\n    >>> max_difference([10, 9, 8, 7, 6, 5, 4, 3, 2, 1])\n    -9\n    \"\"\"\n    diff = 0\n    for i in range(len(lst)-1):\n        if abs(lst[i+1] - lst[i]) > diff:\n            diff = abs(lst[i+1] - lst[i])\n    print(diff)"], [0.9135929942131042, "def find_difference(numbers):\n    \"\"\"Find the difference between the highest value and the lowest value of an array of numbers.\"\"\"\n    return max(numbers) - min(numbers)"], [0.9124774932861328, "def max_difference(numbers):\n    \"\"\"\n    Find the maximum difference between any two elements in a list of numbers.\n    \n    Args:\n       numbers(list): list of numbers\n    Returns:\n       difference (int): maximum difference between any two elements\n    \"\"\"\n    max_diff = 0\n    for i in range(len(numbers)-1):\n        for j in range(i+1, len(numbers)):\n            cur_diff = abs(numbers[i] - numbers[j])\n            if cur_diff > max_diff:\n                max_diff = cur_diff\n    return max_diff"]]}
{"task_id": 335, "problem": []}
{"task_id": 336, "problem": []}
{"task_id": 337, "problem": [[0.8864381313323975, "def count(S, m, n):\n    \"\"\"\n    :type S: List[int]\n    :type m: int\n    :type n: int\n    :rtype: int\n    \"\"\"\n    table = [0 for k in range(n+1)]\n    table[0] = 1\n    for i in range(0, m):\n        for j in range(S[i], n+1):\n            table[j] += table[j-S[i]]\n    return table[n]"]]}
{"task_id": 338, "problem": [[0.9017764925956726, "def validate_binary(binary):\n    \"\"\"\n    Check if a string is a valid binary string\n    :param binary: string\n    :return: bool\n    \"\"\"\n    return all([digit in '01' for digit in binary])"], [0.8980107307434082, "def is_valid_binary_string(input_string):\n    \"\"\"\n    Check if the given string is a valid binary string.\n    A binary string is a string containing only '0' and '1'.\n    Args:\n        input_string (str): The input string to be checked.\n    Returns:\n        bool: True if the string is a valid binary string, False otherwise.\n    \"\"\"\n    for char in input_string:\n        if char not in '01':\n            return False\n    return True"], [0.8969879746437073, "def isValidBinary(bin_num):\n    \"\"\"\n    Checks if a given string is a valid binary number\n    :param bin_num: string\n    :return: bool\n    \"\"\"\n    # Regex expression to match binary numbers\n    pattern = re.compile('^[01]+$')\n    return bool(pattern.match(bin_num))"]]}
{"task_id": 339, "problem": [[0.8985863924026489, "def remove_longest_single_char_substring(input_string):\n    \"\"\"\n    Remove the longest substring of single character\"\"\"\n    longest_string = \"\"\n    temp_string = \"\"\n    for c in input_string:\n        if c == temp_string[-1:]:\n            temp_string += c\n        else:\n            if len(temp_string) > len(longest_string):\n                longest_string = temp_string\n            temp_string = c\n        if len(temp_string) > len(longest_string):\n            longest_string = temp_string\n \n    return input_string.replace(longest_string, \"\")"]]}
{"task_id": 340, "problem": []}
{"task_id": 341, "problem": [[0.9331783056259155, "def has_unique_characters(s): \n    \"\"\"\n    Given a string, determine if it is comprised of all unique characters. For example, the string 'abcde' has all unique characters and should return True. The string 'aabcde' contains duplicate characters and should return False.\n    \"\"\"\n    char_set = [False] * 256 \n\n    for i in range(0, len(s)): \n        val = ord(s[i]) \n\n        # If CHAR_SET is already True,  \n        # return False         \n        if char_set[val]: \n            return False\n\n        # If the character is not present \n        # in character array, then mark it \n        # as True  \n        char_set[val] = True \n\n    return True"], [0.9308285117149353, "def uniqueCharacters(str):\n  \"\"\"\n  Return True if the given string has only unique characters.\n  \"\"\"\n  s = set(str)\n  return len(s) == len(str)\n    def uniqueCharacters(str):\n  \"\"\"\n  Return True if the given string has only unique characters.\n  \"\"\"\n  s = set(str)\n  return len(s) == len(str)"]]}
{"task_id": 342, "problem": [[0.8861914277076721, "def remove_element(nested_list, target):\n    \"\"\"\n    Remove all elements from nested_list that == target.\n    :type nested_list: list\n    :type target: int\n    :rtype: list\n    \"\"\"\n    result = []\n    for i in nested_list:\n        if type(i) is list:\n            i = remove_element(i, target)\n            if i:\n                result.append(i)\n        elif i != target:\n            result.append(i)\n    return result"], [0.872853696346283, "def remove_first_element(lists):\n    \"\"\"\n    Remove the first element from each sublist in the given list of lists.\n    \n    Args:\n    - lists: A list of lists.\n    \n    Returns:\n    - A new list of lists with the first element removed from each sublist.\n    \"\"\"\n    # Use list slicing to remove the first element of each sublist\n    return [lst[1:] for lst in lists]"]]}
{"task_id": 343, "problem": [[0.8836061358451843, "def is_arithmetic(array):\n    \"\"\"Return True if array is an arithmetic progression.\"\"\"\n    \n    # ensure the array has at least 3 elements\n    if len(array) < 3:\n        return False\n\n    # compute the common difference between the first two elements\n    diff = array[1] - array[0]\n\n    # for each subsequent pair of elements\n    for i in range(2, len(array)):\n        # if the difference does not match the common difference, return False\n        if array[i] - array[i - 1] != diff:\n            return False\n\n    # if we've made it here, the array is an arithmetic progression\n    return True"], [0.8831528425216675, "def nth_term(first_term, common_difference, n):\n    \"\"\"\n    Return the nth term of an arithmetic sequence.\n    \n    Args:\n        first_term (int): The first term of the sequence.\n        common_difference (int): The common difference between terms.\n        n (int): The index of the term to return.\n    \n    Returns:\n        int: The nth term of the sequence.\n    \"\"\"\n    return first_term + (n - 1) * common_difference"]]}
{"task_id": 344, "problem": [[0.8958063721656799, "def compute_triangles(r):\n    \"\"\"\n    Compute the number of triangles in a square of side length 2*r + 1.\n    \n    Parameters\n    ----------\n    r : int\n        The radius of the square.\n        \n    Returns\n    -------\n    int\n        The number of triangles in the square.\n    \"\"\"\n    num_points = 2*r + 1\n    return num_points**2"], [0.8826830387115479, "def circle(r=5):\n    \"\"\"\n    This function calculates the circumference and area of a circle.\n    \n    Parameters\n    ----------\n    r : float\n        The radius of the circle.\n    \n    Returns\n    -------\n    circumference : float\n        The circumference of the circle.\n    area : float\n        The area of the circle.\n    \"\"\"\n    pi = 3.14\n    circumference = 2*pi*r\n    area = pi*r**2\n    return circumference, area"]]}
{"task_id": 345, "problem": [[0.8961595892906189, "def find_other_angle(angle):\n    \"\"\"\n    Find the other angle in a triangle given one angle.\n    \n    Args:\n        angle (int): one angle in the triangle\n        \n    Returns:\n        int: the other angle in the triangle\n    \"\"\"\n    return 180 - angle"], [0.8859964609146118, "def angle_of_triangle(a, b, c):\n    \"\"\"\n    Given the lengths of all three sides of a triangle, return the angle opposite the shortest side.\n    \n    :param a: length of side a\n    :param b: length of side b\n    :param c: length of side c\n    :return: angle opposite side a\n    \"\"\"\n    angle = math.acos((b**2 + c**2 - a**2) / (2*b*c))\n    return math.degrees(angle)"]]}
{"task_id": 346, "problem": [[0.8901882767677307, "def find_max(list_of_tuples):\n    \"\"\"\n    Find the maximum value in each tuple in a list of tuples.\n    \n    Args:\n        list_of_tuples (list): A list of tuples.\n    \n    Returns:\n        list: A list of maximum values.\n    \"\"\"\n    max_values = []\n    for tup in list_of_tuples:\n        max_values.append(max(tup))\n    return max_values"], [0.8896616697311401, "def find_max(*args):\n    \"\"\"\n    Find the maximum value in a list of numbers.\n    \n    Args:\n        *args: A list of numbers.\n    \n    Returns:\n        The maximum value in the list.\n    \"\"\"\n    if isinstance(args[0], tuple):\n        return [max(t) for t in args]\n    else:\n        return max(args)"], [0.8832653760910034, "def find_max(lst):\n    \"\"\"\n    Find the maximum value in a list\n    \"\"\"\n    max_val = lst[0]\n    for num in lst:\n        if num > max_val:\n            max_val = num\n\n    return max_val\n    def find_max(lst):\n    \"\"\"\n    Find the maximum value in a list\n    \"\"\"\n    max_val = lst[0]\n    for num in lst:\n        if num > max_val:\n            max_val = num\n\n    return max_val"]]}
{"task_id": 347, "problem": []}
{"task_id": 348, "problem": []}
{"task_id": 349, "problem": [[0.888716995716095, "def lucas(n):\n    \"\"\"\n    Return the nth number in the Lucas sequence.\n    The Lucas sequence is the sequence of integers that begins with 2, 1 and\n    where every number is the sum of the previous two.\n    This function should return an int.\n    >>> lucas(0)\n    2\n    >>> lucas(1)\n    1\n    >>> lucas(2)\n    3\n    >>> lucas(3)\n    4\n    >>> lucas(10)\n    123\n    \"\"\"\n    if n == 0:\n        return 2\n    elif n == 1:\n        return 1\n    else:\n        lucas_values = [2, 1]\n        for i in range(2, n + 1):\n            lucas_values.append(sum(lucas_values[-2:]))\n        return lucas_values[n]"], [0.8879011273384094, "def find_nth_number(n):\n    \"\"\"\n    Find the nth number in the sequence.\n    The sequence starts with 1, 2, 1, 3, 2, 5, 3, 7, 5, 11, 8, 13, 13, 17, 12, 19, 17, 23, 15, 25, 21, 29, 20, 31, 25, 35, 28, 37, 30, 41, 3\"\"\"\n    if n == 1:\n        return 1\n    elif n == 2:\n        return 2\n    else:\n        res = 2\n        pre = 1\n        for _ in range(3, n + 1):\n            res, pre = res + pre, res\n        return res"], [0.8874220848083496, "def nth_lucas(n):\n    \"\"\"\n    Return the nth Lucas number.\n    \n    >>> nth_lucas(0)\n    2\n    >>> nth_lucas(1)\n    1\n    >>> nth_lucas(2)\n    3\n    >>> nth_lucas(3)\n    4\n    >>> nth_lucas(10)\n    123\n    >>> nth_lucas(20)\n    199\n    \"\"\"\n    lucas_cache = {0: 2, 1: 1}\n    \n    if n in lucas_cache:\n        return lucas_cache[n\"\"\"\n    if n not in lucas_cache: \n        lucas_cache[n] = nth_lucas(n - 1) + nth_lucas(n - 2)\n    return lucas_cache[n]"], [0.8866875171661377, "def nth_lucas(n):\n    \"\"\"\n    Return the nth Lucas number.\n    \n    >>> nth_lucas(0)\n    2\n    >>> nth_lucas(1)\n    1\n    >>> nth_lucas(2)\n    3\n    >>> nth_lucas(3)\n    4\n    >>> nth_lucas(10)\n    123\n    \"\"\"\n    if n == 0: \n        return 2;\n    if n == 1:\n        return 1;\n    else:\n        return nth_lucas(n - 1) + nth_lucas(n - 2)"]]}
{"task_id": 350, "problem": [[0.9267804622650146, "def remove_empty_lists(l):\n    \"\"\"\n    Given a list, return a new list with all empty lists removed.\n    \n    >>> remove_empty_lists([1, 2, 3])\n    [1, 2, 3]\n    >>> remove_empty_lists([1, [], 3])\n    [1, 3]\n    >>> remove_empty_lists([1, [], [], 3, [], []])\n    [1, 3]\n    >>> remove_empty_lists([[], [], [], [], [], [], [], []])\n    []\n    \"\"\"\n    # if l is not a list, just return it. This is the base case.\n    if not isinstance(l, list):\n        return l\n    else:\n        # for each item in the list, recursively call this function.\n        # filter out any results that are empty lists.\n        # note that a string of length zero is an empty list.\n        return [x for x in filter(None, map(remove_empty_lists, l))]"], [0.9124547243118286, "def remove_empty_lists(lst):\n    \"\"\"\n    Removes empty lists from a list.\n    \n    Args:\n        lst (list): The list to remove empty lists from.\n    \n    Returns:\n        list: The list with empty lists removed.\n    \"\"\"\n    new_lst = []\n    for li in lst:\n        if li:\n            new_lst.append(li)\n    return new_lst"]]}
{"task_id": 351, "problem": [[0.9361097812652588, "def most_frequent_item(lst):\n    \"\"\"\n    Return the most frequent item in a list.\n    \"\"\"\n    # initialize variables\n    max_count = 0\n    max_item = None\n\n    # iterate through the list\n    for i in range(len(lst)):\n        count = 0\n\n        # count occurrences of the current item in the list\n        for j in range(len(lst)):\n            if lst[j] == lst[i]:\n                count += 1\n\n        # check if the current item has higher frequency than the current maximum\n        if count > max_count:\n            max_count\"\"\"\n    max_count = 0\n    max_item = None\n\n    # iterate through the list\n    for i in range(len(lst)):\n        count = 0\n\n        # count occurrences of the current item in the list\n        for j in range(len(lst)):\n            if lst[j] == lst[i]:\n                count += 1\n\n        # check if the current item has higher frequency than the current maximum\n        if count > max_count:\n            max_count = count\n            max_item = lst[i]\n\n    return max_item"], [0.9350138902664185, "def most_frequent(input_list):\n    \"\"\"\n    Find the most frequent item in a list.\n    \"\"\"\n    # Your code here\n    # Create a dictionary to store the frequency of each item\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    # Find the most frequent item\n    most_frequent_item = max(frequency_dict, key=frequency_dict.get)\n\n    return most_frequent_item\n    def most_frequent\"\"\"\n    # Create a dictionary to store the frequency of each item\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    # Find the most frequent item\n    most_frequent_item = max(frequency_dict, key=frequency_dict.get)\n\n    return most_frequent_item"]]}
{"task_id": 352, "problem": [[0.8792142868041992, "def add_tuple(tpl):\n    \"\"\"\n    Add up all the odd elements of a tuple\"\"\"\n    \n    # Extract elements at odd indices\n    odd_indices_elements = tpl[1::2]\n\n    # Filter out even elements from those extracted earlier\n    even_elements = list(filter(lambda x: x % 2 == 0, odd_indices_elements))\n\n    # Calculate the sum of the even elements and return that value\n    return sum(even_elements)"], [0.8761867880821228, "def add_ten(arr):\n    \"\"\"Add 10 to each element in the list.\n    \n    >>> add_ten([1, 2, 3])\n    [11, 12, 13]\n    \"\"\"\n    new_arr = []\n    \n    for i in arr:\n        new_arr.append(i + 10)\n        \n    return new_arr"], [0.8753759264945984, "def add_list_and_tuple(lst, tpl):\n    \"\"\"\n    Add corresponding elements of a list and a tuple.\n    \n    Args:\n        lst (list): A list of numbers.\n        tpl (tuple): A tuple of numbers of the same length as lst.\n        \n    Returns:\n        list: A list of the sums of corresponding elements of lst and tpl.\n    \"\"\"\n    result = []\n    for i in range(len(lst)):\n        result.append(lst[i] + tpl[i])\n    return result"], [0.8747488856315613, "def add_by_num(L, num): \n    \"\"\"\n    Add num to each element in L.\n    \n    >>> add_by_num([1, 2, 3], 2)\n    [3, 4, 5]\n    \"\"\"\n    new_list = [] \n    for i in range(len(L)): \n        new_list.append(L[i] + num)\n    return new_list"]]}
{"task_id": 353, "problem": [[0.9122427105903625, "def minFlips(self, target: str) -> int:\n    \"\"\"\n    \"\"\"\n    flips = 0\n    prev = '0'\n    for bulb in target:\n        if bulb != prev:\n            flips += 1\n            prev = bulb\n    return flips"], [0.909764289855957, "def min_operations_to_alternate(s: str) -> int:\n    \"\"\"\n    Given a string s consisting only of characters '0' and '1',\n    return the minimum number of characters you need to change to make the string alternating\n    \"\"\"\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n\"\"\"\n    count_a, count_b = 0, 0\n    for i, c in enumerate(s):\n        if i % 2 == 0:\n            if c == '0':\n                count_a += 1\n            else:\n                count_b += 1\n        else:\n            if c == '0':\n                count_b += 1\n            else:\n                count_a += 1\n    return min(count_a, count_b)"], [0.9081219434738159, "def min_swaps(s: str) -> int:\n    \"\"\"\n    Given a string s consisting only of characters '0' and '1', return the minimum number of character swaps to make it a binary string.\n    If it is impossible, return -1.\n    A binary string is a string where each character is either '0' or '1'.\n    \n    Example 1:\n    Input: s = \"0100101010010101\"\n    Output: 5\n    Explanation:\n    Swap character '0' at indices 0, 3, 4, 5 and 7 with\"\"\"\n    zeros, ones = 0, 0\n    for c in s:\n        if c == '0':\n            zeros += 1\n        else:\n            ones += 1\n\n    if abs(zeros - ones) > 1:\n        return -1\n\n    mismatch_count1, mismatch_count2 = 0, 0\n    for i, c in enumerate(s):\n        if i % 2 == 0:\n            if c != '0': mismatch_count1 += 1\n            if c != '1': mismatch_count2 += 1\n        else:\n            if c != '1': mismatch_count1 += 1\n            if c != '0': mismatch_count2 += 1\n\n    return min(mismatch_count1, mismatch_count2) // 2"]]}
{"task_id": 354, "problem": [[0.9275803565979004, "def countDigits(num):\n    \"\"\"\n    Write a function that takes in a positive integer num and returns the number of digits in num.\n    \n    Sample Input\n    num = 1234\n    Sample Output\n    4\n    \n    \"\"\"\n    return len(str(num))"]]}
{"task_id": 355, "problem": [[0.9311329126358032, "def max_product(lst):\n    \"\"\"\n    This function receives a collection of numerical values (integers),\n    and returns the two elements within that list that, if multiplied\n    together, will yield the absolute highest possible product.\n    \"\"\"\n    \n    # To consider negative numbers and their product which can yield the highest product\n    lst.sort() # First sort the list in increasing order\n    \n    # Checking maximum positive product of first two elements and last two elements\n    product_1 = lst[0] * lst[1]\n    product_2 = lst[-1] * lst[-2]\n    \n    # If first two elements product is higher, return them\n    # Else, return last two elements\n    if product_1 > product_2:\n        return [lst[0], lst[1]]\n    else:\n        return [lst[-1], lst[-2]]"], [0.9247413873672485, "def max_product(lst):\n    \"\"\"\n    Given a list of integers, return the product of the maximum two values.\n    \n    >>> max_product([1, 2, 3, 4])\n    (4, 3)\n    >>> max_product([1, 2, 3, 4, 5])\n    (5, 4)\n    >>> max_product([1, 2, 3, 4, 5, 6])\n    (6, 5)\n    \"\"\"\n    if len(lst) < 2:\n        return (\"List must have at least two elements\")\n    elif len(lst) == 2:\n        return (lst[0], lst[1])\n    else:\n        sorted_lst = sorted(lst)\n        return (sorted_lst[-1], sorted_lst[-2])"], [0.9247347116470337, "def max_product(lst):\n    \"\"\"\n    Given a list of integers, return the product of the maximum two values.\n    \n    >>> max_product([1, 2, 3, 4])\n    (4, 3)\n    >>> max_product([1, 2, 3, 4, 5])\n    (5, 4)\n    >>> max_product([1, 2, 3, 4, 5, 6])\n    (6, 5)\n    \"\"\"\n    if len(lst) < 2:\n        return (\"List must have at least two elements\")\n    elif len(lst) == 2:\n        return (lst[0], lst[1])\n    else:\n        sorted_lst = sorted(lst)\n        return (sorted_lst[-1], sorted_lst[-2])"], [0.9246435165405273, "def max_product_pair(lst):\n    \"\"\"\n    Find the pair of elements in a list that have the maximum product.\n    \n    Args:\n        lst: a list of integers\n    \n    Returns:\n        A tuple of two integers that have the maximum product.\n    \"\"\"\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]*lst[j] > max_product:\n                max_product = lst[i]*lst[j]\n                pair = (lst[i], lst[j])\n    return pair"], [0.922596275806427, "def max_product_pairs(lst):\n    \"\"\"\n    Given a list of integers, find all pairs of integers whose product is the maximum product of any pair.\n    \n    Args:\n        lst: list of integers\n    \n    Returns:\n        list of pairs of integers whose product is the maximum product of any pair\n    \"\"\"\n    if not lst:          # check if the list is empty\n        return []\n    #check all possible pairs\n    possible_pairs = [[lst[i], lst[j]] for i in range(len(lst)) for j in range(i+1, len(lst))]\n    #calculate product for each pair\n    products = [pair[0]*pair[1] for pair in possible_pairs]\n    #find maximum product\n    max_product = max(products) \n    #return pairs having maximum product\n    return [possible_pairs[i] for i in range(len(products)) if products[i] == max_product]"]]}
{"task_id": 356, "problem": [[0.9250075221061707, "def is_balanced(root):\n    \"\"\"\n    Return True if the binary tree is balanced.\n    \n    :param root: The root of the binary tree.\n    :type root: TreeNode\n    :rtype: bool\n    \"\"\"\n    if root == None: \n        return True \n  \n    leftHeight = height(root.left) \n    rightHeight = height(root.right) \n  \n    if  abs(leftHeight - rightHeight) < 2 and is_balanced(root.left) is True and is_balanced(root.right) is True: \n        return True \n  \n    return False"], [0.923189640045166, "def is_balanced(root):\n    \"\"\"\n    Check if a binary tree is balanced.\n    A binary tree is balanced if the depth of the two subtrees of every node never differ by more than 1.\n    :param root: root of binary tree\n    :return: True if binary tree is balanced, False if not\n    \"\"\"\n    # Base Case\n    if root is None:\n        return True\n\n    # Get the height of left and right subtrees\n    left_height = is_balanced(root.left)\n    right_height = is_balanced(root.right)\n\n    # Check if difference between heights is not more than 1 \n    if abs(left_height - right_height) <= 1 and \\\n       is_balanced(root.left) and is_balanced(root.right):\n        return True\n\n    return False"], [0.9227168560028076, "def isBalanced(root): \n    \"\"\"\n    :type root: TreeNode\n    :rtype: bool\n    \"\"\"\n    if root is None: \n        return True\n\n    lh = height(root.left) \n    rh = height(root.right)\n\n    if abs(lh-rh) <= 1 and isBalanced(root.left) is True and isBalanced(root.right) is True: \n        return True\n\n    return False"]]}
{"task_id": 357, "problem": [[0.8971201181411743, "def repeat_string(string, n):\n    \"\"\"\n    Given a string and an integer, return a list with the string repeated n times.\n    \"\"\"\n    return [string] * n\n    \n    def repeat_string(string, n):\n    \"\"\"\n    Given a string and an integer, return a list with the string repeated n times.\n    \"\"\"\n    return [string] * n"], [0.8844214677810669, "def rep(lst, times):\n    \"\"\"\n    Return a list of elements repeating times times.\n    >>> rep([1, 2], [3, 2])\n    [1, 1, 1, 2, 2]\n    \"\"\"\n    return [i for i, t in zip(lst, times) for _ in range(t)]"], [0.8840140104293823, "def repeat_string(string, n):\n    \"\"\"\n    Given a string and an integer, return a string that\n    repeats the original string that many times.\n    \n    repeat_string(\"Hello\", 3) -> \"HelloHelloHello\"\n    \"\"\"\n    return string * n"], [0.8795992732048035, "def copy_string(string, n):\n    \"\"\"\n    Return a new string consisting of n copies of the string\"\"\"\n    result = \"\"\n    for _ in range(n):\n        result += string\n    return result"]]}
{"task_id": 358, "problem": [[0.9193006157875061, "def find_surface_area(length, breadth, height):\n    '''\n    This function calculates the surface area of a cuboid.\n    Input: length, breadth, height - these are the three dimensions of the cuboid\n    Output: total surface area of the cuboid \n    '''\n    # Formula of Surface Area of Cuboid = 2(lb + bh + hl)\n    surface_area = 2 * (length * breadth + breadth * height + height * length)\n    return surface_area"]]}
{"task_id": 359, "problem": []}
{"task_id": 360, "problem": [[0.9282146692276001, "def smallest_missing_number(arr):\n    \"\"\"\n    Find the smallest missing number in an array.\n    \n    Args:\n        arr (list): The input array.\n    \n    Returns:\n        int: The smallest missing number.\n    \"\"\"\n    arr.sort()   # Sort the array in ascending order\n\n    for i in range(len(arr)):\n        if arr[i] != i + 1:   # Check if the current element is not equal to i + 1\n            return i + 1     # Return the missing number\n\n    return arr[-1] + 1   # If no element is missing, return the next number after the last element"], [0.9245834350585938, "def find_missing_element(arr, missing):\n    \"\"\"\n    Find the missing element in a given array.\n    \n    Args:\n        arr: a sorted array of integers\n        missing: the missing element\n    \n    Returns:\n        The missing element\n    \"\"\"\n    sorted_arr = sorted(arr)\n    curr = sorted_arr[0]\n    for element in sorted_arr[1:]:\n        if element != (curr + 1):\n            return curr + 1\n        else:\n            curr = element\n    return missing"], [0.9230513572692871, "def missing_nums(arr):\n    \"\"\"\n    Given an array of sorted numbers, find the missing number in the array.\n    The array contains numbers in the range of 1 to 100.\n    The array is sorted in ascending order.\n    \n    Input: [1, 2, 4, 5, 6, 7, 9]\n    Output: 3\n    \n    Input: [1, 2, 3, 4, 6, 7, 8, 9, 10]\n    Output: 5\n    \n    Input: [1, \"\"\"\n    n = len(arr)\n    for i in range(n - 1):\n        expected_num = arr[i] + 1\n        if arr[i + 1] != expected_num:\n            return expected_num\n    return None"]]}
{"task_id": 361, "problem": [[0.9121540188789368, "def heap_sort(arr):\n    \"\"\"\n    Sort a list in ascending order\n    :param arr: list\n    :return: list\n    \"\"\"\n    n = len(arr)\n\n    # Build a maxheap.\n    for i in range(n, -1, -1):\n        heapify(arr, n, i)\n\n    # One by one extract elements\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i] # swap\n        heapify(arr, i, 0)"], [0.9115363955497742, "def heap_sort(arr):\n    \"\"\"\n    Sort a list in ascending order using heap sort.\n    :param arr: List of integers to be sorted.\n    :return: None\n    \"\"\"\n    def heapify(arr, n, i):\n        \"\"\"\n        Heapify a subtree rooted at index i.\n        :param arr: List of integers to be heapified.\n        :param n: Size of the heap.\n        :param i: Index of the root node of the subtree to be heapified.\n        :return: None\n        \"\"\"\n        largest = i\n        left = 2 * i + \"\"\"\n    n = len(arr)\n    for i in range(n, -1, -1):\n        heapify(arr, n, i)\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i]\n        heapify(arr, i, 0)"], [0.9105483293533325, "def heapsort(arr):\n    \"\"\"\n    Sort a list in ascending order using heap sort.\n    :param arr: List of integers to be sorted.\n    :return: None\n    \"\"\"\n    def heapify(arr, n, i):\n        \"\"\"\n        Heapify a subtree rooted at index i.\n        :param arr: List of integers.\n        :param n: Size of the heap.\n        :param i: Index of the root of the subtree.\n        :return: None\n        \"\"\"\n        largest = i\n        left = 2 * i + 1\n        right = 2 * i\"\"\"\n    n = len(arr)\n\n    for i in range(n//2 - 1, -1, -1):\n        heapify(arr, n, i)\n\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i]\n        heapify(arr, i, 0)"], [0.9100583791732788, "def heapSort(arr):\n    \"\"\"\n    Sort a list in ascending order using heap sort.\n    :param arr: List of integers to be sorted.\n    :return: None\n    \"\"\"\n    def heapify(arr, n, i):\n        \"\"\"\n        Heapify a subtree rooted at index i.\n        :param arr: List of integers.\n        :param n: Size of heap.\n        :param i: Index of the root of the subtree.\n        :return: None\n        \"\"\"\n        largest = i\n        left = 2 * i + 1\n        right = 2 * i +\"\"\"\n    n = len(arr)\n\n    for i in range(n // 2 - 1, -1, -1):\n        heapify(arr, n, i)\n\n    for i in range(n - 1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i]\n        heapify(arr, i, 0)"], [0.9092225432395935, "def heapsort(arr):\n    \"\"\"\n    Sort a list in ascending order using heap sort.\n    \n    Args:\n        arr(list): List to be sorted\n        \n    Returns:\n        A copy of the list in ascending order.\n    \"\"\"\n    heapq.heapify(arr)\n    return [heapq.heappop(arr) for _ in range(len(arr))]"], [0.9092015624046326, "def heap_sort(arr):\n    \"\"\"\n    Sort a list in ascending order using heap sort.\n    :param arr: List of integers to be sorted.\n    :return: None\n    \"\"\"\n    def heapify(arr, n, i):\n        \"\"\"\n        Heapify a subtree rooted at index i.\n        :param arr: List of integers.\n        :param n: Size of the heap.\n        :param i: Index of the root node.\n        :return: None\n        \"\"\"\n        largest = i\n        left = 2 * i + 1\n        right = 2 * i + \"\"\"\n    n = len(arr)\n\n    for i in range(n//2 - 1, -1, -1):\n        heapify(arr, n, i)\n\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i]\n        heapify(arr, i, 0)"], [0.9083521962165833, "def heapSort(arr):\n    \"\"\"\n    Sort a list in ascending order\n    :param arr: list of ints\n    :return: list of ints, sorted in ascending order\n    \"\"\"\n    # TODO: Implement heap sort\n    #   See https://courses.cs.vt.edu/cs3113_f20/Lectures/09-Sorting/heapsort.html for help\n    #   See https://www.programiz.com/dsa/heap-sort for help\n    #   See https://www.youtube.com/watch?v=kPRA0fhG1V0 for help\n\"\"\"\n    n = len(arr)\n \n    # Build a maxheap.\n    for i in range(n//2 - 1, -1, -1):\n        heapify(arr, n, i)\n \n    # One by one extract elements\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i]   # swap\n        heapify(arr, i, 0)\n\n    return arr"], [0.9077617526054382, "def heap_sort(arr):\n    \"\"\"\n    Sort a list in ascending order using a heap.\n    \n    Args:\n        arr: A list of integers to be sorted.\n    \n    Returns:\n        A new list of integers in ascending order.\n    \"\"\"\n    import heapq\n    heapq.heapify(arr)\n    return [heapq.heappop(arr) for _ in range(len(arr))]"], [0.9070056080818176, "def heap_sort(arr):\n    \"\"\"\n    Sort a list in ascending order\n    \n    Args:\n        arr(list): List to be sorted\n    \"\"\"\n    n = len(arr)\n\n    for i in range(n, -1, -1):\n        heapify(arr, n, i)\n\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i] \n        heapify(arr, i, 0)"], [0.906933069229126, "def heapSort(arr):\n    \"\"\"\n    Sort a list in ascending order\n    :param arr: list\n    :return: None\n    \"\"\"\n    n = len(arr)\n  \n    # Build a maxheap.\n    for i in range(n, -1, -1):\n        heapify(arr, n, i)\n   \n    # One by one extract elements\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i]   # swap\n        heapify(arr, i, 0\"\"\"\n    n = len(arr)\n  \n    # Build a maxheap.\n    for i in range(n, -1, -1):\n        heapify(arr, n, i)\n   \n    # One by one extract elements\n    for i in range(n-1, 0, -1):\n        arr[i], arr[0] = arr[0], arr[i]   # swap\n        heapify(arr, i, 0)"]]}
{"task_id": 362, "problem": [[0.9135163426399231, "def calculate_volume(num_length, num_width, num_height):\n    \"\"\"\n    Calculate the volume of a cuboid.\n    \n    Args:\n        num_length (int): The length of the cuboid.\n        num_width (int): The width of the cuboid.\n        num_height (int): The height of the cuboid.\n        \n    Returns:\n        int: The volume of the cuboid.\n    \"\"\"\n    return num_length * num_width * num_height"]]}
{"task_id": 363, "problem": [[0.9280613660812378, "def permutations(str):\n    \"\"\"\n    Generate all permutations of the given string.\n    \"\"\"\n    def _permutations(lst, index):\n        if index == len(lst):\n            print(\"\".join(lst))\n        else:\n            _permutations(lst, index + 1)\n            for i in range(index + 1, len(lst)):\n                lst[index], lst[i] = lst[i], lst[index]\n                _permutations(lst, index + 1)\n                lst[index], lst[i] = lst[i], lst[index]\n    \"\"\"\n    lst = list(str)\n    _permutations(lst, 0)"], [0.9250854849815369, "def unique_permutations(str, prefix=\"\"):\n    \"\"\"\n    Generate all unique permutations of a string\n    \"\"\"\n    check_set = set()\n    unique_permutations(str, prefix)\n    \n    \n    def unique_permutations(str, prefix=\"\"):\n    \"\"\"\n    Generate all unique permutations of a string\n    \"\"\"\n    if len(str) == 0:\n        print(prefix)\n    else:\n        for i in range(len(str)):\n            rem = str[0:i] + str[i+1:]\n            if (rem + prefix) not in check_set:\n                check_set.add(rem+prefix)\n                unique_permutations(rem, prefix + str[i])"]]}
{"task_id": 364, "problem": [[0.8983289003372192, "def round_to_5(n):\n    \"\"\"\n    Round a number to the nearest multiple of 5.\n    \n    >>> round_to_5(12)\n    10\n    >>> round_to_5(13)\n    15\n    >>> round_to_5(12.5)\n    10\n    >>> round_to_5(12.6)\n    15\n    \"\"\"\n    return round(n / 5) * 5"], [0.8923430442810059, "def round_up(num):\n    \"\"\"\n    Round up a number to the nearest integer.\n    \"\"\"\n    if num == int(num):\n        return int(num)\n    return int(num + 1)\n    def round_up(num):\n    \"\"\"\n    Round up a number to the nearest integer.\n    \"\"\"\n    if num == int(num):\n        return int(num)\n    return int(num + 1)"], [0.8922929763793945, "def round_to_nearest_hundred(num):\n    \"\"\"\n    Round a number to the nearest hundred.\n    \n    >>> round_to_nearest_hundred(88)\n    80\n    >>> round_to_nearest_hundred(123)\n    100\n    >>> round_to_nearest_hundred(333)\n    300\n    \"\"\"\n    mod = num % 100\n\n    if mod < 50:\n        return num - mod\n    else:\n        return num + (100 - mod)"]]}
{"task_id": 365, "problem": []}
{"task_id": 366, "problem": [[0.9192652702331543, "def remove_chars(string, chars):\n    \"\"\"\n    It should remove all occurrence of given characters from a string.\n    \"\"\"\n    # your code goes here\n    for char in chars:\n        string = string.replace(char, \"\")\n    return string\n    \n    def remove_chars(string, chars):\n    \"\"\"\n    It should remove all occurrence of given characters from a string.\n    \"\"\"\n    for char in chars:\n        string = string.replace(char, \"\")\n    return string"], [0.9189776182174683, "def remove_char(string, char):\n    \"\"\"\n    Remove all instances of a given character from a string.\n    \n    >>> remove_char('hello world', 'l')\n    'heo word'\n    \"\"\"\n    string_list = list(string)\n    for i in string_list:\n        if i == char:\n            string_list.remove(i)\n    string = ''.join(string_list)\n    \n    return string"]]}
{"task_id": 367, "problem": []}
{"task_id": 368, "problem": [[0.9343582391738892, "def find_surface_area(length, breadth, height):\n    '''\n    This function calculates the surface area of a cuboid.\n    Input: length, breadth, height - these are the three dimensions of the cuboid\n    Output: total surface area of the cuboid \n    '''\n    # Formula of Surface Area of Cuboid = 2(lb + bh + hl)\n    surface_area = 2 * (length * breadth + breadth * height + height * length)\n    return surface_area"], [0.9343320727348328, "def find_surface_area(length, breadth, height):\n    '''\n    This function calculates the surface area of a cuboid.\n    Input: length, breadth, height - these are the three dimensions of the cuboid\n    Output: total surface area of the cuboid \n    '''\n    # Formula of Surface Area of Cuboid = 2(lb + bh + hl)\n    surface_area = 2 * (length * breadth + breadth * height + height * length)\n    return surface_area"]]}
{"task_id": 369, "problem": []}
{"task_id": 370, "problem": []}
{"task_id": 371, "problem": [[0.9194601774215698, "def countRotations(arr):\n    \"\"\"\n    Count the number of rotations in a sorted and rotated array\n    :param arr: array of integers\n    :return: number of rotations\n    :rtype: int\n    \"\"\"\n    n = len(arr)\n    # Check if array is sorted\n    if (arr[0] <= arr[n-1]):\n        return 0\n    # Look for smallest element\n    i = 0\n    while (i < n-1):\n        if (arr[i+1] < arr[i]):\n            break\n        i += 1\n    return (i + 1)%n"], [0.9100503921508789, "def count_rotations(nums):\n    \"\"\"\n    Return the count of rotations in the list\n    :param nums: a list of integers\n    :return: an integer\n    \"\"\"\n    # Check if the array is sorted in descending order\n    if nums[0] >= nums[-1]:\n        max_index = 0\n        # Find the index of the max value \n        for i in range(1, len(nums)):\n            if nums[i] >= nums[max_index]:\n                max_index = i\n        # If the array is not sorted, return -1\n        if max_index == len(nums) - 1 and nums[0] < nums[1]:\n            return -1\n        else:\n            # If sorted in descending order, return index of max value + 1\n            return max_index + 1\n    else:\n        min_index = 0\n        # Find the index of the min value\n        for i in range(1, len(nums)):\n            if nums[i] <= nums[min_index]:\n                min_index = i\n        # If the array is not sorted, return -1\n        if min_index == len(nums) - 1 and nums[0] > nums[1]:\n            return -1\n        else:\n            # If sorted in ascending order, return index of min value\n            return min_index"], [0.9013595581054688, "def min_rot(arr): \n    \"\"\"\n    Find the minimum number of rotations to make the array sorted\n    :param arr: array of integers\n    :return: minimum number of rotations\n    \"\"\"\n    n = len(arr) \n    minimum = n \n    for i in range(n): \n        diff = 0 \n        for j in range(n): \n            if (arr[(i + j) % n] != arr[j]): \n                diff += 1\n        minimum = min(diff, minimum) \n    return minimum"], [0.8854879140853882, "def countShifts(arr):\n    \"\"\"\n    Given an array of integers arr, return the number of shifts needed to make it sorted.\n    An array arr is sorted if and only if arr[i] <= arr[i + 1] holds for every i (0-indexed).\n    We define a shift as moving the first element of an array to the end.\n    For example, [1, 2, 3] shifted once is [2, 3, 1].\n    Example 1:\n    Input: arr = [3,4,5,1,2]\n    Output: 1\n    Explanation\"\"\"\n    if len(arr) == 0:\n        return 0\n    for j in range(len(arr)):\n        new_arr = arr[j:]+arr[:j]\n        if is_sorted(new_arr):\n            return j\n    return -1"]]}
{"task_id": 372, "problem": [[0.8912954330444336, "def even_odd_change(arr):\n    \"\"\"\n    Given an array of numbers, replace all even numbers with 0 and all odd numbers with 1.\n    \n    Example:\n    \n    Input: [1, 2, 3, 4, 5, 6]\n    Output: [1, 0, 1, 0, 1, 0]\n    \n    Input: [10, 11, 12, 13, 14, 15]\n    Output: [0, 1, 0, 1, 0, 1]\n\"\"\"\n    for i in range(len(arr)):\n        if arr[i] % 2 == 0:\n            arr[i] = 0\n        else:\n            arr[i] = 1\n    return arr"]]}
{"task_id": 373, "problem": [[0.9088703989982605, "def least_frequent(array):\n    \"\"\"\n    Return the least frequent element in the given list.\n    \n    Args:\n        array (list): A list of integers.\n    \n    Returns:\n        int: The least frequent element in the list.\n    \"\"\"\n    frequency = {} \n    for item in array: \n        frequency[item] = frequency.get(item, 0) + 1\n    \n    least_frequent_number = min(frequency, key=frequency.get)\n    return least_frequent_number"], [0.9032262563705444, "def frequency(arr, num):\n    \"\"\"\n    Return the frequency of num in the given array.\n    \"\"\"\n    return arr.count(num)\n    \n    def frequency(arr, num):\n    \"\"\"\n    Return the frequency of num in the given array.\n    \"\"\"\n    return arr.count(num)"]]}
{"task_id": 374, "problem": [[0.8897498846054077, "def 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    \"\"\"\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 * pell(n-1) + pell(n-2)\n    return pell_dict[n]"], [0.8890237808227539, "def nth_value(n):\n    \"\"\"\n    \"\"\"\n    if n == 1:\n        return 0\n    elif n == 2:\n        return 2\n    else:\n        return 2 * nth_value(n-1)"]]}
{"task_id": 375, "problem": [[0.9047266840934753, "def min_deletions(s):\n    \"\"\"\n    Given a string s, find the minimum number of characters you need to delete to make the string balanced. We define a string is balanced if it has equal number of closing and opening brackets.\n    :type s: str\n    :rtype: int\n    \"\"\"\n    freq = collections.Counter(s)\n    used = set()\n    deletions = 0\n\n    for count in freq.values():\n        while count in used and count > 0:\n            deletions += 1\n            count -= 1\n        used.add(count)\n\n    return deletions"], [0.904708743095398, "def min_deletions(s):\n    \"\"\"\n    Given a string s, find the minimum number of characters you need to delete to make the string balanced. We define a string is balanced if it has equal number of closing and opening brackets.\n    :type s: str\n    :rtype: int\n    \"\"\"\n    freq = collections.Counter(s)\n    used = set()\n    deletions = 0\n\n    for count in freq.values():\n        while count in used and count > 0:\n            deletions += 1\n            count -= 1\n        used.add(count)\n\n    return deletions"], [0.8889316916465759, "def minAddToMakeValid(s: str) -> int:\n    \"\"\"\n    \"\"\"\n    result = balance = 0\n    for c in s:\n        balance += 1 if c == '(' else -1\n        if balance == -1:\n            result += 1\n            balance += 1\n    return result + balance"], [0.8880714774131775, "def minInsertions(s: str) -> int:\n    \"\"\"\n    :type s: str\n    :rtype: int\n    \"\"\"\n    ans, depth = 0, 0\n    for i in range(len(s)):\n        if s[i] == '(':\n            depth += 2\n        else:\n            if s[i - 1] == '(':\n                depth -= 1\n            else:\n                depth -= 2\n            if depth < 0:\n                ans -= depth\n                depth = 0\n    return ans + depth"], [0.8859508037567139, "def min_parentheses(s: str) -> int:\n    \"\"\"\n    Given a string containing just the characters '(' and ')', find the minimum number of parentheses to be added to make the string valid.\n    \n    Example 1:\n    \n    Input: \"())\"\n    Output: 1\n    Example 2:\n    \n    Input: \"(((\"\n    Output: 3\n    Example 3:\n    \n    Input: \"()\"\n    Output: 0\n    Example 4:\n    \n    Input: \"()))((\"\n    Output: 4\n    \"\"\"\n    stack = []\n    count = 0\n    \n    for p in s:\n        if p == '(':\n            stack.append(p)\n        elif p == ')':\n            if stack:\n                stack.pop()\n            else:\n                count += 1\n    count += len(stack)\n    \n    return count"]]}
{"task_id": 376, "problem": [[0.9362866878509521, "def check_odd_even(hex_number):\n    \"\"\"\n    Check if a hexadecimal number is odd or even.\n    \n    Args:\n        hex_number (str): The hexadecimal number to check.\n    \"\"\"\n    # Convert hexadecimal to decimal\n    decimal_number = int(hex_number, 16)\n    \n    # Check if the number is odd or even\n    if decimal_number % 2 == 0:\n        print(f\"The hex number {hex_number} is Even.\")\n    else:\n        print(f\"The hex number {hex_number} is Odd.\")"], [0.9362764358520508, "def check_odd_even(hex_number):\n    \"\"\"\n    Check if a hexadecimal number is odd or even.\n    \n    Args:\n        hex_number (str): The hexadecimal number to check.\n    \"\"\"\n    # Convert hexadecimal to decimal\n    decimal_number = int(hex_number, 16)\n    \n    # Check if the number is odd or even\n    if decimal_number % 2 == 0:\n        print(f\"The hex number {hex_number} is Even.\")\n    else:\n        print(f\"The hex number {hex_number} is Odd.\")"], [0.9282255172729492, "def check_hexadecimal(num):\n    \"\"\"\n    Check if a hexadecimal number is even or odd.\n\n    Args:\n        num (str): The hexadecimal number to check.\n\n    Returns:\n        str: \"Even\" if the number is even, \"Odd\" if the number is odd.\n    \"\"\"\n    # Convert hexadecimal to decimal\n    decimal_num = int(num, 16)\n\n    # Check if the number is even or odd\n    if decimal_num % 2 == 0:\n        return \"Even\"\n    else:\n        return \"Odd\""]]}
{"task_id": 377, "problem": [[0.9333244562149048, "def maxPowerOfTwo(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    p = 0\n    while ((1 << (p + 1)) <= n): p += 1\n    return p"], [0.9219517707824707, "def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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\n    def power_of_two(n):\n    \"\"\"\n    Given an integer n, return the power of 2 that is closest to n.\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"]]}
{"task_id": 378, "problem": []}
{"task_id": 379, "problem": [[0.9045181274414062, "def prepend_string_to_list(my_string, my_list):\n    \"\"\"\n    Prepend a string to all elements in a list\n    \"\"\"\n    for i in range(len(my_list)):\n        my_list[i] = my_string + my_list[i]\n    return my_list\n    \n    def prepend_string_to_list(my_string, my_list):\n    \"\"\"\n    Prepend a string to all elements in a list\n    \"\"\"\n    for item in my_list:\n        print(my_string + item)"]]}
{"task_id": 380, "problem": [[0.9076905846595764, "def create_nested_dict(list1, list2, list3):\n    \"\"\"\n    Create a nested dictionary from three lists.\n\n    Args:\n        list1 (list): The first list.\n        list2 (list): The second list.\n        list3 (list): The third list.\n\n    Returns:\n        dict: The nested dictionary.\n    \"\"\"\n    # create the nested dictionary\n    nested_dict = {}\n\n    for l1, l2, l3 in zip(list1, list2, list3):\n        # check if l3 is an iterable but not a string \n        # (since strings are iterable, but we don't want to treat them as such)\n        if isinstance(l3, (list, tuple)) and not isinstance(l3, str):\n            # convert l3 to dictionary if its iterable\n            l3 = {i: v for i, v in enumerate(l3)}\n        \n        nested_dict[l1] = {l2: l3}\n    return nested_dict"]]}
{"task_id": 381, "problem": [[0.8920077681541443, "def maximum_generated(n: int) -> int:\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    if n == 0:\n        return 0\n    nums = [0] * (n + 1)\n    nums[1] = 1\n    for i in range(2, n + 1):\n        nums[i] = nums[i // 2] if i % 2 == 0 else nums[i // 2] + nums[i // 2 + 1]\n    return max(nums)"], [0.8887335062026978, "def A(n):\n    \"\"\"\n    \"\"\"\n    if n == 0:\n        return 1\n    elif n % 2 == 0:\n        b = 2 ** (n.bit_length() - 1)\n        return 3 * A(n // 2) + 5 * A(n - b)\n    else:\n        return A(n // 2)"]]}
{"task_id": 382, "problem": [[0.9012329578399658, "def max_length(list1): \n    \"\"\"\n    This function returns the longest string in a list\n    \n    :param list1: list of strings\n    :return: longest string\n    \"\"\"\n    return max(list1, key=len) "]]}
{"task_id": 383, "problem": [[0.8964890241622925, "def is_distinct(my_list):\n    \"\"\"\n    Return True if all elements in my_list are distinct.\n    >>> is_distinct([1, 5, 7, 9])\n    True\n    >>> is_distinct([2, 2, 4, 6])\n    False\n    \"\"\"\n    seen = set()\n    for element in my_list:\n        if element in seen:\n            return False \n        seen.add(element)\n    return True"]]}
{"task_id": 384, "problem": [[0.9445359110832214, "def first_non_repeated_char(string):\n    \"\"\"\n    Find the first non-repeated character in a string\n    :param string: string\n    :return: char\n    \"\"\"\n    for ch in string:\n        if string.count(ch) == 1:\n            return ch"], [0.9437726736068726, "def first_nonrepeated_character(string):\n    \"\"\"\n    Given a string, find the first non-repeated character in it.\n    For example, in 'abacabad' the first non-repeated character is 'c'.\n    For 'abacabaabacaba' the answer is 'c' again.\n    The first non-repeated character in 'wsdef' is 'w'.\n    The answer should be case-sensitive, so for 'W' the answer is 'W'.\n    If there is no non-repeated character, return False.\n    \"\"\"\n    for char in string:\n        if string.count(char) == 1:\n            return char\n    return False"], [0.939903736114502, "def first_non_repeating(str): \n    \"\"\"\n    Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1.\n    \n    Examples:\n    \n    s = \"leetcode\"\n    return 0.\n    \n    s = \"loveleetcode\"\n    return 2.\n    \n    s = \"aabb\"\n    return -1.\n    \n    s = \"aaabbbccc\"\n    return -1.\n    \n    s = \"aaabbbcccdd\"\n    return 8.\n    \n    s = \"\"\"\"\n    letters = {}\n  \n    # build a hash table of each character and its count \n    for char in str: \n        if char in letters: \n            letters[char] += 1 \n        else: \n            letters[char] = 1\n    \n    # find the first non-repeating character \n    for char in str: \n        if letters[char] == 1: \n            return char\n    return None"]]}
{"task_id": 385, "problem": []}
{"task_id": 386, "problem": [[0.9345166683197021, "def median(num1, num2, num3): \n    \"\"\"\n    This function returns the median of three numbers\n    \"\"\"\n    \n    \"\"\"\n    Write your code here\n    \"\"\"\n    if (num1 > num2): \n        if (num3 > num1): \n            median = num1 \n        elif (num3 > num2): \n            median = num3\n        else: \n            median = num2\n    else: \n        if (num3 > num2): \n            median = num2\n        elif (num3 > num1): \n            median = num3\n        else: \n            median = num1\n    return median"], [0.9334975481033325, "def median(a, b, c):\n    \"\"\"\n    Given three numbers, return the median value.\n    \n    >>> median(1, 2, 3)\n    2\n    >>> median(1, 2, 2)\n    2\n    >>> median(1, 2, 1)\n    1\n    \"\"\"\n    numbers = [a, b, c]\n    numbers.sort()\n    median_index = len(numbers) // 2\n    return numbers[median_index]"], [0.9324808716773987, "def median(a, b, c):\n    \"\"\"\n    Given three numbers, return the median value.\n    \n    >>> median(1, 2, 3)\n    2\n    >>> median(1, 3, 2)\n    2\n    >>> median(2, 1, 3)\n    2\n    >>> median(2, 3, 1)\n    2\n    >>> median(3, 1, 2)\n    2\n    >>> median(3, 2, 1)\n    2\n    \"\"\"\n    if (a <= b <= c) or (c <= b <= a):\n        return b\n    elif (b <= a <= c) or (c <= a <= b):\n        return a\n    else:\n        return c"], [0.9299930334091187, "def median(a, b, c):\n    \"\"\"\n    Given three numbers, return the median value.\n    \n    >>> median(1, 2, 3)\n    2\n    >>> median(1, 3, 2)\n    2\n    >>> median(2, 1, 3)\n    2\n    >>> median(2, 3, 1)\n    2\n    >>> median(3, 1, 2)\n    2\n    >>> median(3, 2, 1)\n    2\n    \"\"\"\n    median = (a + b + c) - min(a, b, c) - max(a, b, c)\n    return median"]]}
{"task_id": 387, "problem": []}
{"task_id": 388, "problem": [[0.893403172492981, "def xor(a, b):\n    \"\"\"\n    Returns the XOR of two binary strings.\n    \"\"\"\n    result = []\n\n    for i in range(len(a)):\n        result.append(a[i] ^ b[i])\n\n    return result\n    def xor(a, b):\n    \"\"\"\n    Returns the XOR of two binary strings.\n    \"\"\"\n    result = []\n\n    for i in range(len(a)):\n        result.append(a[i] ^ b[i])\n\n    return result"]]}
{"task_id": 389, "problem": [[0.9119685888290405, "def frequency(my_list): \n    \"\"\"\n    The frequency function takes a list as an argument and returns a list of tuples where the first element is the element from the original list and the second element is the frequency of that element in the list.\n    \n    For example, if the argument is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,\"\"\"\n    frequency_list = [] \n    for item in my_list: \n        if item not in frequency_list: \n            frequency_list.append(item) \n  \n    for i in range(0, len(frequency_list)): \n        frequency_list[i] = (frequency_list[i], my_list.count(frequency_list[i])) \n          \n    return frequency_list"], [0.9044647216796875, "def count_occurrences(lst):\n    \"\"\"\n    Given a list of integers, return a list of tuples where each tuple contains a number and the number of occurrences of that number in the list.\n    The list of tuples should be ordered in descending order based on the count of occurrences.\n    For example, given the list [1, 2, 3, 1, 2, 3, 1, 4, 5], return [(1, 3), (2, 2), (3, 2), (4, 1), (5, 1)].\n    \"\"\"\n    from collections import Counter\n    \n\"\"\"\n    count = Counter(lst)  # Count occurrences of each distinct integer\n    result = [(i, count[i]) for i in count]  # Convert to the desired output format\n    result.sort(key=lambda x: (-x[1], x[0]))  # Sort first by descending count, then by ascending integer\n    return result"], [0.9020891189575195, "def list_element_frequency(input_list):\n    \"\"\"\n    This function takes a list as an input and returns a list of tuples.\n    Each tuple contains an element and its corresponding frequency in the input list.\n    The output list is sorted in ascending order based on the element values.\n    \n    Parameters:\n    input_list (list): The input list containing elements.\n    \n    Returns:\n    list: A list of tuples where each tuple contains an element and its frequency.\n    \n    Example:\n    input_list = [1, 2, 2, 3, 4, 4, 4, 5\"\"\"\n    counter = Counter(input_list)\n    unique_elements = list(OrderedDict.fromkeys(input_list))\n    output_list = [(element, counter[element]) for element in unique_elements]\n    return output_list"]]}
{"task_id": 390, "problem": [[0.8906905651092529, "def sum_tuples(input_list):\n    \"\"\"\n    Write a function that takes a list of tuples as input and returns the sum of all the elements in the tuples.\n    For example, if the input is [(1, 2), (3, 4), (5, 6)], the output should be 21.\n    \"\"\"\n    total_sum = 0\n    for tup in input_list:\n        for elem in tup:\n            total_sum += elem\n    return total_sum"]]}
{"task_id": 391, "problem": [[0.9024820327758789, "def C(n, k, p):\n    \"\"\"Calculate 'n choose k' modulo p.\"\"\"\n    if k > n:\n        return 0\n    if k > n-k:\n        k = n-k\n    num, den = 1, 1\n    for i in range(k):\n        num = (num * (n-i)) % p\n        den = (den * (i+1)) % p\n    return (num * pow(den, p-2, p)) % p"], [0.8836112022399902, "def find_perm(n, r, p) : \n    \"\"\"\n    Find permutation of n elements taken r at a time\n    \"\"\"\n    return factorial(n, p) // factorial(n - r, p)\n    \n    def modInverse(a, m) : \n    \"\"\"\n    Find modular inverse of a under modulo m\n    \"\"\"\n    m0 = m \n    y = 0\n    x = 1\n    if (m == 1) : \n        return 0\n    while (a > 1) : \n        q = a // m \n        t = m \n        m = a\"\"\"\n    num = 1 \n    while (r > 0) : \n        num = ((num % p) * (n % p)) % p \n        n -= 1\n        r -= 1\n    den = 1\n    r = 7\n    while (r > 0): \n        den = ((den % p) * (r % p)) % p\n        r -= 1\n    den_inv = modInverse(den, p)\n    return (num * den_inv) % p"]]}
{"task_id": 392, "problem": []}
{"task_id": 393, "problem": [[0.9256856441497803, "def min_num(a, b):\n    \"\"\"\n    Returns the minimum of two numbers.\n    :param a: first number\n    :param b: second number\n    :return: minimum of a and b\n    \"\"\"\n    return min(a, b)"], [0.9256605505943298, "def min_num(a, b):\n    \"\"\"\n    Returns the minimum of two numbers.\n    :param a: first number\n    :param b: second number\n    :return: minimum of a and b\n    \"\"\"\n    return min(a, b)"], [0.9231871366500854, "def minof2num(a, b):\n    \"\"\"\n    This function returns the minimum of two numbers\n    \"\"\"\n    if a < b:\n        return a\n    else:\n        return b\n    def minof2num(a, b):\n    \"\"\"\n    This function returns the minimum of two numbers\n    \"\"\"\n    if a < b:\n        return a\n    else:\n        return b"], [0.922313928604126, "def get_max(num1, num2):\n    \"\"\"\n    Return the maximum of two numbers.\n    \"\"\"\n    return max(num1, num2)\n    def get_min(num1, num2):\n    \"\"\"\n    Return the minimum of two numbers.\n    \"\"\"\n    return max(num1, num2)"], [0.9145485162734985, "def min_number(a, b):\n    \"\"\"\n    Return the minimum of two numbers.\n    \n    >>> min_number(1, 2)\n    1\n    >>> min_number(2, 1)\n    1\n    >>> min_number(1, 1)\n    1\n    \"\"\"\n    return min(a, b)"], [0.9137495756149292, "def find_min(a, b, c):\n    \"\"\"Function which finds the minimum of three numbers\"\"\"\n    min_number = min(a, b, c)\n    return min_number"], [0.9092329740524292, "def min(x, y):\n    \"\"\"\n    Return the minimum of two numbers.\n    \n    >>> min(1, 2)\n    1\n    >>> min(2, 1)\n    1\n    \"\"\"\n    if x < y:\n        return x\n    else:\n        return y"], [0.9084606170654297, "def find_min(lst):\n    \"\"\"\n    Find the minimum value in a list of numbers\n    \"\"\"\n    min_val = lst[0] # Initialize the min_val with the first element of the tuple\n    for i in lst:\n        if i < min_val:\n            min_val = i\n    return min_val\n    def find_min(lst):\n    \"\"\"\n    Find the minimum value in a list of numbers\n    \"\"\"\n    min_val = lst[0] # Initialize the min_val with the first element of the tuple\n    for i in lst:\n        if i < min_val:\n            min_val = i\n    return min_val"], [0.9073214530944824, "def find_min(numbers):\n    \"\"\"\n    Find the minimum number in a list of numbers.\n    :param numbers: a list of numbers\n    :return: the minimum number\n    \"\"\"\n    return min(numbers)"]]}
{"task_id": 394, "problem": []}
{"task_id": 395, "problem": [[0.9245871901512146, "def parity(num):\n    \"\"\"\n    Return even or odd depending on the number\"\"\"\n    if num % 2 == 0:\n        return \"even\"\n    else:\n        return \"odd\""], [0.9196885228157043, "def parity(num):\n    \"\"\"\n    Return the parity of a number.\n    \n    >>> parity(1)\n    'Odd'\n    >>> parity(2)\n    'Even'\n    >>> parity(3)\n    'Odd'\n    >>> parity(4)\n    'Even'\n    >>> parity(5)\n    'Odd'\n    >>> parity(6)\n    'Even'\n    >>> parity(7)\n    'Odd'\n    >>> parity(8)\n    'Even'\n    >>> parity(9)\n    'Odd'\n    >>> parity(10)\n\"\"\"\n    if type(num) != int:\n        return \"Error: Input is not an integer\"\n    elif num % 2 == 0:\n        return \"Even\"\n    else:\n        return \"Odd\""], [0.9196423292160034, "def parity(num):\n    \"\"\"\n    Return even or odd for a given integer\n    \"\"\"\n    try:\n        if num % 2 == 0:\n            return \"even\"\n        else:\n            return \"odd\"\n    except TypeError:\n        return \"Error: input must be an integer\"\n    def parity(num):\n    \"\"\"\n    Return even or odd for a given integer\n    \"\"\"\n    try:\n        if num % 2 == 0:\n            return \"even\"\n        else:\n            return \"odd\"\n    except TypeError:\n        return \"Error: input must be an integer\""], [0.9185214042663574, "def check_parity(n):\n    \"\"\"\n    Check parity of a number\n    :param n: number\n    :return: parity of the number\n    \"\"\"\n    if n == 0:\n        return 0\n    else:\n        return (n & 1) ^ check_parity(n >> 1)"], [0.9179957509040833, "def find_parity(num):\n    \"\"\"\n    Find the parity of a number.\n    \n    Args:\n        num (int): The number to check.\n    \n    Returns:\n        str: 'Even' if the number is even, 'Odd' otherwise.\n    \"\"\"\n    if num % 2 == 0:\n        return 'Even'\n    else:\n        return 'Odd'"], [0.9173063039779663, "def check_parity(n):\n    \"\"\"\n    Check if a number is even or odd\n    \"\"\"\n    # Check if number is even\n    if n % 2 == 0:\n        print('The number {} is even.'.format(n))\n    # If it's not even, it must be odd\n    else:\n        print('The number {} is odd.'.format(n))\n    def check_parity(n):\n    \"\"\"\n    Check if a number is even or odd\n    \"\"\"\n    # Check if number is even\n    if n % 2 == 0:\n        print('The number {} is even.'.format(n))\n    # If it's not even, it must be odd\n    else:\n        print('The number {} is odd.'.format(n))"], [0.9151862859725952, "def parity(n):\n    \"\"\"\n    Return the parity of n.\n    \n    The parity of a number is whether it is even or odd.\n    \n    >>> parity(0)\n    0\n    >>> parity(1)\n    1\n    >>> parity(2)\n    0\n    >>> parity(3)\n    1\n    >>> parity(4)\n    0\n    >>> parity(5)\n    1\n    >>> parity(6)\n    0\n    >>> parity(7)\n    1\n    >>> parity(8)\n    0\n    >>> parity(9)\n    1\n\"\"\"\n    # Base condition: If n is 0 or 1\n    if n == 0:\n        return 0\n    elif n == 1:\n        return 1\n    \n    power = 1\n    \n    while power <= n:\n        power *= 2\n\n    power /= 2\n\n    return (1 - parity(n - power))"], [0.9148987531661987, "def check_parity(n):\n    \"\"\"\n    Check if a number is even or odd\n    :param n: number\n    \"\"\"\n    if n % 2 == 0:\n        print('The number is even')\n    else:\n        print('The number is odd')"], [0.9140782356262207, "def check_parity(n):\n    \"\"\"\n    Check if a number is even or odd\n    :param n: number\n    \"\"\"\n    if n % 2 == 0:\n        print(str(n) + \" is even\")\n    else:\n        print(str(n) + \" is odd\")"]]}
{"task_id": 396, "problem": [[0.9141411185264587, "def nextGreaterElement(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    # Converting the number n to a list of digits\n    digits = [int(d) for d in str(n)]\n\n    # Generating permutations of the digits\n    perm_digits = list(permutations(digits))\n\n    # Sorting the permutations\n    perm_numbers = sorted([int(''.join(map(str, perm))) for perm in perm_digits])\n\n    # Finding the smallest greater number and count number of valid permutations\n    cnt = 0\n    for x in perm_numbers:\n    # Valid number is greater than n and is within 32-bit integer limit\n        if x > n and x <= (2**31 - 1):\n            if cnt == 0:\n                smallest_greater = x\n            cnt += 1\n\n    if cnt == 0:\n        return -1, 0\n    else:\n    # Subtract one permutation which is the smallest greater number itself\n        permutation_cnt = factorial(len(digits)) // (2 * factorial(len(digits) - 2)) - 1\n        return smallest_greater, min(permutation_cnt, cnt - 1)"], [0.912811815738678, "def nextGreaterElement(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    # Converting the number n to a list of digits\n    digits = [int(d) for d in str(n)]\n\n    # Generating permutations of the digits\n    perm_digits = list(permutations(digits))\n\n    # Sorting the permutations\n    perm_numbers = sorted([int(''.join(map(str, perm))) for perm in perm_digits])\n\n    # Finding the smallest greater number and count number of valid permutations\n    cnt = 0\n    for x in perm_numbers:\n        # Valid number is greater than n and is within 32-bit integer limit\n        if x > n and x <= (2**31 - 1) :\n            if cnt == 0:\n                smallest_greater = x\n            cnt += 1\n\n    if cnt == 0:\n        return -1, 0\n    else:\n        # Subtract one permutation which is the smallest greater number itself\n        permutation_cnt = factorial(len(digits)) // (2 * factorial(len(digits) - 2)) - 1\n        return smallest_greater, min(permutation_cnt, cnt - 1)"], [0.9121452569961548, "def nextGreaterElement(n: int) -> int:\n    \"\"\"\n    Find the smallest integer greater than n whose digits are permutations of n's digits.\n    If no such integer exists, return -1.\n    :type n: int\n    :rtype: int\n    \"\"\"\n    num_str = str(n)\n    num_permutations = sorted(set(int(\"\".join(p)) for p in permutations(num_str)))\n    index = num_permutations.index(n)\n    if index + 1 < len(num_permutations) and num_permutations[index + 1] <= 2**31 - 1:\n        return num_permutations[index + 1]\n    return -1"], [0.8966640830039978, "def largest_swap_permutations(num):\n    \"\"\"\n    Given an integer, find the largest permutation of the digits that is smaller than the given integer.\n    :param num: int\n    :return: int\n    \"\"\"\n    num_str = str(num)\n    even_digits = sorted([c for c in num_str if int(c) % 2 == 0], reverse=True)\n    odd_digits = sorted([c for c in num_str if int(c) % 2 == 1], reverse=True)\n\n    result = []\n    for c in num_str:\n        if int(c) % 2 == 0:\n            result.append(even_digits.pop(0))\n        else:\n            result.append(odd_digits.pop(0))\n\n    return int(''.join(result))"]]}
{"task_id": 397, "problem": [[0.8944396376609802, "def kSmallestPairs(nums1: List[int], nums2: List[int], k: int) -> List[List[int]]:\n    \"\"\"\n    \"\"\"\n    if not nums1 or not nums2:\n        return []\n\n    heap = []\n    for n1 in nums1:\n        for n2 in nums2:\n            if len(heap) < k:\n                heapq.heappush(heap, (-n1 - n2, [n1, n2]))\n            else:\n                if n1 + n2 < -heap[0][0]:\n                    heapq.heappop(heap)\n                    heapq.heappush(heap, (-n1 - n2, [n1, n2]))\n\n    return [pair for _, pair in heap]"]]}
{"task_id": 398, "problem": [[0.9020918011665344, "def find_smallest_product(arr):\n    \"\"\"\n    Find the pair of elements in an array that have the smallest product.\n    \n    Args:\n        arr (list): List of integers.\n    \n    Returns:\n        int: The product of the pair of elements with the smallest product.\n    \"\"\"\n    pair = min([(i, j) for i in arr for j in arr if i != j], key=lambda x: x[0]*x[1])\n    return pair[0]*pair[1]"]]}
{"task_id": 399, "problem": [[0.89982670545578, "def find_smallest_value(L):\n    \"\"\"\n    Find the smallest value in a list L.\n    \n    >>> find_smallest_value([1, 2, 3, 4, 5])\n    1\n    >>> find_smallest_value([1, 2, 3, 4, 5, 0])\n    0\n    \"\"\"\n    return min(L)"]]}
{"task_id": 400, "problem": [[0.9136513471603394, "def convertToCamelCase(s):\n    \"\"\"\n    Write a function that takes a string and returns it in camel case.\n    \n    The first word within the string should be lowercase, \n    while the rest of the words with an uppercase letter \n    in the beginning (capitalize).\n    \n    Examples\n    \"hello case\"  =>  \"helloCase\"\n    \"camel case word\"  =>  \"camelCaseWord\"\n    \"\"\"\n    s = s.title().replace(' ', '')\n    return s[0].lower() + s[1:]"]]}
{"task_id": 401, "problem": [[0.9382392764091492, "def remove_odd(arr):\n    \"\"\"\n    Remove odd numbers from the list.\n    \"\"\"\n    return list(filter(lambda num: num % 2 == 0, arr))\n    def remove_odd(arr):\n    \"\"\"\n    Remove odd numbers from the list.\n    \"\"\"\n    return list(filter(lambda num: num % 2 == 0, arr))"], [0.9296125173568726, "def remove_even_numbers(array):\n    \"\"\"\n    Remove all the even numbers from a given array.\n    \"\"\"\n    return list(filter(lambda x: x % 2 != 0, array))\n    def remove_even_numbers(array):\n    \"\"\"\n    Remove all the even numbers from a given array.\n    \"\"\"\n    return list(filter(lambda x: x % 2 != 0, array))"], [0.9258266687393188, "def remove_evens(numbers):\n    \"\"\"\n    Given a list of numbers, return a new list with only the odd numbers.\n    \"\"\"\n    new_list = []\n    for i in numbers:\n        if i % 2 != 0:\n            new_list.append(i)\n    return new_list\n    def remove_evens(numbers):\n    \"\"\"\n    Given a list of numbers, return a new list with only the odd numbers.\n    \"\"\"\n    new_list = []\n    for i in numbers:\n        if i % 2 != 0:\n            new_list.append(i)\n    return new_list"], [0.9258198738098145, "def remove_even_numbers(numbers):\n    \"\"\"\n    Removes all the even numbers from a list of numbers\n    \"\"\"\n    odd_numbers = []\n    for number in numbers:\n        if number % 2 != 0:\n            odd_numbers.append(number)\n    return odd_numbers\n    def remove_even_numbers(numbers):\n    \"\"\"\n    Removes all the even numbers from a list of numbers\n    \"\"\"\n    odd_numbers = []\n    for number in numbers:\n        if number % 2 != 0:\n            odd_numbers.append(number)\n    return odd_numbers"]]}
{"task_id": 402, "problem": [[0.8885118961334229, "def get_nth(arr, n):\n    \"\"\"\n    Return the nth element of an array.\n    \n    >>> get_nth([1, 2, 3, 4], 2)\n    2\n    \"\"\"\n    return arr[n-1]"], [0.8835195302963257, "def get_nth_element(lst, n):\n    \"\"\"\n    Return the nth element of a list.\n    \n    >>> get_nth_element([1, 2, 3, 4], 2)\n    3\n    >>> get_nth_element([1, 2, 3, 4], 4)\n    Index out of range\n    \"\"\"\n    try:\n        return lst[n]\n    except IndexError:\n        return 'Index out of range'"], [0.8787717819213867, "def get_nth_element(arr, n):\n  \"\"\"\n    Returns the nth element of an array.\n    \n    Args:\n      arr: an array of integers\n      n: an integer\n    \n    Returns:\n      The nth element of the array.\n    \"\"\"\n  return arr[n]"]]}
{"task_id": 403, "problem": []}
{"task_id": 404, "problem": [[0.9278503060340881, "def max_product(lst):\n    \"\"\"\n    This function receives a collection of numerical values (integers),\n    and returns the two elements within that list that, if multiplied\n    together, will yield the absolute highest possible product.\n    \"\"\"\n    \n    # To consider negative numbers and their product which can yield the highest product\n    lst.sort() # First sort the list in increasing order\n    \n    # Checking maximum positive product of first two elements and last two elements\n    product_1 = lst[0] * lst[1]\n    product_2 = lst[-1] * lst[-2]\n    \n    # If first two elements product is higher, return them\n    # Else, return last two elements\n    if product_1 > product_2:\n        return [lst[0], lst[1]]\n    else:\n        return [lst[-1], lst[-2]]"], [0.9241726398468018, "def max_product_pair(lst):\n    \"\"\"\n    Find the pair of elements in a list that have the maximum product.\n    \n    Args:\n        lst: a list of integers\n    \n    Returns:\n        A tuple of two integers that have the maximum product.\n    \"\"\"\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]*lst[j] > max_product:\n                max_product = lst[i]*lst[j]\n                pair = (lst[i], lst[j])\n    return pair"], [0.9214178323745728, "def find_max_product(arr):\n    \"\"\"\n    Find the maximum product of two integers in an array\n    :param arr: Array of integers\n    :return: Maximum product of two integers\n    \"\"\"\n    if len(arr) == 0:\n        return 0\n    max_pos_1 = float(\"-inf\")\n    max_pos_2 = float(\"-inf\")\n    max_neg_1 = float(\"inf\")\n    max_neg_2 = float(\"inf\")\n    for num in arr:\n        if num > max_pos_1:\n            max_pos_2 = max_pos_1\n            max_pos_1 = num\n        elif num > max_pos_2:\n            max_pos_2 = num\n\n        if num < max_neg_1:\n            max_neg_2 = max_neg_1\n            max_neg_1 = num\n        elif num < max_neg_2:\n            max_neg_2 = num\n    max_product = max((max_pos_1 * max_pos_2),(max_neg_1 * max_neg_2))\n    return max_product"], [0.9198233485221863, "def max_prod_pair(array):\n    \"\"\"\n    Find the pair of elements in an array that have the maximum product.\n    :param array: list of integers\n    :return: list of two integers\n    \"\"\"\n    if len(array) < 2:\n        return None\n    max_product = array[0] * array[1]\n    max_pair = (array[0], array[1])\n    for i in range(len(array)):\n        for j in range(i+1, len(array)):\n            product = array[i] * array[j]\n            if product > max_product:\n                max_product = product\n                max_pair = (array[i], array[j])\n    return list(max_pair)"], [0.9191478490829468, "def max_product_pair(nums):\n    \"\"\"\n    Find the pair of integers in the list that have the maximum product.\n    \n    Args:\n        nums (list): List of integers.\n    \n    Returns:\n        tuple: Pair of integers with the maximum product.\n    \"\"\"\n    nums.sort(reverse=True)  # Sort the list in descending order\n    max_product = 0\n    result_pair = ()\n\n    for i in range(len(nums)):\n        for j in range(i + 1, len(nums)):\n            product = nums[i] * nums[j]\n            if product > max_product:\n                max_product = product\n                result_pair = (min(nums[i], nums[j]), max(nums[i], nums[j]))\n\n    return result_pair"]]}
{"task_id": 405, "problem": [[0.9114643335342407, "def maxSumDivThree(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    dp = [0, 0, 0]\n    for num in nums:\n        temp = dp[:]\n        for s in temp:\n            dp[(s + num) % 3] = max(dp[(s + num) % 3], s + num)\n    return dp[0]"], [0.9114471077919006, "def maxSumDivThree(nums):\n    \"\"\"\n    :type nums: List[int]\n    :rtype: int\n    \"\"\"\n    dp = [0, 0, 0]\n    for num in nums:\n        temp = dp[:]\n        for s in temp:\n            dp[(s + num) % 3] = max(dp[(s + num) % 3], s + num)\n    return dp[0]"], [0.9023041725158691, "def sum_of_first_three(arr, index=0):\n    \"\"\"\n    Given an array of integers, return the sum of the first three elements.\n    \n    If the array has fewer than three elements, return the sum of all elements.\n    \n    For example, given [1, 2, 3, 4], return 6.\n    \n    Given [1, 2], return 3.\n    \n    Given [1], return 1.\n    \n    Given [], return 0.\n    \"\"\"\n    if index >= len(arr):\n        return 0\n    \n    if index == 2:\n        return max(arr[index] + arr[index - 1] + arr[index - 2], 0)\n    \n    return arr[index] + sum_of_first_three(arr, index + 1)"], [0.8984776735305786, "def find_max_3_elements(lst): \n    \"\"\"\n    Find the maximum sum of 3 elements in a list\n    :param lst: list of integers\n    :return: maximum sum of 3 elements\n    \"\"\"\n    elements = [] \n    for i in range(len(lst)-2): \n        for j in range(i+1, len(lst)-1): \n            for k in range(j+1, len(lst)): \n                elements.append(lst[i] + lst[j] + lst[k]) \n    return max(elements) "]]}
{"task_id": 406, "problem": [[0.8931699991226196, "def find_common_elements(list1, list2):\n    \"\"\"\n    Find common elements in two lists\n    \"\"\"\n    common_elements = []\n\n    for e1 in list1:\n        for e2 in list2:\n            if e1 == e2:\n               common_elements.append(e1)\n\n    return common_elements\n    def find_common_elements(list1, list2):\n    \"\"\"\n    Find common elements in two lists\n    \"\"\"\n    common_elements = []\n\n    for e1 in list1:\n        for e2 in list2:\n            if e1 == e2:\n               common_elements.append(e1)\n\n    return common_elements"]]}
{"task_id": 407, "problem": []}
{"task_id": 408, "problem": [[0.8964580297470093, "def rounded_sum(numbers: List[float]) -> int:\n    \"\"\"\n    Return the sum of the list of numbers, rounded to the nearest integer.\n    If the sum is exactly half of an integer, round down.\n    \"\"\"\n    total_sum = sum(numbers)\n    rounded_sum = round(total_sum)\n    if rounded_sum % 2 != 0 and rounded_sum - total_sum == 0.5:\n        rounded_sum = int(rounded_sum) - 1 if int(rounded_sum) % 2 != 0 else int(rounded_sum)\n    return int(rounded_sum)"]]}
{"task_id": 409, "problem": [[0.9272183775901794, "def sum_of_cube_even_numbers(n):\n    \"\"\"\n    Calculate the sum of the cubes of all even numbers from 2 to n.\n\n    Args:\n        n (int): The upper limit of the range.\n\n    Returns:\n        int: The sum of the cubes of all even numbers from 2 to n.\n\n    Raises:\n        ValueError: If n is not a positive integer.\n    \"\"\"\n    if not isinstance(n, int) or n < 0:\n        raise ValueError(\"Input must be a positive integer\")\n\n    sum_of_cubes = 0\n    for num in range(2, n+1, 2):\n        sum_of_cubes += num**3\n\n    return sum_of_cubes"]]}
{"task_id": 410, "problem": []}
{"task_id": 411, "problem": [[0.9147508144378662, "def cube_sum(arr):\n    \"\"\"\n    Write a function that takes an array of numbers and returns the average of the cubes of the numbers.\n    \n    Example:\n    \n    cube_sum([1, 2, 3, 4, 5]) \u279e 148.75\n    \n    1^3 + 2^3 + 3^3 + 4^3 + 5^3 = 152\n    \n    Average = 152 / 5 = 30.5\n    \n    round(30.5) = 30.75\"\"\"\n    sum = 0\n    for i in range(len(arr)):\n        arr[i] = arr[i] ** 3\n        sum += arr[i]\n    average = round(sum / len(arr))\n    return average"], [0.9060145616531372, "def sum_of_cubes(n):\n    \"\"\"\n    Return the sum of the cubes of all numbers from 1 to n.\n    \"\"\"\n    result = 0\n    for i in range(1, n+1):\n        result += i ** 3\n    return result\n    def sum_of_cubes(n):\n    \"\"\"\n    Return the sum of the cubes of all numbers from 1 to n.\n    \"\"\"\n    result = 0\n    for i in range(1, n+1):\n        result += i ** 3\n    return result"], [0.8996531367301941, "def accumulative_sum(n):\n    \"\"\"\n    Return the sum of the first n numbers\n    \"\"\"\n    sum = 0\n    for i in range(1, n+1):\n        sum += i\n    return sum\n    \n    def cube_sum(n):\n    \"\"\"\n    Return the sum of the first n numbers\n    \"\"\"\n    sum = 0\n    for i in range(1, n+1):\n        sum += i ** 3\n    return sum"], [0.896259605884552, "def sum_of_cubes(n):\n    \"\"\"\n    Return the sum of the first n cubes.\n    \n    >>> sum_of_cubes(5)\n    225\n    \"\"\"\n    sum = 0\n    for i in range(1, n + 1):\n        sum += i ** 3\n    return sum"], [0.8949471712112427, "def generate_cubes(n):\n    \"\"\"\n    Generate a list of the first n cubes.\n    \"\"\"\n    result = []\n    for x in range(n):\n        result.append(x**3)\n    return result\n    def generate_cubes(n):\n    \"\"\"\n    Generate a list of the first n cubes.\n    \"\"\"\n    result = []\n    for x in range(n):\n        result.append(x**3)\n    return result"], [0.8946185111999512, "def generate_cubes(n):\n    \"\"\"\n    Generate a list of the first n cubes.\n    \"\"\"\n    return [x**3 for x in range(n)]\n    \n    def generate_cubes(n):\n    \"\"\"\n    Generate a list of the first n cubes.\n    \"\"\"\n    return [x**3 for x in range(n)]"]]}
{"task_id": 412, "problem": [[0.9062097072601318, "def goldMining(mine):\n    \"\"\"\n    :type mine: List[List[int]]\n    :rtype: int\n    \"\"\"\n    def maxGold(mine, dp, i, j, cols):\n        if i < 0 or i >= len(mine) or j < 0 or j >= cols:\n            return 0\n        if dp[i][j][cols] != -1:\n            return dp[i][j][cols]\n        res = 0\n        for x, y in [(0, 1), (0, -1), (1, 0), (-1, 0\"\"\"\n    rows, cols = len(mine), len(mine[0])\n    dp = [[[-1 for _ in range(cols)] for _ in range(cols)] for _ in range(rows)]\n    return maxGold(mine, dp, 0, 0, cols-1)"], [0.9024122953414917, "def goldMining(mine):\n    \"\"\"\n    :type mine: List[List[int]]\n    :rtype: int\n    \"\"\"\n    def maxGold(mine, dp, row, col, cols):\n        if row < 0 or row >= len(mine) or col < 0 or col >= cols:\n            return 0\n        if dp[row][col][cols] != -1:\n            return dp[row][col][cols]\n        res = 0\n        for i in range(col-1, col+2):\n            res = max(res, maxGold(mine, dp,\"\"\"\n    rows, cols = len(mine), len(mine[0])\n    dp = [[[-1 for _ in range(cols)] for __ in range(cols)] for ___ in range(rows)]\n    return maxGold(mine, dp, 0, 0, cols-1)"], [0.888742208480835, "def maxGold(m, dp, x1, y1, y2):\n    \"\"\"\n    :type m: List[List[int]]\n    :type x1: int\n    :type y1: int\n    :type y2: int\n    :rtype: int\n    \"\"\"\n    x2 = x1 + y2 - y1\n    cols = len(m[0])\n    if y1 < 0 or y1 >= cols or y2 < 0 or y2 >= cols:\n        return float('-inf')\n    if dp[x1][y1][y2] != -1:\n        return dp[x1][y1][y2]\n    if x1 == len(m)-1:\n        return m[x1][y1] + (y1 != y2) * m[x2][y2]\n    ans = float('-inf')\n    for new_y1 in [y1-1, y1, y1+1]:\n        for new_y2 in [y2-1, y2, y2+1]:\n            ans = max(ans, maxGold(m, dp, x1+1, new_y1, new_y2))\n    dp[x1][y1][y2] = ans + m[x1][y1] + (y1 != y2) * m[x2][y2]\n    return dp[x1][y1][y2]"], [0.8885666131973267, "def maxGold(m, dp, x1, y1, y2):\n    \"\"\"\n    :type m: List[List[int]]\n    :type x1: int\n    :type y1: int\n    :type y2: int\n    :rtype: int\n    \"\"\"\n    x2 = x1 + y2 - y1\n    cols = len(m[0])\n    if y1<0 or y1>=cols or y2<0 or y2>=cols:\n        return float('-inf')\n    if dp[x1][y1][y2] != -1:\n        return dp[x1][y1][y2]\n    if x1 == len(m)-1:\n        return m[x1][y1] + (y1 != y2) * m[x2][y2]\n    ans = float('-inf')\n    for new_y1 in [y1-1,y1,y1+1]:\n        for new_y2 in [y2-1,y2,y2+1]:\n            ans = max(ans, maxGold(m,dp,x1+1,new_y1,new_y2))\n    dp[x1][y1][y2] = ans + m[x1][y1] + (y1 != y2) * m[x2][y2]\n    return dp[x1][y1][y2]"]]}
{"task_id": 413, "problem": [[0.8795528411865234, "def get_first_element(lst):\n    \"\"\"\n    Return the first element of the given list.\n    \"\"\"\n    return lst[0]\n    \n    def get_last_element(lst):\n    \"\"\"\n    Return the last element of the given list.\n    \"\"\"\n    return lst[-1]\n    \n    def get_second_element(lst):\n    \"\"\"\n    Return the second element of the given list.\n    \"\"\"\n    return lst[1]\n    \n    def get_second_to_last_element(lst):\n    \"\"\"\n    Return the second to last element of the given list.\"\"\"\n    result = []\n    for tuple in lst:\n        if tuple[0] % 2 == 1:\n            result.append(tuple[0])\n        else:\n            result.append(tuple[1])\n    return result"], [0.8791627883911133, "def extract_third_last(colors):\n    \"\"\"\n    Write a function that takes a tuple of colors and prints the third last color.\n    If the tuple is too small to have a third last color, print \"Tuple is too small to have a third last item\".\n    \n    Example:\n    \n    >>> extract_third_last((\"red\", \"green\", \"blue\", \"yellow\"))\n    blue\n    >>> extract_third_last((\"red\", \"green\"))\n    Tuple is too small to have a third last item\n    \"\"\"\n    try:\n        print(colors[-3])\n    except IndexError:\n        print(\"Tuple is too small to have a third last item\")"], [0.876011848449707, "def third_char(lst):\n    \"\"\"\n    Given a list of words, return the third letter of each word.\n    \"\"\"\n    return [word[2] for word in lst]\n    \n    def third_char(lst):\n    \"\"\"\n    Given a list of words, return the third letter of each word.\n    \"\"\"\n    third_chars = \"\"\n    for word in lst:\n        third_chars += word[2]\n    return third_chars"]]}
{"task_id": 414, "problem": []}
{"task_id": 415, "problem": []}
{"task_id": 416, "problem": [[0.9283691644668579, "def format_date(date):\n    \"\"\"\n    Format a date from yyyy-mm-dd to dd-mm-yyyy\n    \"\"\"\n    splitted_date = date.split(\"-\")\n    reformatted_date = splitted_date[::-1]\n    return \"-\".join(reformatted_date)\n    def format_date(date):\n    \"\"\"\n    Format a date from yyyy-mm-dd to dd-mm-yyyy\n    \"\"\"\n    splitted_date = date.split(\"-\")\n    reformatted_date = splitted_date[::-1]\n    return \"-\".join(reformatted_date)"], [0.908228874206543, "def format_date(date):\n    \"\"\"\n    Format a date from dd/mm/yyyy to yyyy-mm-dd\n    \"\"\"\n    date_list = date.split(\"/\")\n    date_list.reverse() \n    return \"-\".join(date_list) \n    def format_date(date):\n    \"\"\"\n    Format a date from dd/mm/yyyy to yyyy-mm-dd\n    \"\"\"\n    date_list = date.split(\"/\")\n    date_list.reverse() \n    return \"-\".join(date_list) "], [0.903596043586731, "def format_date(date):\n    \"\"\"\n    Format a date from MM/DD/YYYY to YYYY/MM/DD\n    \"\"\"\n    date_list = date.split(\"/\")\n    return date_list[2] + \"/\" + date_list[0] + \"/\" + date_list[1]\n    \n    def format_date(date):\n    \"\"\"\n    Format a date from MM/DD/YYYY to YYYY/MM/DD\n    \"\"\"\n    date_list = date.split(\"/\")\n    return date_list[2] + \"/\" + date_list[0] + \"/\" + date_list[1]"], [0.9004404544830322, "def convertDateFormat(inputDate):\n    \"\"\"\n    Converts a date in the format YYYY-MM-DD to MM-DD-YYYY\n    :param inputDate: The date to be converted\n    :return: The converted date\n    \"\"\"\n    dateList = inputDate.split('-')\n    newFormat = dateList[1] + \"-\" + dateList[0] + \"-\" + dateList[2]\n    return newFormat"]]}
{"task_id": 417, "problem": []}
{"task_id": 418, "problem": [[0.8804166316986084, "def calc_tuples(tuple1, tuple2):\n    \"\"\"\n    \"\"\"\n    max_len = max(len(tuple1), len(tuple2))\n    tuple1 = tuple(list(tuple1) + [1]*(max_len - len(tuple1)))\n    tuple2 = tuple(list(tuple2) + [1]*(max_len - len(tuple2)))\n    result = [(tuple1[i] * tuple1[i+1]) + (tuple2[i] * tuple2[i+1]) for i in range(max_len - 1)]\n    return tuple(result)"]]}
{"task_id": 419, "problem": [[0.8716647624969482, "def solve_quadratic(a, b, c):\n    \"\"\"\n    Solve the quadratic equation, ax**2 + bx + c = 0,\n    using discriminant formula.\n    \"\"\"\n    # calculate the discriminant\n    d = (b**2) - (4*a*c)\n    # find two solutions\n    sol1 = (-b-cmath.sqrt(d))/(2*a)\n    sol2 = (-b+cmath.sqrt(d))/(2*a)\n    return sol1, sol2\n    def solve_quadratic(a, b, c):\n    \"\"\"\n    Solve the quadratic equation, ax**2 + bx\"\"\"\n    # calculate the discriminant\n    d = (b**2) - (4*a*c)\n    # find two solutions\n    sol1 = (-b-cmath.sqrt(d))/(2*a)\n    sol2 = (-b+cmath.sqrt(d))/(2*a)\n    return sol1, sol2"]]}
{"task_id": 420, "problem": [[0.9255360960960388, "def do_lists_share_common_elements(list1, list2):\n    \"\"\"\n    Return True if any element appears in both lists.\n    >>> do_lists_share_common_elements([1, 2, 3], [4, 5, 6])\n    False\n    >>> do_lists_share_common_elements([1, 2, 3], [2, 4, 6])\n    True\n    \"\"\"\n    for element in list1:\n        if element in list2:\n            return True\n    return False"], [0.9247807264328003, "def has_common_element(list1, list2):\n    \"\"\"\n    Return True if the two lists have at least one element in common.\n    >>> has_common_element([1, 2, 3], [4, 5, 6])\n    False\n    >>> has_common_element([1, 2, 3], [2, 5, 6])\n    True\n    \"\"\"\n    for element in list1:\n        if element in list2:\n            return True\n    return False"]]}
{"task_id": 421, "problem": []}
{"task_id": 422, "problem": [[0.906019926071167, "def filter_greater_than(arr, num):\n    \"\"\"\n    Return a new array with only the elements from the original array that are greater than the given number.\n    \"\"\"\n    return [x for x in arr if x > num]\n    def filter_greater_than(arr, num):\n    \"\"\"\n    Return a new array with only the elements from the original array that are greater than the given number.\n    \"\"\"\n    return [x for x in arr if x > num]"], [0.8975059390068054, "def numbers_greater_than(arr, x):\n  \"\"\"\n  Return a list of all numbers greater than x\n  \"\"\"\n  return [num for num in arr if num > x]\n    def numbers_greater_than(arr, x):\n  \"\"\"\n  Return a list of all numbers greater than x\n  \"\"\"\n  return [num for num in arr if num > x]"], [0.8945502638816833, "def count_greater_than(arr, num):\n    \"\"\"\n    Return the number of array elements that are greater than the given number.\n    \n    >>> count_greater_than([5, 4, 3, 2, 1], 2)\n    3\n    \"\"\"\n    count = 0\n\n    for item in arr:\n        if item > num:\n            count += 1\n    \n    return count"]]}
{"task_id": 423, "problem": [[0.8974184989929199, "def check_string(s):\n    \"\"\"\n    Check if a string starts with a substring 'a' followed by two to three 'b's.\n    \"\"\"\n    pattern = '^[a][b]{2,3}$' ## matches if sequence starts with \"a\" and followed by 2 to 3 \"b\"\n    if re.match(pattern, s):\n        return True\n    else:\n        return False\n    \n    def check_string(s):\n    \"\"\"\n    Check if a string starts with a substring 'a' followed by two to three 'b's.\n    \"\"\"\n    pattern = '^[a-zA-Z]*py$' ## matches if sequence only consist uppercase or lowercase alphabets and ends with \"py\"\n    if re.match(pattern, s):\n        return True\n    else:\n        return False"], [0.8936054110527039, "def match_pattern(string):\n    \"\"\"\n    Write a regex to match a string that has an 'a' followed by anything,\n    followed by a 'b'\n    \"\"\"\n    pattern = re.compile(r'abc(?=.*[0-9].*?[0-9].*).*xyz$')\n    return bool(pattern.match(string))"], [0.8932604789733887, "def match_string(s):\n    \"\"\"\n    Match a string that contains 'a' followed by any characters, ending in 'b'.\n    \n    Args:\n        s (str): The string to be matched.\n    \n    Returns:\n        bool or str: True if the string matches the pattern, False otherwise.\n    \"\"\"\n    if not isinstance(s, str):\n        return \"Error: Input is not a string.\"\n    pattern = 'a.*b$'\n    if re.search(pattern, s):\n        return True\n    else:\n        return \"Error: The string does not contain 'a' followed by any characters, ending in 'b'.\""], [0.8876429796218872, "def implement_dfa(input_string):\n    \"\"\"\n    Implement a DFA that accepts the language L = {a^nb^n | n >= 0}\n    :param input_string:\n    :return: True if the input string is accepted by the DFA, False otherwise\n    \"\"\"\n    state = 0\n    a_count = 0\n    b_count = 0\n    for c in input_string:\n        if c == 'a':\n            a_count += 1\n            if state == 0:\n                state = 1\n        if c == 'b':\n            b_count += 1\n            if state == 1 and b_count < a_count + 1:\n                state = 2\n            elif state == 1 and b_count == a_count + 1:\n                state = 3\n    if state == 2:\n        return True\n    else:\n        return False"]]}
{"task_id": 424, "problem": [[0.9449438452720642, "def get_last_digit(number):\n    \"\"\"\n    Write a function that returns the last digit of a given number.\n    \"\"\"\n    return number % 10\n    \n    def get_last_digit(number):\n    \"\"\"\n    Write a function that returns the last digit of a given number.\n    \"\"\"\n    return number % 10"], [0.8983532786369324, "def last_non_zero_digit(n):\n    \"\"\"\n    Last non-zero digit in the factorial of a given number\n    \n    Args:\n        n (int): Given number\n    \n    Returns:\n        int: Last non-zero digit in the factorial of a given number\n    \"\"\"\n    # Array to store last non-zero digit of \n    # factorial of all numbers from 0 to 10\n    res = [1, 1, 2, 6, 4, 2, 2, 4, 2, 8]\n    \n    if (n < 10):\n        return res[n]\n   \n    if (((n//10)%10)%2 == 0):\n        return (6*last_non_zero_digit(n//5)*res[n%10]) % 10\n    else:\n        return (4*last_non_zero_digit(n//5)*res[n%10]) % 10"], [0.8980202674865723, "def sum_last_digits(lst):\n    \"\"\"\n    Given a list of numbers, return the sum of the last digits.\n    \n    >>> sum_last_digits([2, 3, 4])\n    9\n    >>> sum_last_digits([13, 22, 14])\n    9\n    \"\"\"\n    ans = 0\n    for num in lst:\n        ans += int(num[-1])\n    return ans"], [0.8957479000091553, "def rightmost_digit(num):\n    \"\"\"\n    Find the rightmost digit of a number.\n    >>> rightmost_digit(123)\n    3\n    >>> rightmost_digit(456789)\n    9\n    \"\"\"\n    # convert num to string\n    str_num = str(num)\n    # find the index position of \".\"\n    dot_position = str_num.index('.')\n    # find the rightmost digit before the \".\" and convert it to int\n    digit = int(str_num[dot_position - 1])\n    return digit"]]}
{"task_id": 425, "problem": [[0.9094878435134888, "def negative(int_list):\n    \"\"\"\n    Return a list of the negative integers in the input list.\n    \n    >>> negative([1, -2, 3, -4])\n    [-2, -4]\n    \"\"\"\n    return [num for num in int_list if num < 0]"], [0.9088325500488281, "def filter_negative(lst): \n    \"\"\"\n    This function takes a list of numbers and returns a list of only the negative numbers.\n    \n    Parameters:\n    lst (list): A list of numbers.\n    \n    Returns:\n    list: A list of only the negative numbers from the input list.\n    \"\"\"\n    neg_lst = [] \n    for num in lst: \n        if num < 0: \n            neg_lst.append(num) \n\n    return neg_lst"], [0.9070844650268555, "def negative_list(numbers):\n    \"\"\"\n    Return a list of negative numbers from a given list of numbers.\n    \n    Args:\n        numbers (list): A list of numbers.\n    \n    Returns:\n        list: A list of negative numbers.\n    \"\"\"\n    return [num for num in numbers if num < 0]"], [0.9059547781944275, "def get_negative_numbers(numbers):\n  \"\"\"\n  Returns a list of negative numbers from a list of numbers.\n  \n  Args:\n    numbers: A list of numbers.\n  \n  Returns:\n    A list of negative numbers.\n  \"\"\"\n  return [num for num in numbers if num < 0]"]]}
{"task_id": 426, "problem": [[0.9338349103927612, "def remove_odd_index_characters(string):\n    \"\"\"\n    Remove characters which have odd index values in the given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result += string[i]\n    return result\n    def remove_odd_index_characters(string):\n    \"\"\"\n    Remove characters which have odd index values in the given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result += string[i]\n    return result"], [0.9282875657081604, "def remove_odd_index_char(string):\n    \"\"\"\n    Remove the characters of odd index in a given string\n    \"\"\"\n    result = \"\"\n    for i in range(len(string)):\n        if i % 2 == 0:\n            result = result + string[i]\n    return result"], [0.9264898300170898, "def 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\n    def 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"], [0.918079137802124, "def remove_odd_characters(string):\n    \"\"\"\n    Remove odd characters from a string.\n    \n    Args:\n        string (str): The input string.\n    \n    Returns:\n        str: The modified string with odd characters removed.\n    \"\"\"\n    # Remove leading and trailing whitespace characters\n    string = string.strip()\n    \n    # Remove punctuation marks from the string\n    string = string.translate(str.maketrans('', '', string.punctuation))\n    \n    # Remove characters at odd indices\n    modified_string = ''\n    for index, char in enumerate(string):\n        if index % 2 == 0:\n            modified_string += char\n    \n    return modified_string"]]}
{"task_id": 427, "problem": []}
{"task_id": 428, "problem": [[0.9093959927558899, "def int_to_int(int_list):\n    \"\"\"\n    \"\"\"\n    return int(''.join(str(e) for e in int_list))"], [0.9093149304389954, "def list_to_int(list_of_ints):\n    \"\"\"\n    Converts a list of integers into a single integer.\n    \n    Args:\n        list_of_ints: A list of integers.\n    \n    Returns:\n        The integer created from concatenating the list of integers.\n    \"\"\"\n    number = 0\n    for integer in list_of_ints:\n        number = number * 10 + integer\n    return number"]]}
{"task_id": 429, "problem": [[0.8957799077033997, "def find_adverb(string):\n    \"\"\"\n    Find the adverb in a sentence.\n    \n    Args:\n        string: a sentence to search for an adverb in\n    \n    Returns:\n        A tuple of the form (adverb, start, end) if an adverb is found,\n        or None otherwise.\n    \"\"\"\n    words = string.split(\" \")\n    for word in words:\n        if word.endswith('ly'):\n            start = string.index(word)\n            end = start + len(word) - 1\n            return (word, start, end)\n    return None"]]}
{"task_id": 430, "problem": [[0.935171365737915, "def cube_surface_area(side):\n    \"\"\" \n    Calculate and return the total surface area of a cube \n    given the side length.\n    \"\"\"\n    return 6 * side**2"]]}
{"task_id": 431, "problem": []}
{"task_id": 432, "problem": [[0.9214021563529968, "def find_largest_negative(arr):\n    \"\"\"\n    Find the largest negative number in an array.\n\n    Args:\n        arr (list): The input array.\n\n    Returns:\n        int or str: The largest negative number in the array, or a message if no negative numbers are found.\n    \"\"\"\n    if len(arr) == 0:\n        return \"Array is empty.\"\n\n    largest_negative = float('-inf')  # Initialize largest_negative as negative infinity\n\n    for num in arr:\n        if num < 0 and num > largest_negative:\n            largest_negative = num\n\n    if largest_negative == float('-inf'):\n        return \"No negative numbers found.\"\n    else:\n        return largest_negative"], [0.906901478767395, "def get_highest_negative(array):\n    \"\"\"\n    Return the highest negative number in an array.\n    If there are no negative numbers, return None.\n    \n    >>> get_highest_negative([1, 2, 3, 4])\n    None\n    >>> get_highest_negative([1, -2, 3, -4])\n    -4\n    \"\"\"\n    n = float('-inf')\n    for num in array:\n        if num < 0 and num > n:\n            n = num\n    return n"], [0.9021984338760376, "def find_largest_number(arr):\n    \"\"\"\n    Find the largest number in an array.\n    \n    Args:\n        arr (list): The array of numbers.\n    \n    Returns:\n        int: The largest number in the array.\n    \"\"\"\n    max_num = 0\n    for num in arr:\n        if num < 0:\n            return \"Error: Negative numbers are not allowed.\"\n        if num > max_num:\n            max_num = num\n    return max_num"], [0.9008729457855225, "def largest_negative_integer(matrix):\n    \"\"\"\n    Find the largest negative integer in a matrix.\n    \n    Args:\n        matrix (list): A matrix of integers.\n    \n    Returns:\n        int: The largest negative integer in the matrix.\n    \"\"\"\n    if np.max(matrix) >= 0:\n        return -1\n    if np.min(matrix) > 0:\n        return np.min(matrix) - 1\n    low, high = np.min(matrix), -1\n    while low < high:\n        mid = low + (high - low) // 2\n        if is_present(matrix, mid):\n            low = mid + 1\n        else:\n            high = mid\n    return high - 1"]]}
{"task_id": 433, "problem": []}
{"task_id": 434, "problem": []}
{"task_id": 435, "problem": [[0.9038769602775574, "def count_occurrences(lst):\n    \"\"\"\n    Given a list of integers, return a list of tuples where each tuple contains a number and the number of occurrences of that number in the list.\n    The list of tuples should be ordered in descending order based on the count of occurrences.\n    For example, given the list [1, 2, 3, 1, 2, 3, 1, 4, 5], return [(1, 3), (2, 2), (3, 2), (4, 1), (5, 1)].\n    \"\"\"\n    from collections import Counter\n    \n\"\"\"\n    count = Counter(lst)  # Count occurrences of each distinct integer\n    result = [(i, count[i]) for i in count]  # Convert to the desired output format\n    result.sort(key=lambda x: (-x[1], x[0]))  # Sort first by descending count, then by ascending integer\n    return result"]]}
{"task_id": 436, "problem": [[0.9304458498954773, "def cube_elements(lst):\n    \"\"\"\n    Write a function that takes a list of numbers and returns a new list with each element \n    cubed.\n    \"\"\"\n    return [i ** 3 for i in lst]\n    \n    def cube_elements(lst):\n    \"\"\"\n    Write a function that takes a list of numbers and returns a new list with each element \n    cubed.\n    \"\"\"\n    return [i ** 3 for i in lst]"]]}
{"task_id": 437, "problem": []}
{"task_id": 438, "problem": [[0.9113601446151733, "def is_valid_triangle(point1, point2, point3):\n    \"\"\"\n    Check if three points in 3D space can form a valid triangle\n    \"\"\"\n    # Check if all points are distinct\n    if point1 == point2 or point1 == point3 or point2 == point3:\n        return False\n\n    # Check if all points lie on a straight line\n    vector1 = [point2[i] - point1[i] for i in range(3)]\n    vector2 = [point3[i] - point1[i] for i in range(3)]\n    cross_product = [vector1[(i+1)%3]*vector2[(i+2)%3] - vector1[(i+2)%3]*vector2[(i+1)%3] for i in range(3)]\n    if all(c == 0 for c in cross_product):\n        return False\n\n    return True"], [0.9096716046333313, "def is_valid_triangle(a, b, c): \n    \"\"\"\n    Check if a triangle is valid or not\n    :param a: side a\n    :param b: side b\n    :param c: side c\n    :return: True if the triangle is valid else False\n    \"\"\"\n    # A triangle should have 3 sides\n    if a + b <= c or a + c <= b or b + c <= a: \n        return False\n\n    # The sum of any two sides should always be greater than the third side\n    if a + b > c and a + c > b and b + c > a: \n        return True\n    return False"]]}
{"task_id": 439, "problem": []}
{"task_id": 440, "problem": []}
{"task_id": 441, "problem": []}
{"task_id": 442, "problem": []}
{"task_id": 443, "problem": [[0.8931182026863098, "def has_z_followed_by_two_ys(string):\n    \"\"\"Does string contain a literal \"z\" followed by two \"y\" characters?\n    >>> has_z_followed_by_two_ys(\"ziy\")\n    True\n    >>> has_z_followed_by_two_ys(\"zy\")\n    False\n    >>> has_z_followed_by_two_ys(\"z\")\n    False\n    >>> has_z_followed_by_two_ys(\"zyy\")\n    False\n    >>> has_z_followed_by_two_ys(\"zxy\")\n    False\n    >>> has_z_followed_\"\"\"\n    return re.search(r'zy{2,}', string) is not None"], [0.886824369430542, "def check_word(word):\n    \"\"\"\n    Check if a word contains 'ba' followed by either 'r' or 'z'\n    :param word: str - word to check\n    :return: bool - does word contain 'ba' followed by 'r' or 'z'\n    \"\"\"\n    regexp = r'ba[r|z|d]'\n    if re.search(regexp, word):\n        return True\n    return False"], [0.8850387334823608, "def find_target_substrings(text):\n    \"\"\"\n    Find all substrings in the given text that start with 'a' and end with 'Z'.\n    \"\"\"\n    import re\n    \n    # TODO: Implement the function\"\"\"\n    pattern = re.compile(r'a.*Z')\n    return pattern.findall(text)"], [0.8838974237442017, "def find_z_followed_by_2y(s):\n    \"\"\"\n    Find the index of the first occurrence of 'z' in a string, followed by two 'y's.\n    Return -1 if not found.\n    \n    >>> find_z_followed_by_2y('z')\n    -1\n    >>> find_z_followed_by_2y('zxy')\n    -1\n    >>> find_z_followed_by_2y('zyzy')\n    1\n    >>> find_z_followed_by_2y('zyzyz')\n    -1\n    >>> find_z_followed_\"\"\"\n    s = s.lower()\n    for index in range(len(s) - 2):\n        if s[index] == 'z' and s[index+1] == 'y' and s[index+2] == 'y':\n            return index\n    return -1"]]}
{"task_id": 444, "problem": [[0.9016096591949463, "def check_days(month, year):\n    \"\"\"\n    Check if a month has 30 days.\n    \n    Args:\n        month (int): The month number (1-12).\n        year (int): The year.\n    \n    Returns:\n        bool: True if the month has 30 days, False otherwise.\n    \"\"\"\n    thirty_days_months = [4, 6, 9, 11]\n    if month in thirty_days_months:\n        return True\n    elif month == 2:\n        if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):\n            return False  # February has 29 days in a leap year\n        else:\n            return True  # February has 28 days in a non-leap year\n    else:\n        return False  # Months not listed have 31 days"]]}
{"task_id": 445, "problem": []}
{"task_id": 446, "problem": []}
{"task_id": 447, "problem": [[0.9249044060707092, "def calculate_area(length, width):\n    \"\"\"Calculate the area of a rectangle given its length and width.\"\"\"\n    area = length * width\n    return area"], [0.9204224348068237, "def area_rectangle(length, width):\n  \"\"\"\n  This function calculates the area of a rectangle.\n  :param length: The length of the rectangle.\n  :param width: The width of the rectangle.\n  :return: The area of the rectangle.\n  \"\"\"\n  area = length * width\n  return area"], [0.9193296432495117, "def calculateArea(width, height):\n    \"\"\"\n    Calculate the area of a rectangle.\n    \n    :param width: The width of the rectangle.\n    :param height: The height of the rectangle.\n    :return: The area of the rectangle.\n    \"\"\"\n    return width * height"], [0.9170172214508057, "def area_rectangle(length, width):\n    \"\"\"\n    This function calculates the area of a rectangle.\n    :param length: The length of the rectangle.\n    :param width: The width of the rectangle.\n    :return: The area of the rectangle.\n    \"\"\"\n    return length * width"], [0.916586697101593, "def calculate_area(width, height):\n    \"\"\"\n    Calculate the area of a rectangle.\n    \n    Args:\n        width (int): The width of the rectangle.\n        height (int): The height of the rectangle.\n    \n    Returns:\n        int: The area of the rectangle.\n    \"\"\"\n    return width * height"], [0.9161219596862793, "def calculate_area(width: float, height: float) -> float:\n    \"\"\"\n    This function calculates the area of a rectangle.\n    \n    :param width: float - width of the rectangle\n    :param height: float - height of the rectangle\n    :return: float - area of the rectangle\n    \"\"\"\n    area = width * height\n    return area"]]}
{"task_id": 448, "problem": [[0.9057762026786804, "def removeLetters(string, letter):\n    \"\"\"\n    Remove all instances of letter from string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if char.lower() != letter.lower():\n            new_string += char\n    return new_string\n    def removeLetters(string, letter):\n    \"\"\"\n    Remove all instances of letter from string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if char.lower() != letter.lower():\n            new_string += char\n    return new_string"], [0.8996686935424805, "def remove_uppercase_characters(string):\n    \"\"\"\n    Remove all uppercase characters from a string.\n    \n    Args:\n        string (str): The string to remove uppercase characters from.\n    \n    Returns:\n        str: The string with all uppercase characters removed.\n    \"\"\"\n    return ''.join([c for c in string if not c.isupper()])"]]}
{"task_id": 449, "problem": [[0.9079941511154175, "def remove_first_element(lists):\n    \"\"\"\n    Remove the first element from each sublist in the given list of lists.\n    \n    Args:\n    - lists: A list of lists.\n    \n    Returns:\n    - A new list of lists with the first element removed from each sublist.\n    \"\"\"\n    # Use list slicing to remove the first element of each sublist\n    return [lst[1:] for lst in lists]"], [0.8978064060211182, "def first_element(lst):\n    \"\"\"\n    Return the first element of the given list.\n    >>> first_element([1, 2, 3])\n    1\n    >>> first_element([5, 6, 7])\n    5\n    \"\"\"\n    return lst[0]"], [0.8883653283119202, "def get_first_element(lst):\n    \"\"\"\n    Return the first element of the given list.\n    \"\"\"\n    return lst[0]\n    \n    def get_last_element(lst):\n    \"\"\"\n    Return the last element of the given list.\n    \"\"\"\n    return lst[-1]\n    \n    def get_second_element(lst):\n    \"\"\"\n    Return the second element of the given list.\n    \"\"\"\n    return lst[1]\n    \n    def get_second_to_last_element(lst):\n    \"\"\"\n    Return the second to last element of the given list.\"\"\"\n    result = []\n    for tuple in lst:\n        if tuple[0] % 2 == 1:\n            result.append(tuple[0])\n        else:\n            result.append(tuple[1])\n    return result"]]}
{"task_id": 450, "problem": [[0.9375022649765015, "def count_uppercase_characters(string):\n    \"\"\"\n    Count the number of uppercase characters in a string.\n    \n    >>> count_uppercase_characters('Python')\n    1\n    >>> count_uppercase_characters('PYTHON')\n    6\n    \"\"\"\n    chars = [c for c in string if c.isupper()]\n    return len(chars)"]]}
{"task_id": 451, "problem": [[0.9192818403244019, "def all_combinations(list_of_numbers): \n    \"\"\"\n    This function takes a list of numbers and returns a list of all possible combinations of those numbers. \n    For example, if the input is [1, 2, 3], the output will be [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]. \n    The function uses recursion to generate all possible combinations. \n    The base case is when the list is empty, in which case the function returns an empty list. \n    The base case is also when the\"\"\"\n    if len(list_of_numbers) == 0: \n        return [] \n  \n    if len(list_of_numbers) == 1: \n        return [list_of_numbers] \n  \n    combinations = [] \n    for combination in all_combinations(list_of_numbers[1:]): \n        combinations.append(combination) \n        combinations.append([list_of_numbers[0]] + combination) \n  \n    return combinations"], [0.9143268465995789, "def print_combinations(l): \n    \"\"\"\n    Print all possible combinations of a list\n    :param l: list\n    \"\"\"\n    # Get the length of the list\n    n = len(l) \n\n    # Create all possible combinations\n    for i in range(1 << n): \n        comb = [l[j] for j in range(n) if (i & (1 << j))] \n        print(comb)"]]}
{"task_id": 452, "problem": [[0.9399199485778809, "def maxProductSubarray(array):\n    \"\"\"\n    Find the maximum product subarray in a given array.\n    \n    Args:\n        array: List[int]\n    \n    Returns:\n        int: Maximum product subarray\n    \"\"\"\n    max_product = float('-inf')\n    for window_start in range(len(arr)):\n        prod = 1\n        for window_end in range(window_start, len(arr)):\n            prod *= arr[window_end]\n            max_product = max(prod, max_product)\n    return max_product"], [0.9354787468910217, "def max_product_subarray(arr):\n    \"\"\"\n    Find the maximum product subarray in an array.\n    :param arr: List[int]\n    :return: int\n    \"\"\"\n    n = len(arr)\n    min_ending_here = max_ending_here = max_so_far = arr[0]\n\n    for i in range(1, n):\n        if arr[i] < 0:\n            max_ending_here, min_ending_here = min_ending_here, max_ending_here\n\n        max_ending_here = max(arr[i], max_ending_here * arr[i])\n        min_ending_here = min(arr[i], min_ending_here * arr[i])\n\n        max_so_far = max(max_so_far, max_ending_here)\n\n    return max_so_far"]]}
{"task_id": 453, "problem": [[0.8848572969436646, "def is_same(my_list):\n  \"\"\"\n  Checks if all elements in a list are the same.\n  Args:\n    my_list: a list of elements\n  Returns:\n    True if all elements are the same, False otherwise\n  \"\"\"\n  for i in range(len(my_list)):\n    for j in range(i + 1, len(my_list)):\n      if my_list[i] != my_list[j]:\n        return False\n  return True"]]}
{"task_id": 454, "problem": [[0.8957487344741821, "def remove_empty_values(my_dict):\n    \"\"\"\n    Removes all empty values from a dictionary.\n    \n    Args:\n        my_dict (dict): The dictionary to remove empty values from.\n    \n    Returns:\n        dict: The dictionary with empty values removed.\n    \"\"\"\n    return {k: v for k, v in my_dict.items() if v}"]]}
{"task_id": 455, "problem": [[0.9290738105773926, "def findPeak(arr, n): \n    \"\"\"\n    :type arr: List[int]\n    :type n: int\n    :rtype: int\n    \"\"\"\n    # Corner Case \n    if (n == 1): \n        return arr[0] \n  \n    # If arr[0] is peak element \n    if (arr[0] >= arr[1]): \n        return arr[0] \n  \n    # If arr[n-1] is peak element \n    if (arr[n - 1] >= arr[n - 2]): \n        return arr[n - 1] \n  \n    # If there is no peak element \n    for i in range(1, n - 1): \n        if (arr[i] >= arr[i - 1] and arr[i] >= arr[i + 1]): \n            return arr[i] "], [0.9284528493881226, "def find_peak_element(arr):\n    \"\"\"\n    Find a peak element in an array.\n    \n    Args:\n        arr: An array of integers.\n    \n    Returns:\n        The index of a peak element in the array.\n    \"\"\"\n    if len(arr) == 1:\n        return arr[0]\n    if arr[0] >= arr[1]:\n        return arr[0]\n    if arr[-1] >= arr[-2]:\n        return arr[-1]\n    for i in range(1, len(arr)-1):\n        if arr[i] >= arr[i-1] and arr[i] >= arr[i+1]:\n            return i"]]}
{"task_id": 456, "problem": [[0.9363401532173157, "def convert_to_octal(num):\n    \"\"\"\n    This function converts a decimal number to octal\n    \"\"\"\n    oct_num = oct(num)\n    print(\"The octal form of {} is {}\".format(num, oct_num))\n    \n    def convert_to_octal(num):\n    \"\"\"\n    This function converts a decimal number to octal\n    \"\"\"\n    oct_num = oct(num)\n    print(\"The octal form of {} is {}\".format(num, oct_num))"]]}
{"task_id": 457, "problem": []}
{"task_id": 458, "problem": [[0.907058835029602, "def maxProfit(prices, k):\n    \"\"\"\n    :type prices: List[int]\n    :type k: int\n    :rtype: int\n    \"\"\"\n    if not prices or k >= len(prices):\n        return 0\n\n    n = len(prices)\n\n    buy = [-prices[0]] * n\n    sell = [0] * n\n    cooldown = [0] * n\n\n    for i in range(1, n):\n        cooldown[i] = max(cooldown[i-1], sell[i-1])\n\n        if i > k:\n            sell[i] = max(sell[i-1], buy[i-1] + prices[i])\n            buy[i] = max(buy[i-1], cooldown[i-k-1] - prices[i])\n        else:\n            sell[i] = max(sell[i-1], buy[i-1] + prices[i])\n            buy[i] = max(buy[i-1], -prices[i])\n\n    return max(sell[-1], cooldown[-1])"], [0.9070403575897217, "def maxProfit(prices, k):\n    \"\"\"\n    :type prices: List[int]\n    :type k: int\n    :rtype: int\n    \"\"\"\n    if not prices or k >= len(prices):\n        return 0\n\n    n = len(prices)\n\n    buy = [-prices[0]] * n\n    sell = [0] * n\n    cooldown = [0] * n\n\n    for i in range(1, n):\n        cooldown[i] = max(cooldown[i-1], sell[i-1])\n\n        if i > k:\n            sell[i] = max(sell[i-1], buy[i-1] + prices[i])\n            buy[i] = max(buy[i-1], cooldown[i-k-1] - prices[i])\n        else:\n            sell[i] = max(sell[i-1], buy[i-1] + prices[i])\n            buy[i] = max(buy[i-1], -prices[i])\n\n    return max(sell[-1], cooldown[-1])"]]}
{"task_id": 459, "problem": [[0.9097142219543457, "def sum_tuples(input_list):\n    \"\"\"\n    Write a function that takes a list of tuples as input and returns the sum of all the elements in the tuples.\n    For example, if the input is [(1, 2), (3, 4), (5, 6)], the output should be 21.\n    \"\"\"\n    total_sum = 0\n    for tup in input_list:\n        for elem in tup:\n            total_sum += elem\n    return total_sum"], [0.896437406539917, "def add_tuples(tpl1, tpl2):\n    \"\"\"\n    Add two tuples element-wise.\n    \n    >>> add_tuples((1, 2), (10, 20))\n    (11, 22)\n    >>> add_tuples((1, 2), (10, 20, 30))\n    Traceback (most recent call last):\n        ...\n    ValueError: tuples must be of the same length\n    \"\"\"\n    for a, b in tpl1: \n        for c, d in tpl2:\n            return (a+c, b+d)"]]}
{"task_id": 460, "problem": []}
{"task_id": 461, "problem": [[0.9173572659492493, "def check_for_consecutive(arr):\n    \"\"\"\n    Check if an array contains consecutive numbers\n    \"\"\"\n    count = 0\n\n    for i in range(0, len(arr)):\n        if (i+1 < len(arr)) and (arr[i] + 1 == arr[i+1]):\n            count += 1\n\n    if count > 0:\n        return True\n    else:\n        return False\n    def check_for_consecutive(arr):\n    \"\"\"\n    Check if an array contains consecutive numbers\n    \"\"\"\n    count = 0\n\n    for i in range(0, len(arr)):\n        if (i+1 < len(arr)) and (arr[i] + 1 == arr[i+1]):\n            count += 1\n\n    if count > 0:\n        return True\n    else:\n        return False"], [0.9141449928283691, "def has_consecutive_numbers(arr):\n    \"\"\"\n    Given an array of integers, return true if the array contains consecutive numbers.\n    \n    >>> has_consecutive_numbers([1, 2, 3, 4, 5])\n    True\n    >>> has_consecutive_numbers([1, 2, 4, 5])\n    False\n    >>> has_consecutive_numbers([1, 2, 3, 4, 6])\n    False\n    \"\"\"\n    arr.sort()\n    for i in range(len(arr)-1):\n        if arr[i+1] - arr[i] == 1:\n            return True\n    return False"], [0.9134858250617981, "def is_consecutive(input_list):\n    \"\"\"\n    Check if all numbers in a list are consecutive\n    \"\"\"\n    if len(input_list) <= 1:\n        return True\n    for index, item in enumerate(input_list[1:]):\n        if item - input_list[index] != 1:\n            return False\n    return True\n    def is_consecutive(input_list):\n    \"\"\"\n    Check if all numbers in a list are consecutive\n    \"\"\"\n    if len(input_list) <= 1:\n        return True\n    for index, item in enumerate(input_list[1:]):\n        if item - input_list[index] != 1:\n            return False\n    return True"], [0.909623384475708, "def is_consecutive(arr):\n    \"\"\"\n    Check if all elements in an array are consecutive\n    \"\"\"\n    return sorted(arr) == list(range(min(arr), max(arr)+1))\n    def is_consecutive(arr):\n    \"\"\"\n    Check if all elements in an array are consecutive\n    \"\"\"\n    return sorted(arr) == list(range(min(arr), max(arr)+1))"], [0.9043477177619934, "def is_consecutive(array, start, end):\n    \"\"\" Check if there are any successive elements present between start and end index.\"\"\"\n    for i in range(start, end):\n        if array[i] + 1 == array[i + 1]:\n            return True\n    return False"], [0.9034055471420288, "def check_consecutive(arr):\n    \"\"\"\n    Check if an array contains consecutive numbers\n    \n    Args:\n        arr (list): List of numbers\n    \n    Returns:\n        bool: True if consecutive, False otherwise\n    \"\"\"\n    for i in range(len(arr)-1):\n        if arr[i] + 1 == arr[i+1]:\n            return True\n    return False"]]}
{"task_id": 462, "problem": [[0.8987722396850586, "def intersection(list1, list2):\n    \"\"\"\n    Find intersection of two lists\n    \"\"\"\n    return list(set(list1) & set(list2))\n    \n    def intersection(list1, list2):\n    \"\"\"\n    Find intersection of two lists\n    \"\"\"\n    set1 = set(list1)\n    set2 = set(list2)\n\n    return list(set1.intersection(set2))"], [0.8960928320884705, "def find_intersection(arr1, arr2):\n    \"\"\"\n    Find intersection of two arrays\n    \"\"\"\n    set1 = set(arr1)\n    set2 = set(arr2)\n    intersection = set1 & set2\n    return list(intersection)\n    def find_intersection(arr1, arr2):\n    \"\"\"\n    Find intersection of two arrays\n    \"\"\"\n    set1 = set(arr1)\n    set2 = set(arr2)\n    intersection = set1 & set2\n    return list(intersection)"]]}
{"task_id": 463, "problem": []}
{"task_id": 464, "problem": []}
{"task_id": 465, "problem": [[0.9166878461837769, "def sum_of_min_max(lst):\n    \"\"\"\n    Function to take a list of integers and returns the summation of the largest and smallest numbers\n    Arguments:\n    lst -- list -- list of integers\n    Output:\n    summation -- int -- summation of the largest and smallest numbers\n    \"\"\"\n    min_val = min(lst)\n    max_val = max(lst)\n    summation = min_val + max_val\n    return summation"]]}
{"task_id": 466, "problem": [[0.9202669262886047, "def to_lower_case(s): \n    \"\"\"\n    Write a function that takes a string as input and returns the string in lower case.\n    \n    Parameters\n    ----------\n    s : str\n        Input string.\n    \n    Returns\n    -------\n    str\n        String in lower case.\n    \"\"\"\n    return s.lower() "], [0.9135994911193848, "def to_lower_case(str):\n  \"\"\"\n  Converts a string to lower case.\n  \n  Args:\n    str: The string to be converted.\n  \n  Returns:\n    The string in lower case.\n  \"\"\"\n  return str.lower()"], [0.9114802479743958, "def convert_string(input_str):\n    \"\"\"\n    Converts a string to lowercase.\n    \n    Args:\n        input_str (str): The string to be converted.\n        \n    Returns:\n        str: The converted string in lowercase.\n    \"\"\"\n    output = input_str.lower()    # Use the lower() method on the string directly\n    return output"]]}
{"task_id": 467, "problem": [[0.9230068325996399, "def removeLetters(string, letter):\n    \"\"\"\n    Remove all instances of letter from string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if char.lower() != letter.lower():\n            new_string += char\n    return new_string\n    def removeLetters(string, letter):\n    \"\"\"\n    Remove all instances of letter from string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if char.lower() != letter.lower():\n            new_string += char\n    return new_string"]]}
{"task_id": 468, "problem": [[0.9010103344917297, "def findNthDigit(n):\n    \"\"\"\n    :type n: int\n    :rtype: int\n    \"\"\"\n    size = 1\n    length = 9\n    start = 1\n\n    while n > length * size:\n        n -= length * size\n        size += 1\n        length *= 10\n        start *= 10\n\n    start += (n - 1) // size\n    s = str(start)\n    return int(s[(n - 1) % size])"], [0.8986867666244507, "def non_zero_digit_in_factorial(n):\n    \"\"\"\n    Find the first non-zero digit in the factorial of a given number.\n    \n    Args:\n        n (int): The number to find the factorial of.\n    \n    Returns:\n        int: The first non-zero digit in the factorial of n.\n    \"\"\"\n    factorial = 1\n    for i in range(1, n+1):\n        factorial *= i\n        while factorial % 10 == 0:\n            factorial //= 10\n        factorial %= 1000000000\n    return factorial % 10"], [0.894553005695343, "def non_zero_digit_in_factorial(n):\n    \"\"\"\n    Find the first non-zero digit in the factorial of a given number.\n    \n    Args:\n        n (int): The number to find the factorial of.\n    \n    Returns:\n        int: The first non-zero digit in the factorial of n.\n    \"\"\"\n    factorial = 1\n    for i in range(1, n+1):\n        factorial *= i\n        while factorial % 10 == 0:    # remove all trailing zeros\n            factorial //= 10\n        factorial %= 1000000000       # limit the size of factorial to prevent overflow\n    return factorial % 10"]]}
{"task_id": 469, "problem": [[0.9394875764846802, "def maxOccurringChar(input): \n      \"\"\"\n      Find the maximum occurring character in a string\n      \n      Args:\n        input: string\n      \n      Returns:\n        string\n      \"\"\"\n      \n    # Create array to keep the count of  \n    # individual characters and  \n    # initialize the array as 0 \n    count = [0] * 256 \n  \n    # Construct character count array  \n    # from the input string. \n    for i in input: \n        count[ord(i)]+= 1\n    max = -1\n    c = '' \n  \n    # Traverse through the string and  \n    # maintain the count of each  \n    # character \n    for i in input: \n        if max < count[ord(i)]: \n            max = count[ord(i)] \n            c = i \n  \n    return c"]]}
{"task_id": 470, "problem": [[0.9297561645507812, "def subset_sum(numbers, target, partial=[]):\n    \"\"\"\n    Return True if any combination of numbers in the list\n    add up to the target. Otherwise, return False.\n    \"\"\"\n    s = sum(partial)\n\n    if s == target: \n        return True\n    if s > target:\n        return False\n\n    for i, n in enumerate(numbers):\n        remaining = numbers[i+1:]\n        if subset_sum(remaining, target, partial + [n]):\n            return True\n    return False"], [0.928465723991394, "def subset_sum(nums, target):\n    \"\"\"\n    :type nums: List[int]\n    :type target: int\n    :rtype: bool\n    \"\"\"\n    dp = [False] * (target + 1)\n    dp[0] = True\n    for num in nums:\n        for i in range(target, num - 1, -1):\n            dp[i] = dp[i] or dp[i - num]\n    return dp[target]"], [0.9278894662857056, "def isSubsetSum(set, n, sum): \n    \"\"\"\n    Returns True if there is a subset of set with sum equal to given sum, else False\n    \"\"\"\n    \n    \"\"\"\n    The value of subset[i][j] will be True, if there is a subset of set[0..j-1] with sum equal to i\n    \"\"\"\n    \n    \"\"\"\n    subset = [[False for i in range(sum + 1)] for i in range(n + 1)] \n  \n    for i in range(n + 1): \n        subset[i][0] = True\n  \n    for i in range(1, sum + 1): \n         subset[0][i] = False\n             \n    for i in range(1,n + 1): \n        for j in range(1,sum + 1): \n            if j<set[i-1]: \n                subset[i][j] = subset[i-1][j] \n            if j>= set[i-1]: \n                subset[i][j] = subset[i-1][j] or subset[i - 1][j-set[i-1]] \n  \n    return subset[n][sum]"], [0.924390435218811, "def is_subset_sum(arr, n): \n    \"\"\"\n    Returns True if there is a subset of arr[] with sum equal to n. \n    \"\"\"\n    # Base Cases\n    if n == 0:\n        return True\n    if len(arr) == 0 and n != 0:\n        return False\n  \n    # If last element is greater than n, then \n    # ignore it\n    if arr[-1] > n:\n        return is_subset_sum(arr[:-1], n)\n\n    # If last element is equal to n, \n    # return true\n    if arr[-1] == n:\n        return True\n        \n    # Else, check if sum can be obtained  \n    # by any of the following\n    # (a) including the last element  \n    # (b) excluding the last element    \n    return is_subset_sum(arr[:-1], n) or is_subset_sum(arr[:-1], n-arr[-1])"], [0.9221571087837219, "def subset_sum(arr, target):\n    \"\"\"\n    Returns True if there is a subset of arr[] with sum equal to target.\n    :param arr: array of integers\n    :param target: target sum\n    :return: True if there is a subset of arr[] with sum equal to target\n    \"\"\"\n    # Check for the base cases \n    n = len(arr) \n    if n == 0: \n        return False\n              \n    # Create an array to store the current subset sum \n    s = [False] * (target + 1) \n    s[0] = True\n              \"\"\"\n    # Check for the base cases \n    n = len(arr) \n    if n == 0: \n        return False\n              \n    # Create an array to store the current subset sum \n    s = [False] * (target + 1) \n    s[0] = True\n              \n    # Loop over the given array and subtract its elements one by one from 'target' \n    # to get all the possible subset sums \n    for i in range(n): \n        t = arr[i] \n        while t <= target: \n            if s[target - t]: \n                s[t + target] = True\n            t += 1\n              \n    # Return true if target 0 can be reached with subset sum of given set \n    return s[target]"]]}
{"task_id": 471, "problem": []}
{"task_id": 472, "problem": []}
{"task_id": 473, "problem": []}
{"task_id": 474, "problem": []}
{"task_id": 475, "problem": []}
{"task_id": 476, "problem": [[0.9109807014465332, "def sort_list(tuples):\n    \"\"\"\n    A function to sort a list of tuples by the second item in each tuple.\n    \"\"\"\n    return sorted(tuples, key=lambda x: x[1])"]]}
{"task_id": 477, "problem": [[0.8963558077812195, "def findPerimeter(sides):\n  \"\"\"\n  Find the perimeter of a pentagon.\n  \n  @param sides: a list of 5 positive integers.\n  @return: the perimeter of the pentagon.\n  \"\"\"\n  if len(sides) != 5:\n    return \"Not a Pentagon\"\n  else:\n    return sum(sides)"], [0.8900817632675171, "def area_hexagon(side_length):\n  \"\"\"\n  Return the area of a hexagon with the given side length.\n  \n  >>> area_hexagon(10)\n  43.30127018922193\n  \"\"\"\n  return 3 * (3 ** 0.5) * side_length ** 2 / 2"], [0.8887258768081665, "def calculateArea(side): \n    \"\"\"\n    This function calculates the area of a regular hexagon.\n    \n    :param side: The length of one side of the hexagon.\n    :return: The area of the hexagon.\n    \"\"\"\n    area = (3 * math.sqrt(3) * (side * side)) / 2\n    return area"]]}
{"task_id": 478, "problem": [[0.9188082218170166, "def most_frequent_value(array):\n    \"\"\"\n    Return the most frequent value in the given array.\n    \"\"\"\n    counter_dict = {}\n    for val in array:\n        if val in counter_dict:\n            counter_dict[val] += 1\n        else:\n            counter_dict[val] = 1\n    max_count = 0\n    frequent_val = 0\n    for key, val in counter_dict.items():\n        if val > max_count:\n            max_count = val\n            frequent_val = key\n    return frequent_val\n    def most_frequent\"\"\"\n    counter_dict = {}\n    for val in array:\n        if val in counter_dict:\n            counter_dict[val] += 1\n        else:\n            counter_dict[val] = 1\n    max_count = 0\n    frequent_val = 0\n    for key, val in counter_dict.items():\n        if val > max_count:\n            max_count = val\n            frequent_val = key\n    return frequent_val"], [0.9181931018829346, "def highest_value_frequency(arr):\n    \"\"\"\n    Given an array of integers, find the highest value and its frequency.\n    \n    Parameters:\n    arr (list): List of integers\n    \n    Returns:\n    list: List containing the highest value and its frequency\n    \"\"\"\n    max_val = max(arr)\n    freq = arr.count(max_val)\n    return [max_val, freq]"]]}
{"task_id": 479, "problem": [[0.8733251094818115, "def find_symmetric_pairs(matrix):\n    \"\"\"\n    Find a symmetric pair in a matrix.\n    \n    Args:\n        matrix (list): A matrix represented as a list of lists.\n    \n    Returns:\n        tuple: A tuple containing the indices of the symmetric pair.\n    \"\"\"\n    # Initialize an empty dictionary to store the rows and their reverse counterparts\n    rows = {}\n    \n    for i in range(len(matrix)):\n        # Convert each row to a tuple to make it hashable\n        row = tuple(matrix[i])\n        # Compute the reversed row\n        reversed_row = tuple(reversed(matrix[i]))\n        \n        # Check if the reversed row is in the dictionary\n        if reversed_row in rows:\n            # If the reversed row is in the dictionary, we found a symmetric pair.\n            # The symmetric pair is identified by the current row index and the stored row index.\n            symmetric_pair = (rows[reversed_row], i)\n            return symmetric_pair\n        else:\n            # If the reversed row is not in the dictionary, add the current row to the dictionary.\n            rows[row] = i\n\n    # If no symmetric pair is found, return None\n    return None"]]}
{"task_id": 480, "problem": [[0.901929497718811, "def sum_geometric_sequence(a, r, n):\n    \"\"\"\n    Calculate the sum of a geometric sequence.\n    \n    Args:\n        a (float): The first term of the sequence.\n        r (float): The common ratio of the sequence.\n        n (int): The number of terms in the sequence.\n    \n    Returns:\n        float: The sum of the geometric sequence.\n    \"\"\"\n    total_sum = 0\n    for i in range(n):\n        total_sum += a * (r ** i)\n    return total_sum"], [0.9011238813400269, "def geometric_progression(a, r=3, n=5):\n    \"\"\"\n    Calculate the sum of a geometric progression and print the terms.\n    \n    Parameters:\n    a (float): The first term of the progression.\n    r (float): The common ratio of the progression.\n    n (int): The number of terms in the progression.\n    \"\"\"\n    # calculate the sum of the geometric progression\n    sum = a * (1 - r**n) / (1 - r)\n    \n    # check if the sum falls within the specified range\n    if 300 <= sum <= 1200:\n        # print the sum and terms of the geometric progression\n        print(f'The sum of the geometric progression is: {sum}.')\n        print('Terms of the geometric progression:')\n        for i in range(n):\n            term = a * r**i\n            print(term)\n    else:\n        print(f'Invalid input! The sum of the geometric progression is not within the valid range, but {sum}.')"], [0.898700475692749, "def geometric_progression(a, r=3, n=5):\n    \"\"\"\n    Calculate the sum of a geometric progression and print the terms.\n    \n    Parameters:\n    a (float): first term of the progression\n    r (float): common ratio\n    n (int): number of terms\n    \"\"\"\n    # calculate the sum of geometric progression\n    sum = a * (1 - r**n) / (1 - r)\n    \n    # check if sum is within specified range\n    if 300 <= sum <= 1200:\n        # print the sum and terms of geometric progression\n        print(f'Sum of geometric progression: {sum}.')\n        print('Terms of geometric progression:')\n        for i in range(n):\n            term = a * r**i\n            print(term)\n    else:\n        print(f'Invalid input! The sum of geometric progression is not within valid range, but {sum}.')"]]}
{"task_id": 481, "problem": [[0.9222733378410339, "def binary_search(arr, x):\n    '''\n    Searching value in array using Binary Search\n    Args:\n        arr: Sorted array of integers\n        x: Integer to be searched\n    Returns:\n        True if integer is in array, else False\n    Complexity:\n        Time: O(log n)\n        Space: O(1)\n    '''\n    low = 0\n    high = len(arr) - 1\n    mid = 0\n\n    while low <= high:\n\n        mid = (high + low) // 2\n\n        if arr[mid] < x:\n            low = mid + 1\n\n        elif arr[mid] > x:\n            high = mid - 1\n\n        else:\n            return True\n\n    return False"], [0.9222624897956848, "def binary_search(arr, x):\n    '''\n    Searching value in array using Binary Search\n    Args:\n        arr: Sorted array of integers\n        x: Integer to be searched\n    Returns:\n        True if integer is in array, else False\n    Complexity:\n        Time: O(log n)\n        Space: O(1)\n    '''\n    low = 0\n    high = len(arr) - 1\n    mid = 0\n\n    while low <= high:\n\n        mid = (high + low) // 2\n\n        if arr[mid] < x:\n            low = mid + 1\n\n        elif arr[mid] > x:\n            high = mid - 1\n\n        else:\n            return True\n\n    return False"], [0.9213452339172363, "def binary_search(array, element):\n    \"\"\"\n    Return the index of element in array if present, else -1\n    \"\"\"\n    low = 0\n    high = len(array) - 1\n    while low <= high:\n        middle = (low + high) // 2\n        if array[middle] < element:\n            low = middle + 1\n        elif array[middle] > element:\n            high = middle - 1\n        else:\n            return middle\n    return -1  # if the element is not in the array"], [0.9213368892669678, "def binary_search(array, element):\n    \"\"\"\n    Return the index of element in array if present, else -1\n    \"\"\"\n    low = 0\n    high = len(array) - 1\n    while low <= high:\n        middle = (low + high) // 2\n        if array[middle] < element:\n            low = middle + 1\n        elif array[middle] > element:\n            high = middle - 1\n        else:\n            return middle\n    return -1  # if the element is not in the array"], [0.9210646152496338, "def binary_search(arr, low, high, x):\n    \"\"\"\n    Binary search algorithm\n    \"\"\"\n    if high >= low:\n        mid = (low + high) // 2\n        if arr[mid] == x:\n            return True\n        elif arr[mid] > x:\n            return binary_search(arr, low, mid - 1, x)\n        else:\n            return binary_search(arr, mid + 1, high, x)\n    else:\n        return False\n    \n    def linear_search(arr, x):\n    \"\"\"\n    Linear search algorithm\n    \"\"\"\n    while low <= high:\n        mid = (low + high) // 2\n        if arr[mid] == x:\n            return True\n        elif arr[mid] < x:\n            low = mid + 1\n        else:\n            high = mid - 1\n    return False"], [0.9207313060760498, "def binary_search(arr, low, high, x):\n  \"\"\"\n    Binary Search\"\"\"\n  \n    # Check base case\n    if high >= low:\n \n        mid = (high + low) // 2\n \n        if arr[mid] == x:\n            return mid\n \n        elif arr[mid] > x:\n            return binary_search(arr, low, mid - 1, x)\n \n        else:\n            return binary_search(arr, mid + 1, high, x)\n \n    else:\n        return -1"], [0.9203308820724487, "def binary_search(arr, low, high, x):\n  \"\"\"\n    Binary Search\"\"\"\n  \n    if high >= low:\n        mid = (high + low) // 2\n  \n        if arr[mid] == x:\n            return mid\n  \n        elif arr[mid] > x:\n            return binary_search(arr, low, mid - 1, x)\n  \n        else:\n            return binary_search(arr, mid + 1, high, x)\n    else:\n        return -1"], [0.9202941656112671, "def binary_search(arr, low, high, x):\n  \"\"\"\n    Binary Search\"\"\"\n  \n    if high >= low:\n        mid = (high + low) // 2\n  \n        if arr[mid] == x:\n            return mid\n  \n        elif arr[mid] > x:\n            return binary_search(arr, low, mid - 1, x)\n  \n        else:\n            return binary_search(arr, mid + 1, high, x)\n    else:\n        return -1"], [0.9195572137832642, "def binarysearch(arr, x): \n    \"\"\"\n    Binary Search\n    :param arr: list\n    :param x: int\n    :return: int\n    \"\"\"\n    low = 0\n    high = len(arr) - 1\n    mid = 0\n  \n    while low <= high: \n        mid = (high + low) // 2\n  \n        if arr[mid] < x: \n            low = mid + 1\n        elif arr[mid] > x: \n            high = mid - 1\n        else: \n            return mid \n  \n    return -1"]]}
{"task_id": 482, "problem": [[0.8593558073043823, "def generate_grid():\n    \"\"\"\n    Generate a 7x7 grid of integers\n    \"\"\"\n    table = [[0]*7 for _ in range(7)]\n    for i in range(1,8):\n        for j in range(1,8):\n            table[7-i][7-j] = i*j\n    return table\n    def generate_grid():\n    \"\"\"\n    Generate a 7x7 grid of integers\n    \"\"\"\n    table = [[0]*7 for _ in range(7)]\n    for i in range(1,8):\n        for j in range(1,8):\n            table[7-i][7-j] = i*j\n    return table"], [0.859023928642273, "def xy_coordinates(x, y):\n    \"\"\"\n    This function takes in two lists of numbers and returns two new lists of numbers.\n    The first list is the x coordinates of the points and the second list is the y coordinates of the points.\n    The function takes in two lists of numbers and returns two new lists of numbers.\n    The first list is the x coordinates of the points and the second list is the y coordinates of the points.\n    The function takes in two lists of numbers and returns two new lists of numbers.\n    The first list is the x coordinates of the points and the second list is the y coordinates of the points.\n    \"\"\"\n    x_coordinates = []\n    y_coordinates = []\n    \n    for i in x:\n        x_coordinates.append(i * 2)\n    for i in y:\n        y_coordinates.append(i * 2)\n    \n    # Support for fractions\n    for i in x:\n        x_coordinates.append(i + 1/2)\n    for i in y:\n        y_coordinates.append(i + 1/2)\n    \n    return x_coordinates, y_coordinates"]]}
{"task_id": 483, "problem": []}
{"task_id": 484, "problem": [[0.9151778221130371, "def removeLetters(string, letter):\n    \"\"\"\n    Remove all instances of letter from string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if char.lower() != letter.lower():\n            new_string += char\n    return new_string\n    def removeLetters(string, letter):\n    \"\"\"\n    Remove all instances of letter from string.\n    \"\"\"\n    new_string = \"\"\n    for char in string:\n        if char.lower() != letter.lower():\n            new_string += char\n    return new_string"]]}
{"task_id": 485, "problem": [[0.9060376286506653, "def find_nsmallest_absVals(nums, n):  \n    \"\"\"\n    Find the n smallest absolute values in a list of numbers.\n    \n    Args:\n        nums: a list of numbers\n        n: an integer\n    \n    Returns:\n        a list of n smallest absolute values\n    \"\"\"\n    nums_abs = []\n    \n    for num in nums:\n        heapq.heappush(nums_abs, abs(num))\n\n    result = []\n    for _ in range(n):\n        result.append(heapq.heappop(nums_abs))\n\n    return sorted(result)"], [0.9021096229553223, "def smallest_nums(array):\n    \"\"\"Return 5 smallest numbers, in sorted order.\n\n    >>> smallest_nums([7, 8, 3, 1, 2, 9, 4])\n    [1, 2, 3, 4, 7]\n    \"\"\"\n    unique_nums = list(set(array))\n    unique_nums.sort()\n    return unique_nums[:5]"], [0.9004090428352356, "def kth_smallest(lst, n, k):\n    \"\"\"\n    Find kth smallest number in a list\n    \n    Args:\n        lst: list of numbers\n        n: number of elements in list\n        k: kth smallest number\n    \n    Returns:\n        kth smallest number\n    \"\"\"\n    \n    # Using heap queue algorithm to sort list\n    sorted_list = heapq.nsmallest(n, lst)\n    \n    # Return kth smallest number\n    return sorted_list[k-1]"], [0.8991832733154297, "def smallest_nums(array):\n    \"\"\"Return the 5 smallest numbers in a given array.\n    \"\"\"\n    \n    # Your code here\n    \n    # Returns the first 5 smallest unique numbers in a given array.\n    \n    # Your code here\n    \n    # Returns the first 5 smallest unique numbers in a given array.\n    \n    # Your code here\n    \n    # Returns the first 5 smallest unique numbers in a given array.\n    \n    # Your code here\n    \n    # Returns the first 5 smallest unique numbers in a given array.\n    \n    # Your code here\n    \"\"\"\n    unique_nums = list(set(array))  # Removes duplicates from the array.\n    unique_nums.sort()  # Sorts the array from smallest to biggest.\n    return unique_nums[:5]  # Returns the first 5 smallest unique numbers."], [0.8947778940200806, "def minHeap(arr, n):\n    \"\"\"\n    Build a min heap from an array.\n    \"\"\"\n    for i in range(n // 2 - 1, -1, -1):\n        minHeapify(arr, n, i)\n    return arr\n    \n    def minHeapify(arr, n, i):\n    \"\"\"\n    Min heapify a subtree rooted at index i.\n    \"\"\"\n    left = 2 * i + 1\n    right = 2 * i + 2\n    smallest = i\n    if left < n and arr[left] < arr[smallest]:\n        \"\"\"\n    if not isMinHeap(arr, n):\n        buildMinHeap(arr, n)\n    return arr, arr[0]"]]}
{"task_id": 486, "problem": [[0.9243783950805664, "def cone_surface_area(radius, slant_height):\n    \"\"\"\n    Calculate the surface area of a cone.\n    \n    Parameters:\n    - radius (float): The radius of the base of the cone.\n    - slant_height (float): The slant height of the cone.\n    \n    Returns:\n    - float: The surface area of the cone.\n    \"\"\"\n    base_area = math.pi * radius**2\n    lateral_area = math.pi * radius * slant_height\n    total_area = base_area + lateral_area\n    return total_area"], [0.9216525554656982, "def cone_surface_area(r: float, h: float) -> float:\n    \"\"\"\n    Calculate the surface area of a cone.\n    \n    Parameters\n    ----------\n    r : float\n        The radius of the cone.\n    h : float\n        The height of the cone.\n    \n    Returns\n    -------\n    float\n        The surface area of the cone.\n    \n    Notes\n    -----\n    The surface area of a cone is given by the formula:\n    \n    .. math::\n        \\\\text{Surface Area} = \\\\pi r l\n    \n    where :math:`l` is the slant height of the cone.\n    \n    \"\"\"\n    if r <= 0 or h <= 0:\n        return \"Radius and Height must be greater than zero.\"\n    l = math.sqrt(r**2 + h**2)    # l is slant height\n    return math.pi * r * l"], [0.9216408729553223, "def cone_surface_area(r: float, h: float) -> float:\n    \"\"\"\n    Calculate the surface area of a cone.\n    \n    Parameters\n    ----------\n    r : float\n        The radius of the cone.\n    h : float\n        The height of the cone.\n    \n    Returns\n    -------\n    float\n        The surface area of the cone.\n    \n    Notes\n    -----\n    The surface area of a cone is given by the formula:\n    \n    .. math::\n        \\\\text{Surface Area} = \\\\pi r l\n    \n    where :math:`l` is the slant height of the cone.\n    \n    \"\"\"\n    if r <= 0 or h <= 0:\n        return \"Radius and Height must be greater than zero.\"\n    l = math.sqrt(r**2 + h**2)    # l is slant height\n    return math.pi * r * l"], [0.907596230506897, "def cone_surface_area_and_volume(radius, height):\n    \"\"\"\n    This function calculates the surface area and volume of a cone.\n    \n    Parameters:\n    radius (float): The radius of the cone.\n    height (float): The height of the cone.\n    \n    Returns:\n    tuple: A tuple containing the surface area and volume of the cone.\n    \"\"\"\n    surface_area = 3.14 * radius * (radius + ((height**2 + radius**2)**0.5))\n    volume = 3.14 * (radius**2) * (height/3)\n    return surface_area, volume"]]}
{"task_id": 487, "problem": [[0.9132947325706482, "def gcd(a, b):\n    \"\"\"\n    Function to calculate GCD of two numbers\n    \"\"\"\n    # Base case\n    if b == 0:\n        return a\n    else:\n        # Recursive call\n        return gcd(b, a % b)"]]}
{"task_id": 488, "problem": [[0.912738561630249, "def circumference_of_circle(diameter):\n    \"\"\"\n    This function calculates the circumference of a circle\n    :param diameter: diameter of the circle\n    :return: circumference of the circle\n    \"\"\"\n    circumference = 3.14 * diameter\n    return circumference"], [0.9115329384803772, "def find_circle_area(diameter):\n    \"\"\"\n    Find the area of a circle.\n    \n    Args:\n        diameter: The diameter of the circle.\n    \n    Returns:\n        The area of the circle.\n    \"\"\"\n    radius = diameter / 2\n    area = math.pi * (radius ** 2)\n    return area"], [0.9079892635345459, "def calculate_area(diameter):\n    \"\"\"\n    Calculate the area of a circle given its diameter.\n    \n    Args:\n        diameter: Diameter of the circle.\n    \n    Returns:\n        float: Area of the circle.\n    \"\"\"\n    if diameter <= 0:\n        return 0\n    \n    radius = diameter / 2\n    circumference = 2 * 3.14159 * radius\n    area = circumference * radius / 2\n    return area"]]}
{"task_id": 489, "problem": []}
{"task_id": 490, "problem": []}
{"task_id": 491, "problem": [[0.9170641899108887, "def getRemainder(num1, num2):\n    \"\"\"\n    Return the remainder of num1 divided by num2.\n    \n    >>> getRemainder(10, 3)\n    1\n    >>> getRemainder(10, 2)\n    0\n    \"\"\"\n    return num1 % num2"], [0.9141275882720947, "def get_remainder(n1, n2):\n    \"\"\"\n    Return the remainder of n1 divided by n2.\n    \n    >>> get_remainder(10, 3)\n    1\n    >>> get_remainder(10, 2)\n    0\n    \"\"\"\n    return n1 % n2"], [0.9088664650917053, "def find_remainder(dividend, divisor):\n  \"\"\"\n    Find the remainder of a division\n    \n    Args:\n      dividend: dividend of division\n      divisor: divisor of division\n    Returns:\n      remainder: remainder of division\n    \"\"\"\n  return dividend % divisor"], [0.9073973298072815, "def find_remainder(dividend, divisor):\n    \"\"\"\n    Find the remainder of a division\n    \"\"\"\n    # The quotient is the integer part of the division\n    quotient = dividend // divisor\n    # The remainder is what remains after subtracting divisor*quotient from the dividend\n    remainder = dividend - quotient * divisor\n    return remainder\n    def find_remainder(dividend, divisor):\n    \"\"\"\n    Find the remainder of a division\n    \"\"\"\n    # The quotient is the integer part of the division\n    quotient = dividend // divisor\n    # The remainder is what remains after subtracting divisor*quotient from the dividend\n    remainder = dividend - quotient * divisor\n    return remainder"], [0.9064007997512817, "def calculate_remainder(a, b):\n    \"\"\"\n    Calculate the remainder of two integers.\n    \"\"\"\n    # Convert negative integers to positive\n    a = abs(a)\n    b = abs(b)\n\n    # Check if either input is zero\n    if a == 0 or b == 0:\n        return \"Error: Zero is not allowed as an input\"\n\n    # Find the greater and smaller integers\n    greater = max(a, b)\n    smaller = min(a, b)\n\n    # Calculate and return the remainder\n    remainder = greater % smaller\n    return remainder\n    def calculate_remainder(a\"\"\"\n    # Convert negative integers to positive\n    a = abs(a)\n    b = abs(b)\n\n    # Check if either input is zero\n    if a == 0 or b == 0:\n        return \"Error: Zero is not allowed as an input\"\n\n    # Find the greater and smaller integers\n    greater = max(a, b)\n    smaller = min(a, b)\n\n    # Calculate and return the remainder\n    remainder = greater % smaller\n    return remainder"]]}
{"task_id": 492, "problem": [[0.9011297225952148, "def sum_pairs(input_list):\n    \"\"\"\n    \"\"\"\n    output_list = []\n    for i in range(len(input_list)-1):\n        sum = input_list[i] + input_list[i+1]\n        output_list.append(sum)\n    return output_list"]]}
{"task_id": 493, "problem": [[0.9398937225341797, "def sum_of_cubes(n):\n    \"\"\"\n    Return the sum of the cubes of all numbers from 1 to n.\n    \"\"\"\n    result = 0\n    for i in range(1, n+1):\n        result += i ** 3\n    return result\n    def sum_of_cubes(n):\n    \"\"\"\n    Return the sum of the cubes of all numbers from 1 to n.\n    \"\"\"\n    result = 0\n    for i in range(1, n+1):\n        result += i ** 3\n    return result"], [0.9336333274841309, "def sum_of_cubes(n):\n    \"\"\"\n    Return the sum of the first n cubes.\n    \n    >>> sum_of_cubes(5)\n    225\n    \"\"\"\n    sum = 0\n    for i in range(n+1):\n        sum += i**3 \n    return sum"], [0.9302384257316589, "def sum_of_cubes(n):\n    \"\"\"\n    Return the sum of the first n cubes.\n    \n    >>> sum_of_cubes(5)\n    225\n    \"\"\"\n    sum = 0\n    for i in range(1, n + 1):\n        sum += i ** 3\n    return sum"], [0.9292051792144775, "def calculate_sum_of_cubes(n):\n    \"\"\"\n    Calculate the sum of cubes of the first n natural numbers.\n    \n    Args:\n        n (int): The number of natural numbers to consider.\n    \n    Returns:\n        int: The sum of cubes of the first n natural numbers.\n    \"\"\"\n    sum = 0\n    for i in range(1, n + 1):\n        sum += i**3\n    return sum"], [0.9291501045227051, "def accumulative_sum(n):\n    \"\"\"\n    Return the sum of the first n numbers\n    \"\"\"\n    sum = 0\n    for i in range(1, n+1):\n        sum += i\n    return sum\n    \n    def cube_sum(n):\n    \"\"\"\n    Return the sum of the first n numbers\n    \"\"\"\n    sum = 0\n    for i in range(1, n+1):\n        sum += i ** 3\n    return sum"], [0.9287363290786743, "def sumOfCubes(n):\n    \"\"\"\n    Return the sum of the cubes of all numbers from 1 to n, inclusive.\n    \n    >>> sumOfCubes(5)\n    225\n    \"\"\"\n    sum = 0\n    \n    for num in range(1, n+1):\n        sum += num ** 3\n    \n    return sum"], [0.9256159663200378, "def sum_cubes(n):\n    \"\"\"\n    Calculate the sum of cubes of all numbers from 1 to n.\n    \n    Args:\n        n (int): The upper limit of the range.\n    \n    Returns:\n        int: The sum of cubes of all numbers from 1 to n.\n    \"\"\"\n    # Initialize the result\n    result = 0\n\n    # Iterate over all numbers from 1 to n\n    for i in range(1, n+1):\n        # Add the cube of each number to the result\n        result += i ** 3\n\n    return result"]]}
{"task_id": 494, "problem": [[0.9384191036224365, "def moveZerosToEnd(arr): \n    \"\"\"\n    Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.\n    \n    Example:\n    \n    Input: [0,1,0,3,12]\n    Output: [1,3,12,0,0]\n    Note:\n    \n    You must do this in-place without making a copy of the array.\n    Minimize the total number of operations.\n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \n    \"\"\"\n    last_nonzero = 0\n    for i in range(len(arr)): \n        if arr[i] != 0:\n            arr[last_nonzero] = arr[i]\n            last_nonzero += 1\n\n    while last_nonzero < len(arr):\n        arr[last_nonzero] = 0\n        last_nonzero += 1\n\n    return arr"], [0.9377168416976929, "def move_zeros(nums):\n    \"\"\"\n    Do not return anything, modify nums in-place instead.\n    \"\"\"\n    # List comprehension - It will first put all non-zero numbers, then append zeros to the end\n    return [num for num in nums if num != 0] + [0] * nums.count(0)"], [0.937469482421875, "def move_zeros(nums):\n    \"\"\"\n    Do not return anything, modify nums in-place instead.\n    \"\"\"\n    # List comprehesion - It will first put all non-zero numbers, then append zeros to the end\n    return [num for num in nums if num != 0] + [0] * nums.count(0)"], [0.9347382187843323, "def move_zeroes(nums):\n    \"\"\"\n    Do not return anything, modify nums in-place instead.\n    \"\"\"\n    for i in nums:\n        if i == 0:\n            nums.remove(i)\n            nums.append(i)\n    return nums"], [0.9344936013221741, "def move_zeros(nums):\n    \"\"\"\n    Do not return anything, modify nums in-place instead.\n    \"\"\"\n    num_zeros = 0\n    for i in range(len(nums)):\n        if nums[i] != 0:\n            nums[num_zeros], nums[i] = nums[i], nums[num_zeros]\n            num_zeros += 1\n    return nums"], [0.9343514442443848, "def move_zeroes_to_end(array):\n    \"\"\"\n    This function takes a list of numbers as input, \n    moves all the zeroes to the end \n    and returns the updated list.\n    \"\"\"\n    # count the number of zeros\n    num_zeros = array.count(0)\n    \n    # remove all zeros from the list\n    array = [num for num in array if num != 0]\n    \n    # extend the list by the number of zeros\n    array.extend([0]*num_zeros)\n    \n    return array"], [0.9318588972091675, "def move_zeroes(arr):\n    \"\"\"\n    Do not return anything, modify nums in-place instead.\n    \"\"\"\n    j = 0\n    for i in range(len(arr)):\n        if arr[i] != 0:\n            arr[j] = arr[i]\n            j += 1\n    for i in range(j, len(arr)):\n        arr[i] = 0"]]}
{"task_id": 495, "problem": [[0.9077180624008179, "def comb(n, r):\n    \"\"\"\n    Returns the number of combinations of n items taken r at a time.\n    \"\"\"\n    return factorial(n) / (factorial(r) * factorial(n - r))\n    \n    def perm(n, r):\n    \"\"\"\n    Returns the number of permutations of n items taken r at a time.\n    \"\"\"\n    return factorial(n) / factorial(n - r)\n    \n    def factorial(n):\n    \"\"\"\n    Returns the factorial of n.\n    \"\"\"\n    if n == 0:\n        return 1\n    else:\n        \"\"\"\n    perm_val = perm(n, r)\n    rFactorial = factorial(r)\n    answer = perm_val / rFactorial\n    return answer"]]}
{"task_id": 496, "problem": []}
{"task_id": 497, "problem": []}
{"task_id": 498, "problem": [[0.9200259447097778, "def average_odd_numbers(start, end):\n    \"\"\"Calculate the average of odd numbers between start and end.\"\"\"\n    count = 0\n    total = 0\n    for i in range(start, end + 1):\n        if i % 2 == 1:\n            count += 1\n            total += i\n    if count > 0:\n        return total / count\n    else:\n        return None"]]}
{"task_id": 499, "problem": [[0.9258499145507812, "def numSubarrayProductLessThanK(nums: List[int], k: int) -> int:\n    \"\"\"\n    \"\"\"\n    if k <= 1:\n        return 0\n    l = 0\n    count = 0\n    product = 1\n    for r in range(len(nums)):\n        product *= nums[r]\n        while product >= k:\n            product /= nums[l]\n            l += 1\n        count += r - l + 1\n    return count"], [0.9235526323318481, "def numSubarrayProductLessThanK(nums, k):\n    \"\"\"\n    :type nums: List[int]\n    :type k: int\n    :rtype: int\n    \"\"\"\n    if k <= 1:\n        return 0\n    prod = 1\n    count = 0\n    left = 0\n    for right in range(len(nums)):\n        prod *= nums[right]\n        while prod >= k:\n            prod /= nums[left]\n            left += 1\n        count += right - left + 1\n    return count"], [0.9235081672668457, "def numSubarrayProductLessThanK(nums, k):\n    \"\"\"\n    :type nums: List[int]\n    :type k: int\n    :rtype: int\n    \"\"\"\n    if k <= 1:\n        return 0\n    prod = 1\n    count = 0\n    left = 0\n    for right in range(len(nums)):\n        prod *= nums[right]\n        while prod >= k:\n            prod /= nums[left]\n            left += 1\n        count += right - left + 1\n    return count"]]}
