{
  "0": {
    "text": "Write a function in AVAP to remove the matching elements from the first list that are also present in the second list, returning the filtered list.",
    "code": "function remove_matching_tuple(list1, list2) {\n    // Get lengths of both lists\n    getListLen(list1, len1)\n    getListLen(list2, len2)\n    // Build result list by iterating list1\n    result = []\n    i = 0\n    startLoop(i, 0, len1)\n        itemFromList(list1, i, current)\n        found = False\n        j = 0\n        startLoop(j, 0, len2)\n            itemFromList(list2, j, candidate)\n            if(current, candidate, \"==\")\n                found = True\n            end()\n        endLoop()\n        if(found, False, \"==\")\n            result = result + [current]\n        end()\n    endLoop()\n    return(result)\n}"
  },
  "1": {
    "text": "Write a function in AVAP that receives a tuple (represented as a list) and returns the number of lists (sub-lists) present in it. If the input itself is a single list element, return 1; otherwise return the total count of elements.",
    "code": "function find_lists(Input) {\n    getListLen(Input, total)\n    if(total, 1, \"==\")\n        return(1)\n    end()\n    return(total)\n}"
  },
  "2": {
    "text": "Write a function in AVAP to find the first natural number whose factorial is divisible by a given number x.",
    "code": "function first_Factorial_Divisible_Number(x) {\n    i = 1\n    fact = 1\n    result = x\n    startLoop(i, 1, x)\n        fact = fact * i\n        mod = fact % x\n        if(mod, 0, \"==\")\n            result = i\n            return(result)\n        end()\n    endLoop()\n    return(result)\n}"
  },
  "3": {
    "text": "Write a function in AVAP to find the largest number that can be formed with the given list of digits. The digits should be sorted in descending order and concatenated to form the largest possible number.",
    "code": "function find_Max_Num(arr, n) {\n    // Sort digits descending using a simple bubble sort\n    startLoop(i, 0, n)\n        startLoop(j, 0, n)\n            itemFromList(arr, j, valJ)\n            jNext = j + 1\n            if(jNext, n, \"<\")\n                itemFromList(arr, jNext, valJNext)\n                if(valJ, valJNext, \"<\")\n                    // Swap\n                    AddVariableToJSON(\"tmp\", valJ, swapObj)\n                    variableFromJSON(swapObj, \"tmp\", tmp)\n                    arr[j] = valJNext\n                    arr[jNext] = tmp\n                end()\n            end()\n        endLoop()\n    endLoop()\n    // Build number\n    itemFromList(arr, 0, num)\n    i = 1\n    startLoop(i, 1, n)\n        itemFromList(arr, i, digit)\n        num = num * 10 + digit\n    endLoop()\n    return(num)\n}"
  },
  "4": {
    "text": "Write a function in AVAP to check if a triangle is equilateral (all three sides are equal). Return True if equilateral, False otherwise.",
    "code": "function check_equilateral(x, y, z) {\n    if(x, y, \"==\")\n        if(y, z, \"==\")\n            return(True)\n        end()\n    end()\n    return(False)\n}"
  },
  "5": {
    "text": "Write a function in AVAP that, given a list of two-element sub-lists (pairs), groups the second elements by the first element and returns a summary list containing the first element, unique second elements, and the count of occurrences.",
    "code": "function sort_on_occurence(lst) {\n    getListLen(lst, lstLen)\n    keys = []\n    vals = []\n    counts = []\n    i = 0\n    startLoop(i, 0, lstLen)\n        itemFromList(lst, i, pair)\n        itemFromList(pair, 0, key)\n        itemFromList(pair, 1, val)\n        // Check if key already in keys\n        getListLen(keys, kLen)\n        found = False\n        foundIdx = 0\n        k = 0\n        startLoop(k, 0, kLen)\n            itemFromList(keys, k, existingKey)\n            if(existingKey, key, \"==\")\n                found = True\n                foundIdx = k\n            end()\n        endLoop()\n        if(found, True, \"==\")\n            itemFromList(counts, foundIdx, cnt)\n            cnt = cnt + 1\n        end()\n        if(found, False, \"==\")\n            keys = keys + [key]\n            vals = vals + [val]\n            counts = counts + [1]\n        end()\n    endLoop()\n    return(keys)\n}"
  },
  "6": {
    "text": "Write two functions in AVAP: one to reverse the digits of a number, and another to check if a given number is one less than twice its reverse (i.e., 2 * reverse(n) == n + 1).",
    "code": "function rev(num) {\n    rev_num = 0\n    startLoop(i, 0, 20)\n        if(num, 0, \">\")\n            mod = num % 10\n            rev_num = rev_num * 10 + mod\n            num = num / 10\n            num = int(num)\n        end()\n        if(num, 0, \"==\")\n            return(rev_num)\n        end()\n    endLoop()\n    return(rev_num)\n}\n\nfunction check(n) {\n    reversed_n = rev(n)\n    twice_rev = 2 * reversed_n\n    n_plus_1 = n + 1\n    if(twice_rev, n_plus_1, \"==\")\n        return(True)\n    end()\n    return(False)\n}"
  },
  "7": {
    "text": "Write a function in AVAP to convert a list of multiple integers into a single integer by concatenating their string representations.",
    "code": "function multiple_to_single(L) {\n    getListLen(L, length)\n    result_str = \"\"\n    i = 0\n    startLoop(i, 0, length)\n        itemFromList(L, i, elem)\n        elem_str = str(elem)\n        result_str = result_str + elem_str\n    endLoop()\n    result = int(result_str)\n    return(result)\n}"
  },
  "8": {
    "text": "Write a function in AVAP that checks if a given text string contains a word at the end, with optional punctuation. Return 'Found a match!' if found, otherwise 'Not matched!'.",
    "code": "function text_match_word(text) {\n    getRegex(text, \"\\\\w+\\\\S*$\", match)\n    if(match, None, \"!=\")\n        return(\"Found a match!\")\n    end()\n    return(\"Not matched!\")\n}"
  },
  "9": {
    "text": "Write a function in AVAP to find the sum of numbers in a list between two specified indices m and n (inclusive).",
    "code": "function sum_range_list(list1, m, n) {\n    sum_range = 0\n    range_len = n + 1\n    i = 0\n    startLoop(i, 0, range_len)\n        if(None, None, `i >= m`)\n            itemFromList(list1, i, elem)\n            sum_range = sum_range + elem\n        end()\n    endLoop()\n    return(sum_range)\n}"
  }
}